Sway install - nutthawit/alpine-dotfile GitHub Wiki
Sway is a tiling Wayland compositor and a drop-in replacement for the i3 window manager. It works with your existing i3 configuration and supports most of i3's features, plus a few extras. Read more
Install Sway
sudo apk add font-dejavu foot grim i3status sway swaybg swayidle swaylock swaylockd wl-clipboard wmenuBefore using the compositor we need to setup udev, which allows the discovery of usable graphics and input devices on the system, using the udev system daemon. Reference
eudev is a fork of udev from systemd, The goal of eudev is to obtain better compatibility with the OpenRC init system.
Setup eudev as device manager
sudo setup-devd udevWarning
If you forget this step, you can also start Sway by using WLR_LIBINPUT_NO_DEVICES=1 sway -d 2> sway.log. However, after Sway starts, you will not be able to use your keyboard and mouse.
What is a seat?
A seat is a collection of physical input/output devices (keyboard, mouse, monitor/GPU) associated with where a physical user sits, hence "seat".
If a computer serves two independent users with each their own keyboard, mouse and monitor, then it is said to be a multi-seat system. This is not particularly common.
If a computer serves multiple users from a single set of keyboard, mouse and monitor, with other user sessions suspended in the meanwhile, then it is set to be a single-seat but multi-session system.
What is seat management?
Seat management daemons like seatd, (e)logind and ConsoleKit(2) all provide a way for display servers to access input/output devices without having to be root. They also coordinate things like session switching and access revocation.
Note that ConsoleKit and (e)logind also perform other functions entirely unrelated to seat management.
Install seatd
YOUR_USER="tie"
sudo apk add seatd dbus
sudo rc-update add seatd
sudo rc-service seatd start
sudo adduser $YOUR_USER seatCreate a wrapper script to run Sway. Reference
cat << 'EOF' | sudo tee /usr/local/bin/run-sway > /dev/null
#!/bin/sh
# Session
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway
export XDG_RUNTIME_DIR=/run/user/"$(id -u $USER)"
export XDG_RUNTIME_CONFIG="${HOME}/.config"
# Wayland stuff
export MOZ_ENABLE_WAYLAND=1
export QT_QPA_PLATFORM=wayland
export SDL_VIDEODRIVER=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
# Launch Sway with a D-Bus server
dbus-run-session -- sway "$@"
EOF
sudo chmod +x /usr/local/bin/run-swayCreate a .start file to create the XDG_RUNTIME_DIR directory at system startup.
YOUR_GROUP="tie"
XDG_RUNTIME_DIR=/run/user/`id -u $YOUR_USER`
cat << EOF | sudo tee /etc/local.d/create-xdg-runtime-dir.start > /dev/null
#!/bin/sh -eu
# Delete existing directory, create a new one and set permissions
rm -rf $XDG_RUNTIME_DIR
mkdir -p $XDG_RUNTIME_DIR
chown $YOUR_USER:$YOUR_GROUP $XDG_RUNTIME_DIR
chmod 700 $XDG_RUNTIME_DIR
EOF
sudo chmod +x /etc/local.d/create-xdg-runtime-dir.start
sudo rc-update add local defaultYou can read more about /etc/local.d at https://wiki.gentoo.org/wiki//etc/local.d
Configure Sway to start automatically when logging into TTY 1.
cat << 'EOF' >> ~/.profile
# Autostart sway when login tty 1
if [ "$(tty)" = "/dev/tty1" ]; then
run-sway -d 2> ~/sway.log
fi
EOFTip
If you encounter a problem use sway -d 2> ~/sway.log to view the log
Reboot a linux machine
When your machine is back online, login with your normal user. Sway should run immediately
Important
For those who won't to use my configuration, you can create by your self:
- Copy
swaydefault configuration:doas cp /etc/sway/config ~/.config/sway/config - Copy
footdefault configuration:doas cp /etc/xdg/foot/foot.ini ~/.config/foot/foot.ini - The following shell configuration files must be copied from me:
You can now skip this topic.
Install the necessary software packages
doas apk add btop curl git lazygit stowClone dotfile repository
DF="${HOME}/.dotfile"
git clone https://github.com/nutthawit/alpine-dotfile.git $DFBefore continuing, you need to install IBMPlexMono font, as the foot terminal uses it.
Apply configure for shell, sway, foot and git
mv ~/.ashrc ~/.ashrc-old
mv ~/.profile ~/.profile-old
stow -v sh
mkdir ~/.config/sway
stow -v sway
mkdir ~/.config/foot
stow -v foot
stow -v gitApply shell configure for root
doas cp "${DF}/etc/ashrc" /etc/ashrc
doas cp "${DF}/root/.ashrc" /root/.ashrc
doas cp "${DF}/root/.profile" /root/.profile
# Verify
echo $EDITOR
# Output should be
vi