Skip to content

Install Sway on Debian

From a base system just with standard system utilities

Install sway, a terminal, a lock screen app, a suspend app, statistics for the panel, brightness control, volume control, application launcher, wifi manager, browser, screensharing util, to run qt apps, image viewer, pdf viewer, screenshot app.

apt install sway foot swaylock swayidle i3status brightnessctl pavucontrol wofi network-manager firefox-esr xdg-desktop-portal-wlr qtwayland5 imv zathura spectacle  

Set the config files

mkdir -p ~/.config/sway  
cp /etc/sway/config ~/.config/sway/config  

Now for the config file

vim ~/.config/sway/config  

Set the keyboard by adding

input * {  
    xkb_layout "pt"  
}  

Set an exit dialog by adding

# exit dialogue
set $mode_system System (e) xit, (s)leep, (r) eboot, (p) oweroff  
mode "$mode_system" {  
    bindsym e exec swaymsg exit, mode "default"  
    bindsym r exec systemctl reboot, mode "default"  
    bindsym p exec systemctl poweroff, mode "default"  
    bindsym s exec systemctl suspend, mode "default"  

    # back to normal: Enter or Escape
    bindsym Return mode "default"  
    bindsym Escape mode "default"  
}  

bindsym $mod+Shift+x mode "$mode_system" # shortcut to exit the system  

Set the i3status by adding

status_command i3status  

To the "bar" function

Set the control for brightness and volume by adding

#
# Volume control
#
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%  
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%  
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle  
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle  

#
# brightness
#
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-  
bindsym XF86MonBrightnessUp exec brightnessctl set +5%  

To set the aplicatoin laucher replace

set $menu dmenu_path | dmenu | xargs swaymsg exec --  

by

set $menu wofi --show run | xargs swaymsg exec --  

Now for the .bashrc add the lines

export XDG_RUNTIME_DIR=/run/user/$(id -u) # needed to start the environment  
export MOZ_ENABLE_WAYLAND=1 # for firefox  
export XDG_SESSION_TYPE=wayland  
export GDK_BACKEND=wayland  
export QT_QPA_PLATFORM=wayland  

# automatically login into sway
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then  
  exec sway  
fi  

To avoid netowrk conflicts and the NetworkManager can do its work

sudo mv /etc/network/interfaces /etc/network/interfaces.bac  

Reboot