blob: 5bfc7c2a54c3aea3a61888f43249e3088c778158 [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 Turnerbb530ed2022-03-15 14:04:39 +000037 "${modifier}+l" = "exec /usr/bin/env swaylock -c 000000";
38 "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 Turnerb8a61992022-03-15 10:32:51 +000044 };
Skyler Turnerb1fef9e2022-03-07 13:39:14 +000045 keycodebindings = {};
46 left = "h";
47 menu = "/usr/bin/env rofi -show combi";
48 modes = {
49 resize = {
50 Down = "resize grow height 10 px";
51 Escape = "mode default";
52 Left = "resize shrink width 10 px";
53 Return = "mode default";
54 Right = "resize grow width 10 px";
55 Up = "resize shrink height 10 px";
56 h = "resize shrink width 10 px";
57 j = "resize grow height 10 px";
58 k = "resize shrink height 10 px";
59 l = "resize grow width 10 px";
60 };
61 };
62 modifier = "Mod4";
63 output = {
64 HDMI-A-2 = {
65 resolution = "3840x2160";
66 position = "1920,0";
67 };
68 eDP-1 = {
69 resolution = "1920x1080";
70 position = "0,1522";
71 };
Skyler Turnerc6af35b2022-03-09 00:16:45 +000072 "*" = {
Skyler Turner202e73d2022-03-09 00:23:39 +000073 bg = "${./sway/background.png} fill";
Skyler Turnerc6af35b2022-03-09 00:16:45 +000074 };
Skyler Turnerb1fef9e2022-03-07 13:39:14 +000075 };
76 right = "l";
77 seat = {
78 "*" = {
79 hide_cursor = "when-typing enable";
80 };
81 };
82 startup = [];
83 terminal = "alacritty";
84 up = "k";
85 window = {};
86 workspaceAutoBackAndForth = true;
87 workspaceLayout = "default";
88 workspaceOutputAssign = [];
89 };
90
91 extraSessionCommands = ''
92 export SDL_VIDEODRIVER=wayland
93 # needs qt5.qtwayland in systemPackages
94 export QT_QPA_PLATFORM=wayland
95 export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
96 # Fix for some Java AWT applications (e.g. Android Studio),
97 # use this if they aren't displayed properly:
98 export _JAVA_AWT_WM_NONREPARENTING=1
99 '';
100
101 swaynag = {
Skyler Turner36510212022-03-07 23:13:14 +0000102 enable = true;
103 settings = {
Skyler Turnerd0a8f5c2022-03-07 23:16:01 +0000104 "<config>" = {
105 background = "#ffffff99";
106 border-bottom = "#00000000";
107 button-background = "#ffffffcc";
Skyler Turner4ea60622022-03-07 23:24:22 +0000108 button-padding = 10;
Skyler Turnerd0a8f5c2022-03-07 23:16:01 +0000109 button-border-size = 0;
110 };
Skyler Turner7b341db2022-03-07 23:17:23 +0000111
112 warning = {
Skyler Turnere957a372022-03-07 23:18:27 +0000113 background = "#ffffff99";
Skyler Turner6222f752022-03-07 23:21:23 +0000114 border-bottom = "#00000000";
Skyler Turnerf24ef5e2022-03-07 23:26:30 +0000115 button-background = "#ffff00";
116 };
117
118 error = {
119 background = "#ffffff99";
120 border-bottom = "#00000000";
Skyler Turnere609f0a2022-03-07 23:25:17 +0000121 button-background = "#ff0000";
Skyler Turner7b341db2022-03-07 23:17:23 +0000122 };
Skyler Turnerf24ef5e2022-03-07 23:26:30 +0000123
124 green = {
125 background = "#ffffff99";
126 border-bottom = "#00000000";
Skyler Turnerc4d1c0b2022-03-07 23:28:58 +0000127 button-background = "#00b300";
Skyler Turnerf24ef5e2022-03-07 23:26:30 +0000128 };
129
130 blue = {
131 background = "#ffffff99";
132 border-bottom = "#00000000";
Skyler Turnerc4d1c0b2022-03-07 23:28:58 +0000133 button-background = "#0000ff";
Skyler Turnerf24ef5e2022-03-07 23:26:30 +0000134 };
Skyler Turner36510212022-03-07 23:13:14 +0000135 };
Skyler Turner07eb3d12022-03-06 21:08:29 +0000136 };
Skyler Turnereda726a2022-03-07 00:23:17 +0000137
138 systemdIntegration = true;
Skyler Turnerdb486c92022-03-06 10:48:24 +0000139 };
140
141 home.packages = with pkgs; [
142 swaylock
143 swayidle
144 wl-clipboard
Skyler Turnerbb530ed2022-03-15 14:04:39 +0000145 avizo
146 pamixer
147 brightnessctl
Skyler Turner9dfac612022-03-06 10:48:57 +0000148 ];
Skyler Turnerdb486c92022-03-06 10:48:24 +0000149
Skyler Turnerd3b70682022-03-06 23:19:45 +0000150 programs.zsh.profileExtra = ''
151 if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
152 exec systemd-cat -t sway sway
153 fi
154 '';
Skyler Turnerbb530ed2022-03-15 14:04:39 +0000155
156 systemd.user.services.avizo = {
Skyler Turner7b7b73d2022-03-15 14:05:20 +0000157 Install.WantedBy = [ "graphical-session.target" ];
Skyler Turnerbb530ed2022-03-15 14:04:39 +0000158 Service = {
159 ExecReload = "kill -SIGUSR2 \$MAINPID";
160 ExecStart = "${pkgs.avizo}/bin/avizo-service";
161 KillMode = "mixed";
162 Restart = "on-failure";
163 };
164 Unit = {
165 After = "graphical-session.target";
166 Description = "Notification daemon to show volume & brightness changes";
167 Documentation = "N/A (src/apps/personal/sway.nix)";
168 PartOf= "graphical-session.target";
169 };
170 };
Skyler Turnerc6af35b2022-03-09 00:16:45 +0000171}
Skyler Turnerbb530ed2022-03-15 14:04:39 +0000172