Skyler Grey | c711df6 | 2022-05-21 01:06:15 +0100 | [diff] [blame^] | 1 | { pkgs, lib, ... }: let |
| 2 | wlogoutConfig = [ |
| 3 | { |
| 4 | label = "lock"; |
| 5 | action = "swaylock -c 000000 -i ${./sway/lockscreen.png}"; |
| 6 | text = "Lock"; |
| 7 | keybind = "l"; |
| 8 | } |
| 9 | { |
| 10 | label = "hibernate"; |
| 11 | action = "swaylock -c 000000 -i ${./sway/lockscreen.png} -f && systemctl hibernate"; |
| 12 | text = "Hibernate"; |
| 13 | keybind = "h"; |
| 14 | } |
| 15 | { |
| 16 | label = "logout"; |
| 17 | action = "loginctl terminate-user $USER"; |
| 18 | text = "Logout"; |
| 19 | keybind = "e"; |
| 20 | } |
| 21 | { |
| 22 | label = "shutdown"; |
| 23 | action = "systemctl poweroff"; |
| 24 | text = "Shutdown"; |
| 25 | keybind = "s"; |
| 26 | } |
| 27 | { |
| 28 | label = "suspend"; |
| 29 | action = "swaylock -c 000000 -i ${./sway/lockscreen.png} -f && systemctl suspend"; |
| 30 | text = "Suspend"; |
| 31 | keybind = "u"; |
| 32 | } |
| 33 | { |
| 34 | label = "reboot"; |
| 35 | action = "systemctl reboot"; |
| 36 | text = "Reboot"; |
| 37 | keybind = "r"; |
| 38 | } |
| 39 | ]; |
| 40 | wlogoutConfigFile = writeText "wlogout-layout.layout" (builtins.toJSON wlogoutConfig); |
| 41 | in { |
Skyler Turner | db486c9 | 2022-03-06 10:48:24 +0000 | [diff] [blame] | 42 | wayland.windowManager.sway = { |
| 43 | enable = true; |
| 44 | wrapperFeatures.gtk = true; |
Skyler Turner | f2a8839 | 2022-03-06 21:08:15 +0000 | [diff] [blame] | 45 | |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 46 | config = rec { |
Skyler Turner | f2a8839 | 2022-03-06 21:08:15 +0000 | [diff] [blame] | 47 | assigns = {}; |
| 48 | bars = []; |
| 49 | colors = {}; |
Skyler Turner | fe471d3 | 2022-03-07 13:16:17 +0000 | [diff] [blame] | 50 | defaultWorkspace = null; |
| 51 | down = "j"; |
| 52 | floating = {}; |
| 53 | focus = {}; |
| 54 | fonts = {}; |
| 55 | gaps = { |
Skyler Turner | 801a9a8 | 2022-03-07 13:40:41 +0000 | [diff] [blame] | 56 | inner = 10; |
Skyler Turner | 89be006 | 2022-03-07 21:37:09 +0000 | [diff] [blame] | 57 | top = -10; |
Skyler Turner | 1bd708a | 2022-03-07 13:44:27 +0000 | [diff] [blame] | 58 | outer = 0; |
Skyler Turner | a076a83 | 2022-03-09 09:42:54 +0000 | [diff] [blame] | 59 | smartGaps = false; |
Skyler Turner | fe471d3 | 2022-03-07 13:16:17 +0000 | [diff] [blame] | 60 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 61 | input = { |
Skyler Turner | a9227fd | 2022-03-07 13:48:39 +0000 | [diff] [blame] | 62 | "type:touchpad" = { |
Skyler Turner | f277cf6 | 2022-03-07 13:49:14 +0000 | [diff] [blame] | 63 | dwt = "enabled"; |
| 64 | tap = "enabled"; |
| 65 | natural_scroll = "enabled"; |
Skyler Turner | 42bc366 | 2022-03-09 13:33:14 +0000 | [diff] [blame] | 66 | middle_emulation = "enabled"; |
Skyler Turner | a9227fd | 2022-03-07 13:48:39 +0000 | [diff] [blame] | 67 | events = "disabled_on_external_mouse"; |
| 68 | }; |
| 69 | "type:keyboard" = { |
| 70 | xkb_layout = "gb"; |
| 71 | }; |
Skyler Turner | 6dceae2 | 2022-03-16 08:59:08 +0000 | [diff] [blame] | 72 | "type:tablet_tool" = { |
Skyler Turner | 85299c4 | 2022-03-16 08:55:33 +0000 | [diff] [blame] | 73 | map_to_output = "eDP-1"; |
| 74 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 75 | }; |
Skyler Turner | b8a6199 | 2022-03-15 10:32:51 +0000 | [diff] [blame] | 76 | keybindings = lib.mkOptionDefault { |
Skyler Grey | c711df6 | 2022-05-21 01:06:15 +0100 | [diff] [blame^] | 77 | "${modifier}+l" = "exec /usr/bin/env wlogout -c 5 -r 5 -p layer-shell -l ${wlogoutConfigFile}"; # "exec /usr/bin/env swaylock -c 000000"; |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 78 | "XF86AudioRaiseVolume" = "exec volumectl -u up"; |
| 79 | "XF86AudioLowerVolume" = "exec volumectl -u down"; |
| 80 | "XF86AudioMute" = "exec volumectl toggle-mute"; |
| 81 | "XF86AudioMicMute" = "exec volumectl -m toggle-mute"; |
| 82 | "XF86MonBrightnessUp" = "exec lightctl up"; |
| 83 | "XF86MonBrightnessDown" = "exec lightctl down"; |
Skyler Grey | 2826c14 | 2022-05-20 14:18:06 +0100 | [diff] [blame] | 84 | "${modifier}+Shift+s" = "exec grim -g \"$(slurp)\" - | tee ~/Screenshots/\"$(date --rfc-3339=seconds)\".png | wl-copy"; |
Skyler Turner | b8a6199 | 2022-03-15 10:32:51 +0000 | [diff] [blame] | 85 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 86 | keycodebindings = {}; |
| 87 | left = "h"; |
| 88 | menu = "/usr/bin/env rofi -show combi"; |
| 89 | modes = { |
| 90 | resize = { |
| 91 | Down = "resize grow height 10 px"; |
| 92 | Escape = "mode default"; |
| 93 | Left = "resize shrink width 10 px"; |
| 94 | Return = "mode default"; |
| 95 | Right = "resize grow width 10 px"; |
| 96 | Up = "resize shrink height 10 px"; |
| 97 | h = "resize shrink width 10 px"; |
| 98 | j = "resize grow height 10 px"; |
| 99 | k = "resize shrink height 10 px"; |
| 100 | l = "resize grow width 10 px"; |
| 101 | }; |
| 102 | }; |
| 103 | modifier = "Mod4"; |
| 104 | output = { |
| 105 | HDMI-A-2 = { |
| 106 | resolution = "3840x2160"; |
Skyler Turner | c3ab3c2 | 2022-04-20 09:15:08 +0100 | [diff] [blame] | 107 | #position = "1920,0"; |
| 108 | position = "0,0"; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 109 | }; |
| 110 | eDP-1 = { |
| 111 | resolution = "1920x1080"; |
Skyler Turner | c3ab3c2 | 2022-04-20 09:15:08 +0100 | [diff] [blame] | 112 | #position = "0,1522"; |
| 113 | position = "0,2160"; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 114 | }; |
Skyler Turner | c6af35b | 2022-03-09 00:16:45 +0000 | [diff] [blame] | 115 | "*" = { |
Skyler Turner | 202e73d | 2022-03-09 00:23:39 +0000 | [diff] [blame] | 116 | bg = "${./sway/background.png} fill"; |
Skyler Turner | c6af35b | 2022-03-09 00:16:45 +0000 | [diff] [blame] | 117 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 118 | }; |
| 119 | right = "l"; |
| 120 | seat = { |
| 121 | "*" = { |
| 122 | hide_cursor = "when-typing enable"; |
| 123 | }; |
| 124 | }; |
Skyler Turner | b254c9d | 2022-05-14 00:24:37 +0100 | [diff] [blame] | 125 | startup = [ |
| 126 | { command = "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK"; } |
| 127 | ]; |
Skyler Grey | 6378691 | 2022-05-20 11:31:40 +0100 | [diff] [blame] | 128 | terminal = "kitty"; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 129 | up = "k"; |
| 130 | window = {}; |
| 131 | workspaceAutoBackAndForth = true; |
| 132 | workspaceLayout = "default"; |
| 133 | workspaceOutputAssign = []; |
| 134 | }; |
| 135 | |
| 136 | extraSessionCommands = '' |
| 137 | export SDL_VIDEODRIVER=wayland |
| 138 | # needs qt5.qtwayland in systemPackages |
| 139 | export QT_QPA_PLATFORM=wayland |
| 140 | export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" |
| 141 | # Fix for some Java AWT applications (e.g. Android Studio), |
| 142 | # use this if they aren't displayed properly: |
| 143 | export _JAVA_AWT_WM_NONREPARENTING=1 |
| 144 | ''; |
| 145 | |
| 146 | swaynag = { |
Skyler Turner | 3651021 | 2022-03-07 23:13:14 +0000 | [diff] [blame] | 147 | enable = true; |
| 148 | settings = { |
Skyler Turner | d0a8f5c | 2022-03-07 23:16:01 +0000 | [diff] [blame] | 149 | "<config>" = { |
| 150 | background = "#ffffff99"; |
| 151 | border-bottom = "#00000000"; |
| 152 | button-background = "#ffffffcc"; |
Skyler Turner | 4ea6062 | 2022-03-07 23:24:22 +0000 | [diff] [blame] | 153 | button-padding = 10; |
Skyler Turner | d0a8f5c | 2022-03-07 23:16:01 +0000 | [diff] [blame] | 154 | button-border-size = 0; |
| 155 | }; |
Skyler Turner | 7b341db | 2022-03-07 23:17:23 +0000 | [diff] [blame] | 156 | |
| 157 | warning = { |
Skyler Turner | e957a37 | 2022-03-07 23:18:27 +0000 | [diff] [blame] | 158 | background = "#ffffff99"; |
Skyler Turner | 6222f75 | 2022-03-07 23:21:23 +0000 | [diff] [blame] | 159 | border-bottom = "#00000000"; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 160 | button-background = "#ffff00"; |
| 161 | }; |
| 162 | |
| 163 | error = { |
| 164 | background = "#ffffff99"; |
| 165 | border-bottom = "#00000000"; |
Skyler Turner | e609f0a | 2022-03-07 23:25:17 +0000 | [diff] [blame] | 166 | button-background = "#ff0000"; |
Skyler Turner | 7b341db | 2022-03-07 23:17:23 +0000 | [diff] [blame] | 167 | }; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 168 | |
| 169 | green = { |
| 170 | background = "#ffffff99"; |
| 171 | border-bottom = "#00000000"; |
Skyler Turner | c4d1c0b | 2022-03-07 23:28:58 +0000 | [diff] [blame] | 172 | button-background = "#00b300"; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 173 | }; |
| 174 | |
| 175 | blue = { |
| 176 | background = "#ffffff99"; |
| 177 | border-bottom = "#00000000"; |
Skyler Turner | c4d1c0b | 2022-03-07 23:28:58 +0000 | [diff] [blame] | 178 | button-background = "#0000ff"; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 179 | }; |
Skyler Turner | 3651021 | 2022-03-07 23:13:14 +0000 | [diff] [blame] | 180 | }; |
Skyler Turner | 07eb3d1 | 2022-03-06 21:08:29 +0000 | [diff] [blame] | 181 | }; |
Skyler Turner | eda726a | 2022-03-07 00:23:17 +0000 | [diff] [blame] | 182 | |
| 183 | systemdIntegration = true; |
Skyler Turner | db486c9 | 2022-03-06 10:48:24 +0000 | [diff] [blame] | 184 | }; |
| 185 | |
| 186 | home.packages = with pkgs; [ |
| 187 | swaylock |
| 188 | swayidle |
| 189 | wl-clipboard |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 190 | avizo |
| 191 | pamixer |
| 192 | brightnessctl |
Skyler Turner | 9dfac61 | 2022-03-06 10:48:57 +0000 | [diff] [blame] | 193 | ]; |
Skyler Turner | db486c9 | 2022-03-06 10:48:24 +0000 | [diff] [blame] | 194 | |
Skyler Turner | d3b7068 | 2022-03-06 23:19:45 +0000 | [diff] [blame] | 195 | programs.zsh.profileExtra = '' |
| 196 | if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then |
| 197 | exec systemd-cat -t sway sway |
| 198 | fi |
| 199 | ''; |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 200 | |
| 201 | systemd.user.services.avizo = { |
Skyler Turner | 7b7b73d | 2022-03-15 14:05:20 +0000 | [diff] [blame] | 202 | Install.WantedBy = [ "graphical-session.target" ]; |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 203 | Service = { |
| 204 | ExecReload = "kill -SIGUSR2 \$MAINPID"; |
| 205 | ExecStart = "${pkgs.avizo}/bin/avizo-service"; |
| 206 | KillMode = "mixed"; |
| 207 | Restart = "on-failure"; |
| 208 | }; |
| 209 | Unit = { |
| 210 | After = "graphical-session.target"; |
| 211 | Description = "Notification daemon to show volume & brightness changes"; |
| 212 | Documentation = "N/A (src/apps/personal/sway.nix)"; |
| 213 | PartOf= "graphical-session.target"; |
| 214 | }; |
| 215 | }; |
Skyler Turner | c6af35b | 2022-03-09 00:16:45 +0000 | [diff] [blame] | 216 | } |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 217 | |