[TRACKING] Sway / i3 WM on Framework

I am playing on Sway now on Fedora 35 on my Framework Laptop. I found Sway setting up guide on Fedora . It seems the Sway default config file /etc/sway/config has i3 compatibility + Sway specific features. Sway looks really good for people to start tiling window manager. I see Sway’s default terminal is alacritty. And this terminal is one of the best and fastest terminals nowadays watching the Youtube videos. The behaviors of i3 and Sway about tiling is a little different. I also have to migrate the X windows system config files (/etc/X11/xorg.conf.d/*.conf) for keyboard and touchpad to config in Sway or Wayland. I am learning Sway and Alacritty now. :smiley:

2 Likes

I am trying to setup Sway on Fedora 35 on the Framework Laptop (Batch 2, the BIOS version is default. Maybe 3.02). Below is the screenshot. The issue is that Firefox and Firefox’s tab, menu bar and Sway’s status bar on the top by waybar are too big. Firefox is 100% scale.

Searching this forum, I saw some threads related to resolution. On the [RESPONDED] Using elementary OS on the Framework Laptop , there is an example with xrandr. But the xrandr is not recommended on Sway.

On another thread Screen Resolution not displaying correctly on Linux Mint - #2 by Chiraag_Nataraj , I found the following comment.

I use sway as my Wayland compositor and setup fractional scaling (1.5) and it all “Just Works”.

I tried the following 3 settings in .config/sway/config, but after reloading the config ( $mod+Shift+c), nothing is changed.

output eDP1 mode 2256x1504
output eDP1 mode 3000x2000
output eDP1 scale 1.5

Could you tell me how to modify the .config/sway/config to show the display properly with thin and small title bars? Thanks.

Edited at December 29 2021: Sorry I noticed I did set wrong device ID eDP1 instead of correct ID eDP-1 seeing the output of swaymsg -t get_outputs. So, the following setting gave me a better experience.

output eDP-1 scale 1.2

@2disbetter by the way, shall we change this thread title name to a name to describe Sway / i3 common thread that is not Ubuntu specific?

1 Like

Hmm, well I started it around the context of Ubuntu 20.04 LTS specifically. Most of the information in here is specific to that distro.

But absolutely. If we make this a central thread for Sway and i3 on the Framework, that could be helpful.

1 Like

Which part on this thread is Ubuntu specific? I couldn’t find it.

Thanks for renaming the thread title!

Yeah what I meant was that I started it with that intention. I know that running sway or i3 on other distros can have other things necessary that are specific to them. (missing dependencies or repos, for example) However, I too see nothing here that is specific to Ubuntu. :+1:

OK. I understand it now. Thanks for the explanation. :ok_hand:

I replaced the word “I3” with “i3” in the title. The “i3” is the correct name, according to the i3 (window manager) - Wikipedia , Fedora i3 S.I.G. :: Fedora Docs .

1 Like

:crazy_face: whatever floats your boat. To me an I is an i whether it is capitalized or not.

Thanks though!

I’m finding Sway to be excellent, but there are things about i3 I really like and miss. Being able to hide your bar and show it only when pushing a bound key was excellent. Far better than the on / off state that waybar has. BUT apparently this functionality has been merged and we might be seeing it in a repo in a day or two.

1 Like

Are you talking about a bar setting by i3status? Personally I don’t have a need to hide the bar. So, I didn’t notice it. Sway can also use i3status for the bar setting. You meant we might be seeing the hiding feature in the repo of Sway default bar? The Sway default bar might have the feature. (man 5 sway-bar - mode hide', hidden_state hide`)

Sway is great, and the functionality is better than i3. But for the stability, i3 is better than Sway in my experience so far. I saw Firefox on Sway crashed when adding a bookmark. Alacritty still doesn’t work with a language input engine fcitx5 in my use of Japanese input.

By the way, as I finished the Sway, i3 settings on Framework for now, I would share the config files related to Sway, i3, Alacritty and Termnator on the following GitHub repository. It might be useful for someone to try it on Framework Laptop.

2 Likes

I just wanted to share the scaling and font size setting on Sway, and applications’ font size.

Sway

.config/sway/config

font pango:monospace 11
...
output eDP-1 scale 1.2

Font size

  • Firefox: DejaVu Serif: 22

  • Alacritty:

    font:
      size: 12
    
1 Like

So where are you specifically putting these settings? Still in the sway config file?

1 Like

No, the settings are not in the sway config file.

  • Firefox: I did set from the GUI Menu - Settings - General - Language & Appearance - Font & Colors

    It seems the actual settings are saved in the following file.

    ~/.mozilla/firefox/XXXXXXXX.default-release/prefs.js

    user_pref("font.name.serif.x-western", "DejaVu Serif");
    user_pref("font.size.variable.x-western", 22);
    
  • Alacritty: You can create the config file ~/.config/alacritty/alacritty.yml adding the font setting in the file. Here is my config file as a reference. In my case, importing ~/.config/alacritty/framework.yml from ~/.config/alacritty/alacritty.yml to use the common setting file alacritty.yml from both Framework and Thinkpad.

3 Likes

I’ve found the best way to handle scaling is to install sway-hidpi-git from the AUR which patches wlroots, xwayland, and sway to allow HiDPI for Xwayland as well as Wayland apps. I’ve been using it for a while now, and it’s been very reliable. Never had to set any font scales or use xrandr, just

output eDP-1 scale 1.5
output eDP-1 scale_filter smart
xwayland force scale 2
exec xsettingsd

in sway config.

As for other distros, you can compile each part of the sway stack manually to add HiDPI xwayland, I don’t think the patched versions are available pre-configured anywhere but arch.

5 Likes

Hey I’m using sway as well on the framework. Did anyone figure out how to setup the keyboard backlight. Neither light nor brightnessctl seem to find the correct led for the keyboard. Was anyone able to resolve this?

Also what @shark found out sounds pretty nice but compiling everything myself is something I may do in the future as I’m kinda happy with what I’ve got since now.

EDIT:
I just found out that it seems. That this still needs to be developed. So If I understand correctly there is no way for me to get the keyboard backlight to turn on via sway, correct?

1 Like

The Fn + Space is to change the keyboard backlight. You can see https://wiki.archlinux.org/title/Framework_Laptop#Function_keys .

2 Likes

Fail that I didn’t even tried that. I just assumed I would have to do this myself as with all the other hotkeys :smiley: Thanks!

2 Likes

Yeah, it is implemented at the bios level and so functionality for the keyboard backlight is OS independent. :+1:

4 Likes

I am running debian 11 with sway on my framework 12.

i’ll just dump my notes here so they are available for other people.

https://wiki.debian.org/InstallingDebianOn/FrameWork/12thGen

https://community.frame.work/t/debian-testing-on-the-framework-laptop/14448

# usb tethering with smartphone
ip link # find device id -> $usb
ip link set $usb up
dhclient $usb

apt install network-manager
nmtui

apt install sway
apt install xwayland
echo "export WLR_NO_HARDWARE_CURSORS=1" >> ~/.bash_profile
echo "export MOZ_ENABLE_WAYLAND=1" >> ~/.bash_profile

sway -d >sway.log 2>&1

apt install pulseaudio pavucontrol

sway status_bar
#################
david@fw:~$ vim ~/.config/sway/config 
    status_command while ~/.config/sway/status.sh; do sleep 10; done
    colors {
        statusline #779988
        background #323232
        inactive_workspace #32323200 #32323200 #5c5c5c
    }

david@fw:~$ vim ~/.config/sway/status.sh
#!/usr/bin/env bash
date_formatted=$(date "+%a %F %H:%M")
battery=`acpi  -b | cut -d ' ' -f 4`
battery=${battery%,*}
battery_status=$(cat /sys/class/power_supply/BAT1/status)
screen=`brightnessctl --device=intel_backlight --machine-readable | cut -d ',' -f 4`
temp=`sensors coretemp-isa-0000|grep 'Core 0'| cut -d ' ' -f 10`
wifi=`nmcli --terse --color=no --fields=IN-USE,SIGNAL,SSID device wifi|grep '^\*'`
wifi_ssid=`echo $wifi|cut -d':' -f3`
if [ -z "$wifi_ssid" ]; then
  wifi_status='NOT-CONNECTED'
else
  wifi_signal=`echo $wifi|cut -d':' -f2`
  wifi_status="$wifi_ssid $wifi_signal%"
fi
audio=`pactl get-sink-volume @DEFAULT_SINK@ | head -n1 | cut -d '/' -f 2`
echo Audio $audio $wifi_status $temp Screen $screen $battery_status $battery $date_formatted

david@fw:~$ chmod 744 ~/.config/sway/status.sh
2 Likes

I love Sway! Thanks!

1 Like

It should work if you install Xwayland (you’ll have to restart sway afterwards to have it recognize that xwayland is installed).

I am curious to know why using sway with XWayland is better than sway without XWayland.

1 Like