Skip to content

Instantly share code, notes, and snippets.

@loukamb
Last active February 4, 2025 21:49
Show Gist options
  • Save loukamb/cb02dd4562470c49e15126e4f13b9065 to your computer and use it in GitHub Desktop.
Save loukamb/cb02dd4562470c49e15126e4f13b9065 to your computer and use it in GitHub Desktop.
Arch Linux - labwc

Quick personal cheat sheet for setting up a sane, useful instance of the labwc window manager on Arch Linux. These are my own personal notes and will not work on your computer without adjustment.

Setup (chroot after minimal install)

# Use archinstall to create a minimal Arch installation first. Chroot after installation is done.
archinstall

# Set parallel downloads to 25
nvim /etc/pacman.conf

# Setup ALHP optimized mirrors.
sudo -u louka mkdir -p /home/louka/Scratch
cd /home/louka/Scratch
sudo -u louka git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
sudo -u louka makepkg -si
sudo -u louka yay -s alhp-mirrorlist alhp-keyring
nvim /etc/pacman.conf # Add core-x86-64-v3, extras-x86-64-v3 providers
pacman -Syu

# Remove "kms" hook from HOOKS=..., add "plymouth" after udev hook.
nvim /etc/mkinitcpio.conf

# Add "quiet splash" to the kernel commandline parameters.
nvim /etc/kernel/cmdline

# Install headers for the kernel.
pacman -S linux-zen-headers

# Install plymouth.
pacman -S plymouth

# Install nvidia drivers. "nvidia-utils" disables nouveau!
pacman -S nvidia-open-dkms nvidia-utils

# Install my basic packages.
pacman -S --needed wget curl unzip neovim meson sassc clang llvm zig nodejs npm ufw ffmpeg yt-dlp noto-fonts noto-fonts-cjk noto-fonts-emoji gnome-keyring libsecret firefox

# Install lightdm for our display manager.
pacman -S lightdm lightdm-gtk-greeter
nvim /etc/lightdm/lightdm.conf # Set the greeter session to "lightdm-gtk-greeter".
systemctl enable lightdm

# Install labwc-related packages.
pacman -S labwc kanshi mako foot grim slurp swaybg waybar dex thunar archlinux-xdg-menu wl-clipboard wlr-randr xdg-desktop-portal-wlr

# Setup ufw.
systemctl enable ufw
ufw default deny incoming
ufw default allow outgoing

# Create storage directories.
mkdir /storage /storage2 /storage3
chown louka /storage /storage2 /storage3

# Install my software
pacman -S inkscape libreoffice-fresh obs-studio kdenlive krita file-roller

# We're (almost) done! Exit chroot, reboot, and create the files below in TTY. Reboot, and complete.
exit
systemctl reboot

Files

/etc/crypttab

Append:

storage UUID=6ddca5d7-0a76-4de1-8c41-4c692f0d87c8 none luks

/etc/fstab

Append:

UUID=d06cc6ee-44ad-4d20-be35-42a8a6ccedae /storage2 xfs defaults 0 2
UUID=e3e5212e-b13b-448e-bd2b-19e67f3f3c83 /storage3 xfs defaults 0 2
/dev/mapper/storage /storage xfs defaults 0 2

~/screenshot.sh

slurp | grim -g - - | wl-copy

~/.config/labwc/autostart

dex -a &
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
eval $(gnome-keyring-daemon --start)
export SSH_AUTH_SOCK

waybar &
mako &
kanshi &
swaybg -i "/storage/MEGA/Pictures/Wallpapers/Dropped Image (6).png" &

~/.config/labwc/environment

GTK_THEME=Adwaita-dark
QT_SCALE_FACTOR=2
XKB_DEFAULT_LAYOUT=us,ca(fr)
XKB_DEFAULT_OPTIONS=grp:win_space_toggle

~/.config/labwc/rc.xml

<?xml version="1.0" ?>
<labwc_config>
	<resistance>
		<windowEdgeStrength>80</windowEdgeStrength>
		<screenEdgeStrength>80</screenEdgeStrength>
	</resistance>
	<keyboard>
    		<default />
    		<keybind key="C-Space">
			<action name="Execute" command="wofi --show drun --gtk-dark --allow-images" />
		</keybind>
		<keybind key="C-A-t">
			<action name="Execute" command="foot" />
		</keybind>
		<keybind key="Print">
			<action name="Execute" command="/home/louka/screenshot.sh" />
		</keybind>
		<keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <command>pactl set-sink-volume @DEFAULT_SINK@ +5%</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <command>pactl set-sink-volume @DEFAULT_SINK@ -5%</command>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <command>pactl set-sink-mute @DEFAULT_SINK@ toggle</command>
      </action>
    </keybind>
	</keyboard>
	<theme>
		<name>Adwaita-Labwc-dark</name>
		<dropShadows>yes</dropShadows>
		<cornerRadius>4</cornerRadius>
    		<font name="Noto Sans" size="10" />
		<titlebar>
			<layout>icon:iconify,max,close</layout>
			<showTitle>yes</showTitle>
		</titlebar>
	</theme>
</labwc_config>

~/.config/labwc/menu.xml

<?xml version="1.0" ?>
<openbox_menu>
	<menu id="root-menu" label="">
		<menu id="applications" label="Applications" execute="xdg_menu --format openbox3-pipe --root-menu /etc/xdg/menus/arch-applications.menu" />
		<separator/>
		<item label="Firefox">
			<action name="Execute" command="firefox" />
		</item>
		<item label="Files">
			<action name="Execute" command="thunar" />
		</item>
		<item label="Terminal">
			<action name="Execute" command="foot" />
		</item>
		<item label="Reconfigure">
                        <action name="Reconfigure" />
                </item>
		<item label="Exit">
			<action name="Exit" />
		</item>
	</menu>
</openbox_menu>

~/.config/waybar/config

{
    "layer": "top",
    "position": "bottom",
    "height": 42,
    "spacing": 0,
    "modules-left": [],
    "modules-center": ["wlr/taskbar"],
    "modules-right": ["tray", "pulseaudio", "clock"],
    
    "wlr/taskbar": {
        "format": "{icon}",
        "icon-size": 24,
        "tooltip-format": "{title}",
        "on-click": "activate",
        "on-click-middle": "close",
        "rewrite": {
            "Firefox Web Browser": "Firefox",
            "Foot Server": "Terminal"
        }
    },

    "tray": {
        "icon-size": 18,
        "spacing": 10
    },

    "clock": {
        "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
        "format": "{:%I:%M %p}",
        "format-alt": "{:%Y-%m-%d}"
    },
	
    "pulseaudio": {
        "format": "{icon}",
        "format-muted": "πŸ”‡",
        "format-icons": {
            "headphone": "🎧",
            "hands-free": "🎧",
            "headset": "🎧",
            "phone": "πŸ“±",
            "portable": "πŸ“±",
            "car": "πŸš—",
            "default": ["πŸ”ˆ", "πŸ”‰", "πŸ”Š"]
        },
        "on-click": "pavucontrol",
        "tooltip": true,
        "tooltip-format": "{volume}%",
        "scroll-step": 5.0,
        "max-volume": 100,
        "smooth-scrolling-threshold": 1.0
    }
}

~/.config/waybar/style.css

* {
    border: none;
    border-radius: 0;
    font-family: "Noto Sans", "Font Awesome 6 Free", "Font Awesome 6 Brands";
    font-size: 13px;
    min-height: 0;
}

window#waybar {
    background: #1e1e1e;
    color: #ffffff;
    border-bottom: 1px solid #2b2b2b;
}

#taskbar button {
    padding: 0 5px;
    background: transparent;
    color: #ffffff;
    border-bottom: 2px solid transparent;
}

#taskbar button:hover {
    background: rgba(0, 0, 0, 0.2);
    box-shadow: inherit;
    border-bottom: 2px solid #ffffff;
}

#taskbar button.active {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid #ff79c6;
}

#clock,
#pulseaudio,
#tray {
    padding: 0 10px;
    color: #ffffff;
}

#tray > .passive {
    -gtk-icon-effect: dim;
}

#tray > .needs-attention {
    -gtk-icon-effect: highlight;
    background-color: #eb4d4b;
}

#pulseaudio.muted {
    color: #eb4d4b;
}

~/.config/kanshi/config

profile {
	output DP-3 scale 2 position 0,0
	output HDMI-A-1 scale 2 position 1920,0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment