Files
qtile/hooks.py

48 lines
1.4 KiB
Python

# _ _ _ _ _
# __ _| |_(_) | ___ | |__ ___ ___ | | _____
# / _` | __| | |/ _ \ | '_ \ / _ \ / _ \| |/ / __|
# | (_| | |_| | | __/ | | | | (_) | (_) | <\__ \
# \__, |\__|_|_|\___| |_| |_|\___/ \___/|_|\_\___/
# |_|
# by cerberus
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# Imports
# --------------------------------------------------------------------
from libqtile import hook, qtile
import subprocess
import os.path
from libqtile.config import Match
import asyncio
# --------------------------------------------------------------------
# HOOK startup
# --------------------------------------------------------------------
# Client management
FULLSCREEN_RULES = [Match(wm_class="flameshot")]
@hook.subscribe.startup_once
def autostart():
autostartscript = "~/.config/qtile/assets/scripts/autostart.sh"
home = os.path.expanduser(autostartscript)
subprocess.Popen([home])
@hook.subscribe.startup_complete
def go_to_group1():
qtile.focus_screen(0)
qtile.groups_map["1"].toscreen()
@hook.subscribe.client_managed
def force_fullscreen(client) -> None:
"""
Some clients won't start fullscreen (exclusive to wayland)
With this function we force clients defined in FULLSCREEN_RULES to enter fullscreen
"""
if any(client.match(rule) for rule in FULLSCREEN_RULES):
client.fullscreen = True