-- Standard awesome library require("awful") require("awful.autofocus") require("awful.rules") require "awful.layout" require "awful.layout.suit" -- Widget and layout library require("wibox") -- Theme handling library require("beautiful") -- Notification library require("naughty") -- Bring in 'shifty' (the nifty dynamic tags stuffs) require "shifty" -- Bring in my shifty configuration require "shiftyconfig" -- Bring in my handy utils require 'djas' -- My key setup require 'keysetup' -- Try bringing in the Debian menu config require 'debian.menu' -- Neat calendar widget require 'cal' -- Handy dandy state restoration booja require 'reloader' -- Pull the dbus augmentation for naughty in, so introspection doesn't fail require 'naughtyaugment' -- Handy locals local tjoin = awful.util.table.join -- {{{ Variable definitions -- Themes define colours, icons, and wallpapers --beautiful.init("/usr/local/share/awesome/themes/default/theme.lua") beautiful.init(os.getenv("HOME").."/.resources/awesomerc/rc-git/danburn/theme.lua") -- This is used later as the default terminal and editor to run. terminal = "gnome-terminal" editor = os.getenv("EDITOR") or "nano" 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 = { -- awful.layout.suit.tile, awful.layout.suit.fair, awful.layout.suit.floating, } -- }}} -- {{{ Menu -- Create a laucher widget and a main menu function sessionmethod(d) awful.util.spawn("gnome-session-quit " .. d, false) end myawesomemenu = { -- { "manual", terminal .. " -e man awesome" }, -- { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc-new.lua" }, { "restart", awesome.restart }, { "quit", awesome.quit } } mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, { "Debian", debian.menu.Debian_menu.Debian }, { "open terminal", terminal }, { "log out", function () sessionmethod "--logout" end }, { "shut down", function () sessionmethod "--power-off" end }, } }) mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) -- }}} -- {{{ Wibox -- Create a textclock widget mytextclock = awful.widget.textclock() -- Calendar tooltip currently doesn't render. Oddness --cal.register(mytextclock, "%s") -- Create a wibox for each screen and add it mywibox = {} mypromptbox = {} mylayoutbox = {} mytaglist = {} mytaglist.buttons = tjoin( 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 = tjoin( awful.button({ }, 1, function (c) if c == client.focus then c.minimized = true else if not c:isvisible() then awful.tag.viewonly(c:tags()[1]) end -- This will also un-minimize -- the client, if needed client.focus = c c:raise() end 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 -- Create a promptbox for each screen mypromptbox[s] = awful.widget.prompt() -- Create an imagebox widget which will contains an icon indicating which layout we're using. -- We need one layoutbox per screen. mylayoutbox[s] = awful.widget.layoutbox(s) local function layout_button(n, m) return awful.button({}, n, function () awful.layout.inc(layouts, m) end) end mylayoutbox[s]:buttons(tjoin( layout_button(1, 1), layout_button(3, -1), layout_button(4, 1), layout_button(4, -1))) -- Create a taglist widget mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) -- Create a tasklist widget mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) -- Create the wibox mywibox[s] = awful.wibox({ position = "top", screen = s }) -- Widgets that are aligned to the left local left_layout = wibox.layout.fixed.horizontal() left_layout:add(mylauncher) left_layout:add(mytaglist[s]) left_layout:add(mypromptbox[s]) -- Widgets that are aligned to the right local right_layout = wibox.layout.fixed.horizontal() if s == 1 then right_layout:add(wibox.widget.systray()) end right_layout:add(mytextclock) right_layout:add(mylayoutbox[s]) -- Now bring it all together (with the tasklist in the middle) local layout = wibox.layout.align.horizontal() layout:set_left(left_layout) layout:set_middle(mytasklist[s]) layout:set_right(right_layout) mywibox[s]:set_widget(layout) end -- }}} -- {{{ Key bindings globalkeys = keysetup.globalkeys(modkey, mypromptbox) clientkeys = keysetup.clientkeys(modkey) clientbuttons = tjoin( 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) shifty.config.globalkeys = globalkeys shifty.config.clientkeys = clientkeys -- }}} shiftyconfig.go(modkey) shifty.layouts = layouts shifty.taglist = mytaglist shifty.init() -- {{{ Mouse bindings root.buttons(tjoin( awful.button({ }, 3, function () mymainmenu:toggle() end) -- awful.button({ }, 4, awful.tag.viewnext), -- awful.button({ }, 5, awful.tag.viewprev) )) -- }}} -- {{{ Signals -- Signal function to execute when a new client appears. do function ___(c, startup) -- Enable sloppy focus reloader.try_place_client(c, startup) c:connect_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) end client.connect_signal("manage", ___) end client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -- }}} -- Finally, let the reloader in on the game reloader.prepare_reload_state "/home/dsilvers/.config/awesome/client.state"