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