emacs: use custom function for killing current buffer
[~bandali/configs] / .config / sway / config
CommitLineData
ec80f07a
AB
1### Variables
2# super
3set $mod Mod4
4# alt
5set $mod2 Mod1
6set $left h
7set $down j
8set $up k
9set $right l
5c23e497 10set $term urxvt
ec80f07a 11set $menu rofi -show run -display-run '> ' -display-window ' 🗔 '
a60a7887 12set $pass rofi-pass
ec80f07a
AB
13
14### Output configuration
15#
16# Default wallpaper (more resolutions are available in __DATADIR__/backgrounds/sway/)
ec80f07a
AB
17#
18# Example configuration:
19#
20# output HDMI-A-1 resolution 1920x1080 position 1920,0
21#
22# You can get the names of your outputs by running: swaymsg -t get_outputs
23
ed00e704
AB
24### Input configuration
25
26input "65261:24672:technomancy_Atreus" {
27 repeat_delay 200
28 repeat_rate 45
b25452ae 29 # xkb_options altwin:swap_alt_win
ed00e704
AB
30}
31
ec80f07a
AB
32### Idle configuration
33
34exec swayidle \
35 timeout 120 '[ -f ~/.nosleep ] || swaymsg "output * dpms off"' \
36 resume '[ -f ~/.nosleep ] || swaymsg "output * dpms on"' \
37
38
39### Key bindings
40#
41# Basics:
42#
007ff825
AB
43
44set $floating_term $term -name floating
45for_window [class="URxvt" instance="floating"] floating enable
46
a60a7887 47set $mode_launch (⏎)urxvt | | (e)macs | (i)cecat/weasel
007ff825
AB
48mode "$mode_launch" {
49 bindsym Return exec $floating_term, mode "default"
a60a7887 50 bindsym p exec $pass, mode "default"
007ff825 51 bindsym e exec emacs, mode "default"
007ff825
AB
52
53 # back to normal: Escape, or q
54 bindsym Escape mode "default"
55 bindsym q mode "default"
56}
a60a7887 57 bindsym $mod+tab mode "$mode_launch"
007ff825
AB
58 bindsym XF86Launch1 mode "$mode_launch"
59
ec80f07a
AB
60 # start a terminal
61 bindsym $mod+Return exec $term
007ff825 62 bindsym $mod+Shift+Return exec $floating_term
ec80f07a
AB
63
64 # kill focused window
65 bindsym $mod+Shift+q kill
66
67 # start your launcher
a60a7887 68 bindsym $mod+space exec $menu
ec80f07a 69
a60a7887
AB
70 # start your launcher
71 bindsym $mod+Shift+space exec $pass
ec80f07a
AB
72
73 # Drag floating windows by holding down $mod and left mouse button.
74 # Resize them with right mouse button + $mod.
75 # Despite the name, also works for non-floating windows.
76 # Change normal to inverse to use left mouse button for resizing and right
77 # mouse button for dragging.
78 floating_modifier $mod normal
79
bae7970c
AB
80 mouse_warping none
81
ec80f07a
AB
82 # reload the configuration file
83 bindsym $mod+Shift+c reload
84
85 # exit sway (logs you out of your wayland session)
86 # bindsym $mod+Shift+e exit
87
88 bindsym $mod+apostrophe exec rofi-light # rofi-based brightness chooser
89 bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness
90 bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness
91
92 bindsym XF86AudioRaiseVolume exec pamixer --allow-boost --increase 5
93 bindsym XF86AudioLowerVolume exec pamixer --allow-boost --decrease 5
94 bindsym XF86AudioMute exec pamixer --toggle-mute
95 bindsym XF86AudioMicMute exec pactl set-source-mute 1 toggle
96
4512005a 97 bindsym $mod+Shift+apostrophe exec rofi-remmina # choose remmina connection
ec80f07a
AB
98
99 # original sway workspace switch and window move
100 bindsym $mod+bracketleft workspace prev
101 bindsym $mod+bracketright workspace next
102 bindsym $mod+braceleft move container to workspace prev
103 bindsym $mod+braceright move container to workspace next
104
105 # bspwm-esque workspace switch and window move
106 bindsym $mod2+bracketleft exec sway-ws-util switch prev
107 bindsym $mod2+bracketright exec sway-ws-util switch next
108 bindsym $mod2+braceleft exec sway-ws-util move prev follow
109 bindsym $mod2+braceright exec sway-ws-util move next follow
110#
111# Moving around:
112#
113 # Move your focus around
114 bindsym $mod+$left focus left
115 bindsym $mod+$down focus down
116 bindsym $mod+$up focus up
117 bindsym $mod+$right focus right
118 # or use $mod+[up|down|left|right]
119 bindsym $mod+Left focus left
120 bindsym $mod+Down focus down
121 bindsym $mod+Up focus up
122 bindsym $mod+Right focus right
123
124 # _move_ the focused window with the same, but add Shift
125 bindsym $mod+Shift+$left move left
126 bindsym $mod+Shift+$down move down
127 bindsym $mod+Shift+$up move up
128 bindsym $mod+Shift+$right move right
129 # ditto, with arrow keys
130 bindsym $mod+Shift+Left move left
131 bindsym $mod+Shift+Down move down
132 bindsym $mod+Shift+Up move up
133 bindsym $mod+Shift+Right move right
134#
135# Workspaces:
136#
137 # switch to workspace
138 bindsym $mod+1 workspace 1
139 bindsym $mod+2 workspace 2
140 bindsym $mod+3 workspace 3
141 bindsym $mod+4 workspace 4
142 bindsym $mod+5 workspace 5
143 bindsym $mod+6 workspace 6
144 bindsym $mod+7 workspace 7
145 bindsym $mod+8 workspace 8
146 bindsym $mod+9 workspace 9
147 bindsym $mod+0 workspace 10
148 # move focused container to workspace
149 bindsym $mod+Shift+1 move container to workspace 1
150 bindsym $mod+Shift+2 move container to workspace 2
151 bindsym $mod+Shift+3 move container to workspace 3
152 bindsym $mod+Shift+4 move container to workspace 4
153 bindsym $mod+Shift+5 move container to workspace 5
154 bindsym $mod+Shift+6 move container to workspace 6
155 bindsym $mod+Shift+7 move container to workspace 7
156 bindsym $mod+Shift+8 move container to workspace 8
157 bindsym $mod+Shift+9 move container to workspace 9
158 bindsym $mod+Shift+0 move container to workspace 10
159 # Note: workspaces can have any name you want, not just numbers.
160 # We just use 1-10 as the default.
161#
162# Layout stuff:
163#
164 # You can "split" the current object of your focus with
165 # $mod+b or $mod+v, for horizontal and vertical splits
166 # respectively.
167 bindsym $mod+b splith
168 bindsym $mod+v splitv
169
170 # Switch the current container between different layout styles
171 bindsym $mod+s layout stacking
172 bindsym $mod+w layout tabbed
173 bindsym $mod+e layout toggle split
174
175 # Make the current focus fullscreen
176 bindsym $mod+f fullscreen
177
178 # Toggle sticky-ness of the current (floating) window
a60a7887 179 bindsym $mod+Shift+s sticky toggle
ec80f07a
AB
180
181 # Toggle the current focus between tiling and floating mode
a60a7887 182 bindsym $mod+Shift+f floating toggle
ec80f07a
AB
183
184 # Swap focus between the tiling area and the floating area
a60a7887 185 bindsym $mod+grave focus mode_toggle
ec80f07a
AB
186
187 # move focus to the parent container
188 bindsym $mod+a focus parent
b4da300f 189 bindsym $mod+Shift+a focus child
ec80f07a
AB
190#
191# Scratchpad:
192#
193 # Sway has a "scratchpad", which is a bag of holding for windows.
194 # You can send windows there and get them back later.
195
196 # Move the currently focused window to the scratchpad
197 bindsym $mod+Shift+minus move scratchpad
198
199 # Show the next scratchpad window or hide the focused scratchpad window.
200 # If there are multiple scratchpad windows, this command cycles through them.
201 bindsym $mod+minus scratchpad show
202#
203# Resizing containers:
204#
205mode "resize" {
206 # left will shrink the containers width
207 # right will grow the containers width
208 # up will shrink the containers height
209 # down will grow the containers height
210 bindsym $left resize shrink width 10px
211 bindsym $down resize grow height 10px
212 bindsym $up resize shrink height 10px
213 bindsym $right resize grow width 10px
214
215 # ditto, with arrow keys
216 bindsym Left resize shrink width 10px
217 bindsym Down resize grow height 10px
218 bindsym Up resize shrink height 10px
219 bindsym Right resize grow width 10px
220
221 # return to default mode
222 bindsym Return mode "default"
223 bindsym Escape mode "default"
224}
225bindsym $mod+Shift+r mode "resize"
226
227#
228# Power button
229#
230
d9241fc2 231set $mode_system System (l)ock | (e)xit sway | (s)uspend | (h)ibernate | (r)eboot | (S)hutdown
ec80f07a
AB
232mode "$mode_system" {
233 bindsym l exec swaylock, mode "default"
234 bindsym e exec swaymsg exit, mode "default"
235 bindsym s exec systemctl suspend, mode "default"
236 bindsym h exec systemctl hibernate, mode "default"
237 bindsym r exec systemctl reboot, mode "default"
238 bindsym Shift+s exec systemctl poweroff -i, mode "default"
239
240 # back to normal: Enter, Escape, or q
241 bindsym Return mode "default"
242 bindsym Escape mode "default"
243 bindsym q mode "default"
244}
245# bindsym XF86PowerOff mode "$mode_system"
246bindsym $mod+Shift+e mode "$mode_system"
d9241fc2 247bindsym XF86ScreenSaver exec swaylock
ec80f07a
AB
248
249#
250# Presentation mode
251#
252
253bindsym $mod+$mod2+p exec ([ ! -e ~/.nosleep ] && touch ~/.nosleep || rm ~/.nosleep) && killall -USR1 i3status
254
255#
256# Notifications
257#
258
259bindsym $mod+Shift+n mode notifications
260mode notifications {
261 bindsym Return exec makoctl invoke; exec makoctl dismiss; mode default
262 bindsym d exec makoctl dismiss; mode default
263 bindsym Shift+d exec makoctl dismiss -a; mode default
264
265 bindsym Escape mode default
266 bindsym q mode default
267}
268
269#
270# Screenshotting
271#
272
d9241fc2
AB
273set $mode_screenshot (a)ll | (r)egion
274mode "$mode_screenshot" {
ec80f07a 275 bindsym a exec grim $(xdg-user-dir PICTURES)/shots/$(date +'%Y-%m-%d-%H%M%S.png'); mode default
dd00d003 276 bindsym r exec grim -g "$(slurp)" $(xdg-user-dir PICTURES)/shots/$(date +'%Y-%m-%d-%H%M%S.png'); mode default
ec80f07a
AB
277
278 bindsym Escape mode default
279 bindsym q mode default
280}
d9241fc2 281bindsym Print mode "$mode_screenshot"
ec80f07a
AB
282
283#
284# Window configurations
285#
286for_window [class="mpv"] floating enable
287for_window [class="TelegramDesktop"] floating enable
288for_window [app_id="pavucontrol"] floating enable
289for_window [app_id="meld"] floating enable
290for_window [app_id="nm-connection-editor"] floating enable
291
292set $blue #285577
293set $gray #1e1f21
294set $red #900000
295
296#
297# Status Bar:
298#
299# Read `man 5 sway-bar` for more information about this section.
300bar {
301 position bottom
302 colors {
303 background $gray
304 inactive_workspace $gray $gray #888888
305 active_workspace $gray $gray #ffffff
306 urgent_workspace $red $red #ffffff
307 focused_workspace $blue $blue #ffffff
308 }
24a58497 309 status_command i3status | my-i3status
ec80f07a
AB
310}
311
312client.focused $blue $blue #ffffff $blue $blue
313client.unfocused $gray $gray #ffffff $gray $gray
314client.focused_inactive $gray $gray #ffffff $gray $gray
315
b25452ae
AB
316# font pango: DejaVu Sans Mono 9
317font pango: Source Code Pro 9.5
ec80f07a
AB
318
319# get rid of title bars
320default_border pixel 4
321
322exec xrdb .Xresources
323# exec pgrep -x "systemd-inhibit" || \
324# systemd-inhibit --what=handle-power-key --who=aminb \
325# --why="Handle power button in sway" sleep infinity
326exec mako 2>&1 >/tmp/mako.log
b25452ae 327#exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
ec80f07a
AB
328
329include /etc/sway/config.d/*
330include ~/.config/sway/`hostname`
331
332exec systemd-notify --ready || true