systemd: tentative to manage session with systemd

To me, I think it was cleaner to have a parameter with the current
display. This way, the session is specific to the current display. It
seems BindsTo doesn't think this way.
This commit is contained in:
Vincent Bernat 2020-01-19 18:36:36 +01:00
parent d5b72851ec
commit ae691bb025
20 changed files with 132 additions and 82 deletions

View file

@ -1,11 +1,5 @@
-- Start idempotent commands
local execute = {
-- Kill any running nm-applet
"pkill nm-applet",
-- Start PulseAudio
"xset -b", -- Disable bell
-- Enable numlock
"numlockx on",
-- Default browser
"xdg-mime default " .. config.browser .. ".desktop " ..
"x-scheme-handler/http " ..
@ -17,8 +11,3 @@ local execute = {
}
os.execute(table.concat(execute, ";"))
-- Spawn various X programs
xrun("polkit-gnome-authentication-agent-1",
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1")
xrun("NetworkManager Applet", "nm-applet")

View file

@ -1,36 +0,0 @@
-- run a command only if the client does not already exist
local xrun_now = function(name, cmd)
-- Try first the list of clients from awesome (which is available
-- only if awesome has fully started, therefore, this function
-- should be run inside a 0 timer)
local squid = { name, name:sub(1,1):upper() .. name:sub(2) }
if awful.client.cycle(
function(c)
return awful.rules.match_any(c,
{ name = squid,
class = squid,
instance = squid })
end)() then
return
end
-- Not found, let's check with xwininfo. We can only check name but
-- we can catch application without a window...
if os.execute("xwininfo -name '" .. name .. "' > /dev/null 2> /dev/null") == 0 then
return
end
awful.util.spawn(cmd or name, false)
end
-- Run a command if not already running.
xrun = function(name, cmd)
-- We need to wait for awesome to be ready. Hence the timer.
local stimer = timer { timeout = 0 }
local run = function()
stimer:stop()
xrun_now(name, cmd)
end
stimer:add_signal("timeout", run)
stimer:start()
end