[TRACKING] Sway / i3 WM on Framework

I am using i3 window manager on Fedora 35. Though this thread is about Ubuntu. Maybe the content could be similar between Ubuntu and Fedora. So let me post here.

Based on this setting about Media keys: Sway / i3 WM on Framework - #6 by Chiraag_Nataraj and other comments, I created my own.

Note I checked each media key’s symbol by xev -event keyboard. For print screen key, I am using gnome-screenshot command as I also have Gnome environment. To use mpc, you need to install mpd from RPMFusion. I haven’t tested the mpc settings by myself.

# Media keys
# $ xev -event keyboard
# Use pactl.
# Framework Laptop F1: XF86AudioMute
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
# Framework Laptop F2: XF86AudioRaiseVolume
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +10%
# Framework Laptop F3: XF86AudioLowerVolume
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -10%
# Use mpc (Music Playing Client) and mpd (Music Playing Daemon) from RPM Fusion.
# https://fedoramagazine.org/playing-music-on-your-fedora-terminal-with-mpd-and-ncmpcpp/
# Framework Laptop F4: XF86AudioPrev
bindsym XF86AudioPrev exec mpc prev
# Framework Laptop F5: XF86AudioPlay
bindsym XF86AudioPlay exec mpc toggle
# Framework Laptop F6: XF86AudioNext
bindsym XF86AudioNext exec mpc next
# Framework Laptop F7: XF86MonBrightnessDown
# The --min-value option is important to prevent the complete darkness.
bindsym XF86MonBrightnessDown exec "brightnessctl --device intel_backlight --min-value=5 set 5%-"
# Framework Laptop F8: XF86MonBrightnessUp
bindsym XF86MonBrightnessUp exec "brightnessctl --device intel_backlight set 5%+"
# Framework Laptop F9: Super_L + p
# TODO: Assign this multiple screen key with the toggle multiple screens when using it.
# https://fedoramagazine.org/using-i3-with-multiple-monitors/
bindsym $mod+p exec firefox https://fedoramagazine.org/using-i3-with-multiple-monitors/
# Framework Laptop F10: XF86RFKill (already available)
# $ rfkill list all
# $ nmcli radio all
# Framework Laptop F11: Print
# https://unix.stackexchange.com/questions/497897/print-screen-key-in-i3
bindsym Print exec gnome-screenshot -i
# Framework Laptop F12: XF86AudioMedia
bindsym XF86AudioMedia exec firefox https://community.frame.work/
3 Likes

Seeing the GitHub repository of i3 and sway, sway has more stars than i3. But both seems well-maintained. I have been using i3 on my ThinkPad Carbon, and now customizing the i3 on my Framework Laptop.

This Youtube video Tiling Window Management and i3wm config additions introducing i3 is informative. It seems the person has long experience of window managers.

And he is sharing his heavily customized i3 config at his GitHub repository.

Here is how to see it. As he stopped supporting i3, you need to check a past commit.

$ git clone https://github.com/LukeSmithxyz/voidrice.git
$ cd voidrice
$ git checkout ad161d9363aadeb9f4ec3c852ca6c96162f2b4b0
$ vi .config/i3/config

This person’s Youtube play list about Minimalist software looks nice.

1 Like

My experience in general is that Sway works better than i3 on the Framework Laptop, but both work. I have noticed better performance on swap and zero tearing.

The cool thing about i3 and sway is that sway was designed to be a drop in replacement for it. It is i3 for Wayland basically. So your i3 config will work with Sway, with perhaps minimal updates.

2 Likes

Thanks for the info. After checking both sway and i3’s GitHub repositories and Wikipedia pages, sway is on Wayland and completely written in C. The performance might be better in C. And i3 is on X-Window system written in C + some script languages. And the Wayland looks more modern than X Window system. Maybe I will try sway.

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 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