This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

qtile: cleanup config, fix with newer nixpkgs

+169 -87
-62
2configs/desktops/qtile/default.nix
··· 1 - { pkgs, lib, ... }: 2 - { 3 - imports = [ 4 - ../lib/wayland.nix 5 - ]; 6 - 7 - environment.sessionVariables.XDG_CURRENT_DESKTOP = "qtile"; 8 - services.greetd.enable = true; 9 - 10 - # For greetd, we need a shell script into path, which lets us start qtile.service (after importing the environment of the login shell). 11 - services.greetd.settings.default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet --remember --cmd ${pkgs.writeScript "startqtile" '' 12 - #! ${pkgs.bash}/bin/bash 13 - 14 - # first import environment variables from the login manager 15 - export XDG_DATA_DIRS=/run/current-system/sw/share/gsettings-schemas:$XDG_DATA_DIRS 16 - systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY 17 - systemctl --user import-environment XDG_DATA_DIRS PATH 18 - # then start the service 19 - exec systemctl --user --wait start qtile.service 20 - ''}"; 21 - 22 - systemd.user.targets.qtile-session = { 23 - description = "Qtile compositor session"; 24 - documentation = [ "man:systemd.special(7)" ]; 25 - bindsTo = [ "graphical-session.target" ]; 26 - wants = [ "graphical-session-pre.target" ]; 27 - after = [ "graphical-session-pre.target" ]; 28 - }; 29 - 30 - environment.systemPackages = [ 31 - pkgs.python3.pkgs.qtile 32 - pkgs.copyq 33 - ]; 34 - 35 - systemd.user.services.qtile = 36 - let 37 - pyEnv = pkgs.python3.withPackages (_p: [ 38 - pkgs.python3.pkgs.qtile 39 - pkgs.python3.pkgs.iwlib 40 - ]); 41 - in 42 - { 43 - description = "Qtile - Wayland window manager"; 44 - documentation = [ "man:qtile(5)" ]; 45 - bindsTo = [ "graphical-session.target" ]; 46 - wants = [ "graphical-session-pre.target" ]; 47 - after = [ "graphical-session-pre.target" ]; 48 - # We explicitly unset PATH here, as we want it to be set by 49 - # systemctl --user import-environment in startqtile 50 - environment.PATH = lib.mkForce null; 51 - environment.PYTHONPATH = lib.mkForce null; 52 - serviceConfig = { 53 - Type = "simple"; 54 - ExecStart = "${pyEnv}/bin/qtile start -b wayland -c /etc/qtile.py"; 55 - Restart = "on-failure"; 56 - RestartSec = 1; 57 - TimeoutStopSec = 10; 58 - }; 59 - }; 60 - 61 - environment.etc."qtile.py".source = ./qtile.py; 62 - }
+79
2configs/desktops/qtile/nixos.nix
··· 1 + { pkgs, lib, ... }: 2 + let 3 + qtile = pkgs.python3.pkgs.qtile.override { 4 + pulsectl-asyncio = pkgs.python3.pkgs.pulsectl-asyncio.overrideAttrs (oldAttrs: { 5 + postPatch = '' 6 + substituteInPlace setup.cfg --replace "pulsectl >=23.5.0,<=24.11.0" "pulsectl >=23.5.0" 7 + ''; 8 + }); 9 + extraPackages = [ 10 + pkgs.python3.pkgs.dbus-fast 11 + ]; 12 + }; 13 + # qtile-extras = pkgs.python3.pkgs.qtile-extras.override { 14 + # qtile = qtile; 15 + # }; 16 + in 17 + { 18 + imports = [ 19 + ../lib/wayland.nix 20 + ]; 21 + 22 + environment.sessionVariables.XDG_CURRENT_DESKTOP = "qtile"; 23 + services.greetd.enable = true; 24 + 25 + # For greetd, we need a shell script into path, which lets us start qtile.service (after importing the environment of the login shell). 26 + services.greetd.settings.default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet --remember --cmd ${pkgs.writeScript "startqtile" '' 27 + #! ${pkgs.bash}/bin/bash 28 + 29 + # first import environment variables from the login manager 30 + export XDG_DATA_DIRS=/run/current-system/sw/share/gsettings-schemas:$XDG_DATA_DIRS 31 + systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY 32 + systemctl --user import-environment XDG_DATA_DIRS PATH 33 + # then start the service 34 + exec systemctl --user --wait start qtile.service 35 + ''}"; 36 + 37 + systemd.user.targets.qtile-session = { 38 + description = "Qtile compositor session"; 39 + documentation = [ "man:systemd.special(7)" ]; 40 + bindsTo = [ "graphical-session.target" ]; 41 + wants = [ "graphical-session-pre.target" ]; 42 + after = [ "graphical-session-pre.target" ]; 43 + }; 44 + 45 + environment.systemPackages = [ 46 + qtile 47 + pkgs.copyq 48 + ]; 49 + 50 + systemd.user.services.qtile = 51 + let 52 + pyEnv = pkgs.python3.withPackages (_p: [ 53 + qtile 54 + # qtile-extras 55 + pkgs.python3.pkgs.iwlib 56 + ]); 57 + in 58 + { 59 + description = "Qtile - Wayland window manager"; 60 + documentation = [ "man:qtile(5)" ]; 61 + bindsTo = [ "graphical-session.target" ]; 62 + wants = [ "graphical-session-pre.target" ]; 63 + after = [ "graphical-session-pre.target" ]; 64 + # We explicitly unset PATH here, as we want it to be set by 65 + # systemctl --user import-environment in startqtile 66 + environment.PATH = lib.mkForce null; 67 + environment.PYTHONPATH = lib.mkForce null; 68 + environment.PYTHONTRACEMALLOC = "1"; 69 + serviceConfig = { 70 + Type = "simple"; 71 + ExecStart = "${pyEnv}/bin/qtile start -b wayland -c /etc/qtile.py"; 72 + Restart = "on-failure"; 73 + RestartSec = 1; 74 + TimeoutStopSec = 10; 75 + }; 76 + }; 77 + 78 + environment.etc."qtile.py".source = ./qtile.py; 79 + }
+90 -25
2configs/desktops/qtile/qtile.py
··· 3 3 import json 4 4 import os 5 5 from typing import Callable 6 + from pathlib import Path 6 7 7 8 from libqtile import bar, layout, widget, extension, hook 8 9 from libqtile.config import Click, Drag, Group, Key, Match, Screen, ScratchPad, DropDown ··· 18 19 19 20 def dmenu(candidates: list[str], callback: Callable) -> None: 20 21 def thread() -> None: 21 - dmenu = subprocess.Popen(["rofi", "-dmenu"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) 22 + theme = Path("/var/theme/config/rofi-theme").read_text().strip() 23 + dmenu = subprocess.Popen( 24 + ["rofi", "-dmenu", "-theme", theme], 25 + stdin=subprocess.PIPE, 26 + stdout=subprocess.PIPE, 27 + ) 22 28 output = dmenu.communicate(input=("\n".join(candidates)).encode()) 23 29 callback(output[0].decode().rstrip()) 30 + 24 31 threading.Thread(target=thread).start() 32 + 25 33 26 34 @lazy.function 27 35 def goto_workspace(qtile: Qtile) -> None: 28 36 def callback(name: str) -> None: 29 - c=InteractiveCommandClient() 30 - c.group[name].toscreen() 37 + if name: 38 + c = InteractiveCommandClient() 39 + c.group[name].toscreen() 40 + 31 41 dmenu(candidates=qtile.items("group")[1], callback=callback) 42 + 32 43 33 44 @lazy.function 34 45 def moveto_workspace(qtile: Qtile) -> None: 35 46 def callback(name: str) -> None: 36 - c=InteractiveCommandClient() 37 - c.window.togroup(name) 47 + if name: 48 + c = InteractiveCommandClient() 49 + c.window.togroup(name) 50 + 38 51 dmenu(candidates=qtile.items("group")[1], callback=callback) 52 + 39 53 40 54 @lazy.function 41 55 def add_group(qtile: Qtile) -> None: 42 56 def callback(name: str) -> None: 43 - qtile.addgroup(name) 57 + if name: 58 + qtile.addgroup(name) 59 + 44 60 prompt.start_input("Add group: ", callback=callback) 61 + 45 62 46 63 @lazy.function 47 64 def del_group(qtile: Qtile) -> None: 48 65 qtile.delgroup(qtile.current_group.name) 66 + 49 67 50 68 @lazy.function 51 69 def reload_config(qtile: Qtile) -> None: 52 70 with open(state_file, "w") as f: 53 71 f.write(json.dumps(qtile.get_groups(), default=tuple)) 54 72 qtile.reload_config() 73 + 55 74 56 75 mod = "mod4" 57 76 terminal = guess_terminal() ··· 62 81 groups = [Group(name) for name, _ in state.items()] 63 82 else: 64 83 groups = [ 65 - Group("dashboard"), 66 - Group("ff"), 84 + Group("dashboard"), 85 + Group("ff"), 67 86 ] 68 87 69 88 keys = [ ··· 71 90 # at https://docs.qtile.org/en/latest/manual/config/lazy.html 72 91 # Switch between windows 73 92 Key([mod], "Tab", lazy.layout.next(), desc="Move window focus to other window"), 74 - Key([mod, "shift"], "Tab", lazy.layout.previous(), desc="Move window focus to other window"), 75 - 76 - Key([mod], "Escape", lazy.screen.toggle_group(), desc="Switch to last active group"), 93 + Key( 94 + [mod, "shift"], 95 + "Tab", 96 + lazy.layout.previous(), 97 + desc="Move window focus to other window", 98 + ), 99 + Key( 100 + [mod], "Escape", lazy.screen.toggle_group(), desc="Switch to last active group" 101 + ), 77 102 # Move windows between left/right columns or move up/down in current stack. 78 103 # Moving out of range in Columns layout will create new column. 79 104 Key([mod, "shift"], "a", add_group, desc="add group"), 80 105 Key([mod, "shift"], "backspace", del_group, desc="delete group"), 81 - Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"), 82 - Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"), 106 + Key( 107 + [mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left" 108 + ), 109 + Key( 110 + [mod, "shift"], 111 + "l", 112 + lazy.layout.shuffle_right(), 113 + desc="Move window to the right", 114 + ), 83 115 Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"), 84 116 Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"), 85 117 # Grow windows. If current window is on the edge of screen and direction 86 118 # will be to screen edge - window would shrink. 87 119 Key([mod, "control"], "h", lazy.layout.grow_left(), desc="Grow window to the left"), 88 - Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"), 120 + Key( 121 + [mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right" 122 + ), 89 123 Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"), 90 124 Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"), 91 - Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen",), 125 + Key( 126 + [mod], 127 + "f", 128 + lazy.window.toggle_fullscreen(), 129 + desc="Toggle fullscreen", 130 + ), 92 131 Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), 93 132 Key([mod], "d", lazy.spawn("copyq show")), 94 133 Key([mod, "shift"], "Return", lazy.spawn(terminal), desc="Launch terminal"), ··· 96 135 Key([mod], "Space", lazy.next_layout(), desc="Toggle between layouts"), 97 136 Key([mod, "shift"], "c", lazy.window.kill(), desc="Kill focused window"), 98 137 Key([mod], "F11", lazy.spawn("swaylock --image /var/lib/wallpaper/wallpaper")), 99 - Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"), 138 + Key( 139 + [mod], 140 + "t", 141 + lazy.window.toggle_floating(), 142 + desc="Toggle floating on the focused window", 143 + ), 100 144 Key([mod, "shift"], "r", reload_config, desc="Reload the config"), 101 145 Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), 102 146 Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"), ··· 107 151 Key([mod, "shift"], "p", lazy.spawn("otpmenu")), 108 152 Key([mod], "v", goto_workspace, desc="Switch to group"), 109 153 Key([mod, "shift"], "v", moveto_workspace, desc="move window to group"), 110 - Key([], "XF86AudioRaiseVolume", lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%")), 111 - Key([], "XF86AudioLowerVolume", lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%")), 154 + Key( 155 + [], 156 + "XF86AudioRaiseVolume", 157 + lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%"), 158 + ), 159 + Key( 160 + [], 161 + "XF86AudioLowerVolume", 162 + lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%"), 163 + ), 112 164 Key([], "XF86MonBrightnessUp", lazy.spawn("xbacklight -inc 2")), 113 165 Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 2")), 114 - 115 166 Key(["control", "mod1"], "F1", lazy.core.change_vt(1), desc="Switch to VT 1"), 116 167 Key(["control", "mod1"], "F2", lazy.core.change_vt(2), desc="Switch to VT 2"), 117 168 Key(["control", "mod1"], "F3", lazy.core.change_vt(3), desc="Switch to VT 3"), ··· 158 209 widget.HDDBusyGraph(device="nvme0n1", graph_color="#4fbe4f"), 159 210 widget.MemoryGraph(graph_color="#eed563"), 160 211 widget.CPUGraph(graph_color="#8575bf"), 161 - widget.ThermalZone(zone="/sys/class/thermal/thermal_zone1/temp", background="#440000"), 212 + widget.ThermalZone( 213 + zone="/sys/class/thermal/thermal_zone1/temp", background="#440000" 214 + ), 162 215 widget.PulseVolume(background="#009900"), 163 - widget.Backlight(background="#b18f00", backlight_name="intel_backlight"), 216 + widget.Backlight( 217 + background="#b18f00", backlight_name="intel_backlight" 218 + ), 164 219 widget.Battery(background="#e52383"), 165 220 widget.Clock(format="%Y-%m-%d %a %H:%M"), 166 - # NB Systray is incompatible with Wayland, consider using StatusNotifier instead 167 221 widget.StatusNotifier(), 168 222 ], 169 223 24, ··· 193 247 194 248 # Drag floating layouts. 195 249 mouse = [ 196 - Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()), 197 - Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()), 250 + Drag( 251 + [mod], 252 + "Button1", 253 + lazy.window.set_position_floating(), 254 + start=lazy.window.get_position(), 255 + ), 256 + Drag( 257 + [mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size() 258 + ), 198 259 Click([mod], "Button2", lazy.window.bring_to_front()), 199 260 ] 200 261 ··· 226 287 227 288 # When using the Wayland backend, this can be used to configure input devices. 228 289 wl_input_rules = { 229 - "type:keyboard": InputConfig(kb_options="ctrl:nocaps", kb_layout="us", kb_variant="altgr-intl"), 290 + "type:keyboard": InputConfig( 291 + kb_options="ctrl:nocaps", kb_layout="us", kb_variant="altgr-intl" 292 + ), 230 293 "*": InputConfig(click_method="clickfinger"), 231 294 } 295 + 232 296 233 297 @hook.subscribe.startup 234 298 def autostart(): ··· 241 305 "WAYLAND_DISPLAY", 242 306 ] 243 307 ) 308 + 244 309 245 310 # XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this 246 311 # string besides java UI toolkits; you can see several discussions on the