Skyler Turner | 202e73d | 2022-03-09 00:23:39 +0000 | [diff] [blame] | 1 | { pkgs, lib, ... }: { |
Skyler Turner | db486c9 | 2022-03-06 10:48:24 +0000 | [diff] [blame] | 2 | wayland.windowManager.sway = { |
| 3 | enable = true; |
| 4 | wrapperFeatures.gtk = true; |
Skyler Turner | f2a8839 | 2022-03-06 21:08:15 +0000 | [diff] [blame] | 5 | |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 6 | config = rec { |
Skyler Turner | f2a8839 | 2022-03-06 21:08:15 +0000 | [diff] [blame] | 7 | assigns = {}; |
| 8 | bars = []; |
| 9 | colors = {}; |
Skyler Turner | fe471d3 | 2022-03-07 13:16:17 +0000 | [diff] [blame] | 10 | defaultWorkspace = null; |
| 11 | down = "j"; |
| 12 | floating = {}; |
| 13 | focus = {}; |
| 14 | fonts = {}; |
| 15 | gaps = { |
Skyler Turner | 801a9a8 | 2022-03-07 13:40:41 +0000 | [diff] [blame] | 16 | inner = 10; |
Skyler Turner | 89be006 | 2022-03-07 21:37:09 +0000 | [diff] [blame] | 17 | top = -10; |
Skyler Turner | 1bd708a | 2022-03-07 13:44:27 +0000 | [diff] [blame] | 18 | outer = 0; |
Skyler Turner | a076a83 | 2022-03-09 09:42:54 +0000 | [diff] [blame] | 19 | smartGaps = false; |
Skyler Turner | fe471d3 | 2022-03-07 13:16:17 +0000 | [diff] [blame] | 20 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 21 | input = { |
Skyler Turner | a9227fd | 2022-03-07 13:48:39 +0000 | [diff] [blame] | 22 | "type:touchpad" = { |
Skyler Turner | f277cf6 | 2022-03-07 13:49:14 +0000 | [diff] [blame] | 23 | dwt = "enabled"; |
| 24 | tap = "enabled"; |
| 25 | natural_scroll = "enabled"; |
Skyler Turner | 42bc366 | 2022-03-09 13:33:14 +0000 | [diff] [blame] | 26 | middle_emulation = "enabled"; |
Skyler Turner | a9227fd | 2022-03-07 13:48:39 +0000 | [diff] [blame] | 27 | events = "disabled_on_external_mouse"; |
| 28 | }; |
| 29 | "type:keyboard" = { |
| 30 | xkb_layout = "gb"; |
| 31 | }; |
Skyler Turner | 6dceae2 | 2022-03-16 08:59:08 +0000 | [diff] [blame] | 32 | "type:tablet_tool" = { |
Skyler Turner | 85299c4 | 2022-03-16 08:55:33 +0000 | [diff] [blame] | 33 | map_to_output = "eDP-1"; |
| 34 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 35 | }; |
Skyler Turner | b8a6199 | 2022-03-15 10:32:51 +0000 | [diff] [blame] | 36 | keybindings = lib.mkOptionDefault { |
Skyler Turner | 4746458 | 2022-05-12 10:41:32 +0100 | [diff] [blame] | 37 | "${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 Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 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 Turner | b8a6199 | 2022-03-15 10:32:51 +0000 | [diff] [blame] | 44 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 45 | 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"; |
Skyler Turner | c3ab3c2 | 2022-04-20 09:15:08 +0100 | [diff] [blame] | 66 | #position = "1920,0"; |
| 67 | position = "0,0"; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 68 | }; |
| 69 | eDP-1 = { |
| 70 | resolution = "1920x1080"; |
Skyler Turner | c3ab3c2 | 2022-04-20 09:15:08 +0100 | [diff] [blame] | 71 | #position = "0,1522"; |
| 72 | position = "0,2160"; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 73 | }; |
Skyler Turner | c6af35b | 2022-03-09 00:16:45 +0000 | [diff] [blame] | 74 | "*" = { |
Skyler Turner | 202e73d | 2022-03-09 00:23:39 +0000 | [diff] [blame] | 75 | bg = "${./sway/background.png} fill"; |
Skyler Turner | c6af35b | 2022-03-09 00:16:45 +0000 | [diff] [blame] | 76 | }; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 77 | }; |
| 78 | right = "l"; |
| 79 | seat = { |
| 80 | "*" = { |
| 81 | hide_cursor = "when-typing enable"; |
| 82 | }; |
| 83 | }; |
Skyler Turner | b254c9d | 2022-05-14 00:24:37 +0100 | [diff] [blame^] | 84 | startup = [ |
| 85 | { command = "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK"; } |
| 86 | ]; |
Skyler Turner | b1fef9e | 2022-03-07 13:39:14 +0000 | [diff] [blame] | 87 | terminal = "alacritty"; |
| 88 | up = "k"; |
| 89 | window = {}; |
| 90 | workspaceAutoBackAndForth = true; |
| 91 | workspaceLayout = "default"; |
| 92 | workspaceOutputAssign = []; |
| 93 | }; |
| 94 | |
| 95 | extraSessionCommands = '' |
| 96 | export SDL_VIDEODRIVER=wayland |
| 97 | # needs qt5.qtwayland in systemPackages |
| 98 | export QT_QPA_PLATFORM=wayland |
| 99 | export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" |
| 100 | # Fix for some Java AWT applications (e.g. Android Studio), |
| 101 | # use this if they aren't displayed properly: |
| 102 | export _JAVA_AWT_WM_NONREPARENTING=1 |
| 103 | ''; |
| 104 | |
| 105 | swaynag = { |
Skyler Turner | 3651021 | 2022-03-07 23:13:14 +0000 | [diff] [blame] | 106 | enable = true; |
| 107 | settings = { |
Skyler Turner | d0a8f5c | 2022-03-07 23:16:01 +0000 | [diff] [blame] | 108 | "<config>" = { |
| 109 | background = "#ffffff99"; |
| 110 | border-bottom = "#00000000"; |
| 111 | button-background = "#ffffffcc"; |
Skyler Turner | 4ea6062 | 2022-03-07 23:24:22 +0000 | [diff] [blame] | 112 | button-padding = 10; |
Skyler Turner | d0a8f5c | 2022-03-07 23:16:01 +0000 | [diff] [blame] | 113 | button-border-size = 0; |
| 114 | }; |
Skyler Turner | 7b341db | 2022-03-07 23:17:23 +0000 | [diff] [blame] | 115 | |
| 116 | warning = { |
Skyler Turner | e957a37 | 2022-03-07 23:18:27 +0000 | [diff] [blame] | 117 | background = "#ffffff99"; |
Skyler Turner | 6222f75 | 2022-03-07 23:21:23 +0000 | [diff] [blame] | 118 | border-bottom = "#00000000"; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 119 | button-background = "#ffff00"; |
| 120 | }; |
| 121 | |
| 122 | error = { |
| 123 | background = "#ffffff99"; |
| 124 | border-bottom = "#00000000"; |
Skyler Turner | e609f0a | 2022-03-07 23:25:17 +0000 | [diff] [blame] | 125 | button-background = "#ff0000"; |
Skyler Turner | 7b341db | 2022-03-07 23:17:23 +0000 | [diff] [blame] | 126 | }; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 127 | |
| 128 | green = { |
| 129 | background = "#ffffff99"; |
| 130 | border-bottom = "#00000000"; |
Skyler Turner | c4d1c0b | 2022-03-07 23:28:58 +0000 | [diff] [blame] | 131 | button-background = "#00b300"; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | blue = { |
| 135 | background = "#ffffff99"; |
| 136 | border-bottom = "#00000000"; |
Skyler Turner | c4d1c0b | 2022-03-07 23:28:58 +0000 | [diff] [blame] | 137 | button-background = "#0000ff"; |
Skyler Turner | f24ef5e | 2022-03-07 23:26:30 +0000 | [diff] [blame] | 138 | }; |
Skyler Turner | 3651021 | 2022-03-07 23:13:14 +0000 | [diff] [blame] | 139 | }; |
Skyler Turner | 07eb3d1 | 2022-03-06 21:08:29 +0000 | [diff] [blame] | 140 | }; |
Skyler Turner | eda726a | 2022-03-07 00:23:17 +0000 | [diff] [blame] | 141 | |
| 142 | systemdIntegration = true; |
Skyler Turner | db486c9 | 2022-03-06 10:48:24 +0000 | [diff] [blame] | 143 | }; |
| 144 | |
| 145 | home.packages = with pkgs; [ |
| 146 | swaylock |
| 147 | swayidle |
| 148 | wl-clipboard |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 149 | avizo |
| 150 | pamixer |
| 151 | brightnessctl |
Skyler Turner | 9dfac61 | 2022-03-06 10:48:57 +0000 | [diff] [blame] | 152 | ]; |
Skyler Turner | db486c9 | 2022-03-06 10:48:24 +0000 | [diff] [blame] | 153 | |
Skyler Turner | d3b7068 | 2022-03-06 23:19:45 +0000 | [diff] [blame] | 154 | programs.zsh.profileExtra = '' |
| 155 | if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then |
| 156 | exec systemd-cat -t sway sway |
| 157 | fi |
| 158 | ''; |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 159 | |
| 160 | systemd.user.services.avizo = { |
Skyler Turner | 7b7b73d | 2022-03-15 14:05:20 +0000 | [diff] [blame] | 161 | Install.WantedBy = [ "graphical-session.target" ]; |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 162 | Service = { |
| 163 | ExecReload = "kill -SIGUSR2 \$MAINPID"; |
| 164 | ExecStart = "${pkgs.avizo}/bin/avizo-service"; |
| 165 | KillMode = "mixed"; |
| 166 | Restart = "on-failure"; |
| 167 | }; |
| 168 | Unit = { |
| 169 | After = "graphical-session.target"; |
| 170 | Description = "Notification daemon to show volume & brightness changes"; |
| 171 | Documentation = "N/A (src/apps/personal/sway.nix)"; |
| 172 | PartOf= "graphical-session.target"; |
| 173 | }; |
| 174 | }; |
Skyler Turner | c6af35b | 2022-03-09 00:16:45 +0000 | [diff] [blame] | 175 | } |
Skyler Turner | bb530ed | 2022-03-15 14:04:39 +0000 | [diff] [blame] | 176 | |