This note is recorded when I configure Arch Linux with sway Desktop Environment.
User #
“User” section operations are performed on the root account.
Create general user #
Add general user:
useradd -m -G wheel "user name"Set up a password:
passwd "user name"Enable Sudo #
Enable sudo on wheel group.
EDITOR=vim visudoTo allow members of group wheel sudo access:
%wheel ALL=(ALL:ALL) ALLSubsequent operations are performed by the created general user.
Network #
Resolve #
Enable resolve with systemed-resolved:
sudo systemctl start systemd-resolved.service
sudo systemctl enable systemd-resolved.service
# replace resolve.conf
sudo mv /etc/resolv.conf /etc/resolv.conf.org
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.confNetworkManager #
Install NetworkManager. Use NetworkManager instead of systemd-netwokrd for vpn connection:
sudo systemctl start NetworkManager.service
sudo systemctl enable NetworkManager.serviceDate #
Enable systemd-timesyncd:
sudo systemctl start systemd-timesyncd.service
sudo systemctl enable systemd-timesyncd.servicePacman #
Comparing versions before updating #
To see old and new versions of available packages, uncomment the VerbosePkgLists line in /etc/pacman.conf.
Enabling parallel downloads #
To download packages in parallel, uncomment the ParallelDownloads = 5 line in /etc/pacman.conf.
Coloring #
To colorize the output, uncomment the Color line in /etc/pacman.conf.
Pacman #
To Make Pacman appear in the output of pacman. Add ILoveCandy under [options] in /etc/pacman.conf.
Cleaning the package cache #
To clean the package cache, install paccache privided within the pacman-contrib:
sudo pacman -S pacman-contribEnable and start paccache.timer to discard unused packages weekly:
sudo systemctl enable paccache.timer
sudo systemctl start paccache.timerUseful packages #
Install useful packages:
sudo pacman -S git wget man-db man-pages unarchiver duf htop iotop sysstat jq neofetch rsync httpie cmakeZsh #
Install Zsh as shell:
sudo pacman -S zshChange login shell Zsh:
chsh -s /bin/zshConfigure Zsh. My Zsh config is as follows.
- ~/.zshenv
- ~/.config/zsh/.zshrc
- ~/.config/zsh/zsh_defer.zsh
- ~/.config/zsh/abbreviations
- ~/.local/bin/tmux_session.sh
Append the following line to ~/.zshenv:
# Language
export LANGUAGE="en_US.UTF-8"
export LANG="${LANGUAGE}"
export LC_ALL="${LANGUAGE}"
export LC_CTYPE="${LANGUAGE}"
# Editor
export EDITOR=vim
export CVSEDITOR="${EDITOR}"
export SVN_EDITOR="${EDITOR}"
export GIT_EDITOR="${EDITOR}"
# Pager
export PAGER=less
# zsh
export ZDOTDIR="${HOME}/.config/zsh"
export ZSH_COMPLETION_DIR="${HOME}.local/share/zsh/completion"
export PATH="${HOME}/.local/bin:$PATH"Create directories and git clone:
# zsh state directory
mkdir -p ~/.local/state/zsh
# zsh completion directory
mkdir -p ~/.local/share/zsh/completion
# zinit repository directory
mkdir -p ~/.local/share/zinit/zinit.git
# zinit clone
git clone https://github.com/zdharma-continuum/zinit.git ~/.local/share/zinit/zinit.gitXDG Base Directory #
Append the following line to ~/.zshenv:
export XDG_CONFIG_HOME="${HOME}/.config"
export XDG_CACHE_HOME="${HOME}/.cache"
export XDG_DATA_HOME="${HOME}/.local/share"
export XDG_STATE_HOME="${HOME}/.local/state"Source ~/.zshenv:
source ~/.zshenvMake XDG Base Directories:
mkdir -p $XDG_CONFIG_HOME
mkdir -p $XDG_CACHE_HOME
mkdir -p $XDG_DATA_HOME
mkdir -p $XDG_STATE_HOME
mkdir -p "${HOME}/.local/bin"
mkdir -p "${HOME}/.local/src"go #
Install go for libraries:
sudo pacman -S goAppend the following line to ~/.zshenv:
export GOPATH="${XDG_DATA_HOME}/go"
export PATH="${PATH}:${GOPATH}/bin"Source ~/.zshenv:
source ~/.zshenvAUR Helper #
Install yay as AUR Helper:
cd ~/.local/src
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -sifzf #
fzf is a general-purpose command-line fuzzy finder.
Install fzf:
# clone fzf
git clone --depth 1 "https://github.com/junegunn/fzf.git" "${XDG_DATA_HOME}/fzf"
# install fzf
"${XDG_DATA_HOME}/fzf/install" --xdg --completion --key-bindings --no-update-rc --no-bash --no-fishtmux #
tmux is a terminal multiplexer.
Install tmux:
sudo pacman -S tmuxInstall tmux plugin manager:
git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpmConfigure tmux. My tmux config is as follows.
To fetch the tmux plugins, press “tmux prefix” + I in terminal.
git #
Create ~/.config/git/config:
mkdir -p ~/.config/git
# if ~/.gitconfig exists
mv .gitconfig ~/.config/git/config
# if ~/.gitconfig does not exist
touch ~/.config/git/configSet up git:
git config --global pull.rebase false
git config --global init.defaultBranch main
# delta
git config --global delta.navigate true
git config --global delta.light false
git config --global delta.line-numbers true
# user name and mail for git
git config --global user.name "<your name>"
git config --global user.email "<your email>"
# optional
# git config --global [email protected]:.insteadOf https://github.com/Emacs #
Install Emacs:
sudo pacman -S emacs-nativecompConfigure Emacs. My Emacs config is as follows.
Vim #
Append the following line to ~/.zshenv:
export VIMINIT="set nocp | source ${XDG_CONFIG_HOME:-$HOME/.config}/vim/vimrc"Source ~/.zshenv:
source ~/.zshenvConfigure Vim. My Vim config is as follows.
RUSTUP and CARGO #
Append the following line to ~/.zshenv:
export RUSTUP_HOME="${XDG_DATA_HOME}/rustup"
export CARGO_HOME="${XDG_DATA_HOME}/cargo"
[ -d "$CARGO_HOME" ] && . "$CARGO_HOME/env"Source ~/.zshenv:
source ~/.zshenvInstall rustup:
# Make the directory for cargo
mkdir -p $CARGO_HOME
# Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path -yInstall useful packages:
"${CARGO_HOME}/bin/rustup" run stable cargo install bat fd-find ripgrep git-delta grex lsd bottom du-dust csviewghq #
ghq provides a way to organize remote repository clones.
Install ghq:
# Install ghq
go install github.com/x-motemen/ghq@latest
# Set up my ghq.root
git config --global ghq.root "${HOME}/workspace/ghq"navi #
navi is an interactive cheatsheet tool for the command-line.
Install navi:
"${CARGO_HOME}/bin/rustup" run stable cargo install naviAppend the following line to ~/.zshenv:
export NAVI_CONFIG="${HOME}/.config/navi/config.yaml"Source ~/.zshenv:
source ~/.zshenvConfigure navi. My navi config is as follows.
lazygit #
lazygit is A simple terminal UI for git commands. Install lazygit:
go install github.com/jesseduffield/lazygit@latestConfigure lazygit. My lazygit config is as follows.
Maintenance of file system #
SSD #
Enable fstrim.timer:
sudo systemctl enable fstrim.timerBtrfs #
Enable btrfs scrub:
# root(/)
sudo systemctl enable [email protected]
# /home (if mount)
sudo systemctl enable [email protected]GUI #
Display Server protocol #
Install GUI libraries for wayland:
sudo pacman -S xorg-xwayland qt5-waylandDisplay Manager #
Install lightDM as a Display Manager:
sudo pacman -S lightdm lightdm-gtk-greeterTo change LightDM background, edit /etc/lightdm/lightdm-gtk-greeter.conf and define the background variable under the [greeter] section:
[greeter]
background=/usr/share/backgrounds/archlinux/small.pngEnable lightDM:
sudo systemctl enable lightdmSway #
Install sway as a Wayland compositor:
sudo pacman -S sway swaylock swayidle swaybg waybar noto-fontsConfigure sway. My sway config is as follows.
Configure waybar. My waybar config is as follows.
Manage Sway-specific daemons with systemd.
Edit ~/.config/systemd/user/sway-session.target as follows:
[Unit]
Description=Sway compositor session
Documentation=man:systemd.special
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.targetThen, Append the following line to ~/.config/sway/config:
exec_always "systemctl --user import-environment; systemctl --user start sway-session.target"With the above line in the configuration file, whenever Sway starts, it also activates sway-session.target.
xprofile #
Edit ~/.xprofile as follows:
#!/bin/sh
export XDG_SESSION_TYPE=wayland
export XDG_CURRENT_DESKTOP=sway
export XDG_CURRENT_SESSION=sway
export LIBSEAT_BACKEND=logind
export QT_QPA_PLATFORM="wayland;xcb"
export GDK_DPI_SCALE=1
export QT_SCALE_FACTOR=1.5
export MOZ_ENABLE_WAYLAND=1
export WINIT_UNIX_BACKEND=x11
export WLR_DRM_NO_MODIFIERS=1
sleep 5Xdefaults #
Edit ~/.Xdefaults as follows:
Xft.dpi: 144
! These might also be useful depending on your monitor and personal preference:
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgbNotification #
mako is a lightweight notification daemon for Wayland. Install mako:
sudo pacman -S makoConfigure mako. My mako config is as follows.
Append the following line ~/.config/sway/config to execute mako:
exec makoClipboard #
Install wl-clipboard and clipman as a clipboard manager:
sudo pacman -S wl-clipboard
yay -S clipmanKeep secrets secret with enpass: https://www.reddit.com/r/swaywm/comments/ljl0dh/keeping_secrets_secret_with_keepassxc_clipman_and/
Make bash script ~/.config/sway/scripts/myclipman:
#!/usr/bin/env bash
app_id=$( swaymsg -t get_tree | jq -r '.. | select(.type?) | select(.focused==true) | .window_properties.class' )
if [[ $app_id != "Enpass" ]]; then
# --no-persist so that we preserve rich text:
clipman store --no-persist
fiAppend the following line to ~/.config/sway/config:
exec wl-paste -t text --watch ~/.config/sway/scripts/myclipman
bindsym Control+semicolon exec clipman pick -t rofiScreen lock #
Append the following line to ~/.config/sway/config:
exec swayidle -w \
timeout 300 'swaylock -f -C ~/.config/swaylock/config' \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
bindsym $super+Shift+l exec swaylock -f -C ~/.config/swaylock/configOpacity #
The transparent script depends on python i3ipc, so install it.
sudo pacman -S python python-pip
pip install i3ipcAppend the following line to ~/.config/sway/config:
exec /usr/share/sway/scripts/inactive-windows-transparency.py --opacity 0.8Multiple monitor #
kanshi is Automatically selector a display configuration based on connected devices.
Install kanshi:
sudo pacman -S kanshiConfigure kanshi. My kanshi config is as follows.
Link to sway-session.target and start kanshi.
Edit ~/.config/systemd/user/kanashi.service as follows:
[Unit]
Description=Dynamic output configuration for Wayland compositors
Documentation=https://sr.ht/~emersion/kanshi
BindsTo=sway-session.target
[Service]
Type=simple
ExecStart=/usr/bin/kanshi
[Install]
WantedBy=sway-session.targetIf multiple monitors, enable kanshi:
systemctl --user enable kanshi.serviceCustom keybindings #
Append the following line to ~/.config/sway/config:
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +1%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -1%
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec brightnessctl set 5%+
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previousScreen shot #
Install grim and slurp:
sudo pacman -S grim slurpAppend the following line to ~/.config/sway/config:
bindsym $super+Shift+2 exec /usr/share/sway/scripts/grimshot --notify save window $HOME/Downloads/screenshot_$(date "+%y%m%d%H%M%S").png
bindsym $super+Shift+3 exec /usr/share/sway/scripts/grimshot --notify save output $HOME/Downloads/screenshot_$(date "+%y%m%d%H%M%S").png
bindsym $super+Shift+4 exec /usr/share/sway/scripts/grimshot --notify save area $HOME/Downloads/screenshot_$(date "+%y%m%d%H%M%S").pngBacklight #
Install brightnessctl:
sudo pacman -S brightnessctlExternal monitor #
Install ddcci-driver-linux-dkms to expose external monitors in sysfs:
yay -S ddcci-driver-linux-dkmsLoad ddcci kernel module:
sudo vim /etc/modules-load.d/ddcci.conf
# /etc/modules-load.d/ddcci.conf
ddcciFont #
Noto font #
Install Noto font:
sudo pacman -S noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extraAwesome font #
Install Awesome font:
sudo pacman -S ttf-font-awesomeCica font #
Install Cica font as a programming font.
Download latest Cica font:
wget https://github.com/miiton/Cica/releases/download/v5.0.3/Cica_v5.0.3.zipExtract zip file:
unar Cica_v5.0.3.zip -D -o "${XDG_DATA_HOME}/fonts/Cica"Update font cache:
fc-cache -vfSound #
Install sound server:
sudo pacman -S pipewire wireplumber pipewire-alsa pipewire-pulse pavucontrol playerctlBluetooth #
Install bluetooth libraries.
sudo pacman -S bluez bluez-utils bluemanEnable bluetooth.service
sudo systemctl start bluetooth.service
sudo systemctl enable bluetooth.serviceAppend the following line ~/.config/sway/config to execute blueman:
exec blueman-applet
for_window [app_id="blueman-manager"] floating enableKeyboard Input #
key repeat #
Append the following line to ~/.config/sway/config:
input type:keyboard {
repeat_delay 300
repeat_rate 50
}key remap #
Xremap is a key remapper for Linux.
Install Xremap for sway:
"${CARGO_HOME}/bin/rustup" run stable cargo install xremap --features swayConfigure Xremap. My Xremap config is as follows.
Run xremap without sudo as follows. Running xremap without sudo
And, the following is also required:
sudo gpasswd -a "USER_NAME" inputLink to sway-session.target and start Xremap.
Edit ~/.config/systemd/user/xremap.service as follows:
[Unit]
Description=xremap
BindsTo=sway-session.target
[Service]
KillMode=process
ExecStart=%h/.local/share/cargo/bin/xremap %h/.config/xremap/config.yml
ExecStop=/usr/bin/killall xremap
Type=simple
Restart=always
[Install]
WantedBy=sway-session.targetEnable xremap.service:
systemctl --user enable xremap.serviceTouchpad #
Append the following line to ~/.config/sway/config:
input type:touchpad {
tap enabled
dwt enabled
natural_scroll enabled
pointer_accel 1
}Input Method #
I’m skk(Japanese input system) user. So, install fcitx5-skk:
sudo pacman -S fcitx5 fcitx5-skk fcitx5-im fcitx5-configtoolAppend the following line to ~/.xprofile:
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitxAppend the following line ~/.config/sway/config to start fcitx5:
exec fcitx5 -dwallpaper #
Install wallpaper:
sudo pacman -S archlinux-wallpaperAppend the following line ~/.config/sway/config:
output "*" bg /usr/share/backgrounds/archlinux/small.png fillFirewall #
Install ufw as Firewall:
sudo pacman -S ufw
sudo systemctl start ufw.service
sudo systemctl enable ufw.service
sudo ufw enable
sudo ufw default deny
# for kde-connect
sudo ufw allow 1714:1764/udp
sudo ufw allow 1714:1764/tcp
sudo ufw reloadRequired GUI Applications #
thunar #
Install thunar as a file manager:
sudo pacman -S thunar gvfs gvfs-smb sshfs tumblerrofi #
Install rofi as a clone of a simple switcher. But, rofi is package for user under Xorg display servers, and merging support for Wayland compositors in the main branch has indefinitely stalled. So I use rofi-lbonn-wayland for Wayland support.
yay -S rofi-lbonn-waylandConfigure rofi. My fori config is as follows.
As noted in Difference with rofi, rofi-lbonn-wayland has no windows mode. So, I wrote a script for window selector and set as window mode as follows.
And, append the following line to ~/.config/rofi/config.rasi:
configuration {
modes: "windows:~/.config/rofi/scripts/window-select.sh,drun,combi";
combi-modes: [windows,drun];
}Append the following line to ~/.config/sway/config:
# Window toggle
bindsym $super+Tab exec "rofi -show window"
# start rofi (a program launcher)
bindsym $super+space exec "rofi -show combi"wezterm #
Install wezterm as a Terminal:
sudo pacman -S weztermConfigure wezterm. My wezterm config is as follows.
OpenVPN #
Install OpenVPN support:
sudo pacman -S networkmanager-openvpnInstall nm-applet as GUI:
sudo pacman -S network-manager-appletAppend the following line ~/.config/sway/config to execute nm-applet:
exec nm-applet --indicatorClick the plus sign to add a new connection and choose OpenVPN In desktop environment network setting.
Import The client configuration profile by selecting Import a saved VPN configuration... and selecting the appropriate file(xxx.ovpn file).
Set only certain network connections via vpn.
Click IPv4 Settings -> Routes... in vpn config.
Add certain network, and check Use this connection only for resources on it network.
Reboot #
Reboot:
sudo rebootGUI setting #
login sway desktop environment. And, to execute wezterm, enter $super+space.
Google Chrome #
Install Google Chrome:
yay -S google-chromeNextCloud #
Install NextCloud client:
sudo pacman -S nextcloud-clientInstall libraries for NextCloud Auto login:
sudo pacman -S qtkeychain-qt5 libsecret gnome-keyring seahorseLightDM already has the necessary PAM configuration. The password for the user account should be the same as the default keyring.
Append the following line ~/.config/sway/config to execute NextCloud:
exec nextcloud --backgroundEnpass #
Install Enpass as password manager:
yay -S enpass-binAppend the following line ~/.config/sway/config to execute enpass:
for_window [class="Enpass"] {
floating enable
sticky enable
}
exec enpass -minimizefcitx-skk #
Execute fcitx5-configuretool:
fcitx5-configuretoolSet Current Input Method to SKK in Input Method tab.
Set Trigger Key of Clipboard to Empty in Addons tab.
Set Initial Input Mode of SKK to Latin in Addons tab.
Check Return-key does not insert new line on commit checkbox of SKK in Addons tab.
Set user-dictionary path.
Enable sticky-shift as follows.
Sticky Shift with libskk