diff options
| -rw-r--r-- | awesome/rc.lua | 102 |
1 files changed, 55 insertions, 47 deletions
diff --git a/awesome/rc.lua b/awesome/rc.lua index 7d0f34b..8d80fe9 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -1,3 +1,7 @@ +-- If LuaRocks is installed, make sure that packages installed through it are +-- found (e.g. lgi). If LuaRocks is not installed, do nothing. +pcall(require, "luarocks.loader") + -- Standard awesome library local gears = require("gears") local awful = require("awful") @@ -9,7 +13,7 @@ local beautiful = require("beautiful") -- Notification library local naughty = require("naughty") local menubar = require("menubar") -local hotkeys_popup = require("awful.hotkeys_popup").widget +local hotkeys_popup = require("awful.hotkeys_popup") -- Enable hotkeys help widget for VIM and other apps -- when client with a matching name is opened: require("awful.hotkeys_popup.keys") @@ -83,29 +87,14 @@ awful.layout.layouts = { } -- }}} --- {{{ Helper functions -local function client_menu_toggle_fn() - 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 --- }}} - -- {{{ Menu -- Create a launcher widget and a main menu myawesomemenu = { - { "hotkeys", function() return false, hotkeys_popup.show_help end}, + { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, { "manual", terminal .. " -e man awesome" }, { "edit config", editor_cmd .. " " .. awesome.conffile }, { "restart", awesome.restart }, - { "quit", function() awesome.quit() end} + { "quit", function() awesome.quit() end }, } local menu_awesome = { "awesome", myawesomemenu, beautiful.awesome_icon } @@ -134,6 +123,9 @@ mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- }}} +-- Keyboard map indicator and switcher +mykeyboardlayout = awful.widget.keyboardlayout() + -- {{{ Wibar -- Create a textclock widget mytextclock = wibox.widget.textclock(' %H:%M ') @@ -185,19 +177,16 @@ local tasklist_buttons = gears.table.join( 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() + c:emit_signal( + "request::activate", + "tasklist", + {raise = true} + ) end end), - awful.button({ }, 3, client_menu_toggle_fn()), + awful.button({ }, 3, function() + awful.menu.client_list({ theme = { width = 250 } }) + end), awful.button({ }, 4, function () awful.client.focus.byidx(1) end), @@ -238,10 +227,18 @@ awful.screen.connect_for_each_screen(function(s) awful.button({ }, 4, function () awful.layout.inc( 1) end), awful.button({ }, 5, function () awful.layout.inc(-1) end))) -- Create a taglist widget - s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons) + s.mytaglist = awful.widget.taglist { + screen = s, + filter = awful.widget.taglist.filter.all, + buttons = taglist_buttons + } -- Create a tasklist widget - s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons) + s.mytasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + buttons = tasklist_buttons + } -- Create the wibox s.mywibox = awful.wibar({ position = "top", screen = s }) @@ -258,6 +255,7 @@ awful.screen.connect_for_each_screen(function(s) s.mytasklist, -- Middle widget { -- Right widgets layout = wibox.layout.fixed.horizontal, + --mykeyboardlayout, cpuwidget, batwidget, s.mylayoutbox, @@ -356,8 +354,9 @@ globalkeys = gears.table.join( local c = awful.client.restore() -- Focus restored client if c then - client.focus = c - c:raise() + c:emit_signal( + "request::activate", "key.unminimize", {raise = true} + ) end end, {description = "restore minimized", group = "client"}), @@ -491,9 +490,18 @@ for i = 1, 9 do end clientbuttons = gears.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)) + 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) @@ -521,26 +529,31 @@ awful.rules.rules = { instance = { "DTA", -- Firefox addon DownThemAll. "copyq", -- Includes session name in class. + "pinentry", }, class = { "Arandr", + "Blueman-manager", "Gpick", "Kruler", "MessageWin", -- kalarm. "Sxiv", + "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. "Wpa_gui", - "pinentry", "gimp", "mpv", "Mplayer", "veromix", "xtightvncviewer"}, + -- Note that the name property shown in xprop might be set slightly after creation of the client + -- and the name shown there might not match defined rules here. name = { "Event Tester", -- xev. }, role = { "AlarmWindow", -- Thunderbird's calendar. + "ConfigManager", -- Thunderbird's about:config. "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. } }, properties = { floating = true }}, @@ -563,8 +576,8 @@ client.connect_signal("manage", function (c) -- i.e. put it at the end of others instead of setting it master. -- if not awesome.startup then awful.client.setslave(c) end - if awesome.startup and - not c.size_hints.user_position + if awesome.startup + and not c.size_hints.user_position and not c.size_hints.program_position then -- Prevent clients from being unreachable after screen count changes. awful.placement.no_offscreen(c) @@ -576,13 +589,11 @@ client.connect_signal("request::titlebars", function(c) -- buttons for the titlebar local buttons = gears.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) ) @@ -615,10 +626,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 = false}) end) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) |
