Sway

In 2015 I already made a post about sway. Now with the recent 1.0 release it’s time for another one.

sway 1.0

sway is available on the OpenBuildService for openSUSE since August 2015. And on March 12th I updated the package to the 1.0 release, which happened one day earlier.

I packaged all the RCs that lead up to the final release too, to be sure everything works as expected.

When packaging I asked the devs about a proper ChangeLog file which lead to the annotated git tags that they now use. And a small changes to sway, swaylock and swayidle for better versioning. Along with some other nitpicks about scdoc which were solved on IRC.

In the beginning of sway it shipped with swaylock included, and in the latest release it got split out. When I looked around I found a coupe of more nice to have programs, namely:

I packaged all of them and put them in the X11:Wayland devel project for openSUSE. Along with an update to wlroots all those went into openSUSE:Factory when sway 1.0 got released. After legal review and basic checks it landed in openSUSE Tumbleweed. The safest, fastest, and overall nicest rolling release distribution out there ;-)

I also packaged bemenu, a dmenu replacement for Wayland, but it doesn’t work very well. I guess many sway users will want to use fzf anyways, which we also have in openSUSE Tumbleweed. For people who prefer rofi, like you probably know from my post from 2015, we have that too. Though there are some quirks on Wayland.

wl-roots, is also avilable on OBS but its maintainer didn’t push it to Tumbleweed yet.

So let’s get those:

sudo zypper in sway grim mako slurp swayidle swaylock waybar

Like described on the sway wiki I have the following in my .zshrc to launch sway automatically when I log in at TTY1:

if [ "$(tty)" = "/dev/tty1" ]; then
  exec sway
fi

You guys don’t need to worry about the same security issue that we had when launching an X11 window manager like i3 via TTY, where someone could just kill the WM and then access your terminal. In the case of Wayland this is different.

On a fresh install you then copy the default config in your home: cp /etc/sway/config ~/.config/sway and customize it.

I put an exec mako and exec waybar at the end of it to launch the notifaction daemon and the bar. Along with some color and border changes.

Look at the waybar wiki to learn how to configure waybar. I just got the default config mentioned there and tweaked it:

mkdir -p ~/.config/waybar
wget https://raw.githubusercontent.com/Alexays/Waybar/master/resources/config -O ~/.config/waybar/config
vi ~/.config/waybar/config

If you want to use swaylock and swayidle to automatically lock your screen you might want to add something similar to the following to your sway config

exec swayidle -w timeout 120 'swaylock -f -c 000000' timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -f -c 000000'

To make a screenshot use slurp and grim together: slurp | grim -g - screenshot.png
Emersion has a nice example on how to bind it to a kay and name the screenshot with the current date/time which you can see in his dotfiles:

bindsym $mod+g exec grim $(xdg-user-dir PICTURES)/$(date +'%Y-%m-%d-%H%M%S_grim.png')
bindsym $mod+Shift+g slurp | grim -g - $(xdg-user-dir PICTURES)/$(date +'%Y-%m-%d-%H%M%S_grim.png')