Sway on the Framework Laptop 12

I am using Sway on the Framework Laptop 12. This thread is for people to share tips.

Tablet mode

I recently commented, “I installed a virtual keyboard wvkbd. Then I need to set up the auto-rotation, and may add some buttons on Waybar.” on this thread. And here is an update. I customized the wvkbd, changing the keyboard size and font. I set up the auto-rotating display. I added the buttons “Apps” to toggle a menu to launch apps, “Close” to close the current focused window, and “Virt Kbd” to toggle a virtual keyboard.

You can check the details below.

Custom power button

I customized the power key to suspend by pressing the button and power off by long-pressing the button. Because the power key was set to power off when pressing the button by default on Sway. You can check the details below.

I will update the page when I update my configs on Framework Laptop 12.

10 Likes

I updated the above screenshots with the transparent virtual keyboard.

I found a cool keyboard layout such as standard US keyboard layout of wvkbd and menu bar (waybar?) on a tiling window manager for a screenshot on the first comment on the following page. It seems that the left top 2 buttons are to launch apps and virtual keyboard.

I sent the following pull request to the wvkbd project. Stay tuned!

The above pull request was merged. Now Wvkbd (wvkbd-deskintl program) has a US International English-based full keyboard layout. I also added 3 buttons to toggle the virtual keyboard (wvkbd-deskintl), to launch apps, and to close the focused window on the Waybar at the top left. The screenshots are below.

Landscape

Portrait

1 Like

I created my customized layout sets of the wvkbd. One of the layout sets is a 44-key ortholiner split keyboard layout. The photo is below.

My repository with the layout sets is below.

You can customize the layout by the following steps:

  1. Fork my repository junaruga/wvkbd-contrib.
  2. Create the layout/your_layout_name directory, and create some header files. The https://github.com/jjsullivan5196/wvkbd’s *.deskintl.h, and https://github.com/junaruga/wvkbd-contrib/'s layout/split/*.h may be useful to check to create your layout.
  3. Run the make LAYOUT=your_layout_name.
  4. Run the ./wvkbd-your_layout_name.
6 Likes

This is great, thanks for all the work! I was already worrying about the usefullness of tablet mode because switching away from sway wasn’t an option for me

1 Like

I am glad you like my contributions. I am motivated to contribute something to make a compact device use case with a touchscreen mature in Linux. This was one of the things that I wanted to do with the Framework Laptop 12.

There are the following 2 fun challenges in the Framework Laptop 12’s tablet mode with Sway, as far as I know.

Screen lock with virtual keyboard

This topic is discussed at the What Desktop Environment are you using with your FW12? - #14 by junaruga. Maybe it is possible by using the gtklock, gtklock-virtkb-module, or sway-lock-mobile mentioned on the linked thread. However, we may need some contributions to the swaylock or gtklock project to make the use case of the virtual keyboard for screen lock more useful and consumable.

Gestures on touchscreen

Sway has the bindgesture syntax. However, it only supports a touchpad, and it doesn’t support a touchscreen for now. There are the following issue tickets for that.

For example, the following sway config to enable 3-finger swipe up/down to show/hide the virtual keyboard wvkbd only works for touchpad gestures. For the ~/script/control_wvkbd.sh, you can check my framework-laptop-config repository.

# 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

Someone reported the gesture app lisgd worked for the touchscreen. So, I plan to try the app.

I updated the following wiki page, adding the above topics.

2 Likes

I tried the lisgd on my Framework Laptop 12. It works for the touchscreen! I wrote the instructions below. The lisqd supports gestures in specific areas of the edges and corners.

1 Like

If you have the time, I wrote an application to handle rotation on Hyprland that should work for Sway as well. (rotates the monitor, touch, and pen support)

Maybe give it a whirl and see if it does work on Sway? I have only guessed that it would.

@junaruga thanks for your work on wvkbd! I was wondering if there are some events you can hook into that would listen to the hinge turning? Maybe you know

I would really like to enable iio-hyperland only when I have the device flipped around.

Are you talking about the display-rotating events, right? The monitor-sensor command can listen to the events. The command is in the iio-sensor-proxy RPM package on Fedora Linux.

$ sudo dnf install iio-sensor-proxy

Then I am using the following script to auto-rotate the display, hooking the events on Sway. Note that swaymsg output is Sway’s command.

You need to install the mawk command to run the script.

$ sudo dnf install mawk

If you are using Hyprland, you can check the following thread to find the equivalent script or program on Hyprland.

1 Like