This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / 2configs / desktops / sway / default.nix
9.7 kB 290 lines
1{ pkgs, ... }: 2let 3 4 term = "/run/current-system/sw/bin/alacritty"; 5 6in 7{ 8 imports = [ 9 ../lib/wayland.nix 10 ]; 11 programs.sway = { 12 enable = true; 13 wrapperFeatures.gtk = true; 14 }; 15 16 environment.etc."sway/config".text = '' 17 # Default config for sway 18 # 19 # Copy this to ~/.config/sway/config and edit it to your liking. 20 # 21 # Read `man 5 sway` for a complete reference. 22 23 ### Variables 24 # 25 # Logo key. Use Mod1 for Alt. 26 set $mod Mod4 27 # Home row direction keys, like vim 28 set $left h 29 set $down j 30 set $up k 31 set $right l 32 # Your preferred terminal emulator 33 set $term ${term} 34 # Your preferred application launcher 35 # Note: pass the final command to swaymsg so that the resulting window can be opened 36 # on the original workspace that the command was run on. 37 set $menu ${pkgs.dmenu}/bin/dmenu_path | fzfmenu | xargs swaymsg exec -- 38 39 ### Output configuration 40 # 41 # Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) 42 # output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill 43 # 44 # Example configuration: 45 # 46 # output HDMI-A-1 resolution 1920x1080 position 1920,0 47 # 48 # You can get the names of your outputs by running: swaymsg -t get_outputs 49 50 ### Idle configuration 51 # 52 # Example configuration: 53 # 54 # exec swayidle -w \ 55 # timeout 300 'swaylock -f -c 000000' \ 56 # timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ 57 # before-sleep 'swaylock -f -c 000000' 58 # 59 # This will lock your screen after 300 seconds of inactivity, then turn off 60 # your displays after another 300 seconds, and turn your screens back on when 61 # resumed. It will also lock your screen before your computer goes to sleep. 62 63 ### Input configuration 64 # 65 # Example configuration: 66 # 67 # input "2:14:SynPS/2_Synaptics_TouchPad" { 68 # dwt enabled 69 # tap enabled 70 # natural_scroll enabled 71 # middle_emulation enabled 72 # } 73 # 74 # You can get the names of your inputs by running: swaymsg -t get_inputs 75 # Read `man 5 sway-input` for more information about this section. 76 77 ### Key bindings 78 # 79 # Basics: 80 # 81 # Start a terminal 82 bindsym $mod+Shift+Return exec $term 83 84 # Kill focused window 85 bindsym $mod+Shift+c kill 86 87 # Start your launcher 88 bindsym $mod+d exec $menu 89 90 # Drag floating windows by holding down $mod and left mouse button. 91 # Resize them with right mouse button + $mod. 92 # Despite the name, also works for non-floating windows. 93 # Change normal to inverse to use left mouse button for resizing and right 94 # mouse button for dragging. 95 floating_modifier $mod normal 96 97 # Reload the configuration file 98 bindsym $mod+Shift+r reload 99 100 # Exit sway (logs you out of your Wayland session) 101 bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' 102 # 103 # Moving around: 104 # 105 # Move your focus around 106 bindsym $mod+Left focus left 107 bindsym $mod+Down focus down 108 bindsym $mod+Up focus up 109 bindsym $mod+Right focus right 110 111 # Move the focused window with the same, but add Shift 112 bindsym $mod+Shift+Left move left 113 bindsym $mod+Shift+Down move down 114 bindsym $mod+Shift+Up move up 115 bindsym $mod+Shift+Right move right 116 # Layout stuff: 117 # 118 # You can "split" the current object of your focus with 119 # $mod+b or $mod+v, for horizontal and vertical splits 120 # respectively. 121 bindsym $mod+b splith 122 bindsym $mod+v splitv 123 124 # Switch the current container between different layout styles 125 bindsym $mod+s layout stacking 126 bindsym $mod+w layout tabbed 127 bindsym $mod+e layout toggle split 128 129 # Make the current focus fullscreen 130 bindsym $mod+f fullscreen 131 132 # Toggle the current focus between tiling and floating mode 133 bindsym $mod+Shift+space floating toggle 134 135 # Swap focus between the tiling area and the floating area 136 bindsym $mod+space focus mode_toggle 137 138 # Move focus to the parent container 139 bindsym $mod+Shift+a focus parent 140 # 141 # Scratchpad: 142 # 143 # Sway has a "scratchpad", which is a bag of holding for windows. 144 # You can send windows there and get them back later. 145 146 # Move the currently focused window to the scratchpad 147 bindsym $mod+Shift+minus move scratchpad 148 149 # Show the next scratchpad window or hide the focused scratchpad window. 150 # If there are multiple scratchpad windows, this command cycles through them. 151 bindsym $mod+minus scratchpad show 152 # 153 # Resizing containers: 154 # 155 mode "resize" { 156 # left will shrink the containers width 157 # right will grow the containers width 158 # up will shrink the containers height 159 # down will grow the containers height 160 bindsym $left resize shrink width 10px 161 bindsym $down resize grow height 10px 162 bindsym $up resize shrink height 10px 163 bindsym $right resize grow width 10px 164 165 # Ditto, with arrow keys 166 bindsym Left resize shrink width 10px 167 bindsym Down resize grow height 10px 168 bindsym Up resize shrink height 10px 169 bindsym Right resize grow width 10px 170 171 # Return to default mode 172 bindsym Return mode "default" 173 bindsym Escape mode "default" 174 } 175 bindsym $mod+r mode "resize" 176 177 # 178 # Status Bar: 179 # 180 # Read `man 5 sway-bar` for more information about this section. 181 bar { 182 position top 183 184 # When the status_command prints a new line to stdout, swaybar updates. 185 # The default just shows the current date and time. 186 status_command while date +'%Y-%m-%d %H:%M:%S'; do sleep 1; done 187 188 colors { 189 statusline #ffffff 190 background #323232 191 inactive_workspace #32323200 #32323200 #5c5c5c 192 } 193 } 194 195 default_border pixel 1 196 default_floating_border none 197 smart_borders on 198 199 bindsym $mod+q exec ${pkgs.writers.writeDash "goto_workspace" '' 200 set -efux 201 unset TERM # we want fzfmenu to start a new terminal 202 CURRENT_OUTPUT=$(swaymsg -r -t get_outputs | jq '.[] | select(.focused == true).name') 203 FZFMENU_FZF_DEFAULT_OPTS="--select-1" 204 WS=$(swaymsg -r -t get_workspaces | 205 jq -r '.[].name' | 206 fzfmenu -p 'Workspace name: ' 207 ) 208 if [ -n "$WS" ]; then 209 swaymsg workspace "$WS" 210 swaymsg move workspace to output "$CURRENT_OUTPUT" 211 fi 212 ''} 213 214 bindsym $mod+Shift+q exec ${pkgs.writers.writeDash "moveto_workspace" '' 215 set -efux 216 unset TERM # we want fzfmenu to start a new terminal 217 FZFMENU_FZF_DEFAULT_OPTS="--select-1" 218 WS=$(swaymsg -r -t get_workspaces | 219 jq -r '.[].name' | 220 fzfmenu -p 'Workspace name: ' 221 ) 222 if [ -n "$WS" ]; then 223 swaymsg move container to workspace "$WS" 224 fi 225 ''} 226 227 bindsym $mod+x exec ${./starter} floating enable -- ${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yaml 228 bindsym $mod+y exec /run/current-system/sw/bin/switch-theme toggle 229 230 for_window [title="fzfmenu"] floating enable 231 bindsym $mod+Tab focus next 232 bindsym $mod+Escape workspace back_and_forth 233 234 bindsym $mod+p exec ${pkgs.writers.writeDash "passmenu" '' 235 set -efux 236 unset TERM # we want fzfmenu to start a new terminal 237 (cd $HOME/.password-store; find -type f -name '*.gpg') | 238 sed -e 's/\.gpg$//' | 239 fzfmenu -p 'Password: ' | 240 xargs -I{} pass show {} | 241 tr -d '\n' | 242 ${pkgs.wtype}/bin/wtype -s 1 - 243 ''} 244 bindsym $mod+Shift+p exec ${pkgs.writers.writeDash "otpmenu" '' 245 unset TERM 246 ${pkgs.otpmenu}/bin/otpmenu 247 ''} 248 249 # screenlock 250 bindsym $mod+F11 exec ${pkgs.swaylock}/bin/swaylock -f -c 000000 251 252 # media buttons 253 bindsym XF86AudioMute exec ${pkgs.pulseaudio.out}/bin/pactl -- set-sink-mute @DEFAULT_SINK@ toggle 254 bindsym XF86AudioRaiseVolume exec ${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ +4% 255 bindsym XF86AudioLowerVolume exec ${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ -4% 256 bindsym XF86MonBrightnessDown exec ${pkgs.acpilight}/bin/xbacklight -time 0 -dec 1 257 bindsym XF86MonBrightnessUp exec ${pkgs.acpilight}/bin/xbacklight -time 0 -inc 1 258 259 # background programs 260 exec ydotoold 261 exec_always pkill kanshi; exec ${pkgs.kanshi}/bin/kanshi 262 263 # theme and env specific stuff 264 exec_always ${pkgs.writers.writeDash "dbus-sway-environment" '' 265 set -efux 266 dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway 267 systemctl --user stop xdg-desktop-portal xdg-desktop-portal-wlr 268 systemctl --user start xdg-desktop-portal xdg-desktop-portal-wlr 269 ''} 270 271 exec_always ${pkgs.writers.writeDash "gsettings" '' 272 set -efux 273 export XDG_DATA_DIRS=${pkgs.gsettings-desktop-schemas}:$XDG_DATA_DIRS 274 gnome_schema=org.gnome.desktop.interface 275 gsettings set $gnome_schema gtk-theme 'Dracula' 276 ''} 277 278 # keyboard 279 input type:keyboard { 280 xkb_layout us 281 xkb_variant altgr-intl 282 xkb_options caps:hyper 283 } 284 285 # flameshot 286 for_window [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0 287 exec ${pkgs.flameshot}/bin/flameshot 288 ''; 289 290}