blob: 2032bf40f5785903e30ab3a3513cc13d801c955a [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 Greyb1609d52022-10-31 00:22:41 +000059 "${modifier}+n" = ''exec wpa_cli select_network $(wpa_cli list_networks | tail -n +3 | rofi -dmenu -window-title "Select Network" | awk '{print $1;}')'';
Skyler Grey2e6ff852022-08-26 06:49:18 +010060 };
Skyler Grey6a2a8dc2022-10-31 00:08:48 +000061 keycodebindings = {
62 "66" = "exec ${pkgs.wtype}/bin/wtype -P F12";
63 };
Skyler Grey2e6ff852022-08-26 06:49:18 +010064 left = "h";
65 modes = {
66 resize = {
67 Down = "resize grow height 10 px";
68 Escape = "mode default";
69 Left = "resize shrink width 10 px";
70 Return = "mode default";
71 Right = "resize grow width 10 px";
72 Up = "resize shrink height 10 px";
73 h = "resize shrink width 10 px";
74 j = "resize grow height 10 px";
75 k = "resize shrink height 10 px";
76 l = "resize grow width 10 px";
77 };
78 };
79 modifier = "Mod4";
Skyler Grey2e4815e2022-09-05 08:08:10 +010080 output = rec {
Skyler Greye27f9382022-09-01 23:33:04 +010081 HDMI-A-1 = {
Skyler Grey2e6ff852022-08-26 06:49:18 +010082 resolution = "3840x2160";
83 bg = "#FFD0F9 solid_color";
84 position = "0,0";
85 };
Skyler Grey2e4815e2022-09-05 08:08:10 +010086 HDMI-A-2 = HDMI-A-1;
87 # For some reason my monitor sometimes gets one identifier and
88 # sometimes the other, despite being plugged into the same port
Skyler Grey2e6ff852022-08-26 06:49:18 +010089 eDP-1 = {
90 resolution = "1920x1080";
91 position = "0,2160";
92 };
93 "*" = {
94 };
95 };
96 right = "l";
97 seat = {
98 "*" = {
99 hide_cursor = "when-typing enable";
100 };
101 };
102 startup = [
103 {command = "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK";}
Skyler Grey6a2a8dc2022-10-31 00:08:48 +0000104 {
105 command = "light -N 1";
106 always = false;
107 }
108 {
109 command = "\"pkill wob; rm -f $WOBSOCK && mkfifo $WOBSOCK && tail -f $WOBSOCK | wob --output='*'\"";
110 always = true;
111 }
Skyler Grey2e6ff852022-08-26 06:49:18 +0100112 ];
113 terminal = "${pkgs.kitty}/bin/kitty";
114 up = "k";
115 window = {};
116 workspaceAutoBackAndForth = true;
117 workspaceLayout = "default";
118 workspaceOutputAssign = [];
119 };
120
121 extraSessionCommands = ''
Skyler Grey1a0fc1c2022-10-31 00:11:24 +0000122 unset __HM_SESS_VARS_SOURCED
123 . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
124
Skyler Greyb1609d52022-10-31 00:22:41 +0000125 # export WLR_NO_HARDWARE_CURSORS=1
Skyler Grey2e6ff852022-08-26 06:49:18 +0100126 # TODO: Check if above is still needed w/ nvidia card enabled
Skyler Greyb1609d52022-10-31 00:22:41 +0000127 # export SDL_VIDEODRIVER=wayland
Skyler Grey2e6ff852022-08-26 06:49:18 +0100128 # needs qt5.qtwayland in systemPackages
Skyler Greyb1609d52022-10-31 00:22:41 +0000129 # export QT_QPA_PLATFORM=wayland
130 # export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
Skyler Grey2e6ff852022-08-26 06:49:18 +0100131 # Fix for some Java AWT applications (e.g. Android Studio),
132 # use this if they aren't displayed properly:
133 export _JAVA_AWT_WM_NONREPARENTING=1
134 '';
135
136 swaynag = {
137 enable = false;
138 settings = {
139 "<config>" = {
140 background = "#ffffff99";
141 border-bottom = "#00000000";
142 button-background = "#ffffffcc";
143 button-padding = 10;
144 button-border-size = 0;
145 };
146
147 warning = {
148 background = "#ffffff99";
149 border-bottom = "#00000000";
150 button-background = "#ffff00";
151 };
152
153 error = {
154 background = "#ffffff99";
155 border-bottom = "#00000000";
156 button-background = "#ff0000";
157 };
158
159 green = {
160 background = "#ffffff99";
161 border-bottom = "#00000000";
162 button-background = "#00b300";
163 };
164
165 blue = {
166 background = "#ffffff99";
167 border-bottom = "#00000000";
168 button-background = "#0000ff";
169 };
170 };
171 };
172
173 systemdIntegration = true;
Skyler Grey6a2a8dc2022-10-31 00:08:48 +0000174
175 extraConfig = ''
176 set $WOBSOCK $XDG_RUNTIME_DIR/wob.sock
177 '';
Skyler Grey2e6ff852022-08-26 06:49:18 +0100178 };
179
180 home.packages = with pkgs; [
181 wl-clipboard
Skyler Grey6a2a8dc2022-10-31 00:08:48 +0000182 pamixer
183 wob
184 wtype
Skyler Grey2e6ff852022-08-26 06:49:18 +0100185 ];
186
187 programs.zsh.profileExtra = ''
188 if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
189 exec systemd-cat -t sway sway --unsupported-gpu
190 fi
191 '';
192 };
193}