diff --git a/README.md b/README.md index d056327..4b3fe6a 100644 --- a/README.md +++ b/README.md @@ -295,8 +295,9 @@ close · `SUPER+1..9` workspaces · `Print` region screenshot. `nomarchy-menu` dispatcher: root picker (no args) · `power` (lock/logout/suspend/hibernate/reboot/shutdown, SUPER+X) · `theme` (SUPER+T) · `clipboard` (cliphist, SUPER+CTRL+V) · `calc` - (qalc, copy/chain) · `files` (fd → xdg-open) · `web` (Google). - SUPER+D is `rofi -show drun`. + (rofi-calc, live, SUPER+CTRL+C) · `files` (rofi-file-browser, live + navigation, SUPER+CTRL+F) · `emoji` (rofi-emoji, SUPER+CTRL+E) · + `web` (Google). SUPER+D is `rofi -show drun`. - ✓ shipped modules: `network` (nmtui in `$TERMINAL`) · `bluetooth` (blueman-manager) · `capture` (grim/slurp submenu: region/full → clipboard/file, saved to `~/Pictures/Screenshots`) · `keybinds` (the @@ -317,15 +318,26 @@ close · `SUPER+1..9` workspaces · `Print` region screenshot. launcher, no second theming pipeline; the dispatcher owns the menu structure, so the renderer stays swappable (we moved fuzzel → rofi 2.0 once mainline gained native Wayland, for its richer theming) -- **Calculator module rework:** the current `calc` flow - (`modules/home/rofi.nix`) is unsatisfying — you commit the expression - blind, then the result only appears in the *next* menu's `-mesg` line, - and `qalc -t` misparses common phrasings (e.g. `15% of 200` → - `rem(15, 1 B)` instead of `30`). Rework toward live results as you type - (rofi-calc-style: each keystroke re-evaluates and the answer is the top - entry, Enter copies), a more robust qalc invocation, and graceful - handling of parse errors. Decide whether to keep the hand-rolled dmenu - loop or adopt a dedicated calc mode/plugin. +- ✓ **Menu modules from rofi plugins:** the old `calc` flow committed the + expression blind (result only in the *next* menu's `-mesg`) and `qalc -t` + misparsed common phrasings (`15% of 200` → `rem(15, 1 B)`, the natural- + language "of" tripping the CLI). Resolved by adopting purpose-built rofi + modi (`programs.rofi.plugins`), all themed through the same `.rasi`: + - **calc** → **rofi-calc**: live results as you type via libqalculate + directly (dodging the qalc-CLI "of" bug), Enter copies, menu persists + to chain calculations. + - **files** → **rofi-file-browser-extended**: live directory navigation + (Backspace to ascend, toggle hidden) opening with xdg-open, replacing + the flat `fd` dump of `$HOME`. yazi (SUPER+E) stays the power browser. + - **emoji** → **rofi-emoji** (new module, SUPER+CTRL+E): glyph picker, + copies via the plugin's Wayland clipboard adapter. +- **More menu modules from rofi tools:** the script-based counterparts + (run via `rofi -dmenu`, like the hand-rolled modules), each a deliberate + replacement of an existing flow: **rofi-network-manager** (a keyboard + wifi/VPN picker vs today's `nmtui`-in-terminal `network`), **rofi-rbw / + rofi-pass** (a secrets module — Bitwarden via rbw, or `pass` — pairs with + `keys.nix`), and **rofi-pulse-select** (an audio sink/source switcher). + Decide per-module whether it earns replacing the current path. - **Theme parity with legacy:** summer-day/night now carry their legacy bar layouts as `waybar.jsonc` whole-swaps (adapted: dead legacy script modules dropped, Nerd-Fonts-v2 codepoints remapped to FontAwesome/v3, diff --git a/modules/home/keybinds.nix b/modules/home/keybinds.nix index de2ade5..54b610a 100644 --- a/modules/home/keybinds.nix +++ b/modules/home/keybinds.nix @@ -41,7 +41,8 @@ { mods = "$mod CTRL"; key = "V"; action = "exec, nomarchy-menu clipboard"; desc = "Clipboard history"; } { mods = "$mod CTRL"; key = "C"; action = "exec, nomarchy-menu calc"; desc = "Calculator"; } { mods = "$mod CTRL"; key = "W"; action = "exec, nomarchy-menu web"; desc = "Web search"; } - { mods = "$mod CTRL"; key = "F"; action = "exec, nomarchy-menu files"; desc = "File search"; } + { mods = "$mod CTRL"; key = "F"; action = "exec, nomarchy-menu files"; desc = "File browser"; } + { mods = "$mod CTRL"; key = "E"; action = "exec, nomarchy-menu emoji"; desc = "Emoji picker"; } { mods = "$mod CTRL"; key = "N"; action = "exec, nomarchy-menu network"; desc = "Network (nmtui)"; } { mods = "$mod CTRL"; key = "B"; action = "exec, nomarchy-menu bluetooth"; desc = "Bluetooth"; } { mods = "$mod CTRL"; key = "S"; action = "exec, nomarchy-menu capture"; desc = "Screenshot / capture"; } diff --git a/modules/home/rofi.nix b/modules/home/rofi.nix index 2365afb..37d759c 100644 --- a/modules/home/rofi.nix +++ b/modules/home/rofi.nix @@ -100,22 +100,27 @@ let printf '%s' "$sel" | cliphist decode | wl-copy ;; calc) - expr=$(rofi -dmenu -p "= " < /dev/null) || exit 0 - [ -n "$expr" ] || exit 0 - result=$(qalc -t -- "$expr" 2>&1 | tail -n 1) - choice=$(printf '%s\n' "󰆏 Copy result" "󰃬 New calculation" \ - | rofi -dmenu -p "= " -mesg "$expr = $result") || exit 0 - case "$choice" in - *Copy*) printf '%s' "$result" | wl-copy ;; - *New*) exec "$0" calc ;; - esac ;; + # Live calculator (rofi-calc): re-evaluates every keystroke via + # libqalculate — which dodges the qalc CLI's "15% of 200" misparse — + # with the answer as the top entry. Enter copies the result; the + # menu stays open to chain calculations (Esc closes). + exec rofi -show calc -modi calc -no-show-match -no-sort \ + -calc-command "echo -n '{result}' | wl-copy" ;; files) - sel=$(fd . "$HOME" --type f --hidden --exclude .git --exclude .cache 2>/dev/null \ - | head -n 50000 \ - | sed "s|^$HOME/||" \ - | rofi -dmenu -p file) || exit 0 - [ -n "$sel" ] && exec xdg-open "$HOME/$sel" ;; + # Live file browser (rofi-file-browser-extended): navigate into + # directories, go up with Backspace, toggle hidden files with the + # rofi custom key, and open the selection with xdg-open. Starts in + # $HOME. The keyboard-heavy TUI flagship for real work is yazi + # (SUPER+E); this is the quick launcher path. + exec rofi -show file-browser-extended -modi file-browser-extended \ + -file-browser-dir "$HOME" -file-browser-cmd xdg-open ;; + + emoji) + # Emoji / symbol picker (rofi-emoji). The default action copies the + # glyph to the clipboard through the plugin's Wayland adapter + # (wl-copy); the alternate action types it into the focused window. + exec rofi -show emoji -modi emoji ;; web) q=$(rofi -dmenu -p search < /dev/null) || exit 0 @@ -168,6 +173,7 @@ let "󰅌 Clipboard" "󰃬 Calculator" "󰈞 Files" + "󰒨 Emoji" "󰖟 Web search" "󰖩 Network" "󰂯 Bluetooth" @@ -190,6 +196,7 @@ let *Clipboard*) exec "$0" clipboard ;; *Calc*) exec "$0" calc ;; *Files*) exec "$0" files ;; + *Emoji*) exec "$0" emoji ;; *Web*) exec "$0" web ;; *Network*) exec "$0" network ;; *Bluetooth*) exec "$0" bluetooth ;; @@ -201,7 +208,7 @@ let esac ;; *) - echo "usage: nomarchy-menu [power|power-profile|theme|clipboard|calc|files|web|network|bluetooth|capture|keybinds|ask]" >&2 + echo "usage: nomarchy-menu [power|power-profile|theme|clipboard|calc|files|emoji|web|network|bluetooth|capture|keybinds|ask]" >&2 exit 64 ;; esac ''; @@ -210,9 +217,7 @@ in config = lib.mkIf cfg.rofi.enable { home.packages = [ nomarchy-menu - pkgs.libqalculate # qalc, the calc module's engine - pkgs.fd # files module - pkgs.xdg-utils # xdg-open for files/web + pkgs.xdg-utils # xdg-open for the web + file-browser modules pkgs.nodejs # npx, for the Ask Claude module (claude-code from npm) ]; @@ -221,6 +226,12 @@ in terminal = cfg.terminal; font = "${t.fonts.ui} 12"; + # Native rofi modi backing three menu modules: calc (live, via + # libqalculate — no qalc CLI needed), emoji (glyph picker, copies via + # its bundled Wayland adapter), file-browser (live navigation). All + # render through the generated/whole-swap theme like every other modi. + plugins = [ pkgs.rofi-calc pkgs.rofi-emoji pkgs.rofi-file-browser ]; + extraConfig = { modi = "drun,run"; show-icons = true; # app icons via the theme's icon set