blob: ff50e304bc5b7d407781324f860910f7b3b85fbb [file] [log] [blame]
Skyler Grey2e6ff852022-08-26 06:49:18 +01001{
2 pkgs,
3 lib,
Skyler Greye27f9382022-09-01 23:33:04 +01004 home,
Skyler Grey2e6ff852022-08-26 06:49:18 +01005 ...
6}: {
7 home = {
8 wayland.windowManager.sway = {
9 enable = true;
10 wrapperFeatures.gtk = true;
Skyler Greye27f9382022-09-01 23:33:04 +010011 package = pkgs.sway-unwrapped;
Skyler Grey2e6ff852022-08-26 06:49:18 +010012
13 config = rec {
14 assigns = {};
15 bars = [];
16 colors = {};
17 defaultWorkspace = null;
18 down = "j";
19 floating = {};
20 focus = {};
21 fonts = {};
22 gaps = {
23 inner = 10;
24 top = -10;
25 outer = 0;
26 smartGaps = false;
27 };
28 input = {
29 "type:touchpad" = {
30 dwt = "enabled";
31 tap = "enabled";
32 natural_scroll = "enabled";
33 middle_emulation = "enabled";
34 events = "disabled_on_external_mouse";
35 };
36 "type:keyboard" = {
37 xkb_layout = "gb";
Skyler Grey6a2a8dc2022-10-31 00:08:48 +000038 xkb_options = "caps:none";
Skyler Grey2e6ff852022-08-26 06:49:18 +010039 };
40 "type:tablet_tool" = {
41 map_to_output = "eDP-1";
42 };
43 };
44 keybindings = lib.mkOptionDefault {
45 "${modifier}+g" = "sticky toggle";
46 "${modifier}+k" = "exec wl-copy -c";
47 "${modifier}+f" = "maximize toggle";
Skyler Grey6a2a8dc2022-10-31 00:08:48 +000048 "XF86AudioRaiseVolume" = "exec pamixer -ui 5 && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK";
49 "XF86AudioLowerVolume" = "exec pamixer -ud 5 && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK";
50 "XF86AudioMute" = "exec pamixer --toggle-mute && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK";
51 "XF86AudioMicMute" = "exec pamixer --toggle-mute --default-source && ( pamixer --get-mute --default-source && expr \"$(pamixer --default-source --get-volume)\" + 100 > $WOBSOCK ) || pamixer --default-source --get-volume > $WOBSOCK";
52 "XF86MonBrightnessUp" = "exec light -A 3 && light -G | cut -d'.' -f1 > $WOBSOCK";
53 "XF86MonBrightnessDown" = "exec light -U 3 && light -G | cut -d'.' -f1 > $WOBSOCK";
54 "${modifier}+XF86AudioRaiseVolume" = "exec pamixer --default-source -ui 5 && ( pamixer --get-mute --default-source && expr \"$(pamixer --default-source --get-volume)\" + 100 > $WOBSOCK ) || pamixer --default-source --get-volume > $WOBSOCK";
55 "${modifier}+XF86AudioLowerVolume" = "exec pamixer --default-source -ud 5 && ( pamixer --get-mute --default-source && expr \"$(pamixer --default-source --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume --default-source > $WOBSOCK";
56 "${modifier}+XF86AudioMute" = "exec pamixer --toggle-mute --default-source && ( pamixer --get-mute --default-source && expr \"$(pamixer --default-source --get-volume)\" + 100 > $WOBSOCK ) || pamixer --default-source --get-volume > $WOBSOCK";
57 "${modifier}+XF86MonBrightnessUp" = "exec light -A 6 && light -G | cut -d'.' -f1 > $WOBSOCK";
58 "${modifier}+XF86MonBrightnessDown" = "exec light -U 6 && light -G | cut -d'.' -f1 > $WOBSOCK";
Skyler Grey2e6ff852022-08-26 06:49:18 +010059 };
Skyler Grey6a2a8dc2022-10-31 00:08:48 +000060 keycodebindings = {
61 "66" = "exec ${pkgs.wtype}/bin/wtype -P F12";
62 };
Skyler Grey2e6ff852022-08-26 06:49:18 +010063 left = "h";
64 modes = {
65 resize = {
66 Down = "resize grow height 10 px";
67 Escape = "mode default";
68 Left = "resize shrink width 10 px";
69 Return = "mode default";
70 Right = "resize grow width 10 px";
71 Up = "resize shrink height 10 px";
72 h = "resize shrink width 10 px";
73 j = "resize grow height 10 px";
74 k = "resize shrink height 10 px";
75 l = "resize grow width 10 px";
76 };
77 };
78 modifier = "Mod4";
Skyler Grey2e4815e2022-09-05 08:08:10 +010079 output = rec {
Skyler Greye27f9382022-09-01 23:33:04 +010080 HDMI-A-1 = {
Skyler Grey2e6ff852022-08-26 06:49:18 +010081 resolution = "3840x2160";
82 bg = "#FFD0F9 solid_color";
83 position = "0,0";
84 };
Skyler Grey2e4815e2022-09-05 08:08:10 +010085 HDMI-A-2 = HDMI-A-1;
86 # For some reason my monitor sometimes gets one identifier and
87 # sometimes the other, despite being plugged into the same port
Skyler Grey2e6ff852022-08-26 06:49:18 +010088 eDP-1 = {
89 resolution = "1920x1080";
90 position = "0,2160";
91 };
92 "*" = {
93 };
94 };
95 right = "l";
96 seat = {
97 "*" = {
98 hide_cursor = "when-typing enable";
99 };
100 };
101 startup = [
102 {command = "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK";}
Skyler Grey6a2a8dc2022-10-31 00:08:48 +0000103 {
104 command = "light -N 1";
105 always = false;
106 }
107 {
108 command = "\"pkill wob; rm -f $WOBSOCK && mkfifo $WOBSOCK && tail -f $WOBSOCK | wob --output='*'\"";
109 always = true;
110 }
Skyler Grey2e6ff852022-08-26 06:49:18 +0100111 ];
112 terminal = "${pkgs.kitty}/bin/kitty";
113 up = "k";
114 window = {};
115 workspaceAutoBackAndForth = true;
116 workspaceLayout = "default";
117 workspaceOutputAssign = [];
118 };
119
120 extraSessionCommands = ''
121 export WLR_NO_HARDWARE_CURSORS=1
122 # TODO: Check if above is still needed w/ nvidia card enabled
123 export SDL_VIDEODRIVER=wayland
124 # needs qt5.qtwayland in systemPackages
125 export QT_QPA_PLATFORM=wayland
126 export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
127 # Fix for some Java AWT applications (e.g. Android Studio),
128 # use this if they aren't displayed properly:
129 export _JAVA_AWT_WM_NONREPARENTING=1
130 '';
131
132 swaynag = {
133 enable = false;
134 settings = {
135 "<config>" = {
136 background = "#ffffff99";
137 border-bottom = "#00000000";
138 button-background = "#ffffffcc";
139 button-padding = 10;
140 button-border-size = 0;
141 };
142
143 warning = {
144 background = "#ffffff99";
145 border-bottom = "#00000000";
146 button-background = "#ffff00";
147 };
148
149 error = {
150 background = "#ffffff99";
151 border-bottom = "#00000000";
152 button-background = "#ff0000";
153 };
154
155 green = {
156 background = "#ffffff99";
157 border-bottom = "#00000000";
158 button-background = "#00b300";
159 };
160
161 blue = {
162 background = "#ffffff99";
163 border-bottom = "#00000000";
164 button-background = "#0000ff";
165 };
166 };
167 };
168
169 systemdIntegration = true;
Skyler Grey6a2a8dc2022-10-31 00:08:48 +0000170
171 extraConfig = ''
172 set $WOBSOCK $XDG_RUNTIME_DIR/wob.sock
173 '';
Skyler Grey2e6ff852022-08-26 06:49:18 +0100174 };
175
176 home.packages = with pkgs; [
177 wl-clipboard
Skyler Grey6a2a8dc2022-10-31 00:08:48 +0000178 pamixer
179 wob
180 wtype
Skyler Grey2e6ff852022-08-26 06:49:18 +0100181 ];
182
183 programs.zsh.profileExtra = ''
184 if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
185 exec systemd-cat -t sway sway --unsupported-gpu
186 fi
187 '';
188 };
189}