This is a collection of useful references, snippets, and information that I found useful when tinkering with Arch Linux.
Network
Wi-Fi Connection
Using iwd
-
Make sure that
iwd
is running:$ sudo systemctl status iwd
If not, start the service by running:
$ sudo systemctl enable iwd $ sudo systemctl start iwd
-
Start the interactive prompt:
$ sudo iwctl
-
Find the name of the wireless device by listing all devices:
[iwd]# device list
If the device is turned off, turn it on:
[iwd]# device [DEVICE_NAME] set-property Powered on
-
Initiate a scan for networks:
[iwd]# station [DEVICE_NAME] scan
then list all available networks:
[iwd]# station [DEVICE_NAME] get-networks
-
Connect to the desired network:
[iwd]# station [DEVICE_NAME] connect [SSID]
Enter the passphrase (if prompted) to the network.
Using NetworkManager(nmcli
)
-
Install
networkmanager
package if NetworkManager is not installed.$ sudo pacman -S networkmanager
-
Start / enable
NetworkManager.service
.$ sudo systemctl start NetworkManager.service $ sudo systemctl enable NetworkManager.service
-
List nearby Wi-Fi networks:
$ nmcli device wifi list
Connect to a Wi-Fi network:
$ nmcli device wifi connect [SSID] password [PASSWORD]
Connet to a Wi-Fi network (input password through
STDIN
):$ nmcli device wifi connect [SSID] --ask
Disconnect an interface:
$ nmcli device disconnect ifname [INTERFACE]
Get a list of connections with their names, UUIDs, types and backing devices:
$ nmcli connection show
Turn of Wi-Fi:
$ nmcli radio wifi off
Using iwd
as the Wi-Fi Backend
-
Install
iwd
.$ sudo pacman -S iwd
-
Create the following configuration file:
/etc/NetworkManager/conf.d/wifi_backend.conf [device] wifi.backend=iwd
Battery
Check Battery Status
- Install
tlp
.$ sudo pacman -S tlp
- Run the following command.
$ sudo tlp-stat -b
Input Devices
Keyboard Input Remapping
Dual Function Keys
-
Run the following command and find out the name of the keyboard.
$ libinput list-devices | grep "^Device"
-
Create a new configuration:
/etc/interception/udevmon.d/[KEYBOARD_NAME].yaml - JOB: "intercept -g $DEVNODE | dual-function-keys -c </path/to/dual-function-keys.yaml> | uinput -d $DEVNODE" DEVICE: NAME: <keyboard name>
When using a wireless keyboard however, setting the name sometimes does not work. In this case, set the name to
.*
, which processes every input. -
Create a yaml file (conventionally resides in
/etc/interception/dual-function-keys
) that contains the configuration for Dual Function Keys itself. I use the following configuration:/etc/interception/dual-function-keys TIMING: TAP_MILLISEC: 1000 DOUBLE_TAP_MILLISEC: 0 SYNTHETIC_KEYS_PAUSE_MILLISEC: 0 MAPPINGS: # Esc and LCtrl with CapsLock - KEY: KEY_CAPSLOCK TAP: KEY_ESC HOLD: KEY_LEFTCTRL
However, pressing the key will still send the original key on press, and this may interfere with programs such as (neo)vim. To prevent this, add
HOLD_START: BEFORE_CONSUME_OR_RELEASE
.
Using evremap
-
Install
evremap
from AUR:$ paru -S evremap-git
-
Enable / start the system service:
$ sudo systemctl enable evremap.service $ sudo systemctl start evremap.service
-
Edit the service file to point to your config. First check the path of the service:
$ systemctl status evremap.service
Then edit the file to point to your config:
/usr/lib/systemd/system/evremap.service ... ExecStart=bash -c "/usr/bin/evremap remap /etc/evremap.toml -d 0" ...
-
Configure remapping to your taste:
# The name of the device to remap. # Run `sudo evremap list-devices` to see the devices available # on your system. device_name = "[DEVICE_NAME]" # If you have multiple devices with the same name, you can optionally # specify the `phys` value that is printed by the `list-devices` subcommand # phys = "usb-0000:07:00.3-2.1.1/input0" # Configure CAPSLOCK as a Dual Role key. [[dual_role]] input = "KEY_CAPSLOCK" hold = ["KEY_LEFTCTRL"] tap = ["KEY_ESC"] [[remap]] input = ["KEY_LEFTMETA"] output = ["KEY_LEFTALT"] [[remap]] input = ["KEY_LEFTALT"] output = ["KEY_LEFTMETA"] [[remap]] input = ["KEY_RIGHTMETA", "KEY_K"] output = ["KEY_UP"] [[remap]] input = ["KEY_RIGHTMETA", "KEY_L"] output = ["KEY_RIGHT"]
Korean (Hangul) Input
This only works for hyprland
. Source
-
Install
kime
from AUR.$ paru -S kime-bin
-
Add the following configuration:
hyprland.conf # Execute kime exec-once = kime # Set envvars for kime env = XDG_CURRENT_DESKTOP,Hyprland env =GTK_IM_MODULE,kime env = QT_IM_MODULE,kime env = XMODIFIERS,@im=kime # Set ralt, rctrl to hangul and hanja input { ... kb_options = korean:ralt_hangul,korean:rctrl_hanja }
Miscellaneous
Run Fetch Script on Terminal Launch
$ function fish_greeting
neofetch
end
$ funcsave fish_greeting
According to the official docs, fish_greeting
is executed only when an interactive fish starts.
OBS Virtual Camera
-
Install the
v4l2loopback-dkms
package.$ sudo pacman -S v4l2loopback-dkms
-
Load the kernel module.
$ sudo modprobe v4l2loopback
-
To reload the module, first unload the module.
$ sudo modprobe -r v4l2loopback
-
For Chromium / WebRTC based applications, set option
exclusive_caps=1
.$ sudo modprobe v4l2loopback exclusive_caps=1
GPG waiting for lock ...
Error
-
Locate all files with
.lock
or.lck
extension inside~/.gnupg
.$ ls -l ~/.gnupg/*/*.l{o,}ck
-
Remove any lock files found.
Changing the default browser
-
To get the current default web browser:
xdg-settings get default-web-browser
-
To set the default web browser:
xdg-settings set default-web-browser [BROWSER]
for example,
xdg-settings set default-web-browser librewolf.desktop
Keyboard Backlight / Brightness
- Install
brightnessctl
:$ sudo pacman -S brightnessctl
Keyboard Backlight
- Get the maximum brightness level (obtain the vendor name using
ls
in the directory): Or alternatively:$ cat /sys/class/leds/[VENDOR]::kbd_backlight/max_brightness
Then set the brightness using$ brightnessctl --device='[VENDOR]::kbd_backlight' info
brightnessctl
: Make sure to set the brightness level below the max level.$ brightnessctl --device='[VENDOR]::kbd_backlight' set [BRIGHTNESS]
Brightness
- Same process as keyboard backlight, but use the path
instead.$ cat /sys/class/backlight/[VENDOR]/max_brightness
Clipboard
Piping Command Outputs to Clipboard
Wayland
-
Install
wl-clipboard
:$ sudo pacman -S wl-clipboard
-
To copy:
$ echo foo | wl-copy
-
To paste:
$ wl-paste foo
X Window System
-
Install
xclip
:$ sudo pacman -S xclip
-
Add aliases. In
bash
:.bash_aliases ... alias setclip="xclip -selection c" alias getclip="xclip -selection c -o" ...
In
fish
:config.fish ... abbr setclip "xclip -selection c" abbr getclip "xclip -selection c -o" ...
-
To copy:
$ echo foo | setclip
-
To paste:
$ getclip foo
MacOS
-
To copy:
$ echo foo | pbcopy
To copy the contents of a file, this also works (so that you don’t have to use
cat
):$ pbcopy < file.txt
-
To paste:
$ pbpaste foo
Access System Clipboard in (Neo)Vim
I use hyprland
, so this only works for Wayland.
- Install
wl-clipboard
:$ sudo pacman -S wl-clipboard
- Add the following line to
init.vim
: Or toset clipboard+=unnamedplus
init.lua
for neovim:vim.opt.clipboard:append("unnamedplus")
Change Acceleration Profile for ThinkPad Trackpoints
Change libinput
acceleration profile for ThinkPad’s trackpoint from adaptive to flat.
This only works for hyprland
. Source
device {
name = tpps/2-ibm-trackpoint
accel_profile = flat
}
Extract data.tar.gz(or .xz)
from .deb
Use ar
from binutils
. binutils
is in the base-devel
group, so it should
be already installed. Source
$ ar x <deb-file$ data.tar.gz
Desktop Entries
Desktop entries for applications (.desktop
files) usually reside in
/usr/share/applications/
or /usr/local/share/applications/
.
Modify environment variables
To set environment variables, edit the Exec=
line to first use env
.
For example:
...
Exec=env GDK_SCALE=2 /usr/bin/steam-runtime %U
...