Changes to hooks.

This commit is contained in:
Bartek Stalewski 2023-10-15 13:47:14 +02:00
parent 0b7d4b8c54
commit 3e224c15c7

View File

@ -1,6 +1,6 @@
import os import os
import subprocess import subprocess
from libqtile import bar, extension, hook, layout from libqtile import bar, extension, hook, layout, qtile
from libqtile.lazy import lazy from libqtile.lazy import lazy
from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen
from libqtile.backend.wayland import InputConfig from libqtile.backend.wayland import InputConfig
@ -19,17 +19,16 @@ wl_input_rules = {
@hook.subscribe.startup_once @hook.subscribe.startup_once
def autostart(): def autostart():
autostart = os.path.expanduser('~/.config/qtile/autostart.sh') autostart = os.path.expanduser('~/.config/qtile/autostart.sh')
subprocess.Popen([autostart]) subprocess.run([autostart])
@hook.subscribe.shutdown @hook.subscribe.shutdown
def autostop(): def autostop():
autostop = os.path.expanduser('~/.config/qtile/stop.sh') autostop = os.path.expanduser('~/.config/qtile/stop.sh')
subprocess.Popen([autostop]) subprocess.run([autostop])
@hook.subscribe.resume @hook.subscribe.suspend
def resume(): def suspend():
wallpaper = os.path.expanduser('~/.config/qtile/wallpaper.img') qtile.spawn("swaylock --image ~/.config/qtile/wallpaper.img")
subprocess.Popen(['swaylock', '--image', wallpaper])
mod = "mod4" mod = "mod4"
groups = [ groups = [