Framework Laptop 12 tablet mode on Sway - junaruga/framework-laptop-config GitHub Wiki

This article is to share how to set up software to use the tablet mode on Sway on Fedora Linux on the Framework Laptop 12. I am using Fedora Linux 42 right now.

First, please check the following 2 screenshots on Sway. The first screenshot is in landscape mode, and the second screenshot is in portrait mode. And the screenshots have a virtual keyboard.

In the tablet mode, we need the following features:

  • Auto-rotating display
  • Virtual keyboard
  • Controlling window operations such as launching applications, closing windows, and toggling the virtual keyboard on Sway

I would explain how to set up to enable the features below.

Install Sway

Install the following RPMs.

$ sudo dnf install \
  sway \
  waybar \
  network-manager-applet \
  blueman \
  bemenu \
  brightnessctl

Auto-rotating display

Executing the script ~/.config/sway/script/auto_rotate_display.sh in the user-defined sway config .config/sway/config.d/00-framework-laptop-12.

https://github.com/junaruga/framework-laptop-config/blob/cbdb3dcd604b388cab26e22b2471d9187592cd00/home/.config/sway/config.d/00-framework-laptop-12#L9

I referred to the document ArchWiki - Tablet PC - Automatic Rotation - With Sway for the auto_rotate_display.sh. After setting, you need to log out and log in to Sway.

You need to install the following dependencies to run the auto_rotate_display.sh.

$ sudo dnf install mawk

Virtual keyboard

I am using wvkbd GitHub.

Install the dependencies.

$ sudo dnf install \
  cairo-devel \
  pango-devel \
  wayland-devel \
  libxkbcommon-devel \
  scdoc

Below is how to install the wvkbd with the desktop international layout. In my case, I copied the binary into the ~/bin/ directory.

$ git clone https://github.com/jjsullivan5196/wvkbd.git

$ cd wvkbd

$ make LAYOUT=deskintl

$ cp -p wvkbd-deskintl ~/bin/

I am actually using wvkbd with my customized split keyboard layout. You can check https://github.com/junaruga/wvkbd-contrib to understand how to do it.

Controlling window operations

I am using Waybar as a menu bar on Sway. The config files are here. You need to edit the .config/waybar/config and .config/waybar/style.css.

The related parts of the config file are below. I am using the custom module feature on Waybar. The document is here.

https://github.com/junaruga/framework-laptop-config/blob/cbdb3dcd604b388cab26e22b2471d9187592cd00/home/.config/waybar/config#L14

https://github.com/junaruga/framework-laptop-config/blob/cbdb3dcd604b388cab26e22b2471d9187592cd00/home/.config/waybar/config#L100-L111

.config/waybar/config

    "custom/menu": {
        "format": "Apps",
        "on-click": "~/.config/sway/script/toggle_bemenu.sh",
    },
    "custom/close_window": {
        "format": "Close",
        "on-click": "~/.config/sway/script/close_window.sh",
    },
    "custom/virtual_keyboard": {
        "format": "Virt Kbd",
        "on-click": "~/script/toggle_virtual_keyboard.sh",
    }

In the style.css, please check the parts of the #custom-menu, #custom-virtual_keyboard, and #custom-close_window CSS classes.

Screenlock with virtual keyboard

This is discussed on the following thread on the Framework forum. Maybe we can use gtklock and sway-lock-mobile.

https://community.frame.work/t/what-desktop-environment-are-you-using-with-your-fw12/74517/14

Gestures on touchscreen

Sway doesn't support gestures on the touchscreen. See https://github.com/swaywm/sway/issues/7847 and https://github.com/swaywm/sway/issues/1904.

For example, the following config with the 3-finger swipe up/down directions on sway config only works for the touchpad, and doesn't work for the touchscreen.

# Gesture to show/hide the virtual keyboard wvkvd.
# This setting is only for touchpad. The touchscreen is not supported.
# https://github.com/swaywm/sway/issues/1904
bindgesture swipe:3:up exec ~/script/control_wvkbd.sh SIGUSR2
bindgesture swipe:3:down exec ~/script/control_wvkbd.sh SIGUSR1

Use the gesture app lisgd.

How to install

$ git clone https://git.sr.ht/~mil/lisgd
$ cd lisgd

Install the dependencies.

$ sudo dnf install libinput-devel wayland-devel

Download my config file config.h to your top directory. You can modify the file.

$ wget https://raw.githubusercontent.com/junaruga/lisgd/refs/heads/wip/fl12-config/config.h

Compile and install the lisgd.

$ make
$ cp -p lisgd ~/bin/

Test

Run the lisgd with verbose mode, and test if your config.h works.

$ lisgd -v

Stop it after testing.

$ pkill lisgd

Sway config

I am adding the following config to my sway config.

https://github.com/junaruga/framework-laptop-config/blob/7bf2b801612654aa0d331929fc362be4389ab7d7/home/.config/sway/config.d/00-framework-laptop-12#L8-L9

# Run the gesture daemon lisgd.
exec ~/bin/lisgd &