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