diff --git a/awesome/awesome-wm-widgets b/awesome/awesome-wm-widgets index 6fc9f66..257dff3 160000 --- a/awesome/awesome-wm-widgets +++ b/awesome/awesome-wm-widgets @@ -1 +1 @@ -Subproject commit 6fc9f668491ecdb19578a0ac6c5a1be0b8b42881 +Subproject commit 257dff3b6c85444f4477db6a8ae34865b86119a5 diff --git a/awesome/rc.lua b/awesome/rc.lua index c2595dc..8b022cd 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") @@ -17,8 +21,6 @@ require("awful.hotkeys_popup.keys") -- Load Debian menu entries local debian = require("debian.menu") local has_fdo, freedesktop = pcall(require, "freedesktop") --- Improve startup time of menubar -menubar.menu_gen.lookup_category_icons = function() end -- {{{ Error handling -- Check if awesome encountered an error during startup and fell back to @@ -63,18 +65,18 @@ modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. awful.layout.layouts = { - --awful.layout.suit.floating, awful.layout.suit.tile, - awful.layout.suit.tile.left, awful.layout.suit.tile.bottom, + awful.layout.suit.tile.left, awful.layout.suit.tile.top, awful.layout.suit.fair, awful.layout.suit.fair.horizontal, - awful.layout.suit.spiral, - awful.layout.suit.spiral.dwindle, - awful.layout.suit.max, - awful.layout.suit.max.fullscreen, - awful.layout.suit.magnifier, + awful.layout.suit.floating, + --awful.layout.suit.spiral, + --awful.layout.suit.spiral.dwindle, + --awful.layout.suit.max, + --awful.layout.suit.max.fullscreen, + --awful.layout.suit.magnifier, --awful.layout.suit.corner.nw, -- awful.layout.suit.corner.ne, -- awful.layout.suit.corner.sw, @@ -82,29 +84,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 } @@ -131,19 +118,12 @@ mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it -menubar.cache_entries = true -- }}} -- Keyboard map indicator and switcher mykeyboardlayout = awful.widget.keyboardlayout() -- {{{ Wibar --- imports -local cpu_widget = require("awesome-wm-widgets.cpu-widget.cpu-widget") -local ram_widget = require("awesome-wm-widgets.ram-widget.ram-widget") -local volume_control = require("volume-control") -volumecfg = volume_control {device="pulse"} - -- Create a textclock widget mytextclock = wibox.widget.textclock() @@ -170,19 +150,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), @@ -205,6 +182,10 @@ end -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) screen.connect_signal("property::geometry", set_wallpaper) +local cpu_widget = require("awesome-wm-widgets.cpu-widget.cpu-widget") +local ram_widget = require("awesome-wm-widgets.ram-widget.ram-widget") +local volume_control = require("volume-control") +volumecfg = volume_control {device="pulse"} awful.screen.connect_for_each_screen(function(s) -- Wallpaper set_wallpaper(s) @@ -223,18 +204,22 @@ 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 }) - local sep = wibox.widget { - widget = wibox.widget.separator - } - -- Add widgets to the wibox s.mywibox:setup { layout = wibox.layout.align.horizontal, @@ -248,10 +233,10 @@ awful.screen.connect_for_each_screen(function(s) { -- Right widgets layout = wibox.layout.fixed.horizontal, cpu_widget(), + sep, ram_widget(), sep, volumecfg.widget, - sep, mykeyboardlayout, wibox.widget.systray(), mytextclock, @@ -320,8 +305,8 @@ globalkeys = gears.table.join( {description = "open a terminal", group = "launcher"}), awful.key({ modkey, "Control" }, "r", awesome.restart, {description = "reload awesome", group = "awesome"}), - awful.key({ modkey, "Shift" }, "q", awesome.quit, - {description = "quit awesome", group = "awesome"}), + --awful.key({ modkey, "Shift" }, "q", awesome.quit, + --{description = "quit awesome", group = "awesome"}), awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, {description = "increase master width factor", group = "layout"}), @@ -345,8 +330,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"}), @@ -367,19 +353,7 @@ globalkeys = gears.table.join( {description = "lua execute prompt", group = "awesome"}), -- Menubar awful.key({ modkey }, "p", function() menubar.show() end, - {description = "show the menubar", group = "launcher"}), - - -- Volume - awful.key({}, "XF86AudioRaiseVolume", function() volumecfg:up() end), - awful.key({}, "XF86AudioLowerVolume", function() volumecfg:down() end), - awful.key({}, "XF86AudioMute", function() volumecfg:toggle() end), - - -- applications - awful.key({}, "XF86Calculator", function() awful.util.spawn("qalculate-gtk") end), - awful.key({}, "XF86Launch5", function() awful.util.spawn_with_shell("echo -e 'connect 44:EA:D8:39:BB:4B\nquit' | bluetoothctl") end), - awful.key({}, "XF86Launch6", function() awful.util.spawn_with_shell("echo -e 'disconnect 44:EA:D8:39:BB:4B\nquit' | bluetoothctl") end), - awful.key({}, "Print", function() awful.util.spawn_with_shell("spectacle") end), - awful.key({ modkey }, "Print", function() awful.util.spawn_with_shell("spectacle -r") end) + {description = "show the menubar", group = "launcher"}) ) clientkeys = gears.table.join( @@ -477,9 +451,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) @@ -506,23 +489,28 @@ 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", "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 }}, @@ -545,8 +533,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) @@ -558,13 +546,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) ) @@ -597,31 +583,25 @@ 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) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -- }}} --- Autostart {{{ +-- Autorun programs{{{ autorun = true -autorunApps = -{ - "nextcloud", - "clementine", - "keepassxc", +autorunApps = +{ + "keepass", + "clementine" } if autorun then + awful.util.spawn("sleep 1") for app = 1, #autorunApps do - awful.util.spawn(autorunApps[app]) + awful.spawn.with_shell(autorunApps[app]) end -end --- }}} +end--}}} --- own settings {{{ awful.spawn.with_shell("~/.config/awesome/autorun.sh") --- }}}