[9dc074f] | 1 | # Default config for sway
|
---|
| 2 | #
|
---|
| 3 | # Copy this to ~/.config/sway/config and edit it to your liking.
|
---|
| 4 | #
|
---|
| 5 | # Read `man 5 sway` for a complete reference.
|
---|
| 6 |
|
---|
| 7 | ### Variables
|
---|
| 8 | #
|
---|
| 9 | # Logo key. Use Mod1 for Alt.
|
---|
[9c9ce77] | 10 | set $mod Mod4
|
---|
[9dc074f] | 11 | # Home row direction keys, like vim
|
---|
| 12 | set $left h
|
---|
| 13 | set $down j
|
---|
| 14 | set $up k
|
---|
| 15 | set $right l
|
---|
| 16 |
|
---|
[9989e84] | 17 | set $term wterm
|
---|
[9dc074f] | 18 |
|
---|
[eaffc2c] | 19 | bindsym $mod+d exec --no-startup-id "rofi -show drun -run-shell-command '{terminal} -e \\" {cmd}; read -n 1 -s\\"'"
|
---|
| 20 | bindsym $mod+w exec --no-startup-id "rofi -show window -run-shell-command '{terminal} -e \\" {cmd}; read -n 1 -s\\"'"
|
---|
[9dc074f] | 21 |
|
---|
[eaffc2c] | 22 | exec dbus-daemon --session --address=unix:path=$XDG_RUNTIME_DIR/bus
|
---|
| 23 | exec mako
|
---|
| 24 |
|
---|
| 25 | # exec swayidle -w \
|
---|
| 26 | # timeout 300 'swaylock -f -c 000000' \
|
---|
| 27 | # timeout 600 'swaymsg "output * dpms off"' \
|
---|
| 28 | # resume 'swaymsg "output * dpms on"' \
|
---|
| 29 | # before-sleep 'swaylock -f -c 000000'
|
---|
[9dc074f] | 30 |
|
---|
| 31 | ### Key bindings
|
---|
| 32 | #
|
---|
| 33 | # Basics:
|
---|
| 34 | #
|
---|
| 35 | # Start a terminal
|
---|
| 36 | bindsym $mod+Return exec $term
|
---|
[9c9ce77] | 37 | bindsym $mod+c exec $term
|
---|
[53e5e13] | 38 |
|
---|
[9dc074f] | 39 |
|
---|
| 40 | # Kill focused window
|
---|
[eaffc2c] | 41 | bindsym $mod+q kill
|
---|
[9dc074f] | 42 |
|
---|
| 43 |
|
---|
| 44 | # Drag floating windows by holding down $mod and left mouse button.
|
---|
| 45 | # Resize them with right mouse button + $mod.
|
---|
| 46 | # Despite the name, also works for non-floating windows.
|
---|
| 47 | # Change normal to inverse to use left mouse button for resizing and right
|
---|
| 48 | # mouse button for dragging.
|
---|
| 49 | floating_modifier $mod normal
|
---|
| 50 |
|
---|
| 51 | # Reload the configuration file
|
---|
| 52 | bindsym $mod+Shift+c reload
|
---|
| 53 |
|
---|
| 54 | # Exit sway (logs you out of your Wayland session)
|
---|
| 55 | 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'
|
---|
| 56 | #
|
---|
| 57 | # Moving around:
|
---|
| 58 | #
|
---|
| 59 | # Move your focus around
|
---|
| 60 | bindsym $mod+$left focus left
|
---|
| 61 | bindsym $mod+$down focus down
|
---|
| 62 | bindsym $mod+$up focus up
|
---|
| 63 | bindsym $mod+$right focus right
|
---|
| 64 | # Or use $mod+[up|down|left|right]
|
---|
| 65 | bindsym $mod+Left focus left
|
---|
| 66 | bindsym $mod+Down focus down
|
---|
| 67 | bindsym $mod+Up focus up
|
---|
| 68 | bindsym $mod+Right focus right
|
---|
| 69 |
|
---|
| 70 | # Move the focused window with the same, but add Shift
|
---|
| 71 | bindsym $mod+Shift+$left move left
|
---|
| 72 | bindsym $mod+Shift+$down move down
|
---|
| 73 | bindsym $mod+Shift+$up move up
|
---|
| 74 | bindsym $mod+Shift+$right move right
|
---|
| 75 | # Ditto, with arrow keys
|
---|
| 76 | bindsym $mod+Shift+Left move left
|
---|
| 77 | bindsym $mod+Shift+Down move down
|
---|
| 78 | bindsym $mod+Shift+Up move up
|
---|
| 79 | bindsym $mod+Shift+Right move right
|
---|
| 80 | #
|
---|
| 81 | # Workspaces:
|
---|
| 82 | #
|
---|
| 83 | # Switch to workspace
|
---|
| 84 | bindsym $mod+1 workspace 1
|
---|
| 85 | bindsym $mod+2 workspace 2
|
---|
| 86 | bindsym $mod+3 workspace 3
|
---|
| 87 | bindsym $mod+4 workspace 4
|
---|
| 88 | bindsym $mod+5 workspace 5
|
---|
| 89 | bindsym $mod+6 workspace 6
|
---|
| 90 | bindsym $mod+7 workspace 7
|
---|
| 91 | bindsym $mod+8 workspace 8
|
---|
| 92 | bindsym $mod+9 workspace 9
|
---|
| 93 | bindsym $mod+0 workspace 10
|
---|
| 94 | # Move focused container to workspace
|
---|
| 95 | bindsym $mod+Shift+1 move container to workspace 1
|
---|
| 96 | bindsym $mod+Shift+2 move container to workspace 2
|
---|
| 97 | bindsym $mod+Shift+3 move container to workspace 3
|
---|
| 98 | bindsym $mod+Shift+4 move container to workspace 4
|
---|
| 99 | bindsym $mod+Shift+5 move container to workspace 5
|
---|
| 100 | bindsym $mod+Shift+6 move container to workspace 6
|
---|
| 101 | bindsym $mod+Shift+7 move container to workspace 7
|
---|
| 102 | bindsym $mod+Shift+8 move container to workspace 8
|
---|
| 103 | bindsym $mod+Shift+9 move container to workspace 9
|
---|
| 104 | bindsym $mod+Shift+0 move container to workspace 10
|
---|
| 105 | # Note: workspaces can have any name you want, not just numbers.
|
---|
| 106 | # We just use 1-10 as the default.
|
---|
| 107 | #
|
---|
| 108 | # Layout stuff:
|
---|
| 109 | #
|
---|
| 110 | # You can "split" the current object of your focus with
|
---|
| 111 | # $mod+b or $mod+v, for horizontal and vertical splits
|
---|
| 112 | # respectively.
|
---|
| 113 | bindsym $mod+b splith
|
---|
| 114 | bindsym $mod+v splitv
|
---|
| 115 |
|
---|
| 116 | # Switch the current container between different layout styles
|
---|
| 117 | bindsym $mod+s layout stacking
|
---|
[eaffc2c] | 118 | #bindsym $mod+w layout tabbed
|
---|
[9dc074f] | 119 |
|
---|
| 120 | # Make the current focus fullscreen
|
---|
| 121 | bindsym $mod+f fullscreen
|
---|
| 122 |
|
---|
| 123 | # Toggle the current focus between tiling and floating mode
|
---|
| 124 | bindsym $mod+Shift+space floating toggle
|
---|
| 125 |
|
---|
| 126 | # Swap focus between the tiling area and the floating area
|
---|
| 127 | bindsym $mod+space focus mode_toggle
|
---|
| 128 |
|
---|
| 129 | # Move focus to the parent container
|
---|
| 130 | bindsym $mod+a focus parent
|
---|
| 131 | #
|
---|
| 132 | # Scratchpad:
|
---|
| 133 | #
|
---|
| 134 | # Sway has a "scratchpad", which is a bag of holding for windows.
|
---|
| 135 | # You can send windows there and get them back later.
|
---|
| 136 |
|
---|
| 137 | # Move the currently focused window to the scratchpad
|
---|
| 138 | bindsym $mod+Shift+minus move scratchpad
|
---|
| 139 |
|
---|
| 140 | # Show the next scratchpad window or hide the focused scratchpad window.
|
---|
| 141 | # If there are multiple scratchpad windows, this command cycles through them.
|
---|
| 142 | bindsym $mod+minus scratchpad show
|
---|
| 143 | #
|
---|
| 144 | # Resizing containers:
|
---|
| 145 | #
|
---|
| 146 | mode "resize" {
|
---|
| 147 | # left will shrink the containers width
|
---|
| 148 | # right will grow the containers width
|
---|
| 149 | # up will shrink the containers height
|
---|
| 150 | # down will grow the containers height
|
---|
| 151 | bindsym $left resize shrink width 10px
|
---|
| 152 | bindsym $down resize grow height 10px
|
---|
| 153 | bindsym $up resize shrink height 10px
|
---|
| 154 | bindsym $right resize grow width 10px
|
---|
| 155 |
|
---|
| 156 | # Ditto, with arrow keys
|
---|
| 157 | bindsym Left resize shrink width 10px
|
---|
| 158 | bindsym Down resize grow height 10px
|
---|
| 159 | bindsym Up resize shrink height 10px
|
---|
| 160 | bindsym Right resize grow width 10px
|
---|
| 161 |
|
---|
| 162 | # Return to default mode
|
---|
| 163 | bindsym Return mode "default"
|
---|
| 164 | bindsym Escape mode "default"
|
---|
| 165 | }
|
---|
| 166 | bindsym $mod+r mode "resize"
|
---|
| 167 |
|
---|
[53e5e13] | 168 | # Volume control
|
---|
| 169 | bindsym XF86AudioRaiseVolume exec amixer -q sset Master 5%+
|
---|
| 170 | bindsym XF86AudioLowerVolume exec amixer -q sset Master 5%-
|
---|
| 171 | bindsym XF86AudioMute exec amixer -q sset Master toggle
|
---|
| 172 |
|
---|
[9dc074f] | 173 | bar {
|
---|
| 174 | position top
|
---|
[53e5e13] | 175 |
|
---|
[eaffc2c] | 176 | #status_command SCRIPT_DIR=~/.config/i3blocks/ i3blocks
|
---|
| 177 |
|
---|
[4f2555f] | 178 | strip_workspace_name yes
|
---|
[9dc074f] | 179 |
|
---|
[53e5e13] | 180 | #tray_output primary
|
---|
| 181 |
|
---|
[9dc074f] | 182 | colors {
|
---|
[9c9ce77] | 183 | statusline #cccccc
|
---|
| 184 | background #333333
|
---|
| 185 | focused_workspace #333333 #aeafad #333333
|
---|
| 186 | inactive_workspace #333333 #333333 #cccccc
|
---|
[1ba36c3] | 187 | urgent_workspace #333333 #f2777a #2d2d2d
|
---|
[9dc074f] | 188 | }
|
---|
| 189 | }
|
---|
| 190 |
|
---|
[4f2555f] | 191 |
|
---|
[9dc074f] | 192 | input type:keyboard {
|
---|
| 193 | xkb_layout us,ru
|
---|
[1ba36c3] | 194 | xkb_options grp:win_space_toggle,caps:ctrl_modifier#,ctrl:nocaps
|
---|
[9dc074f] | 195 | }
|
---|
| 196 |
|
---|
[9c9ce77] | 197 | # Change borders
|
---|
[9dc074f] | 198 | default_border none
|
---|
[9c9ce77] | 199 | default_floating_border normal
|
---|
| 200 | hide_edge_borders vertical
|
---|
[9dc074f] | 201 |
|
---|
[4f2555f] | 202 | gaps inner 1
|
---|
| 203 |
|
---|
[eaffc2c] | 204 | workspace_auto_back_and_forth on
|
---|
| 205 | focus_on_window_activation focus
|
---|
| 206 | focus_wrapping workspace
|
---|
| 207 |
|
---|
[1ba36c3] | 208 | # Default stumpwm keybinding doesn't work, because C-t is used by many programs
|
---|
| 209 | # and sway let other programs to use binded keys.
|
---|
| 210 | set $StumpMod Control+t
|
---|
[eaffc2c] | 211 |
|
---|
[1ba36c3] | 212 | assign [class="Emacs"] "Editor"
|
---|
| 213 | assign [class="Icecat"] "Browser"
|
---|
| 214 | assign [class="Firefox"] "Browser"
|
---|
| 215 | assign [class="Chromium"] "Browser"
|
---|
[eaffc2c] | 216 |
|
---|
| 217 | mode "stumpwm" {
|
---|
[1ba36c3] | 218 | # Would be nice to have exit from mode after each bind
|
---|
| 219 |
|
---|
| 220 | bindsym --to-code {
|
---|
| 221 | # Launch emacs
|
---|
| 222 | e exec emacsclient; workspace "Editor"; mode default;
|
---|
[9989e84] | 223 |
|
---|
| 224 | shift+e exec "if ps auxf | grep -c emacs > 1; then swaymsg '[class=Emacs] focus'; else swaymsg exec 'emacs'; fi; swaymsg 'mode default'";
|
---|
[1ba36c3] | 225 |
|
---|
| 226 | # Launch terminal
|
---|
| 227 | c mode default; exec $term;
|
---|
| 228 |
|
---|
| 229 | # Kill window
|
---|
| 230 | k kill; mode default;
|
---|
| 231 |
|
---|
| 232 | # Navigation
|
---|
| 233 | n workspace next; mode default;
|
---|
| 234 | p workspace prev; mode default;
|
---|
| 235 |
|
---|
| 236 | # Switch to previous workspace
|
---|
| 237 | t workspace current; mode default;
|
---|
| 238 | Control+t workspace current; mode default;
|
---|
| 239 |
|
---|
| 240 | # Splitting
|
---|
| 241 | s split vertical; mode default;
|
---|
| 242 | Shift+s split horizontal; mode default;
|
---|
| 243 |
|
---|
| 244 | # Exit stumpwmm mode
|
---|
| 245 | g mode default;
|
---|
| 246 |
|
---|
| 247 | Control+g mode default;
|
---|
| 248 |
|
---|
| 249 | # Select workspace with corresponding digit
|
---|
| 250 | 0 workspace "0: Emacs"; mode default;
|
---|
| 251 | 1 workspace 1; mode default;
|
---|
| 252 | 2 workspace 2; mode default;
|
---|
| 253 | 3 workspace 3; mode default;
|
---|
| 254 | 4 workspace 4; mode default;
|
---|
| 255 | 5 workspace 5; mode default;
|
---|
| 256 | 6 workspace 6; mode default;
|
---|
| 257 | 7 workspace 7; mode default;
|
---|
| 258 | 8 workspace 8; mode default;
|
---|
| 259 | 9 workspace 9; mode default;
|
---|
| 260 |
|
---|
| 261 | # Choose/find window
|
---|
| 262 | apostrophe exec --no-startup-id "swaymsg mode default; rofi -show window"
|
---|
| 263 |
|
---|
| 264 | # Combimode
|
---|
| 265 | b exec --no-startup-id "swaymsg mode default; rofi -show combi"
|
---|
| 266 |
|
---|
| 267 |
|
---|
| 268 | # Exec/find shell command
|
---|
| 269 | shift+1 exec --no-startup-id "swaymsg mode default; rofi -show run -run-shell-command '{terminal} -e \\" {cmd}; read -n 1 -s\\"'"
|
---|
| 270 | }
|
---|
| 271 |
|
---|
| 272 | # bindsym --to-code n exec "swaymsg focus down; swaymsg mode default;"
|
---|
| 273 | # bindsym --to-code p exec "swaymsg focus up; swaymsg mode default;"
|
---|
| 274 | # bindsym --to-code b exec "swaymsg focus left; swaymsg mode default;"
|
---|
| 275 | # bindsym --to-code f exec "swaymsg focus right; swaymsg mode default;"
|
---|
[eaffc2c] | 276 |
|
---|
| 277 | # List of windows
|
---|
| 278 | bindsym w exec --no-startup-id "swaymsg mode default; rofi -show window -run-shell-command '{terminal} -e \\" {cmd}; read -n 1 -s\\"'"
|
---|
| 279 | }
|
---|
[1ba36c3] | 280 | bindsym --to-code $StumpMod mode "stumpwm"
|
---|
| 281 |
|
---|
[9989e84] | 282 | bindsym --to-code $mod+n exec --no-startup-id "rofi -show window"
|
---|
[eaffc2c] | 283 |
|
---|
| 284 | bindsym $mod+g mode "default"
|
---|