All in on Sway with Guix

TLDR Notes on what I have installed, and how-to fix things.

So, as the title says - all-in. Posted an initial screenshot on Mastodon.

I’m coming from LXQt which I was quite happy with, but after years of making desktops work, I’ve come to wonder what a desktop really needs; Turns out it doesn’t need much - in fact, for the most part, it needs less. That being said, here it goes:

Configuration

I haven’t cleaned this up yet and might come-back later to supply more info; It’s just an excerpt to get you started. Refer to Sway with Wayland on PantherX OS to try this in A VM instead.

This is based on PantherX OS but you can easily replicate this on guix.

System

;; PantherX OS Server Configuration with SWAY Desktop Environment

(use-modules (gnu)
             (gnu system)
             (px system panther)
       
             ;; swaylock-effects
             (gnu packages wm))

(use-service-modules xorg)

(operating-system
 (inherit %panther-os)
 (host-name "px-base")
 (timezone "Europe/Berlin")
 (locale "en_US.utf8")
 
 (bootloader 
  (bootloader-configuration
   (bootloader grub-efi-bootloader)
   (targets '("/boot/efi"))))
  
 (mapped-devices
  (list (mapped-device
         (source (uuid
                  "bf66bcde-3847-452b-a5e2-1906e5b9766d"))
         (target "cryptroot")
         (type luks-device-mapping))))
  
 (file-systems
  (append
   (list (file-system
          (device "/dev/mapper/cryptroot")
          (mount-point "/")
          (type "ext4")
          (dependencies mapped-devices))
         (file-system
          (device (uuid "14C5-1711"
                        'fat32))
          (mount-point "/boot/efi")
          (type "vfat")))
   %base-file-systems))
 
 (users
  (cons
   (user-account
    (name "panther")
    (comment "panther's account")
    (group "users")
    ;; Set the default password to 'pantherx'
    ;; Important: Change with 'passwd panther' after first login
    (password (crypt "pantherx" "$6$abc"))
    (supplementary-groups '("wheel" "audio" "video"))
    (home-directory "/home/panther"))
   %base-user-accounts))
 
 (services
  (cons*
   (service screen-locker-service-type
            (screen-locker-configuration
             (name "swaylock")
             (program (file-append
                       swaylock-effects
                       "/bin/swaylock"))
             (using-pam? #t)
             (using-setuid? #f)))
   
   (service greetd-service-type
            (greetd-configuration
             (greeter-supplementary-groups
              (list "video" "input" "users"))
             (terminals
              (list
               (greetd-terminal-configuration
                (terminal-vt "1")
                (terminal-switch #t)
                (default-session-command
                  (greetd-wlgreet-sway-session)))
               (greetd-terminal-configuration
                (terminal-vt "2"))
               (greetd-terminal-configuration
                (terminal-vt "3"))
               (greetd-terminal-configuration
                (terminal-vt "4"))
               (greetd-terminal-configuration
                (terminal-vt "5"))
               (greetd-terminal-configuration
                (terminal-vt "6"))))))
   
   %panther-desktop-services-minimal))

 (packages 
  (cons* sway
  %panther-desktop-packages)))

If you want to see a more complete example, here’s my current system configuration.

Sway

Here’s the related sway config, for use at ~/.config/sway/config

Manual Fixes

Network Manager

I had issues running nmtui; Here’s how to fix it:

TERM=foot nmtui

Foot: Unknown Terminal

When you use sudo or ssh to another host with foot, you might get an error about unknown terminal. This fixes it temporarily:

TERM=xterm nano

You could also use alacritty and others instead of foot for now.

Scaling: Blurry Applications

Chrome
  1. chrome://flags/
  2. ozone-platform-hint -> ‘wayland’
VScode & Code
cp /home/franz/.guix-profile/share/applications/vscode.desktop ~/.local/share/applications
cp /home/franz/.guix-profile/share/applications/vscodium.desktop ~/.local/share/applications

Modify entry from (example):

[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/gnu/store/3m7yfw3v9adlhysa36w5vfl2v6swfgvl-vscode-1.84.2/opt/vscode/bin/code
Icon=vscode
Type=Application
StartupNotify=true
StartupWMClass=Code
Categories=TextEditor;Development;IDE;
Actions=new-empty-window;
Keywords=vscode;

to

[Desktop Entry]
Name=Visual Studio Code WAYLAND
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/gnu/store/3m7yfw3v9adlhysa36w5vfl2v6swfgvl-vscode-1.84.2/opt/vscode/bin/code --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland
Icon=vscode
Type=Application
StartupNotify=true
StartupWMClass=Code
Categories=TextEditor;Development;IDE;
Actions=new-empty-window;
Keywords=vscode;

The WAYLAND is entirely optional; Important are the additional arguments. Of course you’ll have to update these, with every related update; I tried using ~/.guix-profile path but it crashes right away.

If code crashes:

  • start without args, change setting window.titleBarStyle from native to custom, then try again (crashes with 2x or more windows)
  • OR change startup args to only –enable-features=WaylandWindowDecorations
Electron in general

Found this on the Arch Wiki, but doesn’t seem to have any effect eventhough the Electron release matches.

Path: ~/.config/electron25-flags.conf

--enable-features=WaylandWindowDecorations
--ozone-platform-hint=auto

Path: ~/.config/electron13-flags.conf

--enable-features=UseOzonePlatform
--ozone-platform=wayland

Not clear whether these work though; VSCode is Electron 25 but these don’t apply.

Keyboard

Check the name of a key with wev, to assign shortcuts.

Display

I have two display’s, and I want them to turn on/off automatically.

Path: ~/.config/kanshi/config

profile {
        output eDP-1 disable
        output DP-2 mode 2560x1440 position 0,0 scale 1.5
}

profile {
        output eDP-1 enable mode 2560x1440 position 0,0
}

Theme

Path: .config/gtk-3.0/settings.ini

I still had an old, theme file:

# Created by lxqt-config-appearance (DO NOT EDIT!)
[Settings]
gtk-theme-name = Breeze-Dark
gtk-icon-theme-name = breeze-dark
# GTK3 ignores bold or italic attributes.
gtk-font-name = IBM Plex Sans 9
gtk-menu-images = 1
gtk-button-images = 1
gtk-toolbar-style = GTK_TOOLBAR_BOTH
gtk-cursor-theme-name = Paper
gtk-cursor-theme-size = 30

Adjusted to this:

[Settings]
gtk-theme-name = Yaru
gtk-application-prefer-dark-theme = 1
gtk-cursor-theme-name = Yaru
gtk-cursor-theme-size = 30
gtk-icon-theme-name = Yaru
gtk-fallback-icon-theme = gnome
gtk-font-name = IBM Plex Sans 9
gtk-xft-antialias = 1
gtk-enable-animations = true
gtk-button-images = 1
gtk-menu-images = 1
gtk-toolbar-style = GTK_TOOLBAR_BOTH

Found another here:

Path: ~/.gtkrc-2.0

# Created by lxqt-config-appearance (DO NOT EDIT!)
gtk-theme-name = "Breeze-Dark"
gtk-icon-theme-name = "breeze-dark"
gtk-font-name = "IBM Plex Sans 9"
gtk-button-images = 1
gtk-menu-images = 1
gtk-toolbar-style = GTK_TOOLBAR_BOTH
gtk-cursor-theme-name = Paper
gtk-cursor-theme-size = 30

Adjusted to this:

gtk-theme-name = "Yaru"
gtk-icon-theme-name = "Yaru"
gtk-font-name = "IBM Plex Sans 9"
gtk-button-images = 1
gtk-menu-images = 1
gtk-toolbar-style = GTK_TOOLBAR_BOTH
gtk-cursor-theme-name = "Yaru"
gtk-cursor-theme-size = 30
Dark theme for Gnome-apps
guix package -i glib:bin
gsettings set org.gnome.desktop.interface color-scheme prefer-dark
Installed Icons

Here’s where you can find what’s available:

$ ls /run/current-system/profile/share/icons/
ePapirus/
ePapirus-Dark/
handhelds/
hicolor/
HighContrast/
Paper/
Paper-Mono-Dark/
Papirus/
Papirus-Dark/
Papirus-Light/
redglass/
whiteglass/
Yaru/
Yaru-bark/
Yaru-bark-dark/
Yaru-blue/
Yaru-blue-dark/
Yaru-dark/
Yaru-magenta/
Yaru-magenta-dark/
Yaru-mate/
Yaru-mate-dark/
Yaru-olive/
Yaru-olive-dark/
Yaru-prussiangreen/
Yaru-prussiangreen-dark/
Yaru-purple/
Yaru-purple-dark/
Yaru-red/
Yaru-red-dark/
Yaru-sage/
Yaru-sage-dark/
Yaru-viridian/
Yaru-viridian-dark/

Flatpak

To have Flatpak-installed application show-up in bemenu, add this to ~/.profile:

source ~/.guix-profile/etc/profile.d/flatpak.sh

Mounting stuff

Just drop this in your sway config

udiskie

It’s your friend; even for encrypted stuff.

SSH

If you don’t want to enter your SSH key every time, add this to ~/.bashrc:

eval `keychain --eval --agents ssh your_ssh_key_name`

It looks for the key in ~/.ssh/your_ssh_key_name, and when you open a new terminal, it should look like this:

 * keychain 2.8.5 ~ http://www.funtoo.org
 * Found existing ssh-agent: 14412
 * Known ssh key: /home/franz/.ssh/your_ssh_key_name

Suspend

For quick suspend via bemenu, I created a desktop file .local/share/applications/suspend.desktop:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=loginctl suspend
Name=Suspend
Comment=Suspend PC
Icon=application-exit
NoDisplay=false
Categories=Utilities;System

Of course you can do this for other things like lock, shutdown, …

File Manager

I just prefer a GUI for now; both thunar (Xfce) and nautilus (Gnome) work good, others should as well.

Audio

I finally replaced ALSA and Pulseaudio with pipewire; Thanks to guix home this is really easy. Here’s how this looks like:

file on GitHub


This is hardly final, or perfect. Good luck :)

Update: 2024-06-01

Linked to files on GitHub; added notes on pipewire.

Update: 2025-03-10

Updated system configuration example, point links to newer versions.