Skyler Grey | a3261d1 | 2022-05-24 21:05:22 +0100 | [diff] [blame] | 1 | { pkgs, pkgs-unstable, lib, ... }: let |
Skyler Grey | c711df6 | 2022-05-21 01:06:15 +0100 | [diff] [blame] | 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 | ]; |
Skyler Grey | cfb1c11 | 2022-05-21 01:14:15 +0100 | [diff] [blame] | 40 | wlogoutJson = (builtins.toJSON wlogoutConfig); |
Skyler Grey | 412a3c1 | 2022-05-21 01:16:46 +0100 | [diff] [blame] | 41 | wlogoutConfigFile = pkgs.writeText "wlogout-layout.layout" (builtins.substring 1 ((builtins.stringLength wlogoutJson) - 2) wlogoutJson); |
Skyler Grey | c711df6 | 2022-05-21 01:06:15 +0100 | [diff] [blame] | 42 | in { |
Skyler Turner | db486c9 | 2022-03-06 10:48:24 +0000 | [diff] [blame] | 43 | wayland.windowManager.sway = { |
| 44 | enable = true; |
| 45 | wrapperFeatures.gtk = true; |
Skyler Turner | f2a8839 | 2022-03-06 21:08:15 +0000 | [diff] [blame] | 46 | |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 47 | config = rec { |
Skyler Turner | f2a8839 | 2022-03-06 21:08:15 +0000 | [diff] [blame] | 48 | assigns = {}; |
| 49 | bars = []; |
| 50 | colors = {}; |
Skyler Turner | fe471d3 | 2022-03-07 13:16:17 +0000 | [diff] [blame] | 51 | defaultWorkspace = null; |
| 52 | down = "j"; |
| 53 | floating = {}; |
| 54 | focus = {}; |
| 55 | fonts = {}; |
| 56 | gaps = { |
Skyler Turner | 801a9a8 | 2022-03-07 13:40:41 +0000 | [diff] [blame] | 57 | inner = 10; |
Skyler Turner | 89be006 | 2022-03-07 21:37:09 +0000 | [diff] [blame] | 58 | top = -10; |
Skyler Turner | 1bd708a | 2022-03-07 13:44:27 +0000 | [diff] [blame] | 59 | outer = 0; |
Skyler Turner | a076a83 | 2022-03-09 09:42:54 +0000 | [diff] [blame] | 60 | smartGaps = false; |
Skyler Turner | fe471d3 | 2022-03-07 13:16:17 +0000 | [diff] [blame] | 61 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 62 | input = { |
Skyler Turner | a9227fd | 2022-03-07 13:48:39 +0000 | [diff] [blame] | 63 | "type:touchpad" = { |
Skyler Turner | f277cf6 | 2022-03-07 13:49:14 +0000 | [diff] [blame] | 64 | dwt = "enabled"; |
| 65 | tap = "enabled"; |
| 66 | natural_scroll = "enabled"; |
Skyler Turner | 42bc366 | 2022-03-09 13:33:14 +0000 | [diff] [blame] | 67 | middle_emulation = "enabled"; |
Skyler Turner | a9227fd | 2022-03-07 13:48:39 +0000 | [diff] [blame] | 68 | events = "disabled_on_external_mouse"; |
| 69 | }; |
| 70 | "type:keyboard" = { |
| 71 | xkb_layout = "gb"; |
| 72 | }; |
Skyler Turner | 6dceae2 | 2022-03-16 08:59:08 +0000 | [diff] [blame] | 73 | "type:tablet_tool" = { |
Skyler Turner | 85299c4 | 2022-03-16 08:55:33 +0000 | [diff] [blame] | 74 | map_to_output = "eDP-1"; |
| 75 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 76 | }; |
Skyler Turner | b8a6199 | 2022-03-15 10:32:51 +0000 | [diff] [blame] | 77 | keybindings = lib.mkOptionDefault { |
Skyler Grey | c711df6 | 2022-05-21 01:06:15 +0100 | [diff] [blame] | 78 | "${modifier}+l" = "exec /usr/bin/env wlogout -c 5 -r 5 -p layer-shell -l ${wlogoutConfigFile}"; # "exec /usr/bin/env swaylock -c 000000"; |
Skyler Grey | b087aa0 | 2022-05-25 23:07:48 +0100 | [diff] [blame] | 79 | "XF86AudioRaiseVolume" = "exec pamixer -ui 5 && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK"; |
| 80 | "XF86AudioLowerVolume" = "exec pamixer -ud 5 && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK"; |
| 81 | "XF86AudioMute" = "exec pamixer --toggle-mute && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK"; |
| 82 | "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"; |
Skyler Grey | 704c5f0 | 2022-05-26 00:13:06 +0100 | [diff] [blame^] | 83 | "XF86MonBrightnessUp" = "exec light -A 3 && light -G | cut -d'.' -f1 > $WOBSOCK"; |
| 84 | "XF86MonBrightnessDown" = "exec light -U 3 && light -G | cut -d'.' -f1 > $WOBSOCK"; |
Skyler Grey | 2826c14 | 2022-05-20 14:18:06 +0100 | [diff] [blame] | 85 | "${modifier}+Shift+s" = "exec grim -g \"$(slurp)\" - | tee ~/Screenshots/\"$(date --rfc-3339=seconds)\".png | wl-copy"; |
Skyler Grey | 0509cd8 | 2022-05-21 20:27:56 +0100 | [diff] [blame] | 86 | "${modifier}+g" = "sticky toggle"; |
Skyler Grey | 0f2c838 | 2022-05-24 13:15:50 +0100 | [diff] [blame] | 87 | "${modifier}+minus" = "exec ${./sway/show-menu.sh}"; |
Skyler Grey | 5b96058 | 2022-05-24 16:36:47 +0100 | [diff] [blame] | 88 | "Print" = "exec grim - | tee ~/Screenshots/\"$(date --rfc-3339=seconds)\".png | wl-copy"; |
| 89 | "${modifier}+Print" = "exec ${./sway/toggle-backlight.sh}"; |
Skyler Turner | b8a6199 | 2022-03-15 10:32:51 +0000 | [diff] [blame] | 90 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 91 | keycodebindings = {}; |
| 92 | left = "h"; |
| 93 | menu = "/usr/bin/env rofi -show combi"; |
| 94 | modes = { |
| 95 | resize = { |
| 96 | Down = "resize grow height 10 px"; |
| 97 | Escape = "mode default"; |
| 98 | Left = "resize shrink width 10 px"; |
| 99 | Return = "mode default"; |
| 100 | Right = "resize grow width 10 px"; |
| 101 | Up = "resize shrink height 10 px"; |
| 102 | h = "resize shrink width 10 px"; |
| 103 | j = "resize grow height 10 px"; |
| 104 | k = "resize shrink height 10 px"; |
| 105 | l = "resize grow width 10 px"; |
| 106 | }; |
| 107 | }; |
| 108 | modifier = "Mod4"; |
| 109 | output = { |
| 110 | HDMI-A-2 = { |
| 111 | resolution = "3840x2160"; |
Skyler Turner | c3ab3c2 | 2022-04-20 09:15:08 +0100 | [diff] [blame] | 112 | #position = "1920,0"; |
| 113 | position = "0,0"; |
Skyler Grey | 7ad4d42 | 2022-05-25 19:53:03 +0100 | [diff] [blame] | 114 | bg = "${./sway/background.png} fill"; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 115 | }; |
| 116 | eDP-1 = { |
| 117 | resolution = "1920x1080"; |
Skyler Turner | c3ab3c2 | 2022-04-20 09:15:08 +0100 | [diff] [blame] | 118 | #position = "0,1522"; |
| 119 | position = "0,2160"; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 120 | }; |
Skyler Turner | c6af35b | 2022-03-09 00:16:45 +0000 | [diff] [blame] | 121 | "*" = { |
Skyler Turner | c6af35b | 2022-03-09 00:16:45 +0000 | [diff] [blame] | 122 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 123 | }; |
| 124 | right = "l"; |
| 125 | seat = { |
| 126 | "*" = { |
| 127 | hide_cursor = "when-typing enable"; |
| 128 | }; |
| 129 | }; |
Skyler Turner | b254c9d | 2022-05-14 00:24:37 +0100 | [diff] [blame] | 130 | startup = [ |
| 131 | { command = "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK"; } |
Skyler Grey | b9a2f1d | 2022-05-25 21:31:12 +0100 | [diff] [blame] | 132 | { command = "pkill swaync; pkill waybar; ${pkgs-unstable.swaynotificationcenter}/bin/swaync & waybar"; always = true; } |
Skyler Grey | 7ad4d42 | 2022-05-25 19:53:03 +0100 | [diff] [blame] | 133 | { command = "pkill glpaper; ${pkgs.glpaper}/bin/glpaper eDP-1 ${./sway/shader.glsl} -F -W 1920 -H 1080"; always = true; } |
Skyler Grey | 704c5f0 | 2022-05-26 00:13:06 +0100 | [diff] [blame^] | 134 | { command = "light -N 1"; always = false; } |
Skyler Turner | b254c9d | 2022-05-14 00:24:37 +0100 | [diff] [blame] | 135 | ]; |
Skyler Grey | 6378691 | 2022-05-20 11:31:40 +0100 | [diff] [blame] | 136 | terminal = "kitty"; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 137 | up = "k"; |
| 138 | window = {}; |
| 139 | workspaceAutoBackAndForth = true; |
| 140 | workspaceLayout = "default"; |
| 141 | workspaceOutputAssign = []; |
| 142 | }; |
| 143 | |
Skyler Grey | 6d486f1 | 2022-05-24 18:48:33 +0100 | [diff] [blame] | 144 | extraConfig = '' |
| 145 | set $WOBSOCK $XDG_RUNTIME_DIR/wob.sock |
Skyler Grey | 89f8e61 | 2022-05-25 22:59:22 +0100 | [diff] [blame] | 146 | exec_always pkill wob; rm -f $WOBSOCK && mkfifo $WOBSOCK && tail -f $WOBSOCK | wob --output='*' |
Skyler Grey | 6d486f1 | 2022-05-24 18:48:33 +0100 | [diff] [blame] | 147 | ''; |
| 148 | |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 149 | extraSessionCommands = '' |
| 150 | export SDL_VIDEODRIVER=wayland |
| 151 | # needs qt5.qtwayland in systemPackages |
| 152 | export QT_QPA_PLATFORM=wayland |
| 153 | export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" |
| 154 | # Fix for some Java AWT applications (e.g. Android Studio), |
| 155 | # use this if they aren't displayed properly: |
| 156 | export _JAVA_AWT_WM_NONREPARENTING=1 |
| 157 | ''; |
| 158 | |
| 159 | swaynag = { |
Skyler Turner | 3651021 | 2022-03-07 23:13:14 +0000 | [diff] [blame] | 160 | enable = true; |
| 161 | settings = { |
Skyler Turner | d0a8f5c | 2022-03-07 23:16:01 +0000 | [diff] [blame] | 162 | "<config>" = { |
| 163 | background = "#ffffff99"; |
| 164 | border-bottom = "#00000000"; |
| 165 | button-background = "#ffffffcc"; |
Skyler Turner | 4ea6062 | 2022-03-07 23:24:22 +0000 | [diff] [blame] | 166 | button-padding = 10; |
Skyler Turner | d0a8f5c | 2022-03-07 23:16:01 +0000 | [diff] [blame] | 167 | button-border-size = 0; |
| 168 | }; |
Skyler Turner | 7b341db | 2022-03-07 23:17:23 +0000 | [diff] [blame] | 169 | |
| 170 | warning = { |
Skyler Turner | e957a37 | 2022-03-07 23:18:27 +0000 | [diff] [blame] | 171 | background = "#ffffff99"; |
Skyler Turner | 6222f75 | 2022-03-07 23:21:23 +0000 | [diff] [blame] | 172 | border-bottom = "#00000000"; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 173 | button-background = "#ffff00"; |
| 174 | }; |
| 175 | |
| 176 | error = { |
| 177 | background = "#ffffff99"; |
| 178 | border-bottom = "#00000000"; |
Skyler Turner | e609f0a | 2022-03-07 23:25:17 +0000 | [diff] [blame] | 179 | button-background = "#ff0000"; |
Skyler Turner | 7b341db | 2022-03-07 23:17:23 +0000 | [diff] [blame] | 180 | }; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 181 | |
| 182 | green = { |
| 183 | background = "#ffffff99"; |
| 184 | border-bottom = "#00000000"; |
Skyler Turner | c4d1c0b | 2022-03-07 23:28:58 +0000 | [diff] [blame] | 185 | button-background = "#00b300"; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 186 | }; |
| 187 | |
| 188 | blue = { |
| 189 | background = "#ffffff99"; |
| 190 | border-bottom = "#00000000"; |
Skyler Turner | c4d1c0b | 2022-03-07 23:28:58 +0000 | [diff] [blame] | 191 | button-background = "#0000ff"; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 192 | }; |
Skyler Turner | 3651021 | 2022-03-07 23:13:14 +0000 | [diff] [blame] | 193 | }; |
Skyler Turner | 07eb3d1 | 2022-03-06 21:08:29 +0000 | [diff] [blame] | 194 | }; |
Skyler Turner | eda726a | 2022-03-07 00:23:17 +0000 | [diff] [blame] | 195 | |
| 196 | systemdIntegration = true; |
Skyler Turner | db486c9 | 2022-03-06 10:48:24 +0000 | [diff] [blame] | 197 | }; |
| 198 | |
| 199 | home.packages = with pkgs; [ |
| 200 | swaylock |
| 201 | swayidle |
| 202 | wl-clipboard |
Skyler Grey | 0509cd8 | 2022-05-21 20:27:56 +0100 | [diff] [blame] | 203 | bc |
Skyler Grey | a0d7874 | 2022-05-24 12:07:30 +0100 | [diff] [blame] | 204 | jq |
Skyler Grey | 35c05c8 | 2022-05-24 16:54:30 +0100 | [diff] [blame] | 205 | pulseaudio |
| 206 | pamixer |
Skyler Grey | 3eef73c | 2022-05-25 10:41:04 +0100 | [diff] [blame] | 207 | glpaper |
Skyler Turner | 9dfac61 | 2022-03-06 10:48:57 +0000 | [diff] [blame] | 208 | ]; |
Skyler Turner | db486c9 | 2022-03-06 10:48:24 +0000 | [diff] [blame] | 209 | |
Skyler Turner | d3b7068 | 2022-03-06 23:19:45 +0000 | [diff] [blame] | 210 | programs.zsh.profileExtra = '' |
| 211 | if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then |
| 212 | exec systemd-cat -t sway sway |
| 213 | fi |
| 214 | ''; |
Skyler Turner | c6af35b | 2022-03-09 00:16:45 +0000 | [diff] [blame] | 215 | } |