Files
scripts/CLAUDE.md
T
adamfandClaude Opus 5.5 c00705a24a Add Kando pie menu of cursor-following popups and aichat quick role
Replace cursor_ask.sh with popup.sh launching popups from a Kando
"popups" menu; cursor_follow.lua gains a popups table (sizes, follow
until Enter, stay_focused) and pauses following while Kando is open.
Add aichat config/role for the quick Claude popup and Kando
menu/theme configs, with gen-colors syncing the Kando theme palette.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-26 12:23:01 +00:00

57 lines
6.4 KiB
Markdown

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Overview
This is a dotfiles/config repository for Arch Linux (Manjaro) using `yay` as the package manager. Configs are installed by symlinking or sourcing from `~/scripts/` into their standard locations. The repo targets Wayland-based desktops (Hyprland and Sway) with an i3 fallback for X11.
## Repository Structure
- **Window managers**: `hypr/`, `sway/`, `i3/` - config files for each WM
- **Hyprland cursor follow + popups**: `hypr/cursor_follow.lua` (required from `base.lua`) keeps a floating window glued beside the mouse cursor (PiP videos, `$mod+z`) and handles the `$mod+a` popups: the `popups` table maps window classes to sizes and whether they follow until Enter is pressed (a `non_consuming` Return bind pauses them; `stay_focused` holds keyboard focus while following, since `follow_mouse = 1`). Opening the Kando menu also pauses a following popup and hands focus to the menu, since the menu needs the keyboard to see SUPER released. `hypr/popup.sh <name>` launches each popup. It also starts Kando on `hyprland.start` and keeps xpad sticky notes in `special:scratchpad`
- **Pie menu**: `kando/menus.json` (the `popups` menu, items run `popup.sh`) and `kando/config.json` (theme), file-symlinked into `~/.config/kando` (the rest of that dir is Kando runtime state). Kando writes settings-window edits through the symlinks, and watches the files, so edits here apply live. Its Hyprland shortcut ID is `kando:popups` (`hl.dsp.global("kando:popups")`); the launcher needs `KANDO_OZONE_PLATFORM=wayland`, otherwise it runs under XWayland
- **AI popups**: `hypr/aichat/config.yaml` (model `claude:claude-haiku-5-5`, `repl_prelude: temp:quick`, thinking disabled via `patch` so no empty `<think>` block) and `hypr/aichat/roles/quick.md` (short answers; code requests get library + functions until asked for the code). `popup.sh` sets `AICHAT_CONFIG_FILE`/`AICHAT_ROLES_DIR`; the API key is only in `~/.config/aichat/.env` as `CLAUDE_API_KEY` — never put it in the repo (`.env` is gitignored)
- **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`
- **Scripts**: `sh/` - shell utilities added to PATH (`sharefile`, `getfile`, `waybar-history`)
- **Submodule**: `hatsune-miku-windows-linux-cursors` - cursor theme (init with `git submodule update --init --recursive`)
- **Packages**: `packages.txt` - list of packages installed via `yay -S`
## Build System
Some configs are built by concatenating a `colors.*` file with a `base.*` file. The build outputs are gitignored. **Always edit the source (`base.*`) files, never the built outputs.**
| Component | Sources | Build output | Build command |
|-----------|---------|--------------|---------------|
| Hyprland | `hypr/colors.lua` + `hypr/base.lua` | `hypr/hyprland.lua` | `hypr/build.sh` |
| Waybar CSS | `waybar/colors.css` + `waybar/base.css` | `waybar/style.css` | `waybar/build.sh` |
After editing a base file, run the corresponding `build.sh` to regenerate the output.
`colors.conf` is the single palette; `sh/gen-colors` writes the `colors.*` fragments and also rewrites `menuThemeColors.purity` in the tracked `kando/config.json` (in place, to keep the symlink).
`hypr/cursor_follow.lua` and `hypr/popup.sh` are not built: `hyprctl reload` picks up Lua changes (then check `hyprctl configerrors`), and `popup.sh` / the aichat files are read on each launch.
## Key Conventions
- Configs are symlinked into `~/.config/` (see README.md for exact symlink commands per component)
- Shell configs (`bashrc`, `zshrc`) are sourced, not symlinked
- `alacritty.toml` uses alacritty's import mechanism rather than symlinking
- Hyprland is the primary/active WM (most recent changes)
- `$mod` in WM configs refers to the Super/Windows key
- Keybindings use vim-style hjkl navigation across all WMs and tmux
- When adding a package dependency, add it to `packages.txt`
- Prefer existing programs over custom scripts for popups and tools (the user asked for this)
## Working on the live Hyprland session
- The config is Lua (Hyprland 0.56). `hyprctl dispatch` takes a Lua expression, so module functions can be called directly: `hyprctl dispatch 'require("cursor_follow").toggle_sticky'`. Window props: `hyprctl getprop address:<addr> stay_focused`. Shortcuts registered by apps: `hyprctl globalshortcuts`
- The user is usually at the desktop. Anything that opens a window takes their keyboard (the following popups even lock it with `stay_focused`), so don't open popups to test them while they may be typing. To check a mouse popup's class and rules without stealing focus, launch it on a hidden workspace and close it afterwards: `hyprctl dispatch 'hl.dsp.exec_cmd("pavucontrol", { workspace = "special:probe silent" })'`
- Chromium ignores `--class` for `--app` windows on Wayland; their class comes from the URL (e.g. `chrome-127.0.0.1__-Default`), which is what the `popups` table matches for the receipt printer page
- To try something that may crash Hyprland, run a nested one on a hidden workspace and drive it with `hyprctl -i <instance>` (its dir appears in `$XDG_RUNTIME_DIR/hypr`; clients spawned with its `exec_cmd` open inside it): `hyprctl dispatch 'hl.dsp.exec_cmd("env HYPRLAND_NO_SD_VARS=1 HYPRLAND_NO_SD_NOTIFY=1 Hyprland --config /path/test.lua", { workspace = "special:probe silent" })'`. Its crash reports also land in `~/.cache/hyprland`
- Hyprland 0.56 bug: a pinned window sent to a hidden workspace (silent move) keeps its layout there once it's focused, and floating or tiling it after that workspace is destroyed segfaults (`CSpace::toggleTargetFloating`). So `$mod+CTRL+N` unpins before moving; don't silently move pinned windows elsewhere
- aichat's REPL (reedline) waits for a reply to cursor-position queries, so it hangs under `script`; drive it with a pty that answers `\e[6n` (or test one-shot `aichat -r quick "..." </dev/null`, which needs stdin closed)