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

  1. 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
    
  2. Start the interactive prompt:
    > sudo iwctl
    
  3. 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
    
  4. Initiate a scan for networks:
    [iwd]# station [DEVICE_NAME] scan
    
    then list all available networks:
    [iwd]# station [DEVICE_NAME] get-networks
    
  5. Connect to the desired network:
    [iwd]# station [DEVICE_NAME] connect [SSID]
    
    Enter the passphrase (if prompted) to the network.

Using nmcli

  1. Install networkmanager package if NetworkManager is not installed.
    > sudo pacman -S networkmanager
    
  2. Start / enable NetworkManager.service.
    > sudo systemctl start NetworkManager.service
    > sudo systemctl enable NetworkManager.service
    
  3. List nearby Wi-Fi networks:
    > nmcli device wifi list
    
    Connect to a Wi-Fi network:
    > nmcli device wifi connect [SSID] password [PASSWORD]
    
    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
    

Battery

Check Battery Status

  1. Install tlp.
    > sudo pacman -S tlp
    
  2. Run the following command.
    > sudo tlp-stat -b
    

Input Devices

Keyboard Input Remapping

Dual Function Keys

  1. Run the following command and find out the name of the keyboard.
    > libinput list-devices | grep "^Device"
    
  2. 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.
  3. 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:
    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

  1. Install evremap from AUR:
    > paru -S evremap-git
    
  2. Enable / start the system service:
    > sudo systemctl enable evremap.service
    > sudo systemctl start evremap.service
    
  3. 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"
    ...
  4. 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

  1. Install kime from AUR.
    > paru -S kime-bin
    
  2. Add these in ~/.config/hypr/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

Source

OBS Virtual Camera

  1. Install the v4l2loopback-dkms package.
    > sudo pacman -S v4l2loopback-dkms
    
  2. Load the kernel module.
    > sudo modprobe v4l2loopback
    
  3. To reload the module, first unload the module.
    > sudo modprobe -r v4l2loopback
    
  4. For Chromium / WebRTC based applications, set option exclusive_caps=1.
    > sudo modprobe v4l2loopback exclusive_caps=1
    

GPG waiting for lock ... Error

  1. Locate all files with .lock or .lck extension inside ~/.gnupg.
    > ls -l ~/.gnupg/*/*.l{o,}ck
    
  2. Remove any lock files found.

Changing the default browser

  1. To get the current default web browser:
    xdg-settings get default-web-browser
    
  2. To set the default web browser:
    xdg-settings set default-web-browser [BROWSER]
    

Keyboard Backlight / Brightness

  1. Install brightnessctl:
    > sudo pacman -S brightnessctl
    

Keyboard Backlight

  1. Get the maximum brightness level (obtain the vendor name using ls in the directory):
    > cat /sys/class/leds/[VENDOR]::kbd_backlight/max_brightness
    
    Or alternatively:
    > brightnessctl --device='[VENDOR]::kbd_backlight' info
    
    Then set the brightness using brightnessctl:
    > brightnessctl --device='[VENDOR]::kbd_backlight' set [BRIGHTNESS]
    
    Make sure to set the brightness level below the max level.

Brightness

  1. Same process as keyboard backlight, but use the path
    > cat /sys/class/backlight/[VENDOR]/max_brightness
    
    instead.

Access System Clipboard in (Neo)Vim

I use hyprland, so this only works for Wayland.

  1. Install wl-clipboard:
    > sudo pacman -S wl-clipboard
    
  2. Add the following line to init.vim:
    set clipboard+=unnamedplus
    
    Or to 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

# Add to hyprland.conf
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