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