37 lines
756 B
Lua
37 lines
756 B
Lua
local settings = require("lua.lib.settings")
|
|
local systemd = require("lua.lib.systemd")
|
|
local utils = require("lua.lib.utils")
|
|
require("lua.lib.globals")
|
|
local M = {}
|
|
|
|
local function start_swaync()
|
|
if settings["systemd"] then
|
|
local unit = "swaync.service"
|
|
local source = HYPR .. "/systemd/" .. unit
|
|
|
|
if systemd.ensure_user_unit(unit, source) then
|
|
hl.exec_cmd("systemctl --user start swaync")
|
|
else
|
|
hl.exec_cmd("swaync")
|
|
end
|
|
else
|
|
hl.exec_cmd("swaync")
|
|
end
|
|
end
|
|
|
|
local function stop_swaync()
|
|
if settings["systemd"] and utils.command_success("systemctl --user status swaync") then
|
|
hl.exec_cmd("systemctl --user stop swaync")
|
|
end
|
|
end
|
|
|
|
M.autostart = {
|
|
start_swaync,
|
|
}
|
|
|
|
M.autostop = {
|
|
stop_swaync,
|
|
}
|
|
|
|
return M
|