dotfiles/.config/qtile/modules/hooks.py

36 lines
812 B
Python
Raw Normal View History

2022-01-25 21:28:02 +01:00
import subprocess
2022-03-25 17:10:57 +01:00
import os
2022-01-25 21:28:02 +01:00
from libqtile import hook
@hook.subscribe.startup
def autostart():
2022-03-20 18:01:58 +01:00
subprocess.call(["autostart.sh"])
2022-03-18 00:11:36 +01:00
@hook.subscribe.client_managed
def show_window(window):
window.group.cmd_toscreen()
2022-03-25 17:10:57 +01:00
@hook.subscribe.client_killed
def toggle_previous_group_if_last_window_killed(window):
group = window.group
if len(group.info()['windows']) == 1:
group.screen.toggle_group()
2022-03-25 17:10:57 +01:00
@hook.subscribe.client_managed
@hook.subscribe.client_urgent_hint_changed
@hook.subscribe.client_killed
@hook.subscribe.setgroup
@hook.subscribe.group_window_add
@hook.subscribe.current_screen_change
@hook.subscribe.changegroup
def hook_response(*args, **kwargs):
file = os.path.expanduser('~/.cache/workspaces')
with open(file, 'a') as f:
print('workspace changed', file=f)