blob: 90cda43cb87216cf9f2ef22237ad70638dcdd587 [file] [log] [blame]
Skyler Grey252927a2022-10-18 22:18:15 +01001{ pkgs
2, lib
3, home
4, ...
Skyler Grey2e6ff852022-08-26 06:49:18 +01005}: {
6 home = {
7 wayland.windowManager.sway = {
8 enable = true;
9 wrapperFeatures.gtk = true;
Skyler Greye27f9382022-09-01 23:33:04 +010010 package = pkgs.sway-unwrapped;
Skyler Grey2e6ff852022-08-26 06:49:18 +010011
12 config = rec {
Skyler Grey252927a2022-10-18 22:18:15 +010013 assigns = { };
14 bars = [ ];
15 colors = { };
Skyler Grey2e6ff852022-08-26 06:49:18 +010016 defaultWorkspace = null;
17 down = "j";
Skyler Grey252927a2022-10-18 22:18:15 +010018 floating = { };
19 focus = { };
20 fonts = { };
Skyler Grey2e6ff852022-08-26 06:49:18 +010021 gaps = {
22 inner = 10;
23 top = -10;
24 outer = 0;
25 smartGaps = false;
26 };
27 input = {
28 "type:touchpad" = {
29 dwt = "enabled";
30 tap = "enabled";
31 natural_scroll = "enabled";
32 middle_emulation = "enabled";
33 events = "disabled_on_external_mouse";
34 };
35 "type:keyboard" = {
36 xkb_layout = "gb";
Skyler Grey6a2a8dc2022-10-31 00:08:48 +000037 xkb_options = "caps:none";
Skyler Grey2e6ff852022-08-26 06:49:18 +010038 };
39 "type:tablet_tool" = {
40 map_to_output = "eDP-1";
41 };
42 };
43 keybindings = lib.mkOptionDefault {
44 "${modifier}+g" = "sticky toggle";
45 "${modifier}+k" = "exec wl-copy -c";
46 "${modifier}+f" = "maximize toggle";
Skyler Grey6a2a8dc2022-10-31 00:08:48 +000047 "XF86AudioRaiseVolume" = "exec pamixer -ui 5 && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK";
48 "XF86AudioLowerVolume" = "exec pamixer -ud 5 && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK";
49 "XF86AudioMute" = "exec pamixer --toggle-mute && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK";
50 "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";
51 "XF86MonBrightnessUp" = "exec light -A 3 && light -G | cut -d'.' -f1 > $WOBSOCK";
52 "XF86MonBrightnessDown" = "exec light -U 3 && light -G | cut -d'.' -f1 > $WOBSOCK";
53 "${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";
54 "${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";
55 "${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";
56 "${modifier}+XF86MonBrightnessUp" = "exec light -A 6 && light -G | cut -d'.' -f1 > $WOBSOCK";
57 "${modifier}+XF86MonBrightnessDown" = "exec light -U 6 && light -G | cut -d'.' -f1 > $WOBSOCK";
Skyler Greyb1609d52022-10-31 00:22:41 +000058 "${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 +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 };
Skyler Grey252927a2022-10-18 22:18:15 +010092 "*" = { };
Skyler Grey2e6ff852022-08-26 06:49:18 +010093 };
94 right = "l";
95 seat = {
96 "*" = {
97 hide_cursor = "when-typing enable";
98 };
99 };
100 startup = [
Skyler Grey252927a2022-10-18 22:18:15 +0100101 { command = "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK"; }
Skyler Grey6a2a8dc2022-10-31 00:08:48 +0000102 {
103 command = "light -N 1";
104 always = false;
105 }
106 {
107 command = "\"pkill wob; rm -f $WOBSOCK && mkfifo $WOBSOCK && tail -f $WOBSOCK | wob --output='*'\"";
108 always = true;
109 }
Skyler Grey2e6ff852022-08-26 06:49:18 +0100110 ];
111 terminal = "${pkgs.kitty}/bin/kitty";
112 up = "k";
Skyler Grey252927a2022-10-18 22:18:15 +0100113 window = { };
Skyler Grey2e6ff852022-08-26 06:49:18 +0100114 workspaceAutoBackAndForth = true;
115 workspaceLayout = "default";
Skyler Grey252927a2022-10-18 22:18:15 +0100116 workspaceOutputAssign = [ ];
Skyler Grey2e6ff852022-08-26 06:49:18 +0100117 };
118
119 extraSessionCommands = ''
Skyler Grey1a0fc1c2022-10-31 00:11:24 +0000120 unset __HM_SESS_VARS_SOURCED
121 . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
122
Skyler Greyb1609d52022-10-31 00:22:41 +0000123 # export WLR_NO_HARDWARE_CURSORS=1
Skyler Grey2e6ff852022-08-26 06:49:18 +0100124 # TODO: Check if above is still needed w/ nvidia card enabled
Skyler Greyb1609d52022-10-31 00:22:41 +0000125 # export SDL_VIDEODRIVER=wayland
Skyler Grey2e6ff852022-08-26 06:49:18 +0100126 # needs qt5.qtwayland in systemPackages
Skyler Greyb1609d52022-10-31 00:22:41 +0000127 # export QT_QPA_PLATFORM=wayland
128 # export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
Skyler Grey2e6ff852022-08-26 06:49:18 +0100129 # Fix for some Java AWT applications (e.g. Android Studio),
130 # use this if they aren't displayed properly:
131 export _JAVA_AWT_WM_NONREPARENTING=1
132 '';
133
134 swaynag = {
135 enable = false;
136 settings = {
137 "<config>" = {
138 background = "#ffffff99";
139 border-bottom = "#00000000";
140 button-background = "#ffffffcc";
141 button-padding = 10;
142 button-border-size = 0;
143 };
144
145 warning = {
146 background = "#ffffff99";
147 border-bottom = "#00000000";
148 button-background = "#ffff00";
149 };
150
151 error = {
152 background = "#ffffff99";
153 border-bottom = "#00000000";
154 button-background = "#ff0000";
155 };
156
157 green = {
158 background = "#ffffff99";
159 border-bottom = "#00000000";
160 button-background = "#00b300";
161 };
162
163 blue = {
164 background = "#ffffff99";
165 border-bottom = "#00000000";
166 button-background = "#0000ff";
167 };
168 };
169 };
170
171 systemdIntegration = true;
Skyler Grey6a2a8dc2022-10-31 00:08:48 +0000172
173 extraConfig = ''
174 set $WOBSOCK $XDG_RUNTIME_DIR/wob.sock
175 '';
Skyler Grey2e6ff852022-08-26 06:49:18 +0100176 };
177
178 home.packages = with pkgs; [
179 wl-clipboard
Skyler Grey6a2a8dc2022-10-31 00:08:48 +0000180 pamixer
181 wob
182 wtype
Skyler Grey2e6ff852022-08-26 06:49:18 +0100183 ];
184
185 programs.zsh.profileExtra = ''
186 if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
187 exec systemd-cat -t sway sway --unsupported-gpu
188 fi
189 '';
190 };
191}