diff --git a/README.md b/README.md index c65e87f..9cdf82f 100644 --- a/README.md +++ b/README.md @@ -31,15 +31,19 @@ Then follow prompts: ``` Configure git? [y/N] Generate SSH key? [y/N] -/home/holmen1/repos/dotfiles/install/bsdinstall/packages/besk/pkglist.txt +Install yay? [y/N] +/home/holmen1/repos/dotfiles/install/archinstall/packages/x1/pkglist.txt Install pkglist? [y/N] +/home/holmen1/repos/dotfiles/install/archinstall/packages/x1/foreignpkglist.txt +Install foreignpkglist? [y/N] Build xmonad? [y/N] Install xmonad? [y/N] Build st? [y/N] Install st? [y/N] +Build xkb keymap? [y/N] Link dotfiles? [y/N] -Enable system monitoring? [y/N] -Run tests? [y/N] +Enable services? [y/N] +Run tests? [Y/n] ``` diff --git a/dotfiles/keyd/default.conf b/dotfiles/keyd/default.conf deleted file mode 100644 index e57e6fc..0000000 --- a/dotfiles/keyd/default.conf +++ /dev/null @@ -1,18 +0,0 @@ -[ids] -* - -[main] -# Tap space for space, hold space to activate the 'num_layer' -space = overload(num_layer, space) - -[num_layer] -u = 7 -i = 8 -o = 9 -j = 4 -k = 5 -l = 6 -m = 1 -, = 2 -. = 3 -n = 0 diff --git a/dotfiles/nvim/README.md b/dotfiles/nvim/README.md index 792c383..fbfebb9 100644 --- a/dotfiles/nvim/README.md +++ b/dotfiles/nvim/README.md @@ -349,85 +349,4 @@ bear -- make :LspStart ``` -## TODO: Home-Row Digits (Linux & FreeBSD) -Explore setting up a "Num Layer" to type digits without reaching for the top row on a standard Swedish layout. The goal is to use the Spacebar as a dual-function "Tap-Hold" key: tap it for a normal `Space`, but hold it down with the thumb to activate a temporary number layer (e.g., mapping `j, k, l` to `4, 5, 6` like a physical numpad). - -**Using `keyd` (Linux & FreeBSD)** - -`keyd` intercepts input at the kernel level (`evdev`) and works identically on both platforms with the same config file. - -Install: -```bash -# Arch -sudo pacman -S keyd -sudo systemctl enable --now keyd - -# FreeBSD -sudo pkg install keyd -sudo sysrc keyd_enable=YES -sudo service keyd start -``` - -Config file: -- Linux: `/etc/keyd/default.conf` -- FreeBSD: `/usr/local/etc/keyd/default.conf` - -```ini -[ids] -* - -[main] -# Tap space for space, hold space to activate the 'num_layer' -space = overload(num_layer, space) - -[num_layer] -u = 7 -i = 8 -o = 9 -j = 4 -k = 5 -l = 6 -m = 1 -, = 2 -. = 3 -n = 0 -``` - -Reload after editing: -```bash -sudo keyd reload -``` - -> Note: VT switching is not supported on FreeBSD with `keyd`. - ---- - -## FreeBSD Keyboard Recovery (if you lose input at login) - -If you cannot type at the FreeBSD login prompt (before X11), you may have a misconfigured keyboard layout or key remapping daemon (e.g., keyd). To recover: - -1. **Reboot and enter single-user mode** from the boot menu. -2. At the prompt, remount filesystems: - ``` - mount -u / - mount -a - ``` -3. Check `/etc/rc.conf` for any `keymap` lines. Comment them out or set to a known working value (e.g., `keymap="us"`). -4. Check for recent changes to `/etc/sysctl.conf` or `/etc/ttys` that might affect keyboard input. -5. If you enabled keyd at the system level, disable it: - ``` - service keyd stop - sysrc keyd_enable=NO - ``` -6. Reboot and test keyboard input at the login prompt. - -Once you regain access, reapply changes one at a time to identify the cause. If you use a non-US layout, set it only after confirming basic input works. - -**How to proceed after recovery:** - -1. Confirm you can log in and type at the console. -2. Re-enable your desired keyboard layout (e.g., Swedish) in X11 only (e.g., via `setxkbmap se` in `.xinitrc`). -3. If using keyd, test its config with the default US layout first, then add custom mappings for your layout as needed. -4. Make incremental changes and reboot or restart X to test each step. -5. Document any changes that cause issues for future reference. diff --git a/dotfiles/x/.xinitrc b/dotfiles/x/.xinitrc index fccdaa7..37b9a47 100644 --- a/dotfiles/x/.xinitrc +++ b/dotfiles/x/.xinitrc @@ -37,6 +37,7 @@ esac # Set keymap (don't background - fast and should complete before apps start) setxkbmap se +echo "se" > "$HOME/.cache/xkb-layout" # Cache current layout for dmenu status script # Set the default X cursor to the usual pointer xsetroot -cursor_name left_ptr & diff --git a/dotfiles/x/README.md b/dotfiles/x/README.md new file mode 100644 index 0000000..a63d499 --- /dev/null +++ b/dotfiles/x/README.md @@ -0,0 +1,29 @@ +# X + +X11 session startup via `~/.xinitrc`. + +--- + +## Files + +| Path | Purpose | +|------------|----------------------------------| +| `.xinitrc` | X session startup — env, apps | + +--- + +## Startup sequence + +1. Check essential programs (`xmonad`, `xterm`) +2. Set `EDITOR`, `TERMINAL`, `BROWSER` +3. Apply base keyboard layout (`setxkbmap se`) +4. Start `xsetroot`, `feh`, `dunst`, `xcompmgr`, `xbindkeys` +5. `exec xmonad` + +--- + +## Keyboard customisation + +Extended key behaviour (CapsLock→Control/Escape, Super→num-layer) lives in +`dotfiles/xkb/` and is applied by running `~/.local/bin/apply-keys.sh` manually. +See [xkb/README.md](../xkb/README.md) for details. diff --git a/dotfiles/xkb/.config/xkb/keymap-bsd.xkb b/dotfiles/xkb/.config/xkb/keymap-bsd.xkb new file mode 100644 index 0000000..03d134a Binary files /dev/null and b/dotfiles/xkb/.config/xkb/keymap-bsd.xkb differ diff --git a/dotfiles/xkb/.config/xkb/keymap-linux.xkb b/dotfiles/xkb/.config/xkb/keymap-linux.xkb new file mode 100644 index 0000000..8948be5 Binary files /dev/null and b/dotfiles/xkb/.config/xkb/keymap-linux.xkb differ diff --git a/dotfiles/xkb/README.md b/dotfiles/xkb/README.md new file mode 100644 index 0000000..15dd4d9 --- /dev/null +++ b/dotfiles/xkb/README.md @@ -0,0 +1,133 @@ +# XKB + +X11 keyboard customisation using **XKB** and **xcape**. + +## Key behaviour + +| Key | Tap | Hold | +|----------|---------|-------------| +| CapsLock | Escape | Control | +| Super | — | Num-layer | + +## Custom symbol mappings + +| Key | L1 | L2 | L3 | L4 | +|-----|-----|-----|-----|----| +| u | u | U | 7 | — | +| i | i | I | 8 | — | +| o | o | O | 9 | — | +| å | [ | ] | — | — | +| s | s | S | $ | — | +| j | j | J | 4 | ( | +| k | k | K | 5 | ) | +| l | l | L | 6 | — | +| ö | ⌫ | : | = | — | +| ä | ↑ | \| | / | — | +| n | n | N | 0 | — | +| m | m | M | 1 | — | +| , | , | ; | 2 | — | +| . | . | : | 3 | — | + +### Num-layer + +Level 3 (Super held) maps row keys to numpad grid: +``` +u i o → 7 8 9 +j k l → 4 5 6 +m , . → 1 2 3 + n → 0 +``` + +### XKB Levels + +Each key can have up to 8 levels, defined as `[ level1, level2, level3, level4, ... ]`: +- **Level 1**: normal tap +- **Level 2**: Shift+key +- **Level 3**: Super+key (via `lv3:lwin_switch`) +- **Level 4**: Super+Shift+key + +Example: `key { [ u, U, 7 ] };` means: normal=`u`, Shift=`U`, Super=`7`. + +--- + +## Files + +| Path | Purpose | +|----------------------------------------|--------------------------------------| +| `.config/xkb/keymap.xkb` | Compiled keymap (generated by build) | +| `apply-keys.sh` | Loads keymap + starts xcape | + +See [install/build/xkb/README.md](../../install/build/xkb/README.md) for build details. + +--- + +## Installation (Arch Linux) + +```sh +sudo pacman -S xorg-setxkbmap xorg-xkbcomp xcape +``` + +Symlink `dotfiles/xkb/` files to `$HOME`, build the keymap once, then `apply-keys.sh` runs on every X startup via `~/.xinitrc`: + +```sh +# Once (or whenever symbols/local changes) +install/build/xkb/build-xkb.sh + +# On every X startup — called automatically by ~/.xinitrc +~/.local/bin/apply-keys.sh +``` + +--- + +## How it works + +### CapsLock → Control / Escape + +`ctrl:nocaps` (built-in XKB option) replaces CapsLock with `Control_L`. +xcape then synthesises `Escape` when `Control_L` is released without a chord: + +```sh +xcape -e 'Control_L=Escape' +``` + +### Super → Num-layer + +`lv3:lwin_switch` (built-in XKB option) makes the left Super key the +**level-3 activator** — the same mechanism as AltGr. +`~/.config/xkb/symbols/local` assigns digits at level 3 for the numpad cluster. + +### XKB Levels + +Each key has multiple levels — outputs defined as `[ level1, level2, level3, ... ]`: +- **Level 1**: unshifted (normal tap) +- **Level 2**: Shift+key +- **Level 3**: level-3 activator held (AltGr by default, Super in this config) +- **Level 4**: level-3 + Shift + +Example: `key { [ u, U, 7 ] };` means: normal=`u`, Shift=`U`, Super=`7`. + +### Load (`apply-keys.sh`) + +Run on every X startup via `.xinitrc`: + +1. `xkbcomp keymap.xkb $DISPLAY` loads the pre-compiled keymap — no setxkbmap, no sed +2. `xcape` is restarted to synthesise Escape on CapsLock tap + +--- + +## Lessons learned + +**Shift modifier stays active in apps**: If a key at level 2 (Shift+key) produces a keysym like `Up`, the app still sees `Shift+Up` instead of bare `Up`. Put frequently-used, modifier-sensitive keys at level 1. + +Example: `ö → Up` at L1 scrolls fine; at L2 it would send `Shift+Up`, which most apps don't recognize as scroll. + +--- + +## Debugging + +```sh +setxkbmap -query # current options +xkbcomp -xkb "$DISPLAY" - | grep -A4 'key ' # check Super mapping +xkbcomp -xkb "$DISPLAY" - | grep -A4 'key ' # check u/7 mapping +xev | grep -A2 KeyPress # watch raw events +``` diff --git a/dotfiles/xmonad/.gitignore b/dotfiles/xmonad/.gitignore deleted file mode 100644 index d3a727a..0000000 --- a/dotfiles/xmonad/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.ghc.* diff --git a/dotfiles/xmonad/README.md b/dotfiles/xmonad/README.md index 454a637..4cd12c5 100644 --- a/dotfiles/xmonad/README.md +++ b/dotfiles/xmonad/README.md @@ -7,32 +7,39 @@ This repository contains a custom configuration for the [XMonad](https://xmonad. ## Shortcuts -| Key Combination | Action | -|------------------------|----------------------------------------| +| Key Combination | Action | +|------------------------|---------------------------------------| | `Mod + Enter` | Launch terminal | -| `Mod + H` | Help menu | | `Mod + Q` | Close the focused window | -| `Mod + Space` | Rotate through available layouts | -| `Mod + Shift + Space` | Reset the layout to default | -| `Mod + N` | Resize/refresh windows | -| `Mod + Tab` | Move to the next workspace | -| `Mod + Shift + Tab` | Move focus to the previous window | | `Mod + J` | Move focus to the next window | | `Mod + K` | Move focus to the previous window | -| `Mod + Shift + Return` | Swap the focused window with master | +| `Mod + Tab` | Next workspace | +| `Mod + Shift + Tab` | Previous workspace | +| `Mod + [1..4]` | Switch to workspace N | +| `Mod + Shift + [1..4]` | Move window to workspace N and follow | +| `Mod + E` | Launch file manager (lf) | +| `Mod + B` | Launch browser | +| `Mod + Space` | Rotate through available layouts | +| `Mod + H` | Shrink the master area | +| `Mod + L` | Expand the master area | | `Mod + ,` | Increment master windows | | `Mod + .` | Decrement master windows | -| `Mod + X` | Logout menu | -| `Mod + M` | VPN menu | +| `Mod + Shift + Return` | Swap the focused window with master | | `Mod + S` | Screenshot to `~/Downloads` | -| `Mod + Shift + S` | Capture a selected area screenshot to `~/Downloads` | -| `Mod + W` | Launch browser | +| `Mod + Shift + S` | Screenshot selected area | +| `Mod + W` | Browser scratchpad toggle | +| `Mod + P` | htop scratchpad toggle | +| `Mod + V` | VPN menu | +| `Mod + Z` | XKB layout menu | +| `Mod + X` | Logout menu | | `Mod + A` | Launch dmenu | +| `Mod + Shift + Q` | Quit xmonad | +| `Mod + M` | Help menu | ## Requirements -- [Xmobar](https://xmobar.org/) +- [Xmobar](https://xmobar.org/) NOT USING - [st - simple terminal](https://st.suckless.org/) - [Brave](https://brave.com/linux/) - thunar fileexplorer diff --git a/dotfiles/xmonad/xmonad.hs b/dotfiles/xmonad/xmonad.hs index eae870c..25f4a22 100644 --- a/dotfiles/xmonad/xmonad.hs +++ b/dotfiles/xmonad/xmonad.hs @@ -5,14 +5,13 @@ import XMonad.Actions.CycleWS import XMonad.Hooks.EwmhDesktops (ewmh, ewmhFullscreen) import XMonad.Hooks.FadeWindows import XMonad.Layout.NoBorders -import XMonad.ManageHook import XMonad.Operations (unGrab) import qualified XMonad.StackSet as W import XMonad.Util.EZConfig (additionalKeys) import XMonad.Util.NamedScratchpad import XMonad.Util.SpawnOnce -myModMask = mod4Mask -- Rebind Mod to the Super key +myModMask = mod1Mask myAppLauncher = "dmenu_run -fn 'JetBrainsMono Nerd Font:size=14' -nb '#222222' -nf '#bbbbbb' -sb '#A300A3' -sf '#eeeeee'" myMagenta = "#A300A3" @@ -55,11 +54,11 @@ myKeys terminal browser = [ ((myModMask, xK_a), spawn myAppLauncher), ((myModMask, xK_e), spawn $ terminal ++ " -e lf"), ((myModMask, xK_Return), spawn terminal), + ((myModMask, xK_b), spawn browser), ((myModMask .|. shiftMask, xK_Return), windows W.swapMaster), + ((myModMask, xK_Tab), nextWS), + ((myModMask .|. shiftMask, xK_Tab), prevWS), ((myModMask, xK_q), kill), - ((myModMask .|. shiftMask, xK_h), sendMessage Shrink), -- Shrink the master area - ((myModMask .|. shiftMask, xK_l), sendMessage Expand), -- Expand the master area - ((myModMask, xK_Tab), nextWS), -- Cycle to the next workspace -- screenshots ((myModMask, xK_s), spawn "scrot ~/Downloads/screenshot_%Y-%m-%d_%H-%M-%S.png"), ((myModMask .|. shiftMask, xK_s), unGrab >> spawn "scrot -s ~/Downloads/screenshot_%Y-%m-%d_%H-%M-%S.png"), @@ -67,21 +66,21 @@ myKeys terminal browser = ((myModMask, xK_x), spawn "~/repos/dotfiles/scripts/dmenu-logout.sh"), ((myModMask, xK_v), spawn "~/repos/dotfiles/scripts/dmenu-mullvad.sh"), ((myModMask, xK_m), spawn "~/repos/dotfiles/scripts/dmenu-help.sh"), + ((myModMask, xK_z), spawn "~/repos/dotfiles/scripts/dmenu-xkb.sh"), ((myModMask, xK_w), namedScratchpadAction (myScratchpads terminal browser) "browser"), ((myModMask, xK_p), namedScratchpadAction (myScratchpads terminal browser) "htop") ] - ++ - -- mod-[1..9], Switch to workspace N - -- mod-shift-[1..9], Move client to workspace N and follow it - [ ((m .|. myModMask, k), windows $ f i) - | (i, k) <- zip myWorkspaces [xK_1 .. xK_9], - (f, m) <- [(W.greedyView, 0), (\i -> \w -> W.greedyView i (W.shift i w), shiftMask)] - ] + ++ + -- mod-[1..9], Switch to workspace N + -- mod-shift-[1..9], Move client to workspace N and follow it + [ ((m .|. myModMask, k), windows $ f i) + | (i, k) <- zip myWorkspaces [xK_1 .. xK_9], + (f, m) <- [(W.greedyView, 0), (\i -> \w -> W.greedyView i (W.shift i w), shiftMask)] + ] myConfig terminal browser = def - { modMask = myModMask, - terminal = terminal, + { terminal = terminal, workspaces = myWorkspaces, focusedBorderColor = myMagenta, layoutHook = myLayout, diff --git a/install/README.md b/install/README.md index 8c956f5..f86cdd6 100644 --- a/install/README.md +++ b/install/README.md @@ -356,6 +356,35 @@ find /path/to/search -name "*.txt" -exec grep "search term" {} \; ### Repo behind remote +**If you've committed locally but remote also has new commits:** + +Git will refuse to pull and ask you to specify a reconciliation strategy: + +``` +fatal: Need to specify how to reconcile divergent branches. +``` + +**Best option (recommended):** +```bash +git pull --rebase +``` +Replays your local commits on top of remote changes. Linear history, cleaner. + +**Alternative (preserves merge history):** +```bash +git pull --no-rebase +``` +or set default: +```bash +git config pull.rebase false +``` + +**Or fast-forward only (fails if diverged):** +```bash +git pull --ff-only +``` + +**Legacy workaround (not recommended):** ```bash git stash [-u] git pull diff --git a/install/archinstall/configure_build_install_link.sh b/install/archinstall/configure_build_install_link.sh index 86e7eea..cd36549 100755 --- a/install/archinstall/configure_build_install_link.sh +++ b/install/archinstall/configure_build_install_link.sh @@ -10,6 +10,7 @@ LINK_SCRIPT=$SCRIPTS_DIR/link_config.sh XMONAD_DIR=$DOTFILES_DIR/install/build/xmonad ST_DIR=$DOTFILES_DIR/install/build/st +XKB_DIR=$DOTFILES_DIR/install/build/xkb COMPUTERNAME=$(hostnamectl --static 2>/dev/null || hostname -s) PKGPROFILE=${COMPUTERNAME} @@ -117,6 +118,14 @@ case "$ans" in ;; esac +read -p "Build xkb keymap? [y/N] " ans +case "$ans" in + [Yy]*) + $XKB_DIR/build-xkb.sh + echo "Built xkb keymap" + ;; +esac + read -p "Link dotfiles? [y/N] " ans case "$ans" in [Yy]*) @@ -134,10 +143,14 @@ case "$ans" in ;; esac -read -p "Run tests? [y/N] " ans +read -p "Run tests? [Y/n] " ans case "$ans" in - [Yy]*) - # Test + [Nn]) + # Skip tests + ;; + *) + # Test (default) $TEST ;; esac + diff --git a/install/archinstall/links/x1/links.config b/install/archinstall/links/x1/links.config index cb1725c..6a09b9d 100644 --- a/install/archinstall/links/x1/links.config +++ b/install/archinstall/links/x1/links.config @@ -4,7 +4,7 @@ DOTFILES_DIR="$BASE_DIR/dotfiles" # Space-separated list of packages to stow # Each package should be a directory in DOTFILES_DIR with files/dirs structured # to mirror the target location relative to $HOME -packages="vim bash nvim x dunst systemd lf vscode brave gdb" +packages="vim bash nvim x xkb dunst systemd lf vscode brave gdb" # Example package structures: # - dotfiles/zsh/.zshrc -> ~/.zshrc diff --git a/install/archinstall/packages/x1/pkglist.txt b/install/archinstall/packages/x1/pkglist.txt index ef48663..697dbcf 100644 --- a/install/archinstall/packages/x1/pkglist.txt +++ b/install/archinstall/packages/x1/pkglist.txt @@ -16,11 +16,9 @@ fastfetch fd feh gdb -ghc-static git grub gst-plugin-pipewire -haskell-language-server htop i3lock intel-media-driver @@ -56,8 +54,10 @@ unzip viu wireplumber xbindkeys +xcape xclip xcompmgr +xorg-xev xorg-xinit xorg-xsetroot xterm diff --git a/install/bsdinstall/README.md b/install/bsdinstall/README.md index faf3aa3..cd58f4c 100644 --- a/install/bsdinstall/README.md +++ b/install/bsdinstall/README.md @@ -12,6 +12,21 @@ Wifi: ETSI otherwise my choice, see [user_configuration_x1.json](../archinstall/log/user_configuration_x1.json) +## Diaster recovery + +1. **Reboot and enter single-user mode** from the boot menu. +2. At the prompt, remount filesystems: + ``` + mount -u / + mount -a + ``` +3. Check `/etc/rc.conf` +4. Check for recent changes to `/etc/sysctl.conf` or `/etc/ttys` +5. If you enabled xxx at the system level, disable it: + ``` + service xxx stop + sysrc xxx_enable=NO + ``` ## Post-installation ### Shell, also need adding hostname if used in scripts @@ -308,8 +323,3 @@ sudo pkg install xlibre-minimal xlibre-xf86-video-intel - GNU make vs BSD make — Use `gmake` for GNU Makefiles; FreeBSD's default `make` is BSD make with different syntax - Header ordering in C network programming — On FreeBSD, include `` before `` and other network headers to avoid compilation errors - - - - - diff --git a/install/bsdinstall/configure_build_install_link.sh b/install/bsdinstall/configure_build_install_link.sh index a8fcd0e..460a4c6 100755 --- a/install/bsdinstall/configure_build_install_link.sh +++ b/install/bsdinstall/configure_build_install_link.sh @@ -10,6 +10,7 @@ LINKS=$DOTFILES_DIR/install/bsdinstall/links/suckless_links.config XMONAD_DIR=$DOTFILES_DIR/install/build/xmonad ST_DIR=$DOTFILES_DIR/install/build/st +XKB_DIR=$DOTFILES_DIR/install/build/xkb COMPUTERNAME=$(hostname -s) PKGPROFILE=${COMPUTERNAME} @@ -88,30 +89,27 @@ case "$ans" in sudo cp -f $ST_DIR/bin/st-0.9.[0-9] /opt/st/ echo "Installed st to /opt/st/" sudo ln -sf /opt/st/st-0.9.* /usr/local/bin/st + sudo -k echo "Created symlink for st" ;; esac sudo -k -read -p "Link dotfiles? [y/N] " ans +read -p "Build xkb keymap? [y/N] " ans case "$ans" in [Yy]*) - # Link dotfiles - $LINK_SCRIPT $LINKS + $XKB_DIR/build-xkb.sh + echo "Built xkb keymap" ;; esac -read -p "Enable keyd num layer? [y/N] " ans +read -p "Link dotfiles? [y/N] " ans case "$ans" in [Yy]*) - sudo mkdir -p /usr/local/etc/keyd - sudo ln -sf $DOTFILES_DIR/dotfiles/keyd/default.conf /usr/local/etc/keyd/default.conf - sudo sysrc keyd_enable=YES - sudo service keyd onerestart - echo "keyd num layer enabled" + # Link dotfiles + $LINK_SCRIPT $LINKS ;; esac -sudo -k read -p "Enable system monitoring? [y/N] " ans case "$ans" in @@ -130,10 +128,13 @@ case "$ans" in ;; esac -read -p "Run tests? [y/N] " ans +read -p "Run tests? [Y/n] " ans case "$ans" in - [Yy]*) - # Test + [Nn]) + # Skip tests + ;; + *) + # Test (default) $TEST ;; esac diff --git a/install/bsdinstall/links/suckless_links.config b/install/bsdinstall/links/suckless_links.config index d0d3fce..bf51b4a 100644 --- a/install/bsdinstall/links/suckless_links.config +++ b/install/bsdinstall/links/suckless_links.config @@ -6,5 +6,5 @@ DOTFILES_DIR="$BASE_DIR/dotfiles" # Space-separated list of packages to stow # Each package should be a directory in DOTFILES_DIR with files/dirs structured # to mirror the target location relative to $HOME -packages="vim bash nvim x dunst lf brave gdb" +packages="vim bash nvim x xkb dunst lf brave gdb" diff --git a/install/bsdinstall/packages/besk/pkglist.txt b/install/bsdinstall/packages/besk/pkglist.txt index 1239db7..c02d071 100644 --- a/install/bsdinstall/packages/besk/pkglist.txt +++ b/install/bsdinstall/packages/besk/pkglist.txt @@ -41,6 +41,7 @@ sysutils/tree graphics/viu ftp/wget x11/xbindkeys +x11/xcape x11/xclip x11-wm/xcompmgr x11/xlibre-minimal diff --git a/install/bsdinstall/sanity_check.sh b/install/bsdinstall/sanity_check.sh index fd39a8e..759e3dc 100755 --- a/install/bsdinstall/sanity_check.sh +++ b/install/bsdinstall/sanity_check.sh @@ -124,17 +124,11 @@ check_command "notify-send" "Desktop notifications" print_header "Key Bindings & Input" check_command "xbindkeys" "Key binding daemon" check_file "$HOME/.xbindkeysrc" "xbindkeys configuration" +check_file "$HOME/.config/xkb/keymap-bsd.xkb" "XKB configuration" check_command "backlight" "Brightness control (FreeBSD)" check_command "mixer" "Audio mixer (OSS)" -# keyd num layer (optional, warn only) -if ! service keyd status >/dev/null 2>&1; then - print_warn "keyd not running - num layer inactive (run: sudo service keyd start)" -elif [ ! -L /usr/local/etc/keyd/default.conf ]; then - print_warn "keyd running but config not symlinked from dotfiles" -else - print_pass "keyd num layer active" -fi +# XKB (optional, warn only) TODO # Screenshot functionality print_header "Screenshots" diff --git a/install/build/README.md b/install/build/README.md index 5de7151..548f73d 100644 --- a/install/build/README.md +++ b/install/build/README.md @@ -11,4 +11,7 @@ A lightweight tiling window manager for X11 written in Haskell Fork of X.Org that must be built from AUR on Arch (available via `pkg` on FreeBSD) [neovim](https://github.com/holmen1/dotfiles/tree/master/install/build/neovim) -Neovim 0.12 - built from source on FreeBSD (not yet available via `pkg` or ports as of March 2026) \ No newline at end of file +Neovim 0.12 - built from source on FreeBSD (not yet available via `pkg` or ports as of March 2026) + +[xkb](https://github.com/holmen1/dotfiles/tree/master/install/build/xkb) +Custom XKB keymap for X11 — Swedish layout with programmer remaps and Super num-layer. Built with `build-xkb.sh`, applied via `scripts/apply-xkb.sh` \ No newline at end of file diff --git a/install/build/xkb/README.md b/install/build/xkb/README.md new file mode 100644 index 0000000..8011de6 --- /dev/null +++ b/install/build/xkb/README.md @@ -0,0 +1,30 @@ +# build/xkb + +Compiles the XKB keymap used by `dotfiles/xkb`. + +## Files + +| Path | Purpose | +|-------------------|------------------------------------------------------| +| `build-xkb.sh` | Compiles keymap into `dotfiles/xkb/.config/xkb/keymap.xkb` | +| `symbols/local` | XKB partial symbols — num-layer digit assignments | + +## Usage + +```sh +install/build/xkb/build-xkb.sh +``` + +Re-run whenever `symbols/local` changes. + +## Dependencies + +```sh +sudo pacman -S xorg-setxkbmap xorg-xkbcomp +``` + +## How it works + +1. `setxkbmap -print` emits the base keymap description to stdout +2. `sed` appends `+local(numpad)` to the `xkb_symbols` include line +3. `xkbcomp` compiles the result into `dotfiles/xkb/.config/xkb/keymap.xkb` diff --git a/install/build/xkb/build-xkb.sh b/install/build/xkb/build-xkb.sh new file mode 100755 index 0000000..f6dd536 --- /dev/null +++ b/install/build/xkb/build-xkb.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# build-xkb.sh — compile XKB keymap for X11 keyboard customisation +# +# Produces: dotfiles/xkb/.config/xkb/keymap-linux.xkb or keymap-bsd.xkb +# +# Re-run this whenever dotfiles/xkb/.config/xkb/symbols/local changes. +# +# Deps: setxkbmap, xkbcomp + +set -e + +DOTFILES="${HOME}/repos/dotfiles" +SYMBOLS_DIR="${DOTFILES}/install/build/xkb" + +case "$(uname -s)" in + FreeBSD*) KEYMAP="${DOTFILES}/dotfiles/xkb/.config/xkb/keymap-bsd.xkb" ;; + *) KEYMAP="${DOTFILES}/dotfiles/xkb/.config/xkb/keymap-linux.xkb" ;; +esac + +mkdir -p "$(dirname "$KEYMAP")" + +setxkbmap se -option ctrl:nocaps,lv3:lwin_switch -print \ + | sed '/xkb_symbols/s|include "\(.*\)"|include "\1+local"|' \ + | xkbcomp -w0 -I"${SYMBOLS_DIR}" - -o "${KEYMAP}" + +echo "Keymap written to ${KEYMAP}" diff --git a/install/build/xkb/symbols/local b/install/build/xkb/symbols/local new file mode 100644 index 0000000..b57a185 --- /dev/null +++ b/install/build/xkb/symbols/local @@ -0,0 +1,25 @@ +// ~/.config/xkb/symbols/local +// +// Custom XKB symbol definitions for Swedish layout. +// See ../../../dotfiles/xkb/README.md for complete mappings. +// +// Format: key { [ level1, level2, level3, level4 ] }; +// Example: key { [ u, U, 7 ] }; // u, Shift+u→U, Super+u→7 + +partial alphanumeric_keys +xkb_symbols "local" { + key { [ u, U, 7 ] }; + key { [ i, I, 8 ] }; + key { [ o, O, 9 ] }; + key { [ j, J, 4, parenleft ] }; + key { [ k, K, 5, parenright ] }; + key { [ l, L, 6 ] }; + key { [ m, M, 1 ] }; + key { [ n, N, 0 ] }; + key { [ comma, semicolon, 2 ] }; + key { [ period, colon, 3 ] }; + key { [ bracketleft, bracketright ] }; + key { [ BackSpace, colon, equal ] }; + key { [ Up, bar, slash ] }; + key { [ s, S, dollar ] }; +}; diff --git a/install/build/xmonad/README.md b/install/build/xmonad/README.md index ea75bd1..c5fc9c2 100644 --- a/install/build/xmonad/README.md +++ b/install/build/xmonad/README.md @@ -42,11 +42,29 @@ Note: [Static linking](https://wiki.archlinux.org/title/Haskell#Static_linking) Instead of GHCup, you can use Pacman to install pre-built Haskell tools: + ```bash # Install GHC and Cabal from official Arch repositories pacman -S ghc-static cabal-install ``` +**Troubleshooting: Could not find module ‘System.Random’** + +After a system upgrade, you may encounter the following error when building: + + Could not find module ‘System.Random’ + There are files missing in the ‘random-1.2.1.3’ package + +This can be resolved by installing the official binary GHC package. For example: + +```bash +wget https://downloads.haskell.org/~ghc/9.12.4/ghc-9.12.4-x86_64-alpine3_12-linux-static-int_native.tar.gz +tar -xvf ghc-9.12.4-x86_64-alpine3_12-linux-static-int_native.tar.gz +# Follow the README or INSTALL instructions in the extracted directory to install GHC +``` + +This provides a complete set of libraries and resolves missing module errors. + **Advantages:** - No need to manage a separate Haskell installer - XMonad builds fine without additional setup diff --git a/install/build/xmonad/build-xmonad.sh b/install/build/xmonad/build-xmonad.sh index 870a8e8..f689916 100755 --- a/install/build/xmonad/build-xmonad.sh +++ b/install/build/xmonad/build-xmonad.sh @@ -2,8 +2,8 @@ set -e # Exit on error -XMONAD_TAG="v0.18.0" -XMONAD_CONTRIB_TAG="v0.18.1" +XMONAD_TAG="v0.18.1" +XMONAD_CONTRIB_TAG="v0.18.2" # Define directories BUILD_DIR=~/repos/dotfiles/install/build/xmonad diff --git a/scripts/apply-xkb.sh b/scripts/apply-xkb.sh new file mode 100755 index 0000000..44607b8 --- /dev/null +++ b/scripts/apply-xkb.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# apply-xkb.sh — apply compiled XKB keymap and restart xcape +# +# CapsLock: hold = Control, tap = Escape +# Super: hold = num-layer (u/i/o=7/8/9, j/k/l=4/5/6, m/,/.=1/2/3, n=0) +# Remaps: å= ö: ä/ ,< .> +# +# Build the keymap first with: install/build/xkb/build-xkb.sh + +case "$(uname -s)" in + FreeBSD*) KEYMAP="$HOME/.config/xkb/keymap-bsd.xkb" ;; + *) KEYMAP="$HOME/.config/xkb/keymap-linux.xkb" ;; +esac + +if [ -f "$KEYMAP" ]; then + xkbcomp -w0 "$KEYMAP" "$DISPLAY" + pkill -x xcape 2>/dev/null || true + xcape -e 'Control_L=Escape' & + echo "custom" > "$HOME/.cache/xkb-layout" +else + echo "Warning: $KEYMAP not found. Run install/build/xkb/build-xkb.sh first." >&2 +fi diff --git a/scripts/dmenu-help.sh b/scripts/dmenu-help.sh index deb33e6..ec17ae9 100755 --- a/scripts/dmenu-help.sh +++ b/scripts/dmenu-help.sh @@ -1,26 +1,9 @@ #!/bin/sh + +README="$HOME/repos/dotfiles/dotfiles/xmonad/README.md" + # Show xmonad keybindings in dmenu -cat </dev/null || echo "se") + +choice=$(printf "help\ncustom\nse" | dmenu -p "xkb[$current]" -nb "#222222" -nf "#ffffff" -sb "#A300A3" -sf "#ffffff" \ + -fn "$FONT") + +[ -z "$choice" ] && exit 0 + +case "$choice" in + help) + sed -n 7,30p "$README" | dmenu -l 24 -i -p "XKB Help" \ +-nb "#222222" -nf "#ffffff" -sb "#222222" -sf "#ffffff" \ +-fn "JetBrainsMono Nerd Font Mono-14" + ;; + custom) + xkbcomp -w0 "$KEYMAP" "$DISPLAY" + pkill -x xcape 2>/dev/null || true + xcape -e 'Control_L=Escape' & + echo "$choice" > "$STATE" + ;; + se) + pkill -x xcape 2>/dev/null || true + setxkbmap se + echo "$choice" > "$STATE" + ;; +esac +