:.: wayland/sway on openbsd

A while ago, I went to Japan and after completing a risky job, I bought a beautiful NEC Lavie that weighs around 900 grams. It's absolutely stunning.

Sad thing is that the laptop is very slow for daily use now and the battery lasts around just 3 hours (my x395 lasts up to six), but I totally love it and I like to use it a lot. So it's my testing laptop and I carry it for short trips. Since it's not a critical machine, I decided to try wayland/sway on it.

For the testing you just need to install wayland/sway and dmenu and setup wayland/sway. I never used i3 so my setup will be very basic, the point of the article is to let you know (and myself) that you can use Wayland on OpenBSD.

$ doas pkg_add sway dmenu
...
MAGIC
...
$

In order to use wayland/sway, we must stop xenodm. wayland/sway comes with a script that you will find in /usr/local/bin/startsway.sh. Before running the script, let's stop xenodm and set up wayland/sway a bit:

$ doas rcctl stop xenodm
## if you want it down for good
$ doas rcctl disable xenodm
$ cat .config/sway/config
input * {
    xkb_layout "jp"
}

input type:touchpad {
    tap enabled
    natural_scroll enabled
}

set $mod Mod4
font terminus 8
floating_modifier $mod
bindsym $mod+Shift+q kill
bindsym $mod+Shift+t exec st
bindsym $mod+d exec dmenu_run
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal
bindsym $mod+Ctrl+h split h
# split in vertical
bindsym $mod+v split v
# fullscreen mode
bindsym $mod+f fullscreen toggle
# change container layout
bindsym $mod+q layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent 
bindsym $mod+a focus parent
# switch to wks
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to wks
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# reload the conf
bindsym $mod+Shift+c reload
# restart sway
bindsym $mod+Shift+r restart
# exec ff
bindsym $mod+Shift+i exec "firefox"
bar {
    ## I need to work on this, the output looks
    ## broken...
    status_command /home/gonzalo/bin/termbar
    position top
}

bindsym $mod+Shift+f mode "$mode_system"

Now after the modifications (you should double check the conf to adjust it to your needs of course) we can run the script and you should end up in something like this:

wayland/sway

You might want to install st, slock if you don't want to use xterm, anyway it should work. I didn't tried a lot or much deep into all the options, but so far it works for me YouTube on Firefox and I played a few videos with mpv, even my termbar works without any issue.

I still need to test much more, but the current state looks pretty solid to try out some stuff and slowly use it as daily driver.