-- Include awesome libraries, with lots of useful function! require("awful") require("wicked") require("beautiful") -- {{{ Variable definitions -- Themes define colours, icons, and wallpapers -- The default is a dark theme theme_path = "/home/SOMEONE/.config/awesome/theme" -- Uncommment this for a lighter theme -- theme_path = "/usr/local/share/awesome/themes/sky/theme" -- Actually load theme beautiful.init(theme_path) -- This is used later as the default terminal and editor to run. terminal = "Murxvtc -fg gray " editor = os.getenv("EDITOR") or "emacs" editor_cmd = terminal .. " -e " .. editor -- Default modkey. -- Usually, Mod4 is the key with a logo between Control and Alt. -- If you do not like this or do not have such a key, -- I suggest you to remap Mod4 to another key using xmodmap or other tools. -- However, you can use another modifier like Mod1, but it may interact with others. modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. layouts = { "tile", "tileleft", "tilebottom", "tiletop", "fairh", "fairv", "magnifier", "max", "fullscreen", "spiral", "dwindle", "floating" } -- Table of clients that should be set floating. The index may be either -- the application class or instance. The instance is useful when running -- a console app in a terminal like (Music on Console) -- xterm -name mocp -e mocp floatapps = { -- by class ["MPlayer"] = true, ["pinentry"] = true, ["gimp"] = true, ["xv"] = true, ["skype"]= true, -- by instance ["mocp"] = true } -- Applications to be moved to a pre-defined tag by class or instance. -- Use the screen and tags indices. apptags = { ["last.fm"] = { screen =1, tag = 1 }, ["gajim.py"] = { screen = 1, tag = 2 }, ["Gran Paradiso"] = { screen = 1, tag = 3 }, ["emacs"] = { screen = 1, tag = 4 }, ["gimp"] = { screen = 1, tag = 6 }, -- ["mocp"] = { screen = 2, tag = 4 }, } -- Define if we want to use titlebar on all applications. use_titlebar = false -- }}} -- {{{ Tags -- Define tags table. tags = {} tagnames = {"Mortuary","Hall of Speakers","Great Gymnasium","Armory","Shattered Temple","Great Foundry"," Gatehouse","City Court","Great Baazar","City Barracks","Prison","Civi Festhall","Hive"} for s = 1, screen.count() do -- Each screen has its own tag table. tags[s] = {} -- Create 9 tags per screen. for tagnumber = 1, 13 do tags[s][tagnumber] = tag({ name = tagnames[tagnumber], layout = layouts[1] }) -- Add tags to screen one by one tags[s][tagnumber].screen = s end -- I'm sure you want to see at least one tag. tags[s][1].selected = true end -- }}} -- {{{ Wibox -- Create a textbox widget mytextbox = widget({ type = "textbox", align = "right" }) bgbox = widget({ type = "textbox", align = "left" }) bgbox.text = "BG" bgbox:buttons ( { button({ },1,function () awful.util.spawn("bgchange") end)}) wicked.register(bgbox,function () awful.util.spawn("bgchange") return "BG" end, "$1", 1800) -- Copland Icon coplandicon = widget({ type = "imagebox", align = "left" }) coplandicon.image = image("/home/SOMEONE/.config/awesome/icons/copland.png") -- Date Icon dateicon = widget({ type = "imagebox", align = "right" }) dateicon.resize = false dateicon.image = image("/home/SOMEONE/.config/awesome/icons/clock.png") -- Music Icon musicicon = widget({ type = "imagebox", align = "right" }) musicicon.image = image("/home/SOMEONE/.config/awesome/icons/moc.png") xmmstextbox = widget({ type = "textbox", align = "right" }) xmmstextbox.text = "Waiting for xmms" -- Set the default text in textbox mytextbox.text = " " .. AWESOME_RELEASE .. " " -- separator separator = widget( {type = "textbox", align = "right"}) separator.text = " " -- VOLUME get_volume = 'amixer get Master | sed -n s/".*Mono:.*\\[\\(.*\\)%\\].*"/"\\1"/p' get_mute = "amixer get Master | grep dB -m 1 | awk '{print $6}'" volicon = widget({type="imagebox", resize = "false",align="right"}) volicon.image= image("/home/SOMEONE/.config/awesome/icons/mix_volume.png") wicked.register(volicon, function (widget, args) local f = io.popen(get_mute) local l = f:read() f:close() if l ~= "[on]" then volicon.image = image("/home/SOMEONE/.config/awesome/icons/mix_recmon.png") return "OFF" else volicon.image = image("/home/SOMEONE/.config/awesome/icons/mix_volume.png") return "ON" end end, "$1",1) volicon:buttons({ button({},1, function() awful.util.spawn("amixer set Master toggle") end), button({},3, function() awful.util.spawn(terminal .. " -e alsamixer") end), button({},4, function() awful.util.spawn("amixer set Master 2%+") end), button({},5, function() awful.util.spawn("amixer set Master 2%-") end), }) volbar = widget({ type = 'progressbar', name = 'volbarwidget', align = 'right' }) volbar.width = 40 volbar.height = 0.65 volbar.gap = 0 volbar.border_padding = 1 volbar.border_width = 1 volbar.ticks_count = 0 volbar.ticks_gap = 0 -- }) volbar:bar_properties_set('vol', { bg = '#222222', fg = '#285577', fg_center = '#285577', fg_end = '#285577', fg_off = '#222222', reverse = false, min_value = 0, max_value = 100 }) wicked.register(volbar, function() local f = io.popen(get_volume) local l = f:read() f:close() return string.format("%i",l) end, '$1', 1, 'vol') volbar:buttons({ button({},1, function() awful.util.spawn("amixer set Master toggle") end), button({},3, function() awful.util.spawn(terminal .. " -e alsamixer") end), button({},4, function() awful.util.spawn("amixer set Master 2%+") end), button({},5, function() awful.util.spawn("amixer set Master 2%-") end), }) -- MAIL mail_status = widget({ type = "textbox", align = "right" }) mail_somehost_1 = widget({ type = "textbox", align = "right" }) mail_somehost_1:buttons({ button({},1, function () awful.util.spawn("getmail -r somehost1") end), button({},3, function () awful.util.spawn(terminal .. " -e mutt -f ~/Mail/somehost1.md/") end), }) mail_somehost_2 = widget({ type = "textbox", align = "right" }) mail_somehost_2:buttons({ button({},1, function () awful.util.spawn("getmail -r somehost2") end), button({},3, function () awful.util.spawn(terminal .. " -e mutt -f ~/Mail/somehost2.md/") end), }) mail_somehost_3 = widget({ type = "textbox", align = "right" }) mail_somehost_3:buttons({ button({},1, function () awful.util.spawn("getmail -r somehost3") end), button({},3, function () awful.util.spawn(terminal .. " -e mutt -f ~/Mail/somehost3.md/") end), }) mail_somehost_4 = widget({ type = "textbox", align = "right" }) mail_somehost_4:buttons({ button({},1, function () awful.util.spawn("getmail -r somehost4") end), button({},3, function () awful.util.spawn(terminal .. " -e mutt -f ~/Mail/somehost4.md/") end), }) -- Battery Icon batticon = widget({ type = "imagebox", align = "right" }) batticon.image = image("/home/SOMEONE/.config/awesome/icons/bat.png") -- Battery Widget batt = widget({type = "textbox", align="right"}) batt.text = "00" wicked.register(batt, function () local f = io.popen("acpi -p") local l = f:read() f:close() return string.format("%0.1f",l) end, "$1", 10) -- CPU Temp Icon tempicon = widget({ type = "imagebox", align = "right" }) tempicon.image = image("/home/SOMEONE/.config/awesome/icons/cpuc.png") -- CPU Temp Widget cputemp = widget({type = "textbox", align="right"}) cputemp.text = "00ºC" wicked.register(cputemp, function () local f = io.popen("acpi -t") local l = f:read() f:close() return l .. "ºC" end, "$1", 5) -- CPU Icon cpuicon = widget({ type = "imagebox", align = "right" }) cpuicon.image = image("/home/SOMEONE/.config/awesome/icons/kcmprocessor.png") -- CPU Graph Widgets cpugraphwidget_1 = widget({ type = 'graph', name = 'cpugraphwidget', align = 'right' }) cpugraphwidget_2 = widget({ type = 'graph', name = 'cpugraphwidget', align = 'right' }) cpugraphwidget_1.height = 0.85 cpugraphwidget_1.width = 45 cpugraphwidget_1.bg = '#333333' cpugraphwidget_1.border_color = '#0a0a0a' cpugraphwidget_1.grow = 'left' cpugraphwidget_1:plot_properties_set('cpu', { fg = '#AEC6D8', fg_center = '#285577', fg_end = '#285577', vertical_gradient = false }) cpugraphwidget_2.height = 0.85 cpugraphwidget_2.width = 45 cpugraphwidget_2.bg = '#333333' cpugraphwidget_2.border_color = '#0a0a0a' cpugraphwidget_2.grow = 'left' cpugraphwidget_2:plot_properties_set('cpu', { fg = '#AEC6D8', fg_center = '#285577', fg_end = '#285577', vertical_gradient = false }) cpuicon:buttons({ button({},1, function () awful.util.spawn(terminal .. " -e htop") end), button({},2, function () awful.util.spawn(terminal .. " -e top") end), button({},3, function () awful.util.spawn(terminal .. " -e atop") end), }) wicked.register(cpugraphwidget_1, wicked.widgets.cpu, '$2', 1, 'cpu') wicked.register(cpugraphwidget_2, wicked.widgets.cpu, '$3', 1, 'cpu') -- Network wnetwork = widget({ type = "textbox", align="right" }) wnetwork.text = " [ not connected | 00 ] " wicked.register(wnetwork, function () local f = io.popen("checkwireless") local l = f:read() f:close() return " [ " .. l .. " ] " end, "$1", 10) netgraphwidget_down = widget({ type = 'graph', name = 'netgraphwidget_down', align = 'right' }) netgraphwidget_up = widget({ type = 'graph', name = 'netgraphwidget_up', align = 'right' }) netgraphwidget_down.height = 0.85 netgraphwidget_down.width = 45 netgraphwidget_down.bg = '#333333' netgraphwidget_down.border_color = '#0a0a0a' netgraphwidget_down.grow = 'left' netgraphwidget_up.height = 0.85 netgraphwidget_up.width = 45 netgraphwidget_up.bg = '#333333' netgraphwidget_up.border_color = '#0a0a0a' netgraphwidget_up.grow = 'left' netgraphwidget_down:plot_properties_set('down', { fg = '#AEC6D8', fg_center = '#285577', fg_end = '#285577', vertical_gradient = false }) netgraphwidget_up:plot_properties_set('up', { fg = '#AEC6D8', fg_center = '#285577', fg_end = '#285577', vertical_gradient = false }) netwidget = widget({ type = 'textbox', name = 'netwidget', align = 'right' }) wicked.register(netgraphwidget_down, wicked.widgets.net,"${wlan0 down_kb}",3,"down") wicked.register(netgraphwidget_up, wicked.widgets.net,"${wlan0 up_kb}",3,"up") wicked.register(netwidget, wicked.widgets.net, 'wlan0: ${wlan0 down_kb} / ${wlan0 up_kb}', nil, nil, 3) -- Memory Icon memicon = widget({ type = "imagebox", align = "right" }) memicon.image = image("/home/SOMEONE/.config/awesome/icons/memory.png") -- Memory bar membarwidget = widget({ type = 'progressbar', name = 'membarwidget', align = 'right' }) membarwidget.width = 40 membarwidget.height = 0.65 membarwidget.gap = 0 membarwidget.border_padding = 1 membarwidget.border_width = 1 membarwidget.ticks_count = 0 membarwidget.ticks_gap = 0 -- }) membarwidget:bar_properties_set('mem', { bg = '#222222', fg = '#285577', fg_center = '#285577', fg_end = '#285577', fg_off = '#222222', reverse = false, min_value = 0, max_value = 100 }) wicked.register(membarwidget, wicked.widgets.mem, '$1', 1, 'mem') -- Create a systray topsystray = widget({ type = "systray", align = "right" }) -- Create a wibox for each screen and add it mywibox_top = {} mywibox_bottom = {} mypromptbox = {} mylayoutbox = {} mytaglist = {} mytaglist.buttons = { button({ }, 1, awful.tag.viewonly), button({ modkey }, 1, awful.client.movetotag), button({ }, 3, function (tag) tag.selected = not tag.selected end), button({ modkey }, 3, awful.client.toggletag), button({ }, 4, awful.tag.viewnext), button({ }, 5, awful.tag.viewprev) } for s = 1, screen.count() do -- Create a promptbox for each screen mypromptbox[s] = widget({ type = "textbox", align = "left" }) -- Create an imagebox widget which will contains an icon indicating which layout we're using. -- We need one layoutbox per screen. mylayoutbox[s] = widget({ type = "imagebox", align = "right" }) mylayoutbox[s]:buttons({ button({ }, 1, function () awful.layout.inc(layouts, 1) end), button({ }, 3, function () awful.layout.inc(layouts, -1) end), button({ }, 4, function () awful.layout.inc(layouts, 1) end), button({ }, 5, function () awful.layout.inc(layouts, -1) end) }) -- Create a taglist widget mytaglist[s] = awful.widget.taglist.new(s, awful.widget.taglist.label.all, mytaglist.buttons) -- Create the wibox mywibox_top[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal, height=11}) mywibox_bottom[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal }) -- Add widgets to the wibox - order matters mywibox_top[s].widgets = { mylauncher, mytaglist[s], mypromptbox[s], musicicon, xmmstextbox, s == 1 and topsystray or nil } -- Add widgets to the wibox - order matters mywibox_bottom[s].widgets = { coplandicon, bgbox, mail_status, mail_somehost_1, mail_somehost_2, mail_somehost_3, mail_somehost_4, separator, wnetwork, separator, netgraphwidget_down, separator, netwidget, separator, netgraphwidget_up, separator, cpuicon, cpugraphwidget_1, separator, cpuicon, cpugraphwidget_2, separator, memicon, membarwidget, separator, tempicon, cputemp, separator, batticon, batt, separator, volicon, volbar, separator, dateicon, mytextbox, mylayoutbox[s], s == 1 and topsystray or nil } mywibox_top[s].screen = s mywibox_bottom[s].screen = s end -- }}} -- {{{ Mouse bindings awesome.buttons({ button({ }, 9, awful.tag.viewnext), button({ }, 8, awful.tag.viewprev) }) -- }}} -- {{{ Key bindings -- Bind keyboard digits -- 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 for i = 1, keynumber do keybinding({ "Mod1" }, i, function () local screen = mouse.screen if tags[screen][i] then awful.tag.viewonly(tags[screen][i]) end end):add() keybinding({ modkey, "Control" }, i, function () local screen = mouse.screen if tags[screen][i] then tags[screen][i].selected = not tags[screen][i].selected end end):add() keybinding({ modkey }, i, function () if client.focus then if tags[client.focus.screen][i] then awful.client.movetotag(tags[client.focus.screen][i]) end end end):add() keybinding({ modkey, "Control", "Shift" }, i, function () if client.focus then if tags[client.focus.screen][i] then awful.client.toggletag(tags[client.focus.screen][i]) end end end):add() end keybinding({ modkey }, "f", function () awful.util.spawn("firefox") end):add() keybinding({ modkey }, "g", function () awful.util.spawn("gajim") end):add() keybinding({ modkey }, "e", function () awful.util.spawn("emacs --font \"Bitstream Vera Sans Mono-11\"") end):add() keybinding({ modkey }, "m", function () awful.util.spawn("lastfm") end):add() keybinding({ modkey }, "r", function () awful.util.spawn(terminal .. " -e screen -R -D") end):add() keybinding({ modkey }, "t", function () awful.util.spawn(terminal .. " -e screen" ) end):add() keybinding({ modkey, "Shift" }, "t", function () awful.util.spawn(terminal .. "-fg red -e screen") end):add() keybinding({ modkey }, "Return", function () awful.util.spawn(terminal) end):add() -- XMMS manipulation keybinding({}, "XF86AudioPlay", function () awful.util.spawn("xmms -t") end):add() keybinding({}, "XF86AudioStop", function () awful.util.spawn("xmms -s") end):add() keybinding({}, "XF86AudioNext", function () awful.util.spawn("xmms -f") end):add() keybinding({}, "XF86AudioPrev", function () awful.util.spawn("xmms -r") end):add() keybinding({}, "XF86AudioMute", function () awful.util.spawn("amixer set Master toggle") end):add() keybinding({}, "XF86AudioRaiseVolume", function ()awful.util.spawn("amixer set Master 2%+") end):add() keybinding({}, "XF86AudioLowerVolume", function ()awful.util.spawn("amixer set Master 2%-") end):add() keybinding({ modkey }, "Left", awful.tag.viewprev):add() keybinding({ modkey }, "Right", awful.tag.viewnext):add() keybinding({ modkey }, "Escape", awful.tag.history.restore):add() keybinding({}, "XF86PowerOff", function () awful.util.spawn("sudo /sbin/halt") end):add() keybinding({ modkey}, "XF86PowerOff", function () awful.util.spawn("sudo /root/s2mem") end):add() -- Standard program keybinding({ modkey, "Control" }, "r", function () mypromptbox[mouse.screen].text = awful.util.escape(awful.util.restart()) end):add() keybinding({ modkey, "Shift" }, "q", awesome.quit):add() -- Client manipulation keybinding({ "Mod1" }, "F4", function () client.focus:kill() end):add() keybinding({ modkey }, "j", function () awful.client.focus.byidx(1); client.focus:raise() end):add() keybinding({ modkey }, "k", function () awful.client.focus.byidx(-1); client.focus:raise() end):add() keybinding({ modkey, "Shift" }, "j", function () awful.client.swap.byidx(1) end):add() keybinding({ modkey, "Shift" }, "k", function () awful.client.swap(-1) end):add() keybinding({ modkey, "Control" }, "j", function () awful.screen.focus(1) end):add() keybinding({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end):add() keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add() keybinding({ modkey, "Control" }, "Return", function () client.focus:swap(awful.client.getmaster()) end):add() keybinding({ modkey }, "o", awful.client.movetoscreen):add() keybinding({ modkey }, "Tab", awful.client.focus.history.previous):add() keybinding({ modkey }, "u", awful.client.urgent.jumpto):add() keybinding({ modkey, "Shift" }, "r", function () client.focus:redraw() end):add() -- Layout manipulation keybinding({ modkey }, "l", function () awful.tag.incmwfact(0.05) end):add() keybinding({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end):add() keybinding({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(1) end):add() keybinding({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end):add() keybinding({ modkey, "Control" }, "h", function () awful.tag.incncol(1) end):add() keybinding({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end):add() keybinding({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add() keybinding({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add() -- Prompt keybinding({ modkey }, "F1", function () awful.prompt.run({ prompt = "Run: " }, mypromptbox[mouse.screen], awful.util.spawn, awful.completion.bash, awful.util.getdir("cache") .. "/history") end):add() keybinding({ modkey }, "F4", function () awful.prompt.run({ prompt = "Run Lua code: " }, mypromptbox[mouse.screen], awful.util.eval, awful.prompt.bash, awful.util.getdir("cache") .. "/history_eval") end):add() keybinding({ modkey, "Ctrl" }, "i", function () local s = mouse.screen if mypromptbox[s].text then mypromptbox[s].text = nil else mypromptbox[s].text = nil if client.focus.class then mypromptbox[s].text = "Class: " .. client.focus.class .. " " end if client.focus.instance then mypromptbox[s].text = mypromptbox[s].text .. "Instance: ".. client.focus.instance .. " " end if client.focus.role then mypromptbox[s].text = mypromptbox[s].text .. "Role: ".. client.focus.role end end end):add() -- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them keybinding({ modkey, "Mod1" }, "t", awful.client.togglemarked):add() for i = 1, keynumber do keybinding({ modkey, "Shift" }, "F" .. i, function () local screen = mouse.screen if tags[screen][i] then for k, c in pairs(awful.client.getmarked()) do awful.client.movetotag(tags[screen][i], c) end end end):add() end -- }}} -- {{{ Hooks -- Hook function to execute when focusing a client. awful.hooks.focus.register(function (c) if not awful.client.ismarked(c) then c.border_color = beautiful.border_focus end end) -- Hook function to execute when unfocusing a client. awful.hooks.unfocus.register(function (c) if not awful.client.ismarked(c) then c.border_color = beautiful.border_normal end end) -- Hook function to execute when marking a client awful.hooks.marked.register(function (c) c.border_color = beautiful.border_marked end) -- Hook function to execute when unmarking a client. awful.hooks.unmarked.register(function (c) c.border_color = beautiful.border_focus end) -- Hook function to execute when the mouse enters a client. awful.hooks.mouse_enter.register(function (c) -- Sloppy focus, but disabled for magnifier layout if awful.layout.get(c.screen) ~= "magnifier" and awful.client.focus.filter(c) then client.focus = c end end) -- Hook function to execute when a new client appears. awful.hooks.manage.register(function (c) if use_titlebar then -- Add a titlebar awful.titlebar.add(c, { modkey = modkey }) end -- Add mouse bindings c:buttons({ button({ }, 9, awful.tag.viewnext), button({ }, 8, awful.tag.viewprev), button({ }, 1, function (c) client.focus = c; c:raise() end), button({ modkey }, 1, function (c) c:mouse_move() end), button({ modkey }, 3, function (c) c:mouse_resize() end) }) -- New client may not receive focus -- if they're not focusable, so set border anyway. c.border_width = beautiful.border_width c.border_color = beautiful.border_normal client.focus = c -- Check if the application should be floating. local cls = c.class local inst = c.instance if floatapps[cls] then c.floating = floatapps[cls] elseif floatapps[inst] then c.floating = floatapps[inst] end -- Check application->screen/tag mappings. local target if apptags[cls] then target = apptags[cls] elseif apptags[inst] then target = apptags[inst] end if target then c.screen = target.screen awful.client.movetotag(tags[target.screen][target.tag], c) end -- Set the windows at the slave, -- i.e. put it at the end of others instead of setting it master. -- awful.client.setslave(c) -- Honor size hints: if you want to drop the gaps between windows, set this to false. -- c.honorsizehints = false end) -- Hook function to execute when arranging the screen. -- (tag switch, new client, etc) awful.hooks.arrange.register(function (screen) local layout = awful.layout.get(screen) if layout then mylayoutbox[screen].image = image(beautiful["layout_" .. layout]) else mylayoutbox[screen].image = nil end -- Give focus to the latest client in history if no window has focus -- or if the current window is a desktop or a dock one. if not client.focus then local c = awful.client.focus.history.get(screen, 0) if c then client.focus = c end end -- Uncomment if you want mouse warping --[[ if client.focus then local c_c = client.focus:fullgeometry() local m_c = mouse.coords() if m_c.x < c_c.x or m_c.x >= c_c.x + c_c.width or m_c.y < c_c.y or m_c.y >= c_c.y + c_c.height then if table.maxn(m_c.buttons) == 0 then mouse.coords({ x = c_c.x + 5, y = c_c.y + 5}) end end end ]] end) -- Hook called every second awful.hooks.timer.register(1, function () -- For unix time_t lovers -- mytextbox.text = " " .. os.time() .. " time_t " -- Otherwise use: mytextbox.text = " " .. os.date() .. " " end) -- }}} xmms_format = " %T [%m:%M]" wicked.register(xmmstextbox, function (widget,args) local xctl = io.popen('xmmsctrl print "' .. xmms_format ..'"') local song = xctl:read() xctl:close() return song end, "$1", 1 )