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.
|
---|
10 | set $mod Mod4
|
---|
11 | # Home row direction keys, like vim
|
---|
12 | set $left h
|
---|
13 | set $down j
|
---|
14 | set $up k
|
---|
15 | set $right l
|
---|
16 |
|
---|
17 | set $term urxvt
|
---|
18 |
|
---|
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\\"'"
|
---|
21 |
|
---|
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'
|
---|
30 |
|
---|
31 | ### Key bindings
|
---|
32 | #
|
---|
33 | # Basics:
|
---|
34 | #
|
---|
35 | # Start a terminal
|
---|
36 | bindsym $mod+Return exec $term
|
---|
37 | bindsym $mod+c exec $term
|
---|
38 |
|
---|
39 |
|
---|
40 | # Kill focused window
|
---|
41 | bindsym $mod+q kill
|
---|
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
|
---|
118 | #bindsym $mod+w layout tabbed
|
---|
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 |
|
---|
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 |
|
---|
173 | bar {
|
---|
174 | position top
|
---|
175 |
|
---|
176 | #status_command SCRIPT_DIR=~/.config/i3blocks/ i3blocks
|
---|
177 |
|
---|
178 | strip_workspace_name yes
|
---|
179 |
|
---|
180 | #tray_output primary
|
---|
181 |
|
---|
182 | colors {
|
---|
183 | statusline #cccccc
|
---|
184 | background #333333
|
---|
185 | focused_workspace #333333 #aeafad #333333
|
---|
186 | inactive_workspace #333333 #333333 #cccccc
|
---|
187 | urgent_workspace #333333 #f2777a #2d2d2d
|
---|
188 | }
|
---|
189 | }
|
---|
190 |
|
---|
191 |
|
---|
192 | input type:keyboard {
|
---|
193 | xkb_layout us,ru
|
---|
194 | xkb_options grp:win_space_toggle,caps:ctrl_modifier#,ctrl:nocaps
|
---|
195 | }
|
---|
196 |
|
---|
197 | # Change borders
|
---|
198 | default_border none
|
---|
199 | default_floating_border normal
|
---|
200 | hide_edge_borders vertical
|
---|
201 |
|
---|
202 | gaps inner 1
|
---|
203 |
|
---|
204 | workspace_auto_back_and_forth on
|
---|
205 | focus_on_window_activation focus
|
---|
206 | focus_wrapping workspace
|
---|
207 |
|
---|
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
|
---|
211 |
|
---|
212 | assign [class="Emacs"] "Editor"
|
---|
213 | assign [class="Icecat"] "Browser"
|
---|
214 | assign [class="Firefox"] "Browser"
|
---|
215 | assign [class="Chromium"] "Browser"
|
---|
216 |
|
---|
217 | mode "stumpwm" {
|
---|
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;
|
---|
223 | shift+e exec emacs; workspace "Editor"; mode default;
|
---|
224 |
|
---|
225 | # Launch terminal
|
---|
226 | c mode default; exec $term;
|
---|
227 |
|
---|
228 | # Kill window
|
---|
229 | k kill; mode default;
|
---|
230 |
|
---|
231 | # Navigation
|
---|
232 | n workspace next; mode default;
|
---|
233 | p workspace prev; mode default;
|
---|
234 |
|
---|
235 | # Switch to previous workspace
|
---|
236 | t workspace current; mode default;
|
---|
237 | Control+t workspace current; mode default;
|
---|
238 |
|
---|
239 | # Splitting
|
---|
240 | s split vertical; mode default;
|
---|
241 | Shift+s split horizontal; mode default;
|
---|
242 |
|
---|
243 | # Exit stumpwmm mode
|
---|
244 | g mode default;
|
---|
245 |
|
---|
246 | Control+g mode default;
|
---|
247 |
|
---|
248 | # Select workspace with corresponding digit
|
---|
249 | 0 workspace "0: Emacs"; mode default;
|
---|
250 | 1 workspace 1; mode default;
|
---|
251 | 2 workspace 2; mode default;
|
---|
252 | 3 workspace 3; mode default;
|
---|
253 | 4 workspace 4; mode default;
|
---|
254 | 5 workspace 5; mode default;
|
---|
255 | 6 workspace 6; mode default;
|
---|
256 | 7 workspace 7; mode default;
|
---|
257 | 8 workspace 8; mode default;
|
---|
258 | 9 workspace 9; mode default;
|
---|
259 |
|
---|
260 | # Choose/find window
|
---|
261 | apostrophe exec --no-startup-id "swaymsg mode default; rofi -show window"
|
---|
262 |
|
---|
263 | # Combimode
|
---|
264 | b exec --no-startup-id "swaymsg mode default; rofi -show combi"
|
---|
265 |
|
---|
266 |
|
---|
267 | # Exec/find shell command
|
---|
268 | shift+1 exec --no-startup-id "swaymsg mode default; rofi -show run -run-shell-command '{terminal} -e \\" {cmd}; read -n 1 -s\\"'"
|
---|
269 | }
|
---|
270 |
|
---|
271 | # bindsym --to-code n exec "swaymsg focus down; swaymsg mode default;"
|
---|
272 | # bindsym --to-code p exec "swaymsg focus up; swaymsg mode default;"
|
---|
273 | # bindsym --to-code b exec "swaymsg focus left; swaymsg mode default;"
|
---|
274 | # bindsym --to-code f exec "swaymsg focus right; swaymsg mode default;"
|
---|
275 |
|
---|
276 | # List of windows
|
---|
277 | bindsym w exec --no-startup-id "swaymsg mode default; rofi -show window -run-shell-command '{terminal} -e \\" {cmd}; read -n 1 -s\\"'"
|
---|
278 | }
|
---|
279 | bindsym --to-code $StumpMod mode "stumpwm"
|
---|
280 |
|
---|
281 | mode "stumpwm-control" {
|
---|
282 |
|
---|
283 | }
|
---|
284 |
|
---|
285 | bindsym $mod+g mode "default"
|
---|