Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 1 | { |
| 2 | pkgs, |
| 3 | lib, |
Skyler Grey | e27f938 | 2022-09-01 23:33:04 +0100 | [diff] [blame] | 4 | home, |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 5 | ... |
| 6 | }: { |
| 7 | home = { |
| 8 | wayland.windowManager.sway = { |
| 9 | enable = true; |
| 10 | wrapperFeatures.gtk = true; |
Skyler Grey | e27f938 | 2022-09-01 23:33:04 +0100 | [diff] [blame] | 11 | package = pkgs.sway-unwrapped; |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 12 | |
| 13 | config = rec { |
| 14 | assigns = {}; |
| 15 | bars = []; |
| 16 | colors = {}; |
| 17 | defaultWorkspace = null; |
| 18 | down = "j"; |
| 19 | floating = {}; |
| 20 | focus = {}; |
| 21 | fonts = {}; |
| 22 | gaps = { |
| 23 | inner = 10; |
| 24 | top = -10; |
| 25 | outer = 0; |
| 26 | smartGaps = false; |
| 27 | }; |
| 28 | input = { |
| 29 | "type:touchpad" = { |
| 30 | dwt = "enabled"; |
| 31 | tap = "enabled"; |
| 32 | natural_scroll = "enabled"; |
| 33 | middle_emulation = "enabled"; |
| 34 | events = "disabled_on_external_mouse"; |
| 35 | }; |
| 36 | "type:keyboard" = { |
| 37 | xkb_layout = "gb"; |
Skyler Grey | 6a2a8dc | 2022-10-31 00:08:48 +0000 | [diff] [blame] | 38 | xkb_options = "caps:none"; |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 39 | }; |
| 40 | "type:tablet_tool" = { |
| 41 | map_to_output = "eDP-1"; |
| 42 | }; |
| 43 | }; |
| 44 | keybindings = lib.mkOptionDefault { |
| 45 | "${modifier}+g" = "sticky toggle"; |
| 46 | "${modifier}+k" = "exec wl-copy -c"; |
| 47 | "${modifier}+f" = "maximize toggle"; |
Skyler Grey | 6a2a8dc | 2022-10-31 00:08:48 +0000 | [diff] [blame] | 48 | "XF86AudioRaiseVolume" = "exec pamixer -ui 5 && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK"; |
| 49 | "XF86AudioLowerVolume" = "exec pamixer -ud 5 && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK"; |
| 50 | "XF86AudioMute" = "exec pamixer --toggle-mute && ( pamixer --get-mute && expr \"$(pamixer --get-volume)\" + 100 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK"; |
| 51 | "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"; |
| 52 | "XF86MonBrightnessUp" = "exec light -A 3 && light -G | cut -d'.' -f1 > $WOBSOCK"; |
| 53 | "XF86MonBrightnessDown" = "exec light -U 3 && light -G | cut -d'.' -f1 > $WOBSOCK"; |
| 54 | "${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"; |
| 55 | "${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"; |
| 56 | "${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"; |
| 57 | "${modifier}+XF86MonBrightnessUp" = "exec light -A 6 && light -G | cut -d'.' -f1 > $WOBSOCK"; |
| 58 | "${modifier}+XF86MonBrightnessDown" = "exec light -U 6 && light -G | cut -d'.' -f1 > $WOBSOCK"; |
Skyler Grey | b1609d5 | 2022-10-31 00:22:41 +0000 | [diff] [blame] | 59 | "${modifier}+n" = ''exec wpa_cli select_network $(wpa_cli list_networks | tail -n +3 | rofi -dmenu -window-title "Select Network" | awk '{print $1;}')''; |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 60 | }; |
Skyler Grey | 6a2a8dc | 2022-10-31 00:08:48 +0000 | [diff] [blame] | 61 | keycodebindings = { |
| 62 | "66" = "exec ${pkgs.wtype}/bin/wtype -P F12"; |
| 63 | }; |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 64 | left = "h"; |
| 65 | modes = { |
| 66 | resize = { |
| 67 | Down = "resize grow height 10 px"; |
| 68 | Escape = "mode default"; |
| 69 | Left = "resize shrink width 10 px"; |
| 70 | Return = "mode default"; |
| 71 | Right = "resize grow width 10 px"; |
| 72 | Up = "resize shrink height 10 px"; |
| 73 | h = "resize shrink width 10 px"; |
| 74 | j = "resize grow height 10 px"; |
| 75 | k = "resize shrink height 10 px"; |
| 76 | l = "resize grow width 10 px"; |
| 77 | }; |
| 78 | }; |
| 79 | modifier = "Mod4"; |
Skyler Grey | 2e4815e | 2022-09-05 08:08:10 +0100 | [diff] [blame] | 80 | output = rec { |
Skyler Grey | e27f938 | 2022-09-01 23:33:04 +0100 | [diff] [blame] | 81 | HDMI-A-1 = { |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 82 | resolution = "3840x2160"; |
| 83 | bg = "#FFD0F9 solid_color"; |
| 84 | position = "0,0"; |
| 85 | }; |
Skyler Grey | 2e4815e | 2022-09-05 08:08:10 +0100 | [diff] [blame] | 86 | HDMI-A-2 = HDMI-A-1; |
| 87 | # For some reason my monitor sometimes gets one identifier and |
| 88 | # sometimes the other, despite being plugged into the same port |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 89 | eDP-1 = { |
| 90 | resolution = "1920x1080"; |
| 91 | position = "0,2160"; |
| 92 | }; |
| 93 | "*" = { |
| 94 | }; |
| 95 | }; |
| 96 | right = "l"; |
| 97 | seat = { |
| 98 | "*" = { |
| 99 | hide_cursor = "when-typing enable"; |
| 100 | }; |
| 101 | }; |
| 102 | startup = [ |
| 103 | {command = "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK";} |
Skyler Grey | 6a2a8dc | 2022-10-31 00:08:48 +0000 | [diff] [blame] | 104 | { |
| 105 | command = "light -N 1"; |
| 106 | always = false; |
| 107 | } |
| 108 | { |
| 109 | command = "\"pkill wob; rm -f $WOBSOCK && mkfifo $WOBSOCK && tail -f $WOBSOCK | wob --output='*'\""; |
| 110 | always = true; |
| 111 | } |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 112 | ]; |
| 113 | terminal = "${pkgs.kitty}/bin/kitty"; |
| 114 | up = "k"; |
| 115 | window = {}; |
| 116 | workspaceAutoBackAndForth = true; |
| 117 | workspaceLayout = "default"; |
| 118 | workspaceOutputAssign = []; |
| 119 | }; |
| 120 | |
| 121 | extraSessionCommands = '' |
Skyler Grey | 1a0fc1c | 2022-10-31 00:11:24 +0000 | [diff] [blame] | 122 | unset __HM_SESS_VARS_SOURCED |
| 123 | . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" |
| 124 | |
Skyler Grey | b1609d5 | 2022-10-31 00:22:41 +0000 | [diff] [blame] | 125 | # export WLR_NO_HARDWARE_CURSORS=1 |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 126 | # TODO: Check if above is still needed w/ nvidia card enabled |
Skyler Grey | b1609d5 | 2022-10-31 00:22:41 +0000 | [diff] [blame] | 127 | # export SDL_VIDEODRIVER=wayland |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 128 | # needs qt5.qtwayland in systemPackages |
Skyler Grey | b1609d5 | 2022-10-31 00:22:41 +0000 | [diff] [blame] | 129 | # export QT_QPA_PLATFORM=wayland |
| 130 | # export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 131 | # Fix for some Java AWT applications (e.g. Android Studio), |
| 132 | # use this if they aren't displayed properly: |
| 133 | export _JAVA_AWT_WM_NONREPARENTING=1 |
| 134 | ''; |
| 135 | |
| 136 | swaynag = { |
| 137 | enable = false; |
| 138 | settings = { |
| 139 | "<config>" = { |
| 140 | background = "#ffffff99"; |
| 141 | border-bottom = "#00000000"; |
| 142 | button-background = "#ffffffcc"; |
| 143 | button-padding = 10; |
| 144 | button-border-size = 0; |
| 145 | }; |
| 146 | |
| 147 | warning = { |
| 148 | background = "#ffffff99"; |
| 149 | border-bottom = "#00000000"; |
| 150 | button-background = "#ffff00"; |
| 151 | }; |
| 152 | |
| 153 | error = { |
| 154 | background = "#ffffff99"; |
| 155 | border-bottom = "#00000000"; |
| 156 | button-background = "#ff0000"; |
| 157 | }; |
| 158 | |
| 159 | green = { |
| 160 | background = "#ffffff99"; |
| 161 | border-bottom = "#00000000"; |
| 162 | button-background = "#00b300"; |
| 163 | }; |
| 164 | |
| 165 | blue = { |
| 166 | background = "#ffffff99"; |
| 167 | border-bottom = "#00000000"; |
| 168 | button-background = "#0000ff"; |
| 169 | }; |
| 170 | }; |
| 171 | }; |
| 172 | |
| 173 | systemdIntegration = true; |
Skyler Grey | 6a2a8dc | 2022-10-31 00:08:48 +0000 | [diff] [blame] | 174 | |
| 175 | extraConfig = '' |
| 176 | set $WOBSOCK $XDG_RUNTIME_DIR/wob.sock |
| 177 | ''; |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 178 | }; |
| 179 | |
| 180 | home.packages = with pkgs; [ |
| 181 | wl-clipboard |
Skyler Grey | 6a2a8dc | 2022-10-31 00:08:48 +0000 | [diff] [blame] | 182 | pamixer |
| 183 | wob |
| 184 | wtype |
Skyler Grey | 2e6ff85 | 2022-08-26 06:49:18 +0100 | [diff] [blame] | 185 | ]; |
| 186 | |
| 187 | programs.zsh.profileExtra = '' |
| 188 | if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then |
| 189 | exec systemd-cat -t sway sway --unsupported-gpu |
| 190 | fi |
| 191 | ''; |
| 192 | }; |
| 193 | } |