diff --git a/config.py b/config.py index 603330a..7aa58be 100644 --- a/config.py +++ b/config.py @@ -35,6 +35,8 @@ from layouts.tabbed import Tabbed from qtile_bonsai import Bonsai from qtile_extras.layout.decorations import RoundedCorners #from libqtile.utils import guess_terminal +from libqtile import hook + mod = "mod4" terminal = "kitty" @@ -42,6 +44,24 @@ browser = "xdg-open http://" wallpaper_path = os.path.expanduser("~/.wallpaper") wallpaper_mode = "fill" +bind_windows = { + "1": [ + "kitty" + ], + "2": [ + "zen", + "firefox" + ], + "3": [ + "dev.zed.Zed", + "Code" + ], + "4": [], + "5": [ + "Element" + ] +} + # Switches between tabbed and plasma layout @lazy.function def switch_tabbed(qtile): @@ -128,6 +148,21 @@ keys = [ [], "XF86AudioMute", lazy.spawn("pamixer -t") + ), + Key( + [], + "XF86AudioPrev", + lazy.spawn("playerctl previous") + ), + Key( + [], + "XF86AudioPlay", + lazy.spawn("playerctl play-pause") + ), + Key( + [], + "XF86AudioNext", + lazy.spawn("playerctl next") ) ] @@ -227,15 +262,16 @@ screens = [ ), widget.Battery( format="Battery: {percent:2.0%} ({char})", - empty_char="Empty", - full_char="Full", - charge_char="Charging", - discharge_char="Discharging", - unknown_char="Unknown", - not_charging_char="Not Charging", - notify_below=15, + empty_char="Empty", + full_char="Full", + charge_char="Charging", + discharge_char="Discharging", + unknown_char="Unknown", + not_charging_char="Not Charging", + notify_below=15, update_interval=1, - show_short_text=False + show_short_text=False, + hide_crash=True ), widget.Volume( get_volume_command="pamixer --get-volume-human", @@ -244,7 +280,7 @@ screens = [ volume_down_command="pamixer -d 1" ), - widget.Backlight(change_command="brightnessctl set {0}%", step=5, format=""), + widget.Backlight(change_command="brightnessctl set {0}%", step=5, format="", hide_crash=True), widget.TextBox("default config", name="default"), widget.TextBox("Press <M-r> to spawn", foreground="#d75f5f"), # NB Systray is incompatible with Wayland, consider using StatusNotifier instead @@ -290,6 +326,19 @@ floating_layout = layout.Floating( Match(title="pinentry"), # GPG key password entry ] ) + + +@hook.subscribe.client_new +def bind_group(spawned_window): + moved = False + for group, windows in bind_windows.items(): + for window in windows: + if not moved and spawned_window.get_wm_class() is not None and window in spawned_window.get_wm_class(): + spawned_window.togroup(group, switch_group=True) + moved = True + if not moved: + logger.warning(f"Window with Classname(s) {spawned_window.get_wm_class()} is not assigned to a group") + auto_fullscreen = True focus_on_window_activation = "smart" reconfigure_screens = True