Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
daed1d7e73 | ||
|
|
78800b327f | ||
|
|
0b419e01f9 | ||
|
|
22c88f46f8 | ||
|
|
29a780f929 | ||
|
|
6f301c67fa | ||
|
|
6e2bbc5277 |
@@ -14,3 +14,6 @@ wofi/style.css
|
||||
|
||||
# Stub Hyprland writes on first run; the real config is hyprland.lua
|
||||
hypr/hyprland.conf
|
||||
|
||||
# Python bytecode
|
||||
__pycache__/
|
||||
|
||||
@@ -9,6 +9,7 @@ This is a dotfiles/config repository for Arch Linux (Manjaro) using `yay` as the
|
||||
## Repository Structure
|
||||
|
||||
- **Window managers**: `hyprland/`, `sway/`, `i3/` - config files for each WM
|
||||
- **KDE Plasma (Steam Deck)**: `kde/` - `apply.sh` installs Krohnkite and runs `shortcuts.py`, which sets Hyprland-style global shortcuts live via kglobalaccel D-Bus (don't hand-edit `kglobalshortcutsrc`; edit the `BINDINGS` table). Avoid `KGlobalAccel.globalShortcutsByKey` over D-Bus because a malformed call crashes kwin_wayland
|
||||
- **Waybar**: `waybar/` - separate config JSONs per WM (`waybar_hyprland_config.json`, `waybar_sway_config.json`) plus shared `waybar_style.css`
|
||||
- **Shell**: `bashrc`, `zshrc` - sourced from the user's dotfiles, not used directly
|
||||
- **Terminal**: `alacritty.toml` (imported via alacritty's import system), `kitty.conf`
|
||||
|
||||
@@ -44,7 +44,9 @@ yay -S $(grep -v '^\s*$' ~/scripts/packages.txt | tr '\n' ' ')
|
||||
~/scripts/uninstall.sh --backup ~/scripts/backups/20260319_120000 all
|
||||
```
|
||||
|
||||
Available targets: `hyprland`, `sway`, `i3`, `cursor`, `shell`, `alacritty`, `tmux`, `nvim`, `vim`, `all`.
|
||||
Available targets: `hyprland`, `sway`, `i3`, `cursor`, `shell`, `alacritty`, `tmux`, `nvim`, `vim`, `kde`, `all`.
|
||||
|
||||
`kde` is for KDE Plasma 6 (Steam Deck desktop mode) and is not part of `all`. See [KDE Plasma (Steam Deck)](#kde-plasma-steam-deck).
|
||||
|
||||
### tmux prerequisite
|
||||
|
||||
@@ -180,6 +182,30 @@ All window managers and tmux use vim-style <kbd>h</kbd><kbd>j</kbd><kbd>k</kbd><
|
||||
| `e` | Exit session |
|
||||
| `Return` / `Esc` | Cancel |
|
||||
|
||||
### KDE Plasma (Steam Deck)
|
||||
|
||||
`install.sh kde` runs `kde/apply.sh`. It installs the [Krohnkite](https://github.com/anametologin/krohnkite) tiling script into `~/.local/share/kwin/scripts`, so it survives SteamOS updates, creates 8 virtual desktops, and sets the shortcuts live through kglobalaccel's D-Bus API (`kde/shortcuts.py`). KWin owns `kglobalshortcutsrc` while it's running, so editing that file by hand doesn't stick. To change a binding, edit the `BINDINGS` table in `kde/shortcuts.py` and press `$mod + Shift + c`. `uninstall.sh kde` (or `kde/apply.sh --reset`) puts every touched shortcut back to its KDE default.
|
||||
|
||||
Bindings match the shared table above, with these differences:
|
||||
|
||||
| Key | KDE behaviour |
|
||||
| ---------------------------- | ------------------------------------------------------------ |
|
||||
| `$mod + Return` / `d` | Konsole / KRunner |
|
||||
| `$mod + F2` / `F3` | Firefox (flatpak) / Dolphin |
|
||||
| `$mod + t` | Cycle Krohnkite layout: spiral (dwindle) → tile (master) → monocle |
|
||||
| `$mod + w` | Monocle layout (instead of a tab group) |
|
||||
| `$mod + e` / `v` | Rotate layout / rotate the focused part |
|
||||
| `$mod + r` | Interactive resize; `$mod + Ctrl + h/j/k/l` resizes tiles |
|
||||
| `$mod + Space` | Switch to the last window |
|
||||
| `$mod + Shift + s` | Keep window on all desktops |
|
||||
| `$mod + Shift + -` | Minimize (no scratchpad in KDE) |
|
||||
| `$mod + 0` / `Shift + e` | Plasma logout/shutdown screen |
|
||||
| `$mod + Ctrl + x` | Kill window (xkill) |
|
||||
| `$mod + Shift + w` | KDE Overview |
|
||||
| `Print` / `$mod + Print` / `$mod + Shift + Print` | Spectacle region → GUI / clipboard / `~/screenshot.png` |
|
||||
|
||||
Not mapped: `$mod + b` (KWin has no "last desktop" action), `$mod + m` (bar toggle), `$mod + g`, `$mod + c`, `$mod + F5`.
|
||||
|
||||
### tmux
|
||||
|
||||
Prefix is <kbd>Ctrl</kbd> + <kbd>f</kbd>.
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
general {
|
||||
lock_cmd = ~/.local/bin/hypr-agent lock; pidof hyprlock || hyprlock
|
||||
unlock_cmd = ~/.local/bin/hypr-agent unlock
|
||||
before_sleep_cmd = loginctl lock-session
|
||||
}
|
||||
|
||||
# Mark idle time for the activity tracker after 5 minutes without input.
|
||||
listener {
|
||||
timeout = 300
|
||||
on-timeout = ~/.local/bin/hypr-agent idle
|
||||
on-resume = ~/.local/bin/hypr-agent resume
|
||||
}
|
||||
+10
@@ -18,6 +18,7 @@ usage() {
|
||||
echo " tmux Source tmux.conf"
|
||||
echo " nvim Neovim (LazyVim) config"
|
||||
echo " vim Source vimrc"
|
||||
echo " kde KDE Plasma (Steam Deck): Krohnkite + Hyprland-style shortcuts"
|
||||
echo " all Everything (uses hyprland as WM)"
|
||||
echo
|
||||
echo "Options:"
|
||||
@@ -133,6 +134,14 @@ install_vim() {
|
||||
append_if_missing "$HOME/.vimrc" "source ~/scripts/vimrc"
|
||||
}
|
||||
|
||||
install_kde() {
|
||||
echo "Installing KDE (Hyprland-style) config..."
|
||||
backup "$CONFIG_DIR/kglobalshortcutsrc"
|
||||
backup "$CONFIG_DIR/kwinrc"
|
||||
backup "$CONFIG_DIR/kxkbrc"
|
||||
"$SCRIPTS_DIR/kde/apply.sh"
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
exit 1
|
||||
@@ -163,6 +172,7 @@ for target in "${targets[@]}"; do
|
||||
tmux) install_tmux ;;
|
||||
nvim) install_nvim ;;
|
||||
vim) install_vim ;;
|
||||
kde) install_kde ;;
|
||||
*)
|
||||
echo "Unknown target: $target"
|
||||
usage
|
||||
|
||||
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bash
|
||||
# Make KDE Plasma 6 (Steam Deck desktop mode) behave like hypr/base.lua:
|
||||
# Krohnkite tiling, 8 virtual desktops, Hyprland-style global shortcuts.
|
||||
# Safe to re-run. Undo with: kde/apply.sh --reset (or uninstall.sh kde)
|
||||
set -euo pipefail
|
||||
|
||||
KDE_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
APPS_DIR="$HOME/.local/share/applications"
|
||||
KROHNKITE_VERSION="0.9.9.2"
|
||||
KROHNKITE_URL="https://github.com/anametologin/krohnkite/releases/download/$KROHNKITE_VERSION/krohnkite.kwinscript"
|
||||
|
||||
kwin_reconfigure() { qdbus org.kde.KWin /KWin reconfigure >/dev/null 2>&1 || true; }
|
||||
|
||||
if [ "${1:-}" = "--reset" ]; then
|
||||
echo "Resetting KDE shortcuts and tiling..."
|
||||
python3 "$KDE_DIR/shortcuts.py" --reset
|
||||
rm -f "$APPS_DIR"/hyprkeys-*.desktop
|
||||
kwriteconfig6 --file kwinrc --group Plugins --key krohnkiteEnabled false
|
||||
kwin_reconfigure
|
||||
kbuildsycoca6 >/dev/null 2>&1 || true
|
||||
echo "Done. (Virtual desktops and Krohnkite itself are left in place.)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ---- Krohnkite -----------------------------------------------------------------
|
||||
installed=$(kpackagetool6 --type KWin/Script --show krohnkite 2>/dev/null | sed -n 's/.*Version *: *//p' || true)
|
||||
if [ "$installed" != "$KROHNKITE_VERSION" ]; then
|
||||
echo "Installing Krohnkite $KROHNKITE_VERSION..."
|
||||
tmp=$(mktemp -d)
|
||||
curl -fsSL -o "$tmp/krohnkite.kwinscript" "$KROHNKITE_URL"
|
||||
if [ -n "$installed" ]; then
|
||||
kpackagetool6 --type KWin/Script -u "$tmp/krohnkite.kwinscript"
|
||||
else
|
||||
kpackagetool6 --type KWin/Script -i "$tmp/krohnkite.kwinscript"
|
||||
fi
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
|
||||
kw() { kwriteconfig6 --file kwinrc --group "$1" --key "$2" "$3"; }
|
||||
kw Plugins krohnkiteEnabled true
|
||||
# gaps: hyprland gaps_in = 5, gaps_out = 0
|
||||
kw Script-krohnkite screenGapBetween 5
|
||||
for side in Left Right Top Bottom; do kw Script-krohnkite "screenGap$side" 0; done
|
||||
# layouts cycled by Super+T: spiral (~dwindle), tile (~master), monocle. 0 disables.
|
||||
for l in threeColumn quarter stacked columns spread floating stair binaryTree cascade; do
|
||||
kw Script-krohnkite "${l}LayoutOrder" 0
|
||||
done
|
||||
kw Script-krohnkite spiralLayoutOrder 1
|
||||
kw Script-krohnkite tileLayoutOrder 2
|
||||
kw Script-krohnkite monocleLayoutOrder 3
|
||||
# hyprland: hyprpwcenter / pavucontrol float
|
||||
kw Script-krohnkite floatingClass "org.pulseaudio.pavucontrol,pavucontrol,org.kde.spectacle,krunner"
|
||||
|
||||
# Super + left/right drag moves/resizes (KWin default, set explicitly)
|
||||
kw MouseBindings CommandAllKey Meta
|
||||
|
||||
# caps:swapescape, as in hyprland input.kb_options
|
||||
kwriteconfig6 --file kxkbrc --group Layout --key ResetOldOptions true
|
||||
kwriteconfig6 --file kxkbrc --group Layout --key Options caps:swapescape
|
||||
# tell KWin to re-read kxkbrc now (same signal the Keyboard KCM sends on Apply)
|
||||
dbus-send --session --type=signal /Layouts org.kde.keyboard.reloadConfig 2>/dev/null || true
|
||||
|
||||
kwin_reconfigure
|
||||
|
||||
# ---- 8 virtual desktops -------------------------------------------------------
|
||||
count=$(qdbus org.kde.KWin /VirtualDesktopManager org.kde.KWin.VirtualDesktopManager.count 2>/dev/null || echo 8)
|
||||
while [ "$count" -lt 8 ]; do
|
||||
qdbus org.kde.KWin /VirtualDesktopManager org.kde.KWin.VirtualDesktopManager.createDesktop "$count" "$((count + 1))" >/dev/null
|
||||
count=$((count + 1))
|
||||
done
|
||||
|
||||
# ---- launchers for commands that have no KDE action ---------------------------
|
||||
mkdir -p "$APPS_DIR"
|
||||
launcher() {
|
||||
local id="$1" name="$2" exec="$3"
|
||||
cat >"$APPS_DIR/hyprkeys-$id.desktop" <<EOF
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=$name
|
||||
Exec=$exec
|
||||
NoDisplay=true
|
||||
X-KDE-StartupNotify=false
|
||||
EOF
|
||||
}
|
||||
launcher screenshot-clip "Screenshot region to clipboard" "spectacle -b -n -r -c"
|
||||
launcher screenshot-save "Screenshot region to ~/screenshot.png" "sh -c 'spectacle -b -n -r -o \"\$HOME/screenshot.png\"'"
|
||||
launcher reload "Reload Hyprland-style KDE config" "sh -c '$KDE_DIR/apply.sh && notify-send \"KDE config reloaded\"'"
|
||||
for n in 1 2 3 4 5 6 7 8; do
|
||||
launcher "move-follow-$n" "Move window to desktop $n and follow" "$KDE_DIR/move-follow $n"
|
||||
done
|
||||
kbuildsycoca6 >/dev/null 2>&1 || true
|
||||
|
||||
# ---- shortcuts ------------------------------------------------------------------
|
||||
sleep 1 # let Krohnkite register its actions after the reconfigure
|
||||
echo "Applying shortcuts..."
|
||||
python3 "$KDE_DIR/shortcuts.py"
|
||||
|
||||
echo "Done. If caps:swapescape doesn't take effect, log out and back in."
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Move the active window to desktop N and switch there (hyprland: SUPER+SHIFT+N)
|
||||
n="$1"
|
||||
qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window to Desktop $n"
|
||||
qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Switch to Desktop $n"
|
||||
Executable
+220
@@ -0,0 +1,220 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Apply Hyprland-style global shortcuts to KDE Plasma 6 through kglobalaccel's D-Bus API.
|
||||
|
||||
kglobalaccel lives inside kwin_wayland and keeps shortcuts in memory, writing them
|
||||
back to ~/.config/kglobalshortcutsrc itself, so editing that file by hand while the
|
||||
session is running does not stick. This sets them live instead.
|
||||
|
||||
Usage: shortcuts.py apply the bindings below
|
||||
shortcuts.py --reset put every action we touched back to its KDE default
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
import dbus
|
||||
|
||||
STATE_FILE = os.path.expanduser("~/.local/state/hyprkeys/cleared.json")
|
||||
|
||||
# ---- key encoding (Qt6 QKeyCombination as int) -------------------------------
|
||||
|
||||
MODS = {"Meta": 0x10000000, "Shift": 0x02000000, "Ctrl": 0x04000000, "Alt": 0x08000000}
|
||||
NAMED = {
|
||||
"Return": 0x01000004, "Esc": 0x01000000, "Tab": 0x01000001, "Print": 0x01000009,
|
||||
"Left": 0x01000012, "Up": 0x01000013, "Right": 0x01000014, "Down": 0x01000015,
|
||||
"PgUp": 0x01000016, "PgDown": 0x01000017, "Space": 0x20,
|
||||
}
|
||||
NAMED.update({f"F{n}": 0x0100002F + n for n in range(1, 13)})
|
||||
# US-layout symbols typed with Shift+digit / Shift+minus
|
||||
SHIFTED = {"1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", "8": "*", "-": "_"}
|
||||
|
||||
|
||||
def key(spec):
|
||||
"""'Meta+Shift+Q' -> int. The final part is a key name or a single character."""
|
||||
*mods, k = spec.split("+")
|
||||
code = sum(MODS[m] for m in mods)
|
||||
return code | (NAMED[k] if k in NAMED else ord(k.upper()))
|
||||
|
||||
|
||||
def keys(*specs):
|
||||
"""Expand specs into key ints. Meta+Shift+<digit> also adds the shifted symbol
|
||||
(Meta+!), because on Wayland the keysym carries the Shift."""
|
||||
out = []
|
||||
for s in specs:
|
||||
out.append(key(s))
|
||||
mods, _, k = s.rpartition("+")
|
||||
if "Shift" in mods.split("+") and k in SHIFTED:
|
||||
out.append(key(f"{mods}+{SHIFTED[k]}"))
|
||||
return out
|
||||
|
||||
|
||||
# ---- binding table -------------------------------------------------------------
|
||||
# (component, action, keys, mode) mode: "set" replaces the keys, "add" keeps existing ones
|
||||
|
||||
K = "kwin"
|
||||
BINDINGS = [
|
||||
# apps
|
||||
("org.kde.konsole.desktop", "_launch", keys("Meta+Return"), "add"),
|
||||
("org.kde.krunner.desktop", "_launch", keys("Meta+D"), "add"),
|
||||
("org.mozilla.firefox.desktop", "_launch", keys("Meta+F2"), "set"),
|
||||
("org.kde.dolphin.desktop", "_launch", keys("Meta+F3", "Meta+Shift+F3"), "set"),
|
||||
("org.pulseaudio.pavucontrol.desktop", "_launch", keys("Meta+Ctrl+M"), "set"),
|
||||
# screenshots
|
||||
("org.kde.spectacle.desktop", "RectangularRegionScreenShot", keys("Print"), "set"),
|
||||
("hyprkeys-screenshot-clip.desktop", "_launch", keys("Meta+Print"), "set"),
|
||||
("hyprkeys-screenshot-save.desktop", "_launch", keys("Meta+Shift+Print"), "set"),
|
||||
# window actions
|
||||
(K, "Window Close", keys("Meta+Shift+Q"), "add"),
|
||||
(K, "Kill Window", keys("Meta+Ctrl+X"), "add"),
|
||||
(K, "Window Fullscreen", keys("Meta+F"), "set"),
|
||||
(K, "Window Resize", keys("Meta+R"), "set"),
|
||||
(K, "Window On All Desktops", keys("Meta+Shift+S"), "set"),
|
||||
(K, "Window Minimize", keys("Meta+Shift+-"), "add"),
|
||||
(K, "Walk Through Windows", keys("Meta+Space"), "add"),
|
||||
(K, "Overview", keys("Meta+Shift+W"), "set"),
|
||||
# session
|
||||
("ksmserver", "Lock Session", keys("Meta+9"), "add"),
|
||||
("ksmserver", "Log Out", keys("Meta+0", "Meta+Shift+E"), "add"),
|
||||
("hyprkeys-reload.desktop", "_launch", keys("Meta+Shift+C"), "set"),
|
||||
# Krohnkite tiling
|
||||
(K, "KrohnkiteFocusLeft", keys("Meta+H", "Meta+Left"), "set"),
|
||||
(K, "KrohnkiteFocusDown", keys("Meta+J", "Meta+Down"), "set"),
|
||||
(K, "KrohnkiteFocusUp", keys("Meta+K", "Meta+Up"), "set"),
|
||||
(K, "KrohnkiteFocusRight", keys("Meta+L", "Meta+Right"), "set"),
|
||||
(K, "KrohnkiteShiftLeft", keys("Meta+Shift+H", "Meta+Shift+Left"), "set"),
|
||||
(K, "KrohnkiteShiftDown", keys("Meta+Shift+J", "Meta+Shift+Down"), "set"),
|
||||
(K, "KrohnkiteShiftUp", keys("Meta+Shift+K", "Meta+Shift+Up"), "set"),
|
||||
(K, "KrohnkiteShiftRight", keys("Meta+Shift+L", "Meta+Shift+Right"), "set"),
|
||||
(K, "KrohnkiteShrinkWidth", keys("Meta+Ctrl+H"), "set"),
|
||||
(K, "KrohnkiteGrowHeight", keys("Meta+Ctrl+J"), "set"),
|
||||
(K, "KrohnkiteShrinkHeight", keys("Meta+Ctrl+K"), "set"),
|
||||
(K, "KrohnkitegrowWidth", keys("Meta+Ctrl+L"), "set"),
|
||||
(K, "KrohnkiteToggleFloat", keys("Meta+Shift+Space"), "set"),
|
||||
(K, "KrohnkiteNextLayout", keys("Meta+T"), "set"),
|
||||
(K, "KrohnkiteMonocleLayout", keys("Meta+W"), "set"),
|
||||
(K, "KrohnkiteRotate", keys("Meta+E"), "set"),
|
||||
(K, "KrohnkiteRotatePart", keys("Meta+V"), "set"),
|
||||
(K, "KrohnkiteTileLayout", [], "set"),
|
||||
(K, "KrohnkiteSetMaster", [], "set"),
|
||||
(K, "KrohnkiteDecrease", [], "set"),
|
||||
]
|
||||
for n in range(1, 9):
|
||||
BINDINGS += [
|
||||
(K, f"Switch to Desktop {n}", keys(f"Meta+{n}"), "set"),
|
||||
(K, f"Window to Desktop {n}", keys(f"Meta+Ctrl+{n}"), "set"),
|
||||
(f"hyprkeys-move-follow-{n}.desktop", "_launch", keys(f"Meta+Shift+{n}"), "set"),
|
||||
]
|
||||
|
||||
# ---- D-Bus helpers ---------------------------------------------------------------
|
||||
|
||||
bus = dbus.SessionBus()
|
||||
ka = dbus.Interface(bus.get_object("org.kde.kglobalaccel", "/kglobalaccel"), "org.kde.KGlobalAccel")
|
||||
|
||||
|
||||
def to_dbus(key_ints):
|
||||
return dbus.Array(
|
||||
[dbus.Struct((dbus.Array([k, 0, 0, 0], signature="i"),), signature=None) for k in key_ints],
|
||||
signature="(ai)",
|
||||
)
|
||||
|
||||
|
||||
def actions_of(comp):
|
||||
try:
|
||||
return {str(a[1]): [str(x) for x in a] for a in ka.allActionsForComponent([comp])}
|
||||
except dbus.DBusException:
|
||||
return {}
|
||||
|
||||
|
||||
def current(action_id):
|
||||
return [int(s[0][0]) for s in ka.shortcutKeys(action_id) if int(s[0][0])]
|
||||
|
||||
|
||||
def set_keys(action_id, key_ints):
|
||||
ka.setForeignShortcutKeys(action_id, to_dbus(key_ints))
|
||||
|
||||
|
||||
def action_id(comp, action):
|
||||
known = actions_of(comp).get(action)
|
||||
if known:
|
||||
return known
|
||||
# not registered yet (our own .desktop launchers, or Krohnkite before it loads)
|
||||
aid = [comp, action, comp.removesuffix(".desktop"), action]
|
||||
ka.doRegister(aid)
|
||||
return aid
|
||||
|
||||
|
||||
def all_actions():
|
||||
for comp in ka.allMainComponents():
|
||||
for aid in actions_of(str(comp[0])).values():
|
||||
yield aid
|
||||
|
||||
|
||||
# ---- main ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def apply():
|
||||
own = {(c, a): ks for c, a, ks, _ in BINDINGS}
|
||||
wanted = {k for ks in own.values() for k in ks}
|
||||
|
||||
# 1. strip our keys from every action that holds one it isn't meant to have
|
||||
cleared = set()
|
||||
for aid in all_actions():
|
||||
mine = own.get((aid[0], aid[1]), [])
|
||||
have = current(aid)
|
||||
keep = [k for k in have if k not in wanted or k in mine]
|
||||
if keep != have:
|
||||
set_keys(aid, keep)
|
||||
if (aid[0], aid[1]) not in own:
|
||||
cleared.add((aid[0], aid[1]))
|
||||
print(f" freed keys from {aid[0]} / {aid[1]}")
|
||||
|
||||
# remember what we freed so --reset can put it back
|
||||
os.makedirs(os.path.dirname(STATE_FILE), exist_ok=True)
|
||||
prev = set()
|
||||
if os.path.exists(STATE_FILE):
|
||||
prev = {tuple(x) for x in json.load(open(STATE_FILE))}
|
||||
json.dump(sorted(prev | cleared), open(STATE_FILE, "w"))
|
||||
|
||||
# 2. assign
|
||||
failed = []
|
||||
for comp, action, ks, mode in BINDINGS:
|
||||
aid = action_id(comp, action)
|
||||
new = ks
|
||||
if mode == "add":
|
||||
new = [k for k in current(aid) if k not in ks] + ks
|
||||
set_keys(aid, new)
|
||||
got = current(aid)
|
||||
if any(k not in got for k in ks):
|
||||
failed.append(f"{comp} / {action}")
|
||||
if failed:
|
||||
print(" WARNING: some keys were not accepted:\n " + "\n ".join(failed))
|
||||
print(f" {len(BINDINGS)} shortcuts applied")
|
||||
|
||||
|
||||
def reset():
|
||||
entries = [(c, a) for c, a, _, _ in BINDINGS]
|
||||
if os.path.exists(STATE_FILE):
|
||||
entries += [tuple(x) for x in json.load(open(STATE_FILE))]
|
||||
# Krohnkite and our own launchers go away entirely; clear them first so the
|
||||
# KDE defaults below don't collide with them.
|
||||
for comp, action in entries:
|
||||
if action.startswith("Krohnkite") or comp.startswith("hyprkeys-"):
|
||||
aid = actions_of(comp).get(action)
|
||||
if aid:
|
||||
set_keys(aid, [])
|
||||
if comp.startswith("hyprkeys-"):
|
||||
ka.unregister(comp, action)
|
||||
for comp, action in entries:
|
||||
if action.startswith("Krohnkite") or comp.startswith("hyprkeys-"):
|
||||
continue
|
||||
aid = actions_of(comp).get(action)
|
||||
if aid:
|
||||
set_keys(aid, [int(s[0][0]) for s in ka.defaultShortcutKeys(aid) if int(s[0][0])])
|
||||
if os.path.exists(STATE_FILE):
|
||||
os.remove(STATE_FILE)
|
||||
print(" shortcuts reset to KDE defaults")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
reset() if "--reset" in sys.argv else apply()
|
||||
+35
-12
@@ -1,18 +1,41 @@
|
||||
# Personal Neovim Config
|
||||
|
||||
My personal Neovim configuration built on [LazyVim](https://github.com/LazyVim/LazyVim).
|
||||
Built on [LazyVim](https://www.lazyvim.org). Everything LazyVim documents still applies —
|
||||
this file only covers what's different. Press `<space>` and wait for which-key, or
|
||||
`<space>?` to fuzzy-search every keymap.
|
||||
|
||||
## Current Setup
|
||||
## Setup
|
||||
|
||||
- **Base**: LazyVim with Gruvbox colorscheme
|
||||
- **AI**: Claude Code integration (`claudecode.nvim`)
|
||||
- **UI**: Snacks dashboard (custom STP banner), Which-Key (helix preset)
|
||||
- **Languages**: TypeScript, Vue, Python, Go, SQL, Tailwind, Docker
|
||||
- **Extras**: mini-surround, Prettier formatting, git extras
|
||||
- Colorscheme: tokyonight (LazyVim default)
|
||||
- Language extras: C/C++ (clangd), Python, Go, TypeScript/Vue/Tailwind, SQL, Docker, Clojure
|
||||
- Requires `tree-sitter-cli` (parsers can't be built without it) — see `../packages.txt`
|
||||
|
||||
## Suggested Plugins to Add
|
||||
## Custom keymaps
|
||||
|
||||
- **vim-fugitive** or **neogit** - deeper git workflow beyond LazyVim's built-in gitsigns
|
||||
- **nvim-lint** - async linting beyond what LSP provides
|
||||
- **oil.nvim** - file explorer that works like a buffer (edit filesystem like text)
|
||||
- **zen-mode.nvim** - distraction-free writing/coding
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `<space>?` | Search all keymaps |
|
||||
| `<C-/>` | Toggle terminal (project root, bottom of current window) |
|
||||
| **AI** — `<space>a` | |
|
||||
| `<space>aa` / `ac` | Toggle CLI / toggle Claude ([sidekick](https://github.com/folke/sidekick.nvim)) |
|
||||
| `<space>as` / `ad` | Select CLI / detach session |
|
||||
| `<space>at` / `af` / `av` | Send this / file / visual selection |
|
||||
| `<space>ap` | Pick a prompt |
|
||||
| `<C-.>` | Focus the sidekick terminal (any mode) |
|
||||
| **Git** (Neogit) — `<space>g` | |
|
||||
| `<space>gg` | Neogit status |
|
||||
| `<space>gc` / `gl` / `gp` | Commit / log / push |
|
||||
| **Harpoon** | |
|
||||
| `<space>h` | Add file to harpoon |
|
||||
| `<C-e>` | Harpoon menu |
|
||||
| `<C-1>`…`<C-4>` | Jump to harpoon file 1–4 |
|
||||
| **Other** | |
|
||||
| `<space>cu` | Undotree |
|
||||
| `<C-w><space>` | Window "hydra" mode (repeat window commands) |
|
||||
|
||||
## Behaviour changes from LazyVim
|
||||
|
||||
- 4-space indent everywhere (clangd fallback style matches); C/C++ has format-on-save **off**
|
||||
(format manually with `<space>cf`)
|
||||
- `nvim a b c` opens the files side by side
|
||||
- Inactive windows are dimmed (vimade); markdown renders inline (markview)
|
||||
|
||||
@@ -7,14 +7,10 @@
|
||||
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
|
||||
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
|
||||
|
||||
-- C/C++ uses 2-space indent to match clang-format's LLVM default
|
||||
-- Disable LazyVim's format-on-save for C/C++
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "c", "cpp" },
|
||||
callback = function()
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
-- Disable LazyVim's format-on-save for C/C++
|
||||
vim.b.autoformat = false
|
||||
end,
|
||||
})
|
||||
|
||||
+10
-11
@@ -2,14 +2,13 @@
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
||||
-- Terminal: open relative to current window (don't squash explorer) and smaller
|
||||
local terminal_opts = {
|
||||
cwd = LazyVim.root(),
|
||||
win = { position = "bottom", height = 0.3, relative = "win" },
|
||||
}
|
||||
vim.keymap.set({ "n", "t" }, "<c-/>", function()
|
||||
Snacks.terminal(nil, terminal_opts)
|
||||
end, { desc = "Terminal (Root Dir)" })
|
||||
vim.keymap.set({ "n", "t" }, "<c-_>", function()
|
||||
Snacks.terminal(nil, terminal_opts)
|
||||
end, { desc = "which_key_ignore" })
|
||||
-- Terminal: open relative to current window (don't squash explorer) and smaller.
|
||||
-- Root is resolved on each press so it follows the current buffer's project.
|
||||
local function terminal()
|
||||
Snacks.terminal(nil, {
|
||||
cwd = LazyVim.root(),
|
||||
win = { position = "bottom", height = 0.3, relative = "win" },
|
||||
})
|
||||
end
|
||||
vim.keymap.set({ "n", "t" }, "<c-/>", terminal, { desc = "Terminal (Root Dir)" })
|
||||
vim.keymap.set({ "n", "t" }, "<c-_>", terminal, { desc = "which_key_ignore" })
|
||||
|
||||
@@ -30,7 +30,7 @@ require("lazy").setup({
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "oxocarbon", "habamax" } },
|
||||
install = { colorscheme = { "tokyonight", "habamax" } },
|
||||
checker = {
|
||||
enabled = true, -- check for plugin updates periodically
|
||||
notify = false, -- notify on update
|
||||
|
||||
@@ -12,8 +12,9 @@ return {
|
||||
"--completion-style=detailed",
|
||||
"--function-arg-placeholders",
|
||||
-- ColumnLimit: 0 = fix indentation only; keep existing line
|
||||
-- breaks, never rewrap or join lines
|
||||
"--fallback-style={BasedOnStyle: LLVM, ColumnLimit: 0}",
|
||||
-- breaks, never rewrap or join lines. IndentWidth: 4 matches
|
||||
-- the editor's shiftwidth
|
||||
"--fallback-style={BasedOnStyle: LLVM, IndentWidth: 4, ColumnLimit: 0}",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"coder/claudecode.nvim",
|
||||
dependencies = { "folke/snacks.nvim" },
|
||||
opts = {
|
||||
terminal = {
|
||||
provider = "snacks",
|
||||
snacks_win_opts = {
|
||||
relative = "win",
|
||||
position = "bottom",
|
||||
height = 0.3,
|
||||
split_width_percentage = 0.99,
|
||||
},
|
||||
},
|
||||
diff_opts = {
|
||||
layout = "vertical",
|
||||
open_in_new_tab = true,
|
||||
keep_terminal_focus = true,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>a", "", desc = "+ai", mode = { "n", "v" } },
|
||||
{ "<leader>ac", "<cmd>ClaudeCode<cr>", desc = "Toggle Claude" },
|
||||
{ "<leader>af", "<cmd>ClaudeCodeFocus<cr>", desc = "Focus Claude" },
|
||||
{ "<leader>ar", "<cmd>ClaudeCode --resume<cr>", desc = "Resume Claude" },
|
||||
{ "<leader>aC", "<cmd>ClaudeCode --continue<cr>", desc = "Continue Claude" },
|
||||
{ "<leader>ab", "<cmd>ClaudeCodeAdd %<cr>", desc = "Add current buffer" },
|
||||
{ "<leader>as", "<cmd>ClaudeCodeSend<cr>", mode = "v", desc = "Send to Claude" },
|
||||
{
|
||||
"<leader>as",
|
||||
"<cmd>ClaudeCodeTreeAdd<cr>",
|
||||
desc = "Add file",
|
||||
ft = { "NvimTree", "neo-tree", "oil" },
|
||||
},
|
||||
-- Diff management
|
||||
{ "<leader>aa", "<cmd>ClaudeCodeDiffAccept<cr>", desc = "Accept diff" },
|
||||
{ "<leader>ad", "<cmd>ClaudeCodeDiffDeny<cr>", desc = "Deny diff" },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
return {
|
||||
{ "nyoom-engineering/oxocarbon.nvim", lazy = false, priority = 1000 },
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = function()
|
||||
vim.opt.background = "dark"
|
||||
vim.cmd("colorscheme oxocarbon")
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
return {
|
||||
{
|
||||
"folke/sidekick.nvim",
|
||||
opts = {
|
||||
-- next edit suggestions need the Copilot LSP
|
||||
nes = { enabled = false },
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<c-.>",
|
||||
function() require("sidekick.cli").focus() end,
|
||||
mode = { "n", "t", "i", "x" },
|
||||
desc = "Sidekick Focus",
|
||||
},
|
||||
{ "<leader>aa", function() require("sidekick.cli").toggle() end, desc = "Toggle CLI" },
|
||||
{
|
||||
"<leader>ac",
|
||||
function() require("sidekick.cli").toggle({ name = "claude", focus = true }) end,
|
||||
desc = "Toggle Claude",
|
||||
},
|
||||
{
|
||||
"<leader>as",
|
||||
function() require("sidekick.cli").select({ filter = { installed = true } }) end,
|
||||
desc = "Select CLI",
|
||||
},
|
||||
{ "<leader>ad", function() require("sidekick.cli").close() end, desc = "Detach CLI session" },
|
||||
{
|
||||
"<leader>at",
|
||||
function() require("sidekick.cli").send({ msg = "{this}" }) end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Send this",
|
||||
},
|
||||
{ "<leader>af", function() require("sidekick.cli").send({ msg = "{file}" }) end, desc = "Send file" },
|
||||
{
|
||||
"<leader>av",
|
||||
function() require("sidekick.cli").send({ msg = "{selection}" }) end,
|
||||
mode = "x",
|
||||
desc = "Send selection",
|
||||
},
|
||||
{
|
||||
"<leader>ap",
|
||||
function() require("sidekick.cli").prompt() end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Select prompt",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -5,9 +5,12 @@ return {
|
||||
recipe = { "minimalist", { animate = true } },
|
||||
fadelevel = 0.8,
|
||||
blocklist = {
|
||||
claude_terminal = {
|
||||
snacks_terminal = {
|
||||
buf_opts = { ft = "snacks_terminal" },
|
||||
},
|
||||
sidekick_terminal = {
|
||||
buf_opts = { ft = "sidekick_terminal" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,60 +1,24 @@
|
||||
-- LazyVim already defines all the default groups; only override what differs.
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts_extend = { "spec" },
|
||||
opts = {
|
||||
preset = "helix",
|
||||
spec = {
|
||||
{
|
||||
mode = { "n", "x" },
|
||||
{ "<leader><tab>", group = "tabs" },
|
||||
{ "<leader>c", group = "code" },
|
||||
{ "<leader>d", group = "debug" },
|
||||
{ "<leader>dp", group = "profiler" },
|
||||
{ "<leader>f", group = "file/find" },
|
||||
{ "<leader>g", group = "git" },
|
||||
{ "<leader>gh", group = "hunks" },
|
||||
{ "<leader>q", group = "quit/session" },
|
||||
{ "<leader>s", group = "search" },
|
||||
{ "<leader>u", group = "ui" },
|
||||
{ "<leader>x", group = "diagnostics/quickfix" },
|
||||
{ "[", group = "prev" },
|
||||
{ "]", group = "next" },
|
||||
{ "g", group = "goto" },
|
||||
{ "gs", group = "surround" },
|
||||
{ "z", group = "fold" },
|
||||
{
|
||||
"<leader>b",
|
||||
group = "buffer",
|
||||
expand = function()
|
||||
return require("which-key.extras").expand.buf()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<leader>w",
|
||||
group = "windows",
|
||||
proxy = "<c-w>",
|
||||
expand = function()
|
||||
return require("which-key.extras").expand.win()
|
||||
end,
|
||||
},
|
||||
-- better descriptions
|
||||
{ "gx", desc = "Open with system app" },
|
||||
{ "gc", group = "comment", desc = "Toggle comment" },
|
||||
},
|
||||
{ "<leader>a", group = "ai", mode = { "n", "v" }, icon = { icon = "", color = "green" } },
|
||||
{ "<leader>aa", icon = { icon = "", color = "green" } },
|
||||
{ "<leader>ac", icon = { icon = "", color = "orange" } },
|
||||
{ "<leader>as", icon = { icon = "", color = "azure" } },
|
||||
{ "<leader>ad", icon = { icon = "", color = "red" } },
|
||||
{ "<leader>at", icon = { icon = "", color = "yellow" }, mode = { "n", "x" } },
|
||||
{ "<leader>af", icon = { icon = "", color = "blue" } },
|
||||
{ "<leader>av", icon = { icon = "", color = "cyan" }, mode = "x" },
|
||||
{ "<leader>ap", icon = { icon = "", color = "purple" }, mode = { "n", "x" } },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
-- disable LazyVim's default <leader>? so the snacks keymaps picker owns it
|
||||
{ "<leader>?", false },
|
||||
{
|
||||
"<c-w><space>",
|
||||
function()
|
||||
require("which-key").show({ keys = "<c-w>", loop = true })
|
||||
end,
|
||||
desc = "Window Hydra Mode (which-key)",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -96,3 +96,4 @@ wine
|
||||
mono
|
||||
|
||||
avahi
|
||||
tree-sitter-cli
|
||||
|
||||
@@ -161,6 +161,11 @@ uninstall_vim() {
|
||||
remove_line "$HOME/.vimrc" "source ~/scripts/vimrc"
|
||||
}
|
||||
|
||||
uninstall_kde() {
|
||||
echo "Uninstalling KDE (Hyprland-style) config..."
|
||||
"$SCRIPTS_DIR/kde/apply.sh" --reset
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
exit 1
|
||||
@@ -205,6 +210,7 @@ for target in "${targets[@]}"; do
|
||||
tmux) uninstall_tmux ;;
|
||||
nvim) uninstall_nvim ;;
|
||||
vim) uninstall_vim ;;
|
||||
kde) uninstall_kde ;;
|
||||
*)
|
||||
echo "Unknown target: $target"
|
||||
usage
|
||||
|
||||
Reference in New Issue
Block a user