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