diff --git a/README.rst b/README.rst index 8f5d03a..6020ca4 100644 --- a/README.rst +++ b/README.rst @@ -151,7 +151,7 @@ Blackburn and Dremora use Icons_, Vertex uses FontAwesome_: be sure to have bitm Additional default software used: :: - unclutter firefox scrot mpd mpc dmenu xsel xlock + unclutter firefox scrot mpd mpc dmenu xsel slock .. _BY-NC-SA: http://creativecommons.org/licenses/by-nc-sa/4.0 .. _b0ab0d7: https://github.com/lcpz/awesome-copycats/tree/b0ab0d7837987be81b9195a36631df773113d491 diff --git a/rc.lua.template b/rc.lua.template index 57a231c..23445bb 100644 --- a/rc.lua.template +++ b/rc.lua.template @@ -19,16 +19,20 @@ local lain = require("lain") --local menubar = require("menubar") local freedesktop = require("freedesktop") local hotkeys_popup = require("awful.hotkeys_popup").widget + require("awful.hotkeys_popup.keys") local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility -- }}} -- {{{ Error handling +-- Check if awesome encountered an error during startup and fell back to +-- another config (This code will only ever execute for the fallback config) if awesome.startup_errors then naughty.notify({ preset = naughty.config.presets.critical, title = "Oops, there were errors during startup!", text = awesome.startup_errors }) end +-- Handle runtime errors after startup do local in_error = false awesome.connect_signal("debug::error", function (err) @@ -52,7 +56,7 @@ local function run_once(cmd_arr) end end -run_once({ "urxvtd", "unclutter -root" }) -- entries must be comma-separated +run_once({ "urxvtd", "unclutter -root" }) -- entries must be separated by commas -- This function implements the XDG autostart specification --[[ @@ -84,12 +88,12 @@ local themes = { local chosen_theme = themes[5] local modkey = "Mod4" local altkey = "Mod1" -local terminal = "xterm" -local editor = os.getenv("EDITOR") or "nano" +local terminal = "urxvtc" +local editor = os.getenv("EDITOR") or "vim" local gui_editor = "gvim" local browser = "firefox" local guieditor = "atom" -local scrlocker = "xlock" +local scrlocker = "slock" awful.util.terminal = terminal awful.util.tagnames = { "1", "2", "3", "4", "5" } @@ -117,57 +121,47 @@ awful.layout.layouts = { --lain.layout.termfair, --lain.layout.termfair.center, } -awful.util.taglist_buttons = my_table.join( - awful.button({ }, 1, function(t) t:view_only() end), - awful.button({ modkey }, 1, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end), - awful.button({ }, 3, awful.tag.viewtoggle), - awful.button({ modkey }, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) - end - end), - awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), - awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) - ) -awful.util.tasklist_buttons = my_table.join( - awful.button({ }, 1, function (c) - if c == client.focus then - c.minimized = true - else - -- Without this, the following - -- :isvisible() makes no sense - c.minimized = false - if not c:isvisible() and c.first_tag then - c.first_tag:view_only() - end - -- This will also un-minimize - -- the client, if needed - client.focus = c - c:raise() - end - end), - awful.button({ }, 3, function() - local instance = nil - return function () - if instance and instance.wibox.visible then - instance:hide() - instance = nil - else - instance = awful.menu.clients({ theme = { width = 250 } }) - end - end - end), - awful.button({ }, 4, function () - awful.client.focus.byidx(1) - end), - awful.button({ }, 5, function () - awful.client.focus.byidx(-1) - end)) +awful.util.taglist_buttons = my_table.join( + awful.button({ }, 1, function(t) t:view_only() end), + awful.button({ modkey }, 1, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end), + awful.button({ }, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end), + awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), + awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) +) + +awful.util.tasklist_buttons = my_table.join( + awful.button({ }, 1, function (c) + if c == client.focus then + c.minimized = true + else + c:emit_signal("request::activate", "tasklist", {raise = true}) + end + end), + awful.button({ }, 3, function () + local instance = nil + + return function () + if instance and instance.wibox.visible then + instance:hide() + instance = nil + else + instance = awful.menu.clients({theme = {width = 250}}) + end + end + end), + awful.button({ }, 4, function () awful.client.focus.byidx(1) end), + awful.button({ }, 5, function () awful.client.focus.byidx(-1) end) +) lain.layout.termfair.nmaster = 3 lain.layout.termfair.ncol = 1 @@ -179,8 +173,7 @@ lain.layout.cascade.tile.extra_padding = 5 lain.layout.cascade.tile.nmaster = 5 lain.layout.cascade.tile.ncol = 2 -local theme_path = string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), chosen_theme) -beautiful.init(theme_path) +beautiful.init(string.format(gears.filesystem.get_configuration_dir() .. "/themes/%s/theme.lua", chosen_theme)) -- }}} -- {{{ Menu @@ -608,10 +601,19 @@ for i = 1, 9 do ) end -clientbuttons = my_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)) +clientbuttons = gears.table.join( + awful.button({ }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + end), + awful.button({ modkey }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + awful.mouse.client.move(c) + end), + awful.button({ modkey }, 3, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + awful.mouse.client.resize(c) + end) +) -- Set keys root.keys(globalkeys) @@ -674,13 +676,11 @@ client.connect_signal("request::titlebars", function(c) -- buttons for the titlebar local buttons = my_table.join( awful.button({ }, 1, function() - client.focus = c - c:raise() + c:emit_signal("request::activate", "titlebar", {raise = true}) awful.mouse.client.move(c) end), awful.button({ }, 3, function() - client.focus = c - c:raise() + c:emit_signal("request::activate", "titlebar", {raise = true}) awful.mouse.client.resize(c) end) ) @@ -713,10 +713,7 @@ end) -- Enable sloppy focus, so that focus follows mouse. client.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 + c:emit_signal("request::activate", "mouse_enter", {raise = true}) end) -- No border for maximized clients @@ -729,7 +726,7 @@ function border_adjust(c) end end -client.connect_signal("focus", border_adjust) client.connect_signal("property::maximized", border_adjust) +client.connect_signal("focus", border_adjust) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -- }}}