Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33e1a059f8 | ||
|
|
c00705a24a | ||
|
|
2f5a53595d | ||
|
|
cc5f0348dc | ||
|
|
7ab3dc7779 | ||
|
|
daed1d7e73 | ||
|
|
78800b327f | ||
|
|
0b419e01f9 | ||
|
|
22c88f46f8 | ||
|
|
29a780f929 | ||
|
|
6f301c67fa | ||
|
|
6e2bbc5277 |
@@ -14,3 +14,9 @@ wofi/style.css
|
|||||||
|
|
||||||
# Stub Hyprland writes on first run; the real config is hyprland.lua
|
# Stub Hyprland writes on first run; the real config is hyprland.lua
|
||||||
hypr/hyprland.conf
|
hypr/hyprland.conf
|
||||||
|
|
||||||
|
# Python bytecode
|
||||||
|
__pycache__/
|
||||||
|
|
||||||
|
# Secrets, e.g. API keys for aichat (keep them in ~/.config/aichat/.env)
|
||||||
|
.env
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ This is a dotfiles/config repository for Arch Linux (Manjaro) using `yay` as the
|
|||||||
|
|
||||||
## Repository Structure
|
## Repository Structure
|
||||||
|
|
||||||
- **Window managers**: `hyprland/`, `sway/`, `i3/` - config files for each WM
|
- **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`
|
- **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
|
- **Shell**: `bashrc`, `zshrc` - sourced from the user's dotfiles, not used directly
|
||||||
- **Terminal**: `alacritty.toml` (imported via alacritty's import system), `kitty.conf`
|
- **Terminal**: `alacritty.toml` (imported via alacritty's import system), `kitty.conf`
|
||||||
@@ -27,6 +31,10 @@ Some configs are built by concatenating a `colors.*` file with a `base.*` file.
|
|||||||
|
|
||||||
After editing a base file, run the corresponding `build.sh` to regenerate the output.
|
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
|
## Key Conventions
|
||||||
|
|
||||||
- Configs are symlinked into `~/.config/` (see README.md for exact symlink commands per component)
|
- Configs are symlinked into `~/.config/` (see README.md for exact symlink commands per component)
|
||||||
@@ -35,3 +43,14 @@ After editing a base file, run the corresponding `build.sh` to regenerate the ou
|
|||||||
- Hyprland is the primary/active WM (most recent changes)
|
- Hyprland is the primary/active WM (most recent changes)
|
||||||
- `$mod` in WM configs refers to the Super/Windows key
|
- `$mod` in WM configs refers to the Super/Windows key
|
||||||
- Keybindings use vim-style hjkl navigation across all WMs and tmux
|
- 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)
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ yay -S $(grep -v '^\s*$' ~/scripts/packages.txt | tr '\n' ' ')
|
|||||||
~/scripts/uninstall.sh --backup ~/scripts/backups/20260319_120000 all
|
~/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
|
### tmux prerequisite
|
||||||
|
|
||||||
@@ -67,6 +69,9 @@ If you prefer to link configs manually instead of using `install.sh`:
|
|||||||
ln -sf ~/scripts/hypr ~/.config/hypr
|
ln -sf ~/scripts/hypr ~/.config/hypr
|
||||||
ln -sf ~/scripts/waybar ~/.config/waybar
|
ln -sf ~/scripts/waybar ~/.config/waybar
|
||||||
ln -sf ~/scripts/wofi ~/.config/wofi
|
ln -sf ~/scripts/wofi ~/.config/wofi
|
||||||
|
mkdir -p ~/.config/kando
|
||||||
|
ln -sf ~/scripts/kando/menus.json ~/.config/kando/menus.json
|
||||||
|
ln -sf ~/scripts/kando/config.json ~/.config/kando/config.json
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Sway
|
#### Sway
|
||||||
@@ -168,6 +173,48 @@ All window managers and tmux use vim-style <kbd>h</kbd><kbd>j</kbd><kbd>k</kbd><
|
|||||||
| `$mod + F5` | Music (mocp) |
|
| `$mod + F5` | Music (mocp) |
|
||||||
| `Print` | Screenshot |
|
| `Print` | Screenshot |
|
||||||
|
|
||||||
|
### Hyprland only
|
||||||
|
|
||||||
|
| Key | Action |
|
||||||
|
| ---------------------------- | ---------------------------------------------------------------- |
|
||||||
|
| `$mod + a` | Pie menu of popups, see [Popups](#popups-mod--a) |
|
||||||
|
| `$mod + z` | Pause the following window; press again over another window to make it follow instead, or over the paused one to resume it. With nothing following, the window under the cursor follows |
|
||||||
|
| `$mod + Shift + z` | Stop following |
|
||||||
|
| `$mod + Ctrl + z` | Toggle a bigger window centered above the cursor |
|
||||||
|
| `$mod + Alt + s` | Play / pause the video (playerctl) |
|
||||||
|
| `$mod + Alt + a / d` | Skip the video back / forward 10s |
|
||||||
|
| `$mod + Alt + Up / Down` | Widen / narrow the gap between the cursor and the window |
|
||||||
|
| `$mod + Alt + Right / Left` | Make the following window bigger / smaller |
|
||||||
|
| `$mod + Alt + z` | Show these cursor-follow keys in a notification |
|
||||||
|
|
||||||
|
Picture-in-Picture windows follow the cursor automatically (`hypr/cursor_follow.lua`).
|
||||||
|
|
||||||
|
### Popups (`$mod + a`)
|
||||||
|
|
||||||
|
`$mod + a` opens a [Kando](https://kando.menu) pie menu at the cursor. Keep `$mod` held, flick toward a slice and let go, or tap `$mod + a` and then click a slice or press its letter. Each slice runs `hypr/popup.sh <name>`:
|
||||||
|
|
||||||
|
| Slice (key) | What it opens |
|
||||||
|
| ---------------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||||
|
| AI question (`a`) | aichat in kitty: short answers, follow-ups keep context; code requests get the library and functions |
|
||||||
|
| Ask about a screen region (`r`) | Drag a box (slurp + grim), type a question, then chat about the screenshot |
|
||||||
|
| Terminal (`t`) | kitty |
|
||||||
|
| Audio (`v`) | pavucontrol |
|
||||||
|
| Receipt printer (`p`) | The receipt_maker page as a Chromium app: `127.0.0.1:8765` if it is running, else the website |
|
||||||
|
| Sticky notes (`s`) | Shows / hides the xpad notes, which live in the scratchpad (also `$mod + -`) |
|
||||||
|
|
||||||
|
Keyboard popups (AI, terminal) follow the cursor and keep keyboard focus until Enter is pressed in them (or the pie menu is opened), then stay put so they can be scrolled with the mouse. The others are only placed beside the cursor. Sizes and which popups follow are the `popups` table at the top of `hypr/cursor_follow.lua`.
|
||||||
|
|
||||||
|
Setup:
|
||||||
|
|
||||||
|
- The AI popups need an Anthropic API key in `~/.config/aichat/.env` (never in this repo; `.env` is gitignored):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p ~/.config/aichat && read -rs "k?API key: " && printf 'CLAUDE_API_KEY=%s\n' "$k" > ~/.config/aichat/.env && chmod 600 ~/.config/aichat/.env
|
||||||
|
```
|
||||||
|
|
||||||
|
- aichat's model and the short-answer instructions are `hypr/aichat/config.yaml` and `hypr/aichat/roles/quick.md`; `popup.sh` points aichat at them, so plain `aichat` elsewhere is unaffected.
|
||||||
|
- Kando's menu and theme are `kando/menus.json` and `kando/config.json`, linked into `~/.config/kando` by `install.sh hyprland`. Edits made in Kando's settings window are written straight back into the repo. Kando is started by `cursor_follow.lua` when Hyprland starts.
|
||||||
|
|
||||||
### System menu (`$mod + 0`)
|
### System menu (`$mod + 0`)
|
||||||
|
|
||||||
| Key | Action |
|
| Key | Action |
|
||||||
@@ -180,6 +227,30 @@ All window managers and tmux use vim-style <kbd>h</kbd><kbd>j</kbd><kbd>k</kbd><
|
|||||||
| `e` | Exit session |
|
| `e` | Exit session |
|
||||||
| `Return` / `Esc` | Cancel |
|
| `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
|
### tmux
|
||||||
|
|
||||||
Prefix is <kbd>Ctrl</kbd> + <kbd>f</kbd>.
|
Prefix is <kbd>Ctrl</kbd> + <kbd>f</kbd>.
|
||||||
@@ -232,6 +303,7 @@ Generated files (gitignored; `install.sh` runs `gen-colors` before building):
|
|||||||
| `i3/colors.conf` | `set $color_name #HEXVAL` | `i3config` (include) |
|
| `i3/colors.conf` | `set $color_name #HEXVAL` | `i3config` (include) |
|
||||||
| `waybar/colors.css` | CSS custom properties | `waybar/style.css` (@import) |
|
| `waybar/colors.css` | CSS custom properties | `waybar/style.css` (@import) |
|
||||||
| `wofi/colors.css` | CSS custom properties | `wofi/style.css` (@import) |
|
| `wofi/colors.css` | CSS custom properties | `wofi/style.css` (@import) |
|
||||||
|
| `kando/config.json` | `menuThemeColors.purity` | Kando's Purity theme (tracked; only that key is rewritten, and Kando reloads it live) |
|
||||||
|
|
||||||
## Scripts
|
## Scripts
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
alias vim=nvim
|
alias vim=nvim
|
||||||
|
|
||||||
|
# Drop interactive host shells straight into the "dev" distrobox.
|
||||||
|
# Skip with: NO_DISTROBOX=1 bash
|
||||||
|
if [[ $- == *i* && -z $CONTAINER_ID && ! -e /run/.containerenv && -z $NO_DISTROBOX ]] \
|
||||||
|
&& command -v distrobox >/dev/null && podman container exists dev 2>/dev/null; then
|
||||||
|
distrobox enter dev && exit # falls back to host shell if enter fails
|
||||||
|
fi
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# aichat config for the SUPER+A AI popups (popup.sh points AICHAT_CONFIG_FILE and AICHAT_ROLES_DIR here)
|
||||||
|
# The API key stays out of the repo, in ~/.config/aichat/.env as CLAUDE_API_KEY=...
|
||||||
|
model: claude:claude-haiku-5-5
|
||||||
|
stream: true
|
||||||
|
save: false
|
||||||
|
wrap: auto
|
||||||
|
wrap_code: false
|
||||||
|
function_calling: false
|
||||||
|
save_session: false
|
||||||
|
# every REPL starts with a throwaway session (so follow-ups keep context) and the quick role
|
||||||
|
repl_prelude: temp:quick
|
||||||
|
left_prompt: '{color.cyan}> {color.reset}'
|
||||||
|
right_prompt: ''
|
||||||
|
|
||||||
|
clients:
|
||||||
|
- type: claude
|
||||||
|
models:
|
||||||
|
- name: claude-haiku-5-5
|
||||||
|
max_input_tokens: 200000
|
||||||
|
max_output_tokens: 4096
|
||||||
|
require_max_tokens: true
|
||||||
|
supports_vision: true
|
||||||
|
# Haiku otherwise streams an empty thinking block, which aichat prints as <think></think>
|
||||||
|
patch:
|
||||||
|
chat_completions:
|
||||||
|
'.*':
|
||||||
|
body:
|
||||||
|
thinking:
|
||||||
|
type: disabled
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
You are a terse reference assistant in a small terminal popup, about 70 columns by 20 lines.
|
||||||
|
Reply with only the answer, starting with its first word, in 1-3 short sentences.
|
||||||
|
No preamble, alternatives, caveats or summaries. No headings, tables or bold.
|
||||||
|
When first asked to write or make code, do not write it: reply with the library to use, then the
|
||||||
|
key functions or methods in the order they would be called, one per line as `name()` and a few
|
||||||
|
words on what it does. When the user then asks to see the code, write it in one short code block.
|
||||||
|
If the question could mean two things, answer the likelier one and name the other in a few words.
|
||||||
|
The user will ask a follow-up if they want more.
|
||||||
+18
-11
@@ -6,7 +6,7 @@
|
|||||||
---- MONITORS ----
|
---- MONITORS ----
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
hl.monitor({ output = "", mode = "preferred", position = "auto", scale = 1 })
|
hl.monitor({ output = "", mode = "preferred", position = "auto", scale = 1.5 })
|
||||||
-- Per-machine layout generated by nwg-displays
|
-- Per-machine layout generated by nwg-displays
|
||||||
pcall(require, "monitors")
|
pcall(require, "monitors")
|
||||||
|
|
||||||
@@ -14,8 +14,10 @@ pcall(require, "monitors")
|
|||||||
---- MY PROGRAMS ----
|
---- MY PROGRAMS ----
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
local terminal = "kitty"
|
-- kitty restores the last window's maximized state, which Hyprland obeys, so new terminals
|
||||||
local fileManager = "kitty -e ranger"
|
-- would cover the layout instead of tiling into it
|
||||||
|
local terminal = "kitty -o remember_window_size=no"
|
||||||
|
local fileManager = terminal .. " -e ranger"
|
||||||
local menu = "wofi --show drun"
|
local menu = "wofi --show drun"
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
@@ -151,7 +153,7 @@ hl.bind(mod .. " + CTRL + M", hl.dsp.exec_cmd("hyprpwcenter"))
|
|||||||
hl.bind(mod .. " + F2", hl.dsp.exec_cmd("waterfox"))
|
hl.bind(mod .. " + F2", hl.dsp.exec_cmd("waterfox"))
|
||||||
hl.bind(mod .. " + F3", hl.dsp.exec_cmd(fileManager))
|
hl.bind(mod .. " + F3", hl.dsp.exec_cmd(fileManager))
|
||||||
hl.bind(mod .. " + SHIFT + F3", hl.dsp.exec_cmd("pcmanfm"))
|
hl.bind(mod .. " + SHIFT + F3", hl.dsp.exec_cmd("pcmanfm"))
|
||||||
hl.bind(mod .. " + F5", hl.dsp.exec_cmd("kitty -e mocp"))
|
hl.bind(mod .. " + F5", hl.dsp.exec_cmd(terminal .. " -e mocp"))
|
||||||
|
|
||||||
-- Toggle window layout between master and dwindle
|
-- Toggle window layout between master and dwindle
|
||||||
local layoutIsMaster = false
|
local layoutIsMaster = false
|
||||||
@@ -249,8 +251,16 @@ hl.bind(mod .. " + B", hl.dsp.focus({ workspace = "previous" })) -- back_and_for
|
|||||||
for i = 1, 8 do
|
for i = 1, 8 do
|
||||||
-- Switch to workspace
|
-- Switch to workspace
|
||||||
hl.bind(mod .. " + " .. i, hl.dsp.focus({ workspace = i }))
|
hl.bind(mod .. " + " .. i, hl.dsp.focus({ workspace = i }))
|
||||||
-- Move container to workspace (silent = don't follow)
|
-- Move container to workspace (silent = don't follow). A pinned window is unpinned first: Hyprland 0.56
|
||||||
hl.bind(mod .. " + CTRL + " .. i, hl.dsp.window.move({ workspace = i, follow = false }))
|
-- leaves a pinned window's layout on the hidden workspace once it's focused here, and floating or tiling
|
||||||
|
-- it after that workspace is gone crashes Hyprland
|
||||||
|
hl.bind(mod .. " + CTRL + " .. i, function()
|
||||||
|
local w = hl.get_active_window()
|
||||||
|
if w and w.pinned then
|
||||||
|
hl.dispatch(hl.dsp.window.pin({ action = "disable" }))
|
||||||
|
end
|
||||||
|
hl.dispatch(hl.dsp.window.move({ workspace = i, follow = false }))
|
||||||
|
end)
|
||||||
-- Move to workspace AND follow (replaces $mod+Shift+N in i3)
|
-- Move to workspace AND follow (replaces $mod+Shift+N in i3)
|
||||||
hl.bind(mod .. " + SHIFT + " .. i, hl.dsp.window.move({ workspace = i, follow = true }))
|
hl.bind(mod .. " + SHIFT + " .. i, hl.dsp.window.move({ workspace = i, follow = true }))
|
||||||
end
|
end
|
||||||
@@ -316,11 +326,8 @@ hl.window_rule({
|
|||||||
float = true,
|
float = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
hl.window_rule({
|
-- Picture-in-Picture windows float and follow the cursor (SUPER+Z / SUPER+SHIFT+Z), see cursor_follow.lua
|
||||||
name = "PiP",
|
require("cursor_follow")
|
||||||
match = { title = "^(Picture-in-Picture)$" },
|
|
||||||
float = false,
|
|
||||||
})
|
|
||||||
|
|
||||||
-------------------------------
|
-------------------------------
|
||||||
---- WORKSPACE NAMES / ICONS --
|
---- WORKSPACE NAMES / ICONS --
|
||||||
|
|||||||
@@ -0,0 +1,463 @@
|
|||||||
|
-- cursor_follow: keep a floating window glued next to the mouse cursor (Hyprland Lua config)
|
||||||
|
-- Picture-in-Picture windows follow automatically; SUPER+Z pauses following, and pressed again over
|
||||||
|
-- another window makes that one follow instead (or over the paused one, resumes it);
|
||||||
|
-- SUPER+SHIFT+Z stops; SUPER+CTRL+Z toggles a bigger window centered
|
||||||
|
-- above the cursor; SUPER+ALT+S/A/D play/pause and seek the video (via playerctl);
|
||||||
|
-- SUPER+ALT+Up/Down widen/narrow the gap to the cursor; SUPER+ALT+Right/Left grow/shrink the window;
|
||||||
|
-- SUPER+ALT+Z lists these keybindings.
|
||||||
|
-- SUPER+A opens a Kando pie menu of popups (popup.sh) that open beside the cursor; the keyboard ones
|
||||||
|
-- hold focus while they follow it and stop following once Enter is pressed in them, so they can be scrolled.
|
||||||
|
-- Load from hyprland.lua with: require("cursor_follow")
|
||||||
|
|
||||||
|
local M = {
|
||||||
|
cfg = {
|
||||||
|
width = 480, -- size applied when a window starts following
|
||||||
|
height = 270,
|
||||||
|
gap = 24, -- px between the cursor hotspot and the window
|
||||||
|
gap_step = 8, -- px added/removed per gap key press
|
||||||
|
margin = 8, -- keep this far from monitor edges
|
||||||
|
dir = { x = 1, y = -1 }, -- starting side of the cursor (right, above); flips at screen edges
|
||||||
|
centered_scale = 1.25, -- window size multiplier while centered above the cursor
|
||||||
|
size_step = 1.1, -- window size multiplier per grow key press (shrink divides by it)
|
||||||
|
min_width = 160, -- smallest width the shrink key goes down to
|
||||||
|
interval = 8, -- ms between cursor polls
|
||||||
|
player = "firefox", -- MPRIS player for the video keys (Waterfox shows up as firefox)
|
||||||
|
seek = 10, -- seconds skipped by the seek keys
|
||||||
|
-- SUPER+A menu popups by window class: size, and whether it follows the cursor until Enter is
|
||||||
|
-- pressed in it (keyboard popups) or is only placed beside the cursor (ones used with the mouse)
|
||||||
|
popups = {
|
||||||
|
["popup-ai"] = { 640, 420, follow = true },
|
||||||
|
["popup-term"] = { 640, 360, follow = true },
|
||||||
|
-- the receipt printer page as a Chromium app, served locally or by the website
|
||||||
|
["chrome-127.0.0.1__-Default"] = { 480, 720 },
|
||||||
|
["chrome-www.adam-french.co.uk__receipt_-Default"] = { 480, 720 },
|
||||||
|
["org.pulseaudio.pavucontrol"] = { 640, 480 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
target = nil, -- address of the followed window
|
||||||
|
paused = false,
|
||||||
|
centered = false, -- window centered horizontally above the cursor instead of beside it
|
||||||
|
}
|
||||||
|
|
||||||
|
local cfg = M.cfg
|
||||||
|
local last_x, last_y
|
||||||
|
-- current side of the cursor per axis; stays flipped until the window hits the opposite edge
|
||||||
|
local side = { x = cfg.dir.x, y = cfg.dir.y }
|
||||||
|
local timer
|
||||||
|
-- marks the followed window so it can be picked back up after a config reload
|
||||||
|
local tag = "cursor-follow"
|
||||||
|
-- marks it as centered too, so the mode survives a reload
|
||||||
|
local centered_tag = "cursor-follow-centered"
|
||||||
|
-- window that was following before a popup took over, picked back up when the popup closes
|
||||||
|
local resume_after_popup
|
||||||
|
-- sticky notes, kept in the scratchpad
|
||||||
|
local sticky_class = "xpad"
|
||||||
|
-- the SUPER+A pie menu's full-screen window (Kando's settings window has the same class)
|
||||||
|
local menu_class, menu_title = "menu.kando.Kando", "Kando Menu"
|
||||||
|
|
||||||
|
local function selector()
|
||||||
|
return "address:" .. M.target
|
||||||
|
end
|
||||||
|
|
||||||
|
-- the popup spec of a following SUPER+A popup
|
||||||
|
local function follow_popup(w)
|
||||||
|
local p = w and cfg.popups[w.class]
|
||||||
|
return p and p.follow and p
|
||||||
|
end
|
||||||
|
|
||||||
|
-- focus follows the mouse and the followed window is never under the cursor, so a keyboard
|
||||||
|
-- popup holds keyboard focus while it follows
|
||||||
|
local function lock_focus(on)
|
||||||
|
if follow_popup(M.target and hl.get_window(selector())) then
|
||||||
|
hl.dispatch(hl.dsp.window.set_prop({ window = selector(), prop = "stay_focused", value = on and "1" or "0" }))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function set_tag(name, on)
|
||||||
|
hl.dispatch(hl.dsp.window.tag({ window = selector(), tag = (on and "+" or "-") .. name }))
|
||||||
|
end
|
||||||
|
|
||||||
|
local function resize(x, y)
|
||||||
|
hl.dispatch(hl.dsp.window.resize({ window = selector(), x = math.floor(x + 0.5), y = math.floor(y + 0.5) }))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- centered mode always starts with the window above the cursor
|
||||||
|
local function reset_side()
|
||||||
|
side.x, side.y = cfg.dir.x, M.centered and -1 or cfg.dir.y
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Keep a window of `size` starting at `p` within [lo, hi] minus the margin
|
||||||
|
local function clamp(p, size, lo, hi)
|
||||||
|
p = math.max(lo + cfg.margin, math.min(p, hi - cfg.margin - size))
|
||||||
|
return math.floor(p + 0.5)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Position along one axis: on side `dir` of the cursor, flipped if it would leave the monitor
|
||||||
|
-- and the other side has room. Returns the position and the (possibly flipped) side.
|
||||||
|
local function axis(cur, size, lo, hi, dir)
|
||||||
|
local after, before = cur + cfg.gap, cur - cfg.gap - size
|
||||||
|
local fits_after, fits_before = after + size <= hi - cfg.margin, before >= lo + cfg.margin
|
||||||
|
if dir > 0 and not fits_after and fits_before then
|
||||||
|
dir = -1
|
||||||
|
elseif dir < 0 and not fits_before and fits_after then
|
||||||
|
dir = 1
|
||||||
|
end
|
||||||
|
return clamp(dir > 0 and after or before, size, lo, hi), dir
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.detach()
|
||||||
|
timer:set_enabled(false)
|
||||||
|
if M.target then
|
||||||
|
set_tag(tag, false)
|
||||||
|
set_tag(centered_tag, false)
|
||||||
|
lock_focus(false)
|
||||||
|
end
|
||||||
|
M.target, M.paused = nil, false
|
||||||
|
last_x, last_y = nil, nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Position for a window of `size` beside the cursor, on the sides in `s` (flipped in place at
|
||||||
|
-- the monitor edges), or centered above it
|
||||||
|
local function beside_cursor(size, s, centered)
|
||||||
|
local c, m = hl.get_cursor_pos(), hl.get_monitor_at_cursor()
|
||||||
|
if not c or not m then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local mw, mh = m.width / m.scale, m.height / m.scale
|
||||||
|
local x, y
|
||||||
|
if centered then
|
||||||
|
x = clamp(c.x - size.x / 2, size.x, m.x, m.x + mw)
|
||||||
|
else
|
||||||
|
x, s.x = axis(c.x, size.x, m.x, m.x + mw, s.x)
|
||||||
|
end
|
||||||
|
y, s.y = axis(c.y, size.y, m.y, m.y + mh, s.y)
|
||||||
|
return x, y
|
||||||
|
end
|
||||||
|
|
||||||
|
local function place()
|
||||||
|
local w = M.target and hl.get_window(selector())
|
||||||
|
-- stop once the window is closed or tiled again
|
||||||
|
if not w or not w.floating then
|
||||||
|
M.detach()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local x, y = beside_cursor(w.size, side, M.centered)
|
||||||
|
if not x or (x == last_x and y == last_y) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
last_x, last_y = x, y
|
||||||
|
hl.dispatch(hl.dsp.window.move({ window = selector(), x = x, y = y }))
|
||||||
|
end
|
||||||
|
|
||||||
|
timer = hl.timer(place, { timeout = cfg.interval, type = "repeat" })
|
||||||
|
timer:set_enabled(false)
|
||||||
|
|
||||||
|
-- keep_size: picking a window back up after a reload, so leave its size alone
|
||||||
|
function M.attach(w, keep_size)
|
||||||
|
if M.target then
|
||||||
|
M.detach()
|
||||||
|
end
|
||||||
|
M.target = w.address
|
||||||
|
reset_side()
|
||||||
|
local sel = selector()
|
||||||
|
set_tag(tag, true)
|
||||||
|
set_tag(centered_tag, M.centered)
|
||||||
|
hl.dispatch(hl.dsp.window.float({ window = sel, action = "enable" }))
|
||||||
|
hl.dispatch(hl.dsp.window.pin({ window = sel, action = "enable" }))
|
||||||
|
-- moves would otherwise animate and trail behind the cursor
|
||||||
|
hl.dispatch(hl.dsp.window.set_prop({ window = sel, prop = "no_anim", value = "1" }))
|
||||||
|
if not keep_size then
|
||||||
|
local s = M.centered and cfg.centered_scale or 1
|
||||||
|
resize(cfg.width * s, cfg.height * s)
|
||||||
|
end
|
||||||
|
lock_focus(true)
|
||||||
|
timer:set_enabled(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.toggle_pause()
|
||||||
|
M.paused = not M.paused
|
||||||
|
last_x, last_y = nil, nil
|
||||||
|
timer:set_enabled(not M.paused)
|
||||||
|
lock_focus(not M.paused)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.change_gap(d)
|
||||||
|
cfg.gap = math.max(0, cfg.gap + d)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.toggle_centered()
|
||||||
|
M.centered = not M.centered
|
||||||
|
reset_side()
|
||||||
|
local w = M.target and hl.get_window(selector())
|
||||||
|
if w then
|
||||||
|
set_tag(centered_tag, M.centered)
|
||||||
|
local s = M.centered and cfg.centered_scale or 1 / cfg.centered_scale
|
||||||
|
resize(w.size.x * s, w.size.y * s)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Grow (f > 1) or shrink the followed window, keeping its aspect ratio and keeping it between
|
||||||
|
-- min_width and the monitor width. Later windows start at the new size too.
|
||||||
|
function M.scale(f)
|
||||||
|
local w = M.target and hl.get_window(selector())
|
||||||
|
if not w then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local m = hl.get_monitor_at_cursor()
|
||||||
|
local max = m and m.width / m.scale - 2 * cfg.margin or math.huge
|
||||||
|
f = math.max(cfg.min_width / w.size.x, math.min(f, max / w.size.x))
|
||||||
|
cfg.width, cfg.height = cfg.width * f, cfg.height * f
|
||||||
|
resize(w.size.x * f, w.size.y * f)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------
|
||||||
|
---- RULES ----
|
||||||
|
---------------
|
||||||
|
|
||||||
|
local pip_title = "Picture-in-Picture"
|
||||||
|
|
||||||
|
hl.window_rule({
|
||||||
|
name = "cursor-follow-pip",
|
||||||
|
match = { title = "^(" .. pip_title .. ")$" },
|
||||||
|
float = true,
|
||||||
|
pin = true,
|
||||||
|
size = cfg.width .. " " .. cfg.height,
|
||||||
|
no_anim = true,
|
||||||
|
no_initial_focus = true,
|
||||||
|
keep_aspect_ratio = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
for class, p in pairs(cfg.popups) do
|
||||||
|
hl.window_rule({
|
||||||
|
name = "cursor-follow-" .. class,
|
||||||
|
match = { class = "^(" .. class .. ")$" },
|
||||||
|
float = true,
|
||||||
|
pin = p.follow,
|
||||||
|
size = p[1] .. " " .. p[2],
|
||||||
|
no_anim = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.window_rule({
|
||||||
|
name = "cursor-follow-sticky",
|
||||||
|
match = { class = "^(" .. sticky_class .. ")$" },
|
||||||
|
workspace = "special:scratchpad silent",
|
||||||
|
float = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Kando draws the pie menu in a transparent window covering the screen
|
||||||
|
hl.window_rule({
|
||||||
|
name = "kando",
|
||||||
|
match = { class = menu_class, title = menu_title },
|
||||||
|
no_blur = true,
|
||||||
|
opaque = true,
|
||||||
|
move = { 0, 0 },
|
||||||
|
rounding = 0,
|
||||||
|
size = { "100%", "100%" },
|
||||||
|
border_size = 0,
|
||||||
|
no_anim = true,
|
||||||
|
float = true,
|
||||||
|
pin = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
----------------
|
||||||
|
---- EVENTS ----
|
||||||
|
----------------
|
||||||
|
|
||||||
|
local function maybe_attach_pip(w)
|
||||||
|
if w.title == pip_title and w.address ~= M.target then
|
||||||
|
M.attach(w)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- keyboard popups follow the cursor; the others are only placed beside it
|
||||||
|
local function open_popup(w)
|
||||||
|
local p = cfg.popups[w.class]
|
||||||
|
if not p then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if p.follow then
|
||||||
|
if w.address ~= M.target then
|
||||||
|
resume_after_popup = M.target
|
||||||
|
M.attach(w, true)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local x, y = beside_cursor({ x = p[1], y = p[2] }, { x = cfg.dir.x, y = cfg.dir.y }, false)
|
||||||
|
if x then
|
||||||
|
hl.dispatch(hl.dsp.window.move({ window = "address:" .. w.address, x = x, y = y }))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The pie menu needs the keyboard (it selects when SUPER is released) and would otherwise have
|
||||||
|
-- a following popup chase the cursor across it, so a following popup stays where it is from here on
|
||||||
|
local function open_menu(w)
|
||||||
|
if w.class ~= menu_class or w.title ~= menu_title then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if M.target and not M.paused and follow_popup(hl.get_window(selector())) then
|
||||||
|
M.toggle_pause()
|
||||||
|
-- stay_focused may already have kept focus from the menu as it mapped
|
||||||
|
hl.dispatch(hl.dsp.focus({ window = "address:" .. w.address }))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
hl.on("window.open", maybe_attach_pip)
|
||||||
|
hl.on("window.open", open_popup)
|
||||||
|
hl.on("window.open", open_menu)
|
||||||
|
-- browsers can set the PiP title after the window maps
|
||||||
|
hl.on("window.title", maybe_attach_pip)
|
||||||
|
|
||||||
|
hl.on("window.close", function(w)
|
||||||
|
if w.address == M.target then
|
||||||
|
M.detach()
|
||||||
|
-- hand following back to the window the popup took over from
|
||||||
|
local prev = follow_popup(w) and resume_after_popup and hl.get_window("address:" .. resume_after_popup)
|
||||||
|
if prev and prev.floating then
|
||||||
|
M.attach(prev, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- an unpinned window stays on one workspace (SUPER+CTRL+N unpins it to send it away), so stop following it
|
||||||
|
hl.on("window.pin", function(w)
|
||||||
|
if w.address == M.target and not w.pinned then
|
||||||
|
M.detach()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Enter in a following popup sends what was typed, so stop following and let the answer be
|
||||||
|
-- scrolled with the mouse; non_consuming still passes the key on to the popup
|
||||||
|
hl.bind("Return", function()
|
||||||
|
local w = M.target and not M.paused and hl.get_active_window()
|
||||||
|
if w and w.address == M.target and follow_popup(w) then
|
||||||
|
M.toggle_pause()
|
||||||
|
end
|
||||||
|
end, { non_consuming = true })
|
||||||
|
|
||||||
|
------------------
|
||||||
|
---- KEYBINDS ----
|
||||||
|
------------------
|
||||||
|
|
||||||
|
local keys -- { keys, description, action, bind options }, listed by M.help
|
||||||
|
|
||||||
|
local function player(args)
|
||||||
|
return hl.dsp.exec_cmd("playerctl -p " .. cfg.player .. " " .. args)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.help()
|
||||||
|
local lines = {}
|
||||||
|
for _, k in ipairs(keys) do
|
||||||
|
lines[#lines + 1] = k[1] .. ": " .. k[2]
|
||||||
|
end
|
||||||
|
hl.exec_cmd("notify-send -t 10000 'cursor follow' '" .. table.concat(lines, "\n") .. "'")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- show or hide the sticky notes in the scratchpad, moving any pads that are elsewhere into it
|
||||||
|
function M.toggle_sticky()
|
||||||
|
local pads = false
|
||||||
|
for _, w in ipairs(hl.get_windows()) do
|
||||||
|
if w.class == sticky_class then
|
||||||
|
pads = true
|
||||||
|
if not w.workspace or w.workspace.name ~= "special:scratchpad" then
|
||||||
|
hl.dispatch(
|
||||||
|
hl.dsp.window.move({
|
||||||
|
window = "address:" .. w.address,
|
||||||
|
workspace = "special:scratchpad",
|
||||||
|
follow = false,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not pads then
|
||||||
|
hl.exec_cmd("xpad --show")
|
||||||
|
end
|
||||||
|
hl.dispatch(hl.dsp.workspace.toggle_special("scratchpad"))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Pause the following window. Once paused, the window under the cursor (focus follows the mouse)
|
||||||
|
-- follows instead, leaving the paused one where it is, or the paused one resumes if it's under the cursor.
|
||||||
|
function M.follow_or_pause()
|
||||||
|
local w = hl.get_active_window()
|
||||||
|
if M.target and (not M.paused or not w or w.address == M.target) then
|
||||||
|
M.toggle_pause()
|
||||||
|
elseif w then
|
||||||
|
-- popups keep their own size
|
||||||
|
M.attach(w, cfg.popups[w.class] ~= nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
keys = {
|
||||||
|
{ "SUPER + Z", "pause following; when paused, the window under the cursor follows instead", M.follow_or_pause },
|
||||||
|
{ "SUPER + SHIFT + Z", "stop following", M.detach },
|
||||||
|
{ "SUPER + CTRL + Z", "toggle a bigger window centered above the cursor", M.toggle_centered },
|
||||||
|
{ "SUPER + ALT + S", "play/pause the video", player("play-pause") },
|
||||||
|
{ "SUPER + ALT + A", "skip back " .. cfg.seek .. "s", player("position " .. cfg.seek .. "-"), { repeating = true } },
|
||||||
|
{ "SUPER + ALT + D", "skip forward " .. cfg.seek .. "s", player("position " .. cfg.seek .. "+"), { repeating = true } },
|
||||||
|
{
|
||||||
|
"SUPER + ALT + up",
|
||||||
|
"widen the gap to the cursor",
|
||||||
|
function()
|
||||||
|
M.change_gap(cfg.gap_step)
|
||||||
|
end,
|
||||||
|
{ repeating = true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SUPER + ALT + down",
|
||||||
|
"narrow the gap to the cursor",
|
||||||
|
function()
|
||||||
|
M.change_gap(-cfg.gap_step)
|
||||||
|
end,
|
||||||
|
{ repeating = true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SUPER + ALT + right",
|
||||||
|
"make the window bigger",
|
||||||
|
function()
|
||||||
|
M.scale(cfg.size_step)
|
||||||
|
end,
|
||||||
|
{ repeating = true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SUPER + ALT + left",
|
||||||
|
"make the window smaller",
|
||||||
|
function()
|
||||||
|
M.scale(1 / cfg.size_step)
|
||||||
|
end,
|
||||||
|
{ repeating = true },
|
||||||
|
},
|
||||||
|
{ "SUPER + ALT + Z", "show these keybindings", M.help },
|
||||||
|
{ "SUPER + A", "pie menu of popups: hold SUPER, flick toward one, release", hl.dsp.global("kando:popups") },
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, k in ipairs(keys) do
|
||||||
|
hl.bind(k[1], k[3], k[4])
|
||||||
|
end
|
||||||
|
|
||||||
|
-- A config reload starts this module from scratch while the followed window stays pinned,
|
||||||
|
-- so it would tag along across workspaces but stand still. Pick it back up.
|
||||||
|
local resumed = hl.get_windows({ tag = tag })[1]
|
||||||
|
if not resumed then
|
||||||
|
for _, w in ipairs(hl.get_windows()) do
|
||||||
|
if w.title == pip_title then
|
||||||
|
resumed = w
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if resumed then
|
||||||
|
M.centered = hl.get_windows({ tag = centered_tag })[1] ~= nil
|
||||||
|
M.attach(resumed, true)
|
||||||
|
-- popups spend most of their life with Enter already pressed
|
||||||
|
if follow_popup(resumed) then
|
||||||
|
M.toggle_pause()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- the pie menu runs in the background so it opens instantly; its launcher defaults to XWayland
|
||||||
|
hl.on("hyprland.start", function()
|
||||||
|
hl.exec_cmd("env KANDO_OZONE_PLATFORM=wayland kando")
|
||||||
|
end)
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -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
|
||||||
|
}
|
||||||
Executable
+46
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# popup: open one of the popups in the SUPER+A pie menu (Kando runs `popup.sh <name>`)
|
||||||
|
# cursor_follow.lua places each popup window beside the cursor by its class, and the keyboard
|
||||||
|
# ones (ai, term) follow it until Enter is pressed in them.
|
||||||
|
|
||||||
|
kitty=(kitty -o confirm_os_window_close=0 -o window_padding_width=10)
|
||||||
|
# aichat's config and quick role live next to this script; the API key is in ~/.config/aichat/.env
|
||||||
|
export AICHAT_CONFIG_FILE="$HOME/.config/hypr/aichat/config.yaml"
|
||||||
|
export AICHAT_ROLES_DIR="$HOME/.config/hypr/aichat/roles"
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
ai)
|
||||||
|
exec "${kitty[@]}" --class popup-ai -o 'map escape close_window' -e aichat
|
||||||
|
;;
|
||||||
|
region) # ask the AI about a dragged-out screen region
|
||||||
|
geometry=$(slurp) || exit
|
||||||
|
img=$(mktemp --suffix=.png)
|
||||||
|
grim -g "$geometry" "$img" || exit
|
||||||
|
exec "${kitty[@]}" --class popup-ai -o 'map escape close_window' -e "$0" region-chat "$img"
|
||||||
|
;;
|
||||||
|
region-chat) # runs inside the region popup: ask about the screenshot, then keep chatting about it
|
||||||
|
read -e -r -p $'\001\e[36m\002about this region> \001\e[0m\002' q
|
||||||
|
aichat --empty-session --save-session -s region -r quick -f "$2" "${q:-What is this?}"
|
||||||
|
rm -f "$2"
|
||||||
|
exec aichat -s region
|
||||||
|
;;
|
||||||
|
receipt) # the receipt printer page, served here while the Pi is down, otherwise by the website
|
||||||
|
url=https://www.adam-french.co.uk/receipt/
|
||||||
|
curl -sf -m 1 http://127.0.0.1:8765/healthz >/dev/null && url=http://127.0.0.1:8765/
|
||||||
|
# Chromium names an app window's class after its URL, so cursor_follow.lua knows both of these
|
||||||
|
exec chromium --no-first-run --no-default-browser-check --app="$url"
|
||||||
|
;;
|
||||||
|
sticky)
|
||||||
|
exec hyprctl dispatch 'require("cursor_follow").toggle_sticky'
|
||||||
|
;;
|
||||||
|
term)
|
||||||
|
exec "${kitty[@]}" --class popup-term
|
||||||
|
;;
|
||||||
|
audio)
|
||||||
|
exec pavucontrol
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "usage: popup.sh ai|region|receipt|sticky|term|audio" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
+15
-1
@@ -9,7 +9,7 @@ usage() {
|
|||||||
echo "Usage: $(basename "$0") [OPTIONS] <target>..."
|
echo "Usage: $(basename "$0") [OPTIONS] <target>..."
|
||||||
echo
|
echo
|
||||||
echo "Targets:"
|
echo "Targets:"
|
||||||
echo " hyprland Hyprland + waybar + wofi"
|
echo " hyprland Hyprland + waybar + wofi + Kando"
|
||||||
echo " sway Sway + waybar + wofi"
|
echo " sway Sway + waybar + wofi"
|
||||||
echo " i3 i3 + i3blocks + i3status"
|
echo " i3 i3 + i3blocks + i3status"
|
||||||
echo " cursor Miku cursor theme"
|
echo " cursor Miku cursor theme"
|
||||||
@@ -18,6 +18,7 @@ usage() {
|
|||||||
echo " tmux Source tmux.conf"
|
echo " tmux Source tmux.conf"
|
||||||
echo " nvim Neovim (LazyVim) config"
|
echo " nvim Neovim (LazyVim) config"
|
||||||
echo " vim Source vimrc"
|
echo " vim Source vimrc"
|
||||||
|
echo " kde KDE Plasma (Steam Deck): Krohnkite + Hyprland-style shortcuts"
|
||||||
echo " all Everything (uses hyprland as WM)"
|
echo " all Everything (uses hyprland as WM)"
|
||||||
echo
|
echo
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
@@ -70,6 +71,10 @@ install_hyprland() {
|
|||||||
link "$SCRIPTS_DIR/hypr" "$CONFIG_DIR/hypr"
|
link "$SCRIPTS_DIR/hypr" "$CONFIG_DIR/hypr"
|
||||||
link "$SCRIPTS_DIR/waybar" "$CONFIG_DIR/waybar"
|
link "$SCRIPTS_DIR/waybar" "$CONFIG_DIR/waybar"
|
||||||
link "$SCRIPTS_DIR/wofi" "$CONFIG_DIR/wofi"
|
link "$SCRIPTS_DIR/wofi" "$CONFIG_DIR/wofi"
|
||||||
|
# Kando keeps runtime state next to its settings, so only the settings files are linked
|
||||||
|
mkdir -p "$CONFIG_DIR/kando"
|
||||||
|
link "$SCRIPTS_DIR/kando/menus.json" "$CONFIG_DIR/kando/menus.json"
|
||||||
|
link "$SCRIPTS_DIR/kando/config.json" "$CONFIG_DIR/kando/config.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_sway() {
|
install_sway() {
|
||||||
@@ -133,6 +138,14 @@ install_vim() {
|
|||||||
append_if_missing "$HOME/.vimrc" "source ~/scripts/vimrc"
|
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
|
if [ $# -eq 0 ]; then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
@@ -163,6 +176,7 @@ for target in "${targets[@]}"; do
|
|||||||
tmux) install_tmux ;;
|
tmux) install_tmux ;;
|
||||||
nvim) install_nvim ;;
|
nvim) install_nvim ;;
|
||||||
vim) install_vim ;;
|
vim) install_vim ;;
|
||||||
|
kde) install_kde ;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown target: $target"
|
echo "Unknown target: $target"
|
||||||
usage
|
usage
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"version": "3.0.1",
|
||||||
|
"locale": "auto",
|
||||||
|
"showIntroductionDialog": false,
|
||||||
|
"menuTheme": "purity",
|
||||||
|
"darkMenuTheme": "default",
|
||||||
|
"menuThemeColors": {},
|
||||||
|
"darkMenuThemeColors": {},
|
||||||
|
"enableDarkModeForMenuThemes": false,
|
||||||
|
"enableSelectionWedges": false,
|
||||||
|
"underlineQuickSelectKey": false,
|
||||||
|
"drawQuickSelectKey": false,
|
||||||
|
"fadeInDuration": 0,
|
||||||
|
"fadeOutDuration": 0,
|
||||||
|
"enableMenuAnimations": false,
|
||||||
|
"enablePointerReactiveEffects": false,
|
||||||
|
"soundTheme": "none",
|
||||||
|
"soundVolume": 0.5,
|
||||||
|
"enableVersionCheck": true,
|
||||||
|
"ignoreWriteProtectedConfigFiles": false,
|
||||||
|
"settingsWindowColorScheme": "system",
|
||||||
|
"settingsWindowFlavor": "transparent-system",
|
||||||
|
"trayIconFlavor": "color",
|
||||||
|
"hardwareAcceleration": true,
|
||||||
|
"lazyInitialization": false,
|
||||||
|
"zoomFactor": 1,
|
||||||
|
"hideSettingsButton": false,
|
||||||
|
"settingsButtonPosition": "bottom-right",
|
||||||
|
"windowsInkWorkaround": true,
|
||||||
|
"maxSelectionRadius": 0,
|
||||||
|
"centerDeadZone": 50,
|
||||||
|
"minParentDistance": 150,
|
||||||
|
"dragThreshold": 15,
|
||||||
|
"keepInputFocus": false,
|
||||||
|
"hideOnFocusOut": true,
|
||||||
|
"enableMarkingMode": true,
|
||||||
|
"enableTurboMode": true,
|
||||||
|
"warpMouse": true,
|
||||||
|
"returnPointerToMenuOpeningPosition": false,
|
||||||
|
"hoverModeNeedsConfirmation": false,
|
||||||
|
"triggerCenterClickOnKeyRelease": false,
|
||||||
|
"gestureMinStrokeLength": 150,
|
||||||
|
"gestureMinStrokeAngle": 20,
|
||||||
|
"gestureJitterThreshold": 10,
|
||||||
|
"gesturePauseTimeout": 100,
|
||||||
|
"fixedStrokeLength": 0,
|
||||||
|
"rmbSelectsParent": false,
|
||||||
|
"enableGamepad": true,
|
||||||
|
"gamepadBackButton": 1,
|
||||||
|
"gamepadCloseButton": 2,
|
||||||
|
"sameShortcutBehavior": "nothing",
|
||||||
|
"wlrootsPointerGetTimeoutMouse": 500,
|
||||||
|
"wlrootsPointerGetTimeoutTouch": 1500,
|
||||||
|
"wlrootsPointerGetTimeoutDefaultBehavior": "center",
|
||||||
|
"useDefaultOsShowSettingsHotkey": true,
|
||||||
|
"enableAchievements": true,
|
||||||
|
"enableAchievementNotifications": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
{
|
||||||
|
"version": "3.0.1",
|
||||||
|
"menus": [
|
||||||
|
{
|
||||||
|
"root": {
|
||||||
|
"name": "Popups",
|
||||||
|
"icon": "apps",
|
||||||
|
"iconTheme": "material-symbols-rounded",
|
||||||
|
"type": "root",
|
||||||
|
"activateWorkflow": {
|
||||||
|
"quickSelectKey": "Backspace",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "close-menu"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"name": "AI question",
|
||||||
|
"icon": "smart_toy",
|
||||||
|
"iconTheme": "material-symbols-rounded",
|
||||||
|
"type": "button",
|
||||||
|
"selectWorkflow": {
|
||||||
|
"quickSelectKey": "A",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "close-menu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "execute-command",
|
||||||
|
"command": "~/.config/hypr/popup.sh ai",
|
||||||
|
"detached": true,
|
||||||
|
"isolated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ask about a screen region",
|
||||||
|
"icon": "screenshot_region",
|
||||||
|
"iconTheme": "material-symbols-rounded",
|
||||||
|
"type": "button",
|
||||||
|
"selectWorkflow": {
|
||||||
|
"quickSelectKey": "R",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "close-menu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "execute-command",
|
||||||
|
"command": "~/.config/hypr/popup.sh region",
|
||||||
|
"detached": true,
|
||||||
|
"isolated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Terminal",
|
||||||
|
"icon": "terminal",
|
||||||
|
"iconTheme": "material-symbols-rounded",
|
||||||
|
"type": "button",
|
||||||
|
"selectWorkflow": {
|
||||||
|
"quickSelectKey": "T",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "close-menu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "execute-command",
|
||||||
|
"command": "~/.config/hypr/popup.sh term",
|
||||||
|
"detached": true,
|
||||||
|
"isolated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Audio",
|
||||||
|
"icon": "volume_up",
|
||||||
|
"iconTheme": "material-symbols-rounded",
|
||||||
|
"type": "button",
|
||||||
|
"selectWorkflow": {
|
||||||
|
"quickSelectKey": "V",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "close-menu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "execute-command",
|
||||||
|
"command": "~/.config/hypr/popup.sh audio",
|
||||||
|
"detached": true,
|
||||||
|
"isolated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Receipt printer",
|
||||||
|
"icon": "receipt_long",
|
||||||
|
"iconTheme": "material-symbols-rounded",
|
||||||
|
"type": "button",
|
||||||
|
"selectWorkflow": {
|
||||||
|
"quickSelectKey": "P",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "close-menu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "execute-command",
|
||||||
|
"command": "~/.config/hypr/popup.sh receipt",
|
||||||
|
"detached": true,
|
||||||
|
"isolated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Sticky notes",
|
||||||
|
"icon": "sticky_note_2",
|
||||||
|
"iconTheme": "material-symbols-rounded",
|
||||||
|
"type": "button",
|
||||||
|
"selectWorkflow": {
|
||||||
|
"quickSelectKey": "S",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "close-menu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "execute-command",
|
||||||
|
"command": "~/.config/hypr/popup.sh sticky",
|
||||||
|
"detached": true,
|
||||||
|
"isolated": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"shortcut": "",
|
||||||
|
"shortcutID": "popups",
|
||||||
|
"useFixedPosition": false,
|
||||||
|
"fixedMenuPosition": {
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"anchored": false,
|
||||||
|
"hoverMode": false,
|
||||||
|
"tags": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"collections": [
|
||||||
|
{
|
||||||
|
"name": "Favorites",
|
||||||
|
"icon": "favorite",
|
||||||
|
"iconTheme": "material-symbols-rounded",
|
||||||
|
"tags": [
|
||||||
|
"favs"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
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
|
# 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
|
- Colorscheme: tokyonight (LazyVim default)
|
||||||
- **AI**: Claude Code integration (`claudecode.nvim`)
|
- Language extras: C/C++ (clangd), Python, Go, TypeScript/Vue/Tailwind, SQL, Docker, Clojure
|
||||||
- **UI**: Snacks dashboard (custom STP banner), Which-Key (helix preset)
|
- Requires `tree-sitter-cli` (parsers can't be built without it) — see `../packages.txt`
|
||||||
- **Languages**: TypeScript, Vue, Python, Go, SQL, Tailwind, Docker
|
|
||||||
- **Extras**: mini-surround, Prettier formatting, git extras
|
|
||||||
|
|
||||||
## Suggested Plugins to Add
|
## Custom keymaps
|
||||||
|
|
||||||
- **vim-fugitive** or **neogit** - deeper git workflow beyond LazyVim's built-in gitsigns
|
| Key | Action |
|
||||||
- **nvim-lint** - async linting beyond what LSP provides
|
|-----|--------|
|
||||||
- **oil.nvim** - file explorer that works like a buffer (edit filesystem like text)
|
| `<space>?` | Search all keymaps |
|
||||||
- **zen-mode.nvim** - distraction-free writing/coding
|
| `<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)
|
-- 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")
|
-- 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", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = { "c", "cpp" },
|
pattern = { "c", "cpp" },
|
||||||
callback = function()
|
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
|
vim.b.autoformat = false
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,14 +2,13 @@
|
|||||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||||
-- Add any additional keymaps here
|
-- Add any additional keymaps here
|
||||||
|
|
||||||
-- Terminal: open relative to current window (don't squash explorer) and smaller
|
-- Terminal: open relative to current window (don't squash explorer) and smaller.
|
||||||
local terminal_opts = {
|
-- Root is resolved on each press so it follows the current buffer's project.
|
||||||
|
local function terminal()
|
||||||
|
Snacks.terminal(nil, {
|
||||||
cwd = LazyVim.root(),
|
cwd = LazyVim.root(),
|
||||||
win = { position = "bottom", height = 0.3, relative = "win" },
|
win = { position = "bottom", height = 0.3, relative = "win" },
|
||||||
}
|
})
|
||||||
vim.keymap.set({ "n", "t" }, "<c-/>", function()
|
end
|
||||||
Snacks.terminal(nil, terminal_opts)
|
vim.keymap.set({ "n", "t" }, "<c-/>", terminal, { desc = "Terminal (Root Dir)" })
|
||||||
end, { desc = "Terminal (Root Dir)" })
|
vim.keymap.set({ "n", "t" }, "<c-_>", terminal, { desc = "which_key_ignore" })
|
||||||
vim.keymap.set({ "n", "t" }, "<c-_>", function()
|
|
||||||
Snacks.terminal(nil, terminal_opts)
|
|
||||||
end, { desc = "which_key_ignore" })
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ require("lazy").setup({
|
|||||||
version = false, -- always use the latest git commit
|
version = false, -- always use the latest git commit
|
||||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||||
},
|
},
|
||||||
install = { colorscheme = { "oxocarbon", "habamax" } },
|
install = { colorscheme = { "tokyonight", "habamax" } },
|
||||||
checker = {
|
checker = {
|
||||||
enabled = true, -- check for plugin updates periodically
|
enabled = true, -- check for plugin updates periodically
|
||||||
notify = false, -- notify on update
|
notify = false, -- notify on update
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ return {
|
|||||||
"--completion-style=detailed",
|
"--completion-style=detailed",
|
||||||
"--function-arg-placeholders",
|
"--function-arg-placeholders",
|
||||||
-- ColumnLimit: 0 = fix indentation only; keep existing line
|
-- ColumnLimit: 0 = fix indentation only; keep existing line
|
||||||
-- breaks, never rewrap or join lines
|
-- breaks, never rewrap or join lines. IndentWidth: 4 matches
|
||||||
"--fallback-style={BasedOnStyle: LLVM, ColumnLimit: 0}",
|
-- 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 } },
|
recipe = { "minimalist", { animate = true } },
|
||||||
fadelevel = 0.8,
|
fadelevel = 0.8,
|
||||||
blocklist = {
|
blocklist = {
|
||||||
claude_terminal = {
|
snacks_terminal = {
|
||||||
buf_opts = { ft = "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 {
|
return {
|
||||||
{
|
{
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
event = "VeryLazy",
|
|
||||||
opts_extend = { "spec" },
|
|
||||||
opts = {
|
opts = {
|
||||||
preset = "helix",
|
preset = "helix",
|
||||||
spec = {
|
spec = {
|
||||||
{
|
{ "<leader>a", group = "ai", mode = { "n", "v" }, icon = { icon = "", color = "green" } },
|
||||||
mode = { "n", "x" },
|
{ "<leader>aa", icon = { icon = "", color = "green" } },
|
||||||
{ "<leader><tab>", group = "tabs" },
|
{ "<leader>ac", icon = { icon = "", color = "orange" } },
|
||||||
{ "<leader>c", group = "code" },
|
{ "<leader>as", icon = { icon = "", color = "azure" } },
|
||||||
{ "<leader>d", group = "debug" },
|
{ "<leader>ad", icon = { icon = "", color = "red" } },
|
||||||
{ "<leader>dp", group = "profiler" },
|
{ "<leader>at", icon = { icon = "", color = "yellow" }, mode = { "n", "x" } },
|
||||||
{ "<leader>f", group = "file/find" },
|
{ "<leader>af", icon = { icon = "", color = "blue" } },
|
||||||
{ "<leader>g", group = "git" },
|
{ "<leader>av", icon = { icon = "", color = "cyan" }, mode = "x" },
|
||||||
{ "<leader>gh", group = "hunks" },
|
{ "<leader>ap", icon = { icon = "", color = "purple" }, mode = { "n", "x" } },
|
||||||
{ "<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" },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
-- disable LazyVim's default <leader>? so the snacks keymaps picker owns it
|
-- disable LazyVim's default <leader>? so the snacks keymaps picker owns it
|
||||||
{ "<leader>?", false },
|
{ "<leader>?", false },
|
||||||
{
|
|
||||||
"<c-w><space>",
|
|
||||||
function()
|
|
||||||
require("which-key").show({ keys = "<c-w>", loop = true })
|
|
||||||
end,
|
|
||||||
desc = "Window Hydra Mode (which-key)",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
+51
-3
@@ -11,6 +11,8 @@ sway
|
|||||||
swaybg
|
swaybg
|
||||||
swayidle
|
swayidle
|
||||||
swaylock
|
swaylock
|
||||||
|
network-manager-applet
|
||||||
|
pamac-gtk
|
||||||
|
|
||||||
hyprland
|
hyprland
|
||||||
hyprpaper
|
hyprpaper
|
||||||
@@ -20,11 +22,15 @@ hyprsunset
|
|||||||
hyprshutdown
|
hyprshutdown
|
||||||
hyprpwcenter
|
hyprpwcenter
|
||||||
hyprlauncher
|
hyprlauncher
|
||||||
|
nwg-displays
|
||||||
|
|
||||||
dex
|
dex
|
||||||
polkit-gnome
|
polkit-gnome
|
||||||
|
xdg-utils
|
||||||
|
|
||||||
waybar
|
waybar
|
||||||
|
claudebar
|
||||||
|
pacman-contrib
|
||||||
|
|
||||||
grim
|
grim
|
||||||
slurp
|
slurp
|
||||||
@@ -32,12 +38,14 @@ slurp
|
|||||||
mako
|
mako
|
||||||
brightnessctl
|
brightnessctl
|
||||||
gammastep
|
gammastep
|
||||||
|
libnotify
|
||||||
|
playerctl
|
||||||
|
|
||||||
lxappearance
|
lxappearance
|
||||||
|
|
||||||
gimp
|
gimp
|
||||||
bambustudio-bin
|
bambustudio-bin
|
||||||
surfshark
|
surfshark-client
|
||||||
spotify
|
spotify
|
||||||
waterfox-bin
|
waterfox-bin
|
||||||
ytmdl
|
ytmdl
|
||||||
@@ -57,11 +65,14 @@ yay
|
|||||||
alacritty
|
alacritty
|
||||||
kitty
|
kitty
|
||||||
tmux
|
tmux
|
||||||
|
zsh
|
||||||
ranger
|
ranger
|
||||||
mocp
|
|
||||||
dunst
|
dunst
|
||||||
cliphist
|
cliphist
|
||||||
inotify-tools
|
inotify-tools
|
||||||
|
ripgrep
|
||||||
|
fd
|
||||||
|
fzf
|
||||||
|
|
||||||
fcitx5
|
fcitx5
|
||||||
fcitx5-chinese-addons
|
fcitx5-chinese-addons
|
||||||
@@ -76,17 +87,22 @@ pipewire-pulse
|
|||||||
volctl
|
volctl
|
||||||
moc-pulse
|
moc-pulse
|
||||||
|
|
||||||
|
nerd-dictation-git
|
||||||
|
ydotool
|
||||||
|
|
||||||
nodejs
|
nodejs
|
||||||
npm
|
npm
|
||||||
yarn
|
yarn
|
||||||
zed
|
zed
|
||||||
vim
|
vim
|
||||||
neovim
|
neovim
|
||||||
|
claude-code
|
||||||
|
ipython
|
||||||
|
|
||||||
activitywatch-bin
|
activitywatch-bin
|
||||||
|
|
||||||
ranger
|
|
||||||
thunar
|
thunar
|
||||||
|
pcmanfm
|
||||||
rar
|
rar
|
||||||
unrar
|
unrar
|
||||||
zip
|
zip
|
||||||
@@ -96,3 +112,35 @@ wine
|
|||||||
mono
|
mono
|
||||||
|
|
||||||
avahi
|
avahi
|
||||||
|
|
||||||
|
tree-sitter-cli
|
||||||
|
base-devel
|
||||||
|
clang
|
||||||
|
glibc
|
||||||
|
linux-api-headers
|
||||||
|
git
|
||||||
|
curl
|
||||||
|
tar
|
||||||
|
|
||||||
|
ttf-inconsolata
|
||||||
|
ttf-nerd-fonts-symbols
|
||||||
|
ttf-nerd-fonts-symbols-mono
|
||||||
|
noto-fonts-cjk
|
||||||
|
gsfonts
|
||||||
|
|
||||||
|
go
|
||||||
|
gopls
|
||||||
|
delve
|
||||||
|
golangci-lint
|
||||||
|
gofumpt
|
||||||
|
staticcheck
|
||||||
|
revive
|
||||||
|
go-tools
|
||||||
|
|
||||||
|
kando-bin
|
||||||
|
aichat
|
||||||
|
xpad
|
||||||
|
pavucontrol
|
||||||
|
wofi
|
||||||
|
chromium
|
||||||
|
jq
|
||||||
|
|||||||
@@ -53,4 +53,35 @@ echo "Wrote waybar/colors.css"
|
|||||||
cp "$SCRIPT_DIR/waybar/colors.css" "$SCRIPT_DIR/wofi/colors.css"
|
cp "$SCRIPT_DIR/waybar/colors.css" "$SCRIPT_DIR/wofi/colors.css"
|
||||||
echo "Wrote wofi/colors.css"
|
echo "Wrote wofi/colors.css"
|
||||||
|
|
||||||
|
# Kando: colors for its Purity pie menu theme, set in kando/config.json (Kando reloads it live)
|
||||||
|
# rgba <#hex> <alpha> -> rgb(r g b / alpha)
|
||||||
|
rgba() {
|
||||||
|
hex="${1#\#}"
|
||||||
|
printf 'rgb(%d %d %d / %s)' "0x$(echo "$hex" | cut -c1-2)" "0x$(echo "$hex" | cut -c3-4)" "0x$(echo "$hex" | cut -c5-6)" "$2"
|
||||||
|
}
|
||||||
|
kando="$SCRIPT_DIR/kando/config.json"
|
||||||
|
if [ -f "$kando" ]; then
|
||||||
|
colors=$(
|
||||||
|
jq -n \
|
||||||
|
--arg text "$(rgba "$color_text_light" 0.9)" \
|
||||||
|
--arg icon "$(rgba "$color_text_light" 0.9)" \
|
||||||
|
--arg icon_hover "$(rgba "$color_primary" 1)" \
|
||||||
|
--arg ring "$(rgba "$color_bg" 0.94)" \
|
||||||
|
--arg inner "$(rgba "$color_primary" 0.6)" \
|
||||||
|
--arg wedge "$(rgba "$color_primary" 0.18)" \
|
||||||
|
--arg submenu "$(rgba "$color_alt_bg" 0.9)" \
|
||||||
|
--arg action "$(rgba "$color_alt_bg" 0.9)" \
|
||||||
|
--arg background "$(rgba "$color_bg_secondary" 0)" \
|
||||||
|
--arg vignette "$(rgba "$color_bg_secondary" 0.55)" \
|
||||||
|
'{"text-color": $text, "icon-color": $icon, "icon-hover-color": $icon_hover,
|
||||||
|
"ring-color": $ring, "inner-circle": $inner, "wedge-color": $wedge,
|
||||||
|
"sector-color-submenu": $submenu, "sector-color-action": $action,
|
||||||
|
"background-main": $background, "background-secondary": $vignette}'
|
||||||
|
)
|
||||||
|
# written in place, so the symlink in ~/.config/kando keeps pointing here
|
||||||
|
updated=$(jq --argjson colors "$colors" '.menuThemeColors.purity = $colors' "$kando")
|
||||||
|
printf '%s\n' "$updated" >"$kando"
|
||||||
|
echo "Wrote kando/config.json (Purity theme colors)"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Done. All color fragments generated."
|
echo "Done. All color fragments generated."
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Start the "dev" distrobox container at login
|
||||||
|
After=default.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/bin/podman start dev
|
||||||
|
ExecStop=/usr/bin/podman stop -t 10 dev
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
+9
-1
@@ -9,7 +9,7 @@ usage() {
|
|||||||
echo "Usage: $(basename "$0") [OPTIONS] <target>..."
|
echo "Usage: $(basename "$0") [OPTIONS] <target>..."
|
||||||
echo
|
echo
|
||||||
echo "Targets:"
|
echo "Targets:"
|
||||||
echo " hyprland Hyprland + waybar + wofi"
|
echo " hyprland Hyprland + waybar + wofi + Kando"
|
||||||
echo " sway Sway + waybar + wofi"
|
echo " sway Sway + waybar + wofi"
|
||||||
echo " i3 i3 + i3blocks + i3status"
|
echo " i3 i3 + i3blocks + i3status"
|
||||||
echo " cursor Miku cursor theme"
|
echo " cursor Miku cursor theme"
|
||||||
@@ -107,6 +107,8 @@ uninstall_hyprland() {
|
|||||||
restore "$CONFIG_DIR/hypr"
|
restore "$CONFIG_DIR/hypr"
|
||||||
restore "$CONFIG_DIR/waybar"
|
restore "$CONFIG_DIR/waybar"
|
||||||
restore "$CONFIG_DIR/wofi"
|
restore "$CONFIG_DIR/wofi"
|
||||||
|
restore "$CONFIG_DIR/kando/menus.json"
|
||||||
|
restore "$CONFIG_DIR/kando/config.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstall_sway() {
|
uninstall_sway() {
|
||||||
@@ -161,6 +163,11 @@ uninstall_vim() {
|
|||||||
remove_line "$HOME/.vimrc" "source ~/scripts/vimrc"
|
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
|
if [ $# -eq 0 ]; then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
@@ -205,6 +212,7 @@ for target in "${targets[@]}"; do
|
|||||||
tmux) uninstall_tmux ;;
|
tmux) uninstall_tmux ;;
|
||||||
nvim) uninstall_nvim ;;
|
nvim) uninstall_nvim ;;
|
||||||
vim) uninstall_vim ;;
|
vim) uninstall_vim ;;
|
||||||
|
kde) uninstall_kde ;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown target: $target"
|
echo "Unknown target: $target"
|
||||||
usage
|
usage
|
||||||
|
|||||||
Reference in New Issue
Block a user