Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## rc.lua [lua]
- require("awful")
- require("awful.autofocus")
- require("awful.rules")
- require("beautiful")
- require("vicious")
- require("naughty")
- require("eminent")
- -- {{{ Variables
- -- Theme:
- beautiful.init(awful.util.getdir("config") .. "/theme/theme.lua")
- local terminal = "urxvtc"
- local editor = "vim"
- local editor_cmd = terminal .. " -e " .. editor
- local web_browser = "GTK2_RC_FILES=/home/barthalion/.themes/Flow-Brave/gtk-2.0/gtkrc firefox"
- local mail_client = "GTK2_RC_FILES=/home/barthalion/.themes/Flow-Brave/gtk-2.0/gtkrc thunderbird"
- local file_browser = terminal .. " -e " .. "ranger"
- local spawn_dmenu = "dmenu_run" ..
- " -fn '".. beautiful.font_alt .. "'" ..
- " -nb '".. beautiful.bg_normal.. "'" ..
- " -nf '".. beautiful.fg_normal.. "'" ..
- " -sb '".. beautiful.bg_focus .. "'" ..
- " -sf '".. beautiful.fg_focus .. "'"
- -- Keys:
- local altkey = "Mod1"
- local modkey = "Mod4"
- layouts =
- {
- awful.layout.suit.tile, --1
- awful.layout.suit.tile.left, --2
- awful.layout.suit.tile.bottom, --3
- awful.layout.suit.tile.top, --4
- awful.layout.suit.fair, --5
- awful.layout.suit.fair.horizontal, --6
- awful.layout.suit.spiral, --7
- awful.layout.suit.spiral.dwindle, --8
- awful.layout.suit.floating --9
- }
- -- }}}
- -- {{{ Tags
- tags = { names = { "1", "2", "3" , "4" },
- layout = { layouts[3], layouts[9], layouts[9] , layouts[9] } }
- for s = 1, screen.count() do
- tags[s] = awful.tag(tags.names, s, tags.layout)
- end
- -- }}}
- -- {{{ Widgets
- -- Containers
- topbar = {}
- bottombar = {}
- -- Generic widgets
- clock = awful.widget.textclock({align = "right"}, "%H:%M")
- mysystray = widget({ type = "systray" })
- separator = widget({ type = "textbox" })
- separator.text = " | "
- spacer = widget({ type = "textbox" })
- spacer.width = 6
- -- Set all the icons needed
- -- For some reason, type "imagebox" inflates the images and seems
- -- to offer no way to resize them down. So a textbox is set with
- -- a background image to do the job right.
- cpuicon = widget ({ type = "textbox" })
- cpuicon.bg_image = image(beautiful.widget_cpu)
- cpuicon.bg_align = "middle"
- cpuicon.width = 8
- memicon = widget ({ type = "textbox" })
- memicon.bg_image = image(beautiful.widget_mem)
- memicon.bg_align = "middle"
- memicon.width = 8
- netdownicon = widget ({ type = "textbox" })
- netdownicon.bg_image = image(beautiful.widget_netdown)
- netdownicon.bg_align = "middle"
- netdownicon.width = 8
- netupicon = widget ({ type = "textbox" })
- netupicon.bg_image = image(beautiful.widget_netup)
- netupicon.bg_align = "middle"
- netupicon.width = 8
- mailicon = widget ({ type = "textbox" })
- mailicon.bg_image = image(beautiful.widget_mail)
- mailicon.bg_align = "middle"
- mailicon.width = 8
- clockicon = widget ({ type = "textbox" })
- clockicon.bg_image = image(beautiful.widget_clock)
- clockicon.bg_align = "middle"
- clockicon.width = 8
- mpdicon = widget ({ type = "textbox" })
- mpdicon.bg_align = "middle"
- mpdicon.width = 8
- rssicon = widget ({ type = "textbox" })
- rssicon.bg_image = image(beautiful.widget_rss)
- rssicon.bg_align = "middle"
- rssicon.width = 8
- pkgicon = widget ({ type = "textbox" })
- pkgicon.bg_image = image(beautiful.widget_pacman)
- pkgicon.bg_align = "middle"
- pkgicon.width = 8
- volicon = widget ({ type = "textbox" })
- volicon.bg_image = image(beautiful.widget_spkr)
- volicon.bg_align = "middle"
- volicon.width = 8
- -- Create some widgets...
- cpuinfo = widget ({ type = "textbox" })
- meminfo = widget ({ type = "textbox" })
- netdowninfo = widget ({ type = "textbox" })
- netupinfo = widget ({ type = "textbox" })
- mailinfo = widget ({ type = "textbox" })
- mpdinfo = widget ({ type = "textbox" })
- rssinfo = widget ({ type = "textbox" })
- pkginfo = widget ({ type = "textbox" })
- volinfo = widget ({ type = "textbox" })
- -- ... And register them
- vicious.register(cpuinfo, vicious.widgets.cpu, "$2%/$3%")
- vicious.cache(vicious.widgets.mem)
- vicious.register(meminfo, vicious.widgets.mem, "$1% ($2Mb)", 5)
- vicious.cache(vicious.widgets.net)
- vicious.register(netdowninfo, vicious.widgets.net, "${eth0 down_kb}", 3)
- vicious.register(netupinfo, vicious.widgets.net, "${eth0 up_kb}", 3)
- vicious.register(volinfo, vicious.widgets.volume, "$1", 1, "PCM")
- -- Gmail widget - change icon to red, when new mail is available
- vicious.register(mailinfo, vicious.widgets.gmail,
- function (widget, args)
- if args["{count}"] == 0 then
- mailicon.bg_image = image(beautiful.widget_mail)
- return 0
- else
- mailicon.bg_image = image(beautiful.widget_rmail)
- return args["{count}"]
- end
- end, 61)
- -- MPD widget. Hides icon and text when nothing is playing.
- vicious.register(mpdinfo, vicious.widgets.mpd,
- function (widget, args)
- if args["{state}"] == "Stop" then
- mpdicon.bg_image = nil
- mpdicon.width = 0
- return ""
- else
- mpdicon.bg_image = image(beautiful.widget_mpd)
- mpdicon.width = 8
- return "MPD: " .. args["{Artist}"] .. ' - ' .. args["{Title}"]
- end
- end)
- -- Create a wibox for each screen and add it
- mylayoutbox = {}
- mytaglist = {}
- mytaglist.buttons = awful.util.table.join(
- awful.button({ }, 1, awful.tag.viewonly),
- awful.button({ modkey }, 1, awful.client.movetotag),
- awful.button({ }, 3, awful.tag.viewtoggle),
- awful.button({ modkey }, 3, awful.client.toggletag),
- awful.button({ }, 4, awful.tag.viewnext),
- awful.button({ }, 5, awful.tag.viewprev)
- )
- mytasklist = {}
- mytasklist.buttons = awful.util.table.join(
- awful.button({ }, 1, function (c)
- if not c:isvisible() then
- awful.tag.viewonly(c:tags()[1])
- end
- client.focus = c
- c:raise()
- end),
- awful.button({ }, 3, function ()
- if instance then
- instance:hide()
- instance = nil
- else
- instance = awful.menu.clients({ width=250 })
- end
- end),
- awful.button({ }, 4, function ()
- awful.client.focus.byidx(1)
- if client.focus then client.focus:raise() end
- end),
- awful.button({ }, 5, function ()
- awful.client.focus.byidx(-1)
- if client.focus then client.focus:raise() end
- end))
- for s = 1, screen.count() do
- -- Set a screen margin, for borders
- awful.screen.padding( screen[s], {top = 1, bottom = 1} )
- -- Create the layout box, taglist, and tasklist widgets
- mylayoutbox[s] = awful.widget.layoutbox(s)
- mylayoutbox[s]:buttons(awful.util.table.join(
- awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
- awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
- awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
- awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
- mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
- mytasklist[s] = awful.widget.tasklist( function(c)
- local text, bg, status_image, icon = awful.widget.tasklist.label.currenttags(c,s)
- return text, bg, status_image, nil
- end, mytasklist.buttons)
- -- Create the bars
- topbar[s] = awful.wibox({
- position = "top", screen = s, height = 13,
- fg = beautiful.fg_normal, bg = beautiful.bg_normal,
- border_width = beautiful.border_width,
- border_color = beautiful.border_normal,
- })
- bottombar[s] = awful.wibox({
- position = "bottom", screen = s, height = 13,
- fg = beautiful.fg_normal, bg = beautiful.bg_normal,
- border_width = beautiful.border_width,
- border_color = beautiful.border_normal
- })
- -- Fill the bars with widgets
- right_aligned = { layout = awful.widget.layout.horizontal.rightleft}
- if s == 1 then table.insert(right_aligned, mysystray) end
- table.insert(right_aligned, mylayoutbox[s])
- topbar[s].widgets = {
- mytaglist[s],
- { mylayoutbox[s], spacer, mysystray,
- layout = awful.widget.layout.horizontal.rightleft
- },
- mytasklist[s],
- layout = awful.widget.layout.horizontal.leftright,
- height = 13
- }
- bottombar[s].widgets = {
- { spacer, mpdicon, spacer, mpdinfo,
- layout = awful.widget.layout.horizontal.leftright
- },
- clock, spacer, clockicon, separator, pkginfo, spacer, pkgicon, separator,
- mailinfo, spacer, mailicon, separator, rssinfo, spacer, rssicon, separator,
- netupinfo, spacer, netupicon, spacer, netdowninfo, spacer, netdownicon, separator,
- volinfo, spacer, volicon, separator, meminfo, spacer, memicon, separator,
- cpuinfo, spacer, cpuicon,
- layout = awful.widget.layout.horizontal.rightleft,
- height = 13
- }
- end
- -- }}}
- -- {{{ Mouse bindings
- root.buttons(awful.util.table.join(
- awful.button({ }, 3, function() end ),
- awful.button({ }, 4, awful.tag.viewnext),
- awful.button({ }, 5, awful.tag.viewprev)
- ))
- -- }}}
- -- {{{ Key bindings
- globalkeys = awful.util.table.join(
- -- Program shortcuts
- awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
- awful.key({ modkey, }, "a", function () awful.util.spawn_with_shell(spawn_dmenu) end),
- awful.key({ modkey, }, "q", function () awful.util.spawn(file_browser) end),
- awful.key({ modkey, }, "w", function () awful.util.spawn_with_shell(web_browser) end),
- -- Multimedia keys
- awful.key({}, "#166", function () awful.util.spawn_with_shell("mpc prev") end),
- awful.key({}, "#167", function () awful.util.spawn_with_shell("mpc next") end),
- awful.key({}, "#172", function () awful.util.spawn_with_shell("mpc toggle") end),
- awful.key({}, "#122", function () awful.util.spawn_with_shell("amixer -q set PCM 1-") end),
- awful.key({}, "#123", function () awful.util.spawn_with_shell("amixer -q set PCM 1+") end),
- awful.key({}, "#121", function () awful.util.spawn_with_shell("amixer -q set PCM toggle") end),
- awful.key({}, "#180", function () awful.util.spawn_with_shell(web_browser) end),
- awful.key({}, "#163", function () awful.util.spawn_with_shell(mail_client) end),
- -- Layout presets (dwm-style)
- awful.key({ modkey, }, "f", function () awful.layout.set( awful.layout.suit.floating ) end),
- awful.key({ modkey, }, "t", function () awful.layout.set( awful.layout.suit.tile ) end),
- awful.key({ modkey, }, "m", function () awful.layout.set( awful.layout.suit.max ) end),
- awful.key({ modkey, "Shift" }, "m", function () awful.layout.set( awful.layout.suit.max.fullscreen ) end),
- -- Moving between layouts
- awful.key({ modkey, }, "Up", function () awful.layout.inc(layouts, -1) end),
- awful.key({ modkey, }, "Down", function () awful.layout.inc(layouts, 1) end),
- -- Standard keys
- awful.key({ modkey, "Control" }, "r", awesome.restart),
- awful.key({ modkey, "Shift" }, "q", awesome.quit ),
- awful.key({ modkey, }, "Left", awful.tag.viewprev ),
- awful.key({ modkey, }, "Right", awful.tag.viewnext ),
- awful.key({ modkey, }, "Escape", awful.tag.history.restore),
- awful.key({ modkey, }, "j",
- function ()
- awful.client.focus.byidx( 1)
- if client.focus then client.focus:raise() end
- end),
- awful.key({ modkey, }, "k",
- function ()
- awful.client.focus.byidx(-1)
- if client.focus then client.focus:raise() end
- end),
- awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
- awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
- awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
- awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
- awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
- awful.key({ modkey, }, "Tab",
- function ()
- awful.client.focus.history.previous()
- if client.focus then
- client.focus:raise()
- end
- end),
- awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
- awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
- awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
- awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
- awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
- awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
- awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
- awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
- -- Lua Prompt
- awful.key({ modkey }, "x",
- function ()
- awful.prompt.run({ prompt = "Run Lua code: " },
- mypromptbox[mouse.screen].widget,
- awful.util.eval, nil,
- awful.util.getdir("cache") .. "/history_eval")
- end)
- )
- clientkeys = awful.util.table.join(
- awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
- awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
- awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
- awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
- awful.key({ modkey, }, "o", awful.client.movetoscreen ),
- awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
- awful.key({ modkey, }, "n", function (c) c.minimized = not c.minimized end),
- awful.key({ modkey, "Shift" }, "u", function (c) c.urgent = not c.urgent end),
- awful.key({ modkey, "Control" }, "m",
- function (c)
- c.maximized_horizontal = not c.maximized_horizontal
- c.maximized_vertical = not c.maximized_vertical
- end)
- )
- -- Compute the maximum number of digit we need, limited to 9
- keynumber = 0
- for s = 1, screen.count() do
- keynumber = math.min(9, math.max(#tags[s], keynumber));
- end
- -- Bind all key numbers to tags.
- for i = 1, keynumber do
- globalkeys = awful.util.table.join(globalkeys,
- awful.key({ modkey }, "#" .. i + 9,
- function ()
- local screen = mouse.screen
- if tags[screen][i] then
- awful.tag.viewonly(tags[screen][i])
- end
- end),
- awful.key({ modkey, "Control" }, "#" .. i + 9,
- function ()
- local screen = mouse.screen
- if tags[screen][i] then
- awful.tag.viewtoggle(tags[screen][i])
- end
- end),
- awful.key({ modkey, "Shift" }, "#" .. i + 9,
- function ()
- if client.focus and tags[client.focus.screen][i] then
- awful.client.movetotag(tags[client.focus.screen][i])
- end
- end),
- awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
- function ()
- if client.focus and tags[client.focus.screen][i] then
- awful.client.toggletag(tags[client.focus.screen][i])
- end
- end))
- end
- clientbuttons = awful.util.table.join(
- awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
- awful.button({ modkey }, 1, awful.mouse.client.move),
- awful.button({ modkey }, 3, awful.mouse.client.resize))
- -- Set keys
- root.keys(globalkeys)
- -- }}}
- -- {{{ Rules
- awful.rules.rules = {
- { rule = { },
- properties = { border_width = beautiful.border_width,
- border_color = beautiful.border_normal,
- focus = true, size_hints_honor = true,
- keys = clientkeys,
- buttons = clientbuttons } },
- { rule = { class = "MPlayer" },
- properties = { floating = true , tags[1][2]} },
- }
- -- }}}
- -- {{{ Signals
- -- Signal function to execute when a new client appears.
- client.add_signal("manage", function (c, startup)
- -- Enable sloppy focus
- c:add_signal("mouse::enter", function(c)
- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
- and awful.client.focus.filter(c) then
- client.focus = c
- end
- end)
- if not startup then
- awful.client.setslave(c)
- -- Put windows in a smart way, only if they does not set an initial position.
- if not c.size_hints.user_position and not c.size_hints.program_position then
- awful.placement.no_overlap(c)
- awful.placement.no_offscreen(c)
- end
- end
- end)
- -- Only float windows have a border
- for s = 1, screen.count() do screen[s]:add_signal("arrange", function ()
- local clients = awful.client.visible(s)
- local layout = awful.layout.getname(awful.layout.get(s))
- if #clients > 0 then
- for _, c in pairs(clients) do
- if awful.client.floating.get(c) or layout == "floating" then
- c.border_width = beautiful.floating_border_width
- c.border_color = beautiful.border_color
- c.above = true
- else
- c.border_width = 0
- c,border_color = beautiful.border_color
- end
- end
- end
- end)
- end
- -- Focus window have a border
- client.add_signal("focus", function(c) c.border_width = 1 end)
- -- }}}
- -- {{{ Autostart
- local r = require("runonce")
- r.run("urxvtd -q -o -f")
- r.run("mpdscribble")
- r.run("mpd /home/barthalion/.config/mpd/conf")
- r.run("bash /home/barthalion/.config/awesome/widget-rss.sh")
- r.run("bash /home/barthalion/.config/awesome/widget-pacman.sh")
- ## theme.lua [lua]
- -- AwesomeWM theme (~/.config/awesome/themes/byte/theme.lua)
- -- mu @ freenode
- theme = {}
- theme.confdir = awful.util.getdir("config") .. "/theme"
- theme.font = "DejaVuSans 8"
- theme.font_alt = theme.font
- theme.bg_normal = "#262729"
- theme.bg_focus = "#262729"
- theme.bg_urgent = "#262729"
- theme.bg_minimize = "#262729"
- theme.fg_normal = "#fafafa"
- theme.fg_focus = "#659fdb"
- theme.fg_urgent = "#f03669"
- theme.fg_minimize = "#fafafa"
- theme.border_width = "0"
- theme.border_color = "#659fdb"
- theme.border_marked = "#91231c"
- theme.floating_border_width = "1"
- theme.wallpaper_path = "/home/barthalion/background.png"
- theme.wallpaper_cmd = { "hsetroot -fill '"..theme.wallpaper_path.."'" }
- -- Display the taglist squares
- theme.taglist_squares_sel = theme.confdir .. "/taglist/focus.png"
- theme.taglist_squares_unsel = theme.confdir .. "/taglist/unfocus.png"
- -- Layout icons
- theme.layout_fairh = theme.confdir .. "/layouts/fairh.png"
- theme.layout_fairv = theme.confdir .. "/layouts/fairv.png"
- theme.layout_floating = theme.confdir .. "/layouts/floating.png"
- --theme.layout_magnifier = theme.confdir .. "/layouts/magnifier.png"
- --theme.layout_max = theme.confdir .. "/layouts/max.png"
- --theme.layout_fullscreen = theme.confdir .. "/layouts/fullscreen.png"
- theme.layout_tilebottom = theme.confdir .. "/layouts/tilebottom.png"
- theme.layout_tileleft = theme.confdir .. "/layouts/tileleft.png"
- theme.layout_tile = theme.confdir .. "/layouts/tile.png"
- theme.layout_tiletop = theme.confdir .. "/layouts/tiletop.png"
- theme.layout_spiral = theme.confdir .. "/layouts/spiral.png"
- theme.layout_dwindle = theme.confdir .. "/layouts/dwindle.png"
- -- Widget icons
- theme.widget_sep = theme.confdir .. "/widgets/seperator.png"
- theme.widget_cpu = theme.confdir .. "/widgets/cpu.png"
- --theme.widget_temp = theme.confdir .. "/widgets/temp.png"
- theme.widget_mem = theme.confdir .. "/widgets/mem.png"
- theme.widget_spkr = theme.confdir .. "/widgets/spkr.png"
- --theme.widget_head = theme.confdir .. "/widgets/phones.png"
- theme.widget_netdown = theme.confdir .. "/widgets/net_down.png"
- theme.widget_netup = theme.confdir .. "/widgets/net_up.png"
- theme.widget_mail = theme.confdir .. "/widgets/mail.png"
- theme.widget_rmail = theme.confdir .. "/widgets/rmail.png"
- theme.widget_pacman = theme.confdir .. "/widgets/pacman.png"
- --theme.widget_rpacman = theme.confdir .. "/widgets/rpacman.png"
- --theme.widget_batt_full = theme.confdir .. "/widgets/bat_full.png"
- --theme.widget_batt_low = theme.confdir .. "/widgets/bat_low.png"
- --theme.widget_batt_empty = theme.confdir .. "/widgets/bat_empty.png"
- theme.widget_clock = theme.confdir .. "/widgets/clock.png"
- theme.widget_mpd = theme.confdir .. "/widgets/note.png"
- theme.widget_rss = theme.confdir .. "/widgets/rss.png"
- return theme
Add Comment
Please, Sign In to add comment