blob: 857e6d159a7e17e1304c0abf400eb44d8ecfca05 [file] [log] [blame]
Skyler Turner202e73d2022-03-09 00:23:39 +00001{ pkgs, lib, ... }: {
Skyler Turnerdb486c92022-03-06 10:48:24 +00002 wayland.windowManager.sway = {
3 enable = true;
4 wrapperFeatures.gtk = true;
Skyler Turnerf2a88392022-03-06 21:08:15 +00005
Skyler Turnerbb530ed2022-03-15 14:04:39 +00006 config = rec {
Skyler Turnerf2a88392022-03-06 21:08:15 +00007 assigns = {};
8 bars = [];
9 colors = {};
Skyler Turnerfe471d32022-03-07 13:16:17 +000010 defaultWorkspace = null;
11 down = "j";
12 floating = {};
13 focus = {};
14 fonts = {};
15 gaps = {
Skyler Turner801a9a82022-03-07 13:40:41 +000016 inner = 10;
Skyler Turner89be0062022-03-07 21:37:09 +000017 top = -10;
Skyler Turner1bd708a2022-03-07 13:44:27 +000018 outer = 0;
Skyler Turnera076a832022-03-09 09:42:54 +000019 smartGaps = false;
Skyler Turnerfe471d32022-03-07 13:16:17 +000020 };
Skyler Turnerb1fef9e2022-03-07 13:39:14 +000021 input = {
Skyler Turnera9227fd2022-03-07 13:48:39 +000022 "type:touchpad" = {
Skyler Turnerf277cf62022-03-07 13:49:14 +000023 dwt = "enabled";
24 tap = "enabled";
25 natural_scroll = "enabled";
Skyler Turner42bc3662022-03-09 13:33:14 +000026 middle_emulation = "enabled";
Skyler Turnera9227fd2022-03-07 13:48:39 +000027 events = "disabled_on_external_mouse";
28 };
29 "type:keyboard" = {
30 xkb_layout = "gb";
31 };
Skyler Turner6dceae22022-03-16 08:59:08 +000032 "type:tablet_tool" = {
Skyler Turner85299c42022-03-16 08:55:33 +000033 map_to_output = "eDP-1";
34 };
Skyler Turnerb1fef9e2022-03-07 13:39:14 +000035 };
Skyler Turnerb8a61992022-03-15 10:32:51 +000036 keybindings = lib.mkOptionDefault {
Skyler Turner47464582022-05-12 10:41:32 +010037 "${modifier}+l" = "exec /usr/bin/env wlogout -c 5 -r 5 -p layer-shell -l ${./sway/wlogout-layout.layout}"; # "exec /usr/bin/env swaylock -c 000000";
Skyler Turnerbb530ed2022-03-15 14:04:39 +000038 "XF86AudioRaiseVolume" = "exec volumectl -u up";
39 "XF86AudioLowerVolume" = "exec volumectl -u down";
40 "XF86AudioMute" = "exec volumectl toggle-mute";
41 "XF86AudioMicMute" = "exec volumectl -m toggle-mute";
42 "XF86MonBrightnessUp" = "exec lightctl up";
43 "XF86MonBrightnessDown" = "exec lightctl down";
Skyler Grey2826c142022-05-20 14:18:06 +010044 "${modifier}+Shift+s" = "exec grim -g \"$(slurp)\" - | tee ~/Screenshots/\"$(date --rfc-3339=seconds)\".png | wl-copy";
Skyler Turnerb8a61992022-03-15 10:32:51 +000045 };
Skyler Turnerb1fef9e2022-03-07 13:39:14 +000046 keycodebindings = {};
47 left = "h";
48 menu = "/usr/bin/env rofi -show combi";
49 modes = {
50 resize = {
51 Down = "resize grow height 10 px";
52 Escape = "mode default";
53 Left = "resize shrink width 10 px";
54 Return = "mode default";
55 Right = "resize grow width 10 px";
56 Up = "resize shrink height 10 px";
57 h = "resize shrink width 10 px";
58 j = "resize grow height 10 px";
59 k = "resize shrink height 10 px";
60 l = "resize grow width 10 px";
61 };
62 };
63 modifier = "Mod4";
64 output = {
65 HDMI-A-2 = {
66 resolution = "3840x2160";
Skyler Turnerc3ab3c22022-04-20 09:15:08 +010067 #position = "1920,0";
68 position = "0,0";
Skyler Turnerb1fef9e2022-03-07 13:39:14 +000069 };
70 eDP-1 = {
71 resolution = "1920x1080";
Skyler Turnerc3ab3c22022-04-20 09:15:08 +010072 #position = "0,1522";
73 position = "0,2160";
Skyler Turnerb1fef9e2022-03-07 13:39:14 +000074 };
Skyler Turnerc6af35b2022-03-09 00:16:45 +000075 "*" = {
Skyler Turner202e73d2022-03-09 00:23:39 +000076 bg = "${./sway/background.png} fill";
Skyler Turnerc6af35b2022-03-09 00:16:45 +000077 };
Skyler Turnerb1fef9e2022-03-07 13:39:14 +000078 };
79 right = "l";
80 seat = {
81 "*" = {
82 hide_cursor = "when-typing enable";
83 };
84 };
Skyler Turnerb254c9d2022-05-14 00:24:37 +010085 startup = [
86 { command = "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK"; }
87 ];
Skyler Grey63786912022-05-20 11:31:40 +010088 terminal = "kitty";
Skyler Turnerb1fef9e2022-03-07 13:39:14 +000089 up = "k";
90 window = {};
91 workspaceAutoBackAndForth = true;
92 workspaceLayout = "default";
93 workspaceOutputAssign = [];
94 };
95
96 extraSessionCommands = ''
97 export SDL_VIDEODRIVER=wayland
98 # needs qt5.qtwayland in systemPackages
99 export QT_QPA_PLATFORM=wayland
100 export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
101 # Fix for some Java AWT applications (e.g. Android Studio),
102 # use this if they aren't displayed properly:
103 export _JAVA_AWT_WM_NONREPARENTING=1
104 '';
105
106 swaynag = {
Skyler Turner36510212022-03-07 23:13:14 +0000107 enable = true;
108 settings = {
Skyler Turnerd0a8f5c2022-03-07 23:16:01 +0000109 "<config>" = {
110 background = "#ffffff99";
111 border-bottom = "#00000000";
112 button-background = "#ffffffcc";
Skyler Turner4ea60622022-03-07 23:24:22 +0000113 button-padding = 10;
Skyler Turnerd0a8f5c2022-03-07 23:16:01 +0000114 button-border-size = 0;
115 };
Skyler Turner7b341db2022-03-07 23:17:23 +0000116
117 warning = {
Skyler Turnere957a372022-03-07 23:18:27 +0000118 background = "#ffffff99";
Skyler Turner6222f752022-03-07 23:21:23 +0000119 border-bottom = "#00000000";
Skyler Turnerf24ef5e2022-03-07 23:26:30 +0000120 button-background = "#ffff00";
121 };
122
123 error = {
124 background = "#ffffff99";
125 border-bottom = "#00000000";
Skyler Turnere609f0a2022-03-07 23:25:17 +0000126 button-background = "#ff0000";
Skyler Turner7b341db2022-03-07 23:17:23 +0000127 };
Skyler Turnerf24ef5e2022-03-07 23:26:30 +0000128
129 green = {
130 background = "#ffffff99";
131 border-bottom = "#00000000";
Skyler Turnerc4d1c0b2022-03-07 23:28:58 +0000132 button-background = "#00b300";
Skyler Turnerf24ef5e2022-03-07 23:26:30 +0000133 };
134
135 blue = {
136 background = "#ffffff99";
137 border-bottom = "#00000000";
Skyler Turnerc4d1c0b2022-03-07 23:28:58 +0000138 button-background = "#0000ff";
Skyler Turnerf24ef5e2022-03-07 23:26:30 +0000139 };
Skyler Turner36510212022-03-07 23:13:14 +0000140 };
Skyler Turner07eb3d12022-03-06 21:08:29 +0000141 };
Skyler Turnereda726a2022-03-07 00:23:17 +0000142
143 systemdIntegration = true;
Skyler Turnerdb486c92022-03-06 10:48:24 +0000144 };
145
146 home.packages = with pkgs; [
147 swaylock
148 swayidle
149 wl-clipboard
Skyler Turnerbb530ed2022-03-15 14:04:39 +0000150 avizo
151 pamixer
152 brightnessctl
Skyler Turner9dfac612022-03-06 10:48:57 +0000153 ];
Skyler Turnerdb486c92022-03-06 10:48:24 +0000154
Skyler Turnerd3b70682022-03-06 23:19:45 +0000155 programs.zsh.profileExtra = ''
156 if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
157 exec systemd-cat -t sway sway
158 fi
159 '';
Skyler Turnerbb530ed2022-03-15 14:04:39 +0000160
161 systemd.user.services.avizo = {
Skyler Turner7b7b73d2022-03-15 14:05:20 +0000162 Install.WantedBy = [ "graphical-session.target" ];
Skyler Turnerbb530ed2022-03-15 14:04:39 +0000163 Service = {
164 ExecReload = "kill -SIGUSR2 \$MAINPID";
165 ExecStart = "${pkgs.avizo}/bin/avizo-service";
166 KillMode = "mixed";
167 Restart = "on-failure";
168 };
169 Unit = {
170 After = "graphical-session.target";
171 Description = "Notification daemon to show volume & brightness changes";
172 Documentation = "N/A (src/apps/personal/sway.nix)";
173 PartOf= "graphical-session.target";
174 };
175 };
Skyler Turnerc6af35b2022-03-09 00:16:45 +0000176}
Skyler Turnerbb530ed2022-03-15 14:04:39 +0000177