summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorMike Crute <crutem@amazon.com>2019-02-04 12:33:49 -0800
committerMike Crute <crutem@amazon.com>2019-02-04 12:33:49 -0800
commit378e0f01bd71f844ea37bdc43347a2c799ce25c5 (patch)
tree0f129158647e9f8bdfb06ac14d9538f2300b42fc /.config
parent95812b24590aed6a2ad7b91f2f2288e03e5a899d (diff)
downloaddotfiles-378e0f01bd71f844ea37bdc43347a2c799ce25c5.tar.bz2
dotfiles-378e0f01bd71f844ea37bdc43347a2c799ce25c5.tar.xz
dotfiles-378e0f01bd71f844ea37bdc43347a2c799ce25c5.zip
Better start/stop handling for awesome
Diffstat (limited to '.config')
-rw-r--r--.config/awesome/mcrute.lua50
-rw-r--r--.config/awesome/rc.lua4
2 files changed, 26 insertions, 28 deletions
diff --git a/.config/awesome/mcrute.lua b/.config/awesome/mcrute.lua
index d1bfa02..064eb1c 100644
--- a/.config/awesome/mcrute.lua
+++ b/.config/awesome/mcrute.lua
@@ -218,13 +218,6 @@ local function do_equal(p, orientation)
218 end 218 end
219end 219end
220 220
221-- setup_device_handling configures callbacks that need to be run when
222-- something changes about the system. This used to connect some dbus events to
223-- configure keyboards and mice but just does display management now.
224function setup_device_handling()
225 awesome.connect_signal("screen::change", configure_displays)
226end
227
228-- set_solid_wallpaper sets the gears wallpaper to a solid color as defined in 221-- set_solid_wallpaper sets the gears wallpaper to a solid color as defined in
229-- beautiful.bg_normal 222-- beautiful.bg_normal
230function set_solid_wallpaper(s) 223function set_solid_wallpaper(s)
@@ -257,23 +250,31 @@ function customize_theme()
257 end 250 end
258end 251end
259 252
260-- start_desktop_target calls systemd to startup all the processes in the user 253-- connect_signals hooks into startup, exit, and screen change events. On
261-- session and hooks the quit function to properly shutdown systemd when 254-- startup it will start the desktop.target in the user mode systemd which can
262-- awesome quits. This starts a desktop.target in the user mode systemd which 255-- pull in widgets and anything else that enhances the desktop environment. It
263-- can pull in widgets and anything else that enhances the desktop environment. 256-- will stop this target at exit and wait for that shutdown to complete.
264function start_desktop_target() 257--
265 awful.spawn.spawn("systemctl --user start desktop.target") 258-- This function also configures callbacks that need to be run when something
266 259-- changes about the system. This used to connect some dbus events to configure
267 -- Only do this once in case awesome gets reloaded 260-- keyboards and mice but just does display management now.
268 if not awesome._awesome_quit then 261function connect_signals()
269 awesome._awesome_quit = awesome.quit 262 awesome.connect_signal("screen::change", configure_displays)
270 awesome.quit = function() 263
271 -- The use of io.popen here is intentional because it will block until 264 awesome.connect_signal("startup", function()
272 -- systemd has finished stopping the target 265 awful.spawn.spawn("systemctl --user start desktop.target")
273 io.popen("systemctl --user --wait stop desktop.target") 266 end)
274 awesome._awesome_quit() 267
268 awesome.connect_signal("exit", function(is_restart)
269 -- There is no need to do this if this is a restart because the current
270 -- awesome exec's a new awesome which will inherit everything from the
271 -- current session.
272 if not is_restart then
273 -- The use of io.popen here is intentional because it will block
274 -- until systemd has finished stopping the target.
275 io.popen("systemctl --user stop desktop.target")
275 end 276 end
276 end 277 end)
277end 278end
278 279
279-- add_window_rules mixes additional window rules into awful.rules.rules. To 280-- add_window_rules mixes additional window rules into awful.rules.rules. To
@@ -555,11 +556,10 @@ return {
555 -- Public "API" used by rc.lua 556 -- Public "API" used by rc.lua
556 add_global_keys = add_global_keys, 557 add_global_keys = add_global_keys,
557 add_window_rules = add_window_rules, 558 add_window_rules = add_window_rules,
559 connect_signals = connect_signals,
558 customize_theme = customize_theme, 560 customize_theme = customize_theme,
559 get_clock = get_clock, 561 get_clock = get_clock,
560 get_layouts = get_layouts, 562 get_layouts = get_layouts,
561 setup_device_handling = setup_device_handling,
562 start_desktop_target = start_desktop_target,
563 battery = battery, 563 battery = battery,
564 564
565 -- Public functions that are useful on import 565 -- Public functions that are useful on import
diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua
index 3577384..7c763f3 100644
--- a/.config/awesome/rc.lua
+++ b/.config/awesome/rc.lua
@@ -20,7 +20,7 @@ require("awful.hotkeys_popup.keys")
20-- See this file for more details about local customizations 20-- See this file for more details about local customizations
21local mcrute = require("mcrute") 21local mcrute = require("mcrute")
22 22
23mcrute.setup_device_handling() 23mcrute.connect_signals()
24 24
25-- {{{ Error handling 25-- {{{ Error handling
26-- Check if awesome encountered an error during startup and fell back to 26-- Check if awesome encountered an error during startup and fell back to
@@ -502,5 +502,3 @@ end)
502client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) 502client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
503client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) 503client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
504-- }}} 504-- }}}
505
506mcrute.start_desktop_target()