1{
2 pkgs,
3 config,
4 lib,
5 ...
6}:
7let
8 term = config.wayland.windowManager.sway.config.terminal;
9 homeDir = config.home.homeDirectory;
10 cfg = config.py.gui;
11in
12{
13 options.py.gui = {
14 enable = lib.mkEnableOption "GUI Configuration";
15 };
16 config = lib.mkIf cfg.enable {
17 catppuccin = {
18 sway.enable = true;
19 };
20 home.sessionVariables = {
21 XDG_CURRENT_DESKTOP = "sway";
22 };
23 wayland.windowManager.sway = {
24 enable = lib.mkDefault true;
25 package = null;
26 # nix-community/home-manager/issues/5311
27 checkConfig = false;
28 wrapperFeatures.base = true;
29 wrapperFeatures.gtk = true;
30 extraConfig = ''
31 default_border pixel
32 focus_on_window_activation smart
33 '';
34 systemd = {
35 enable = true;
36 xdgAutostart = true;
37 };
38 config = {
39 terminal = lib.getExe pkgs.ghostty;
40 menu = "exec ${term} --class=py.floating --window-height=20 --window-width=12 --font-size=14 -e ${pkgs.sway-launcher-desktop}/bin/sway-launcher-desktop";
41 modifier = "Mod4";
42 bars = [ { command = "true"; } ];
43 focus = {
44 followMouse = true;
45 mouseWarping = true;
46 newWindow = "smart";
47 };
48 fonts = {
49 names = [ "IBM Plex Sans" ];
50 style = "Regular";
51 size = 12.0;
52 };
53 gaps = {
54 inner = 1;
55 outer = 1;
56 smartBorders = "on";
57 smartGaps = false;
58 };
59 input = {
60 "type:keyboard" = {
61 xkb_options = "caps:escape";
62 };
63 "type:mouse" = {
64 accel_profile = "flat";
65 };
66 "type:touchpad" = {
67 accel_profile = "adaptive";
68 scroll_factor = "1.5";
69 tap = "enabled";
70 };
71 };
72 modes = {
73 resize = {
74 Escape = "mode default";
75 Return = "mode default";
76 Up = "resize shrink height 10 px";
77 Down = "resize grow height 10 px";
78 Left = "resize shrink width 10 px";
79 Right = "resize grow width 10 px";
80 h = "resize shrink width 10 px";
81 j = "resize grow height 10 px";
82 k = "resize shrink height 10 px";
83 l = "resize grow width 10 px";
84 };
85 };
86 output = {
87 eDP-1 = {
88 scale = "1.2";
89 };
90 "*" = {
91 bg = "${homeDir}/bgs/xenia-hangout-mocha.png fill";
92 };
93 };
94 startup = [
95 { command = "${pkgs.dex}/bin/dex -a"; }
96 { command = "${homeDir}/scripts/unfuck-xdg-portals.fish"; }
97 { command = "wl-paste -t text --watch clipman store --no-persist"; }
98 ];
99 window = {
100 commands = [
101 {
102 command = "inhibit_idle fullscreen";
103 criteria = {
104 class = "Chromium|zoom|Firefox";
105 };
106 }
107 {
108 command = "floating enable, sticky enable, resize set 20 ppt 40 ppt, border pixel 4";
109 criteria = {
110 app_id = "^py.floating$";
111 };
112 }
113 {
114 command = "resize set 20 ppt";
115 criteria = {
116 title = "Mumble PTT";
117 };
118 }
119 ];
120 };
121 colors = {
122 background = "$base";
123 focused = {
124 border = "$pink";
125 background = "$base";
126 text = "$text";
127 indicator = "$rosewater";
128 childBorder = "$pink";
129 };
130 focusedInactive = {
131 border = "$mauve";
132 background = "$base";
133 text = "$text";
134 indicator = "$rosewater";
135 childBorder = "$mauve";
136 };
137 unfocused = {
138 border = "$mauve";
139 background = "$base";
140 text = "$text";
141 indicator = "$rosewater";
142 childBorder = "$mauve";
143 };
144 urgent = {
145 border = "$peach";
146 background = "$base";
147 text = "$peach";
148 indicator = "$overlay0";
149 childBorder = "$peach";
150 };
151 placeholder = {
152 border = "$overlay0";
153 background = "$base";
154 text = "$text";
155 indicator = "$overlay0";
156 childBorder = "$overlay0";
157 };
158 };
159 };
160 };
161 };
162}