fix(ui): #139 sheets size themselves; #141 waybar clicks stop reading the env
Some checks failed
Check / eval (push) Has been cancelled
Some checks failed
Check / eval (push) Has been cancelled
#139 — calcurse/doctor floated full-screen. Two faults stacked, which is why it looked like the float rules were dead: 1. Hyprland 0.55.4 silently ignores percentage `size` rules. Matrix on hardware (both orders, kitty memory off): `size 60% 65%` never applies, `size 1536 936` applies either way, configerrors empty both times. Rule order was a red herring. 2. Kitty defaults to remember_window_size=yes and replays the last OS window's size into every float — so after a tiled terminal, a sheet opens maximized. This is the Ghostty regression: Ghostty had no such memory, so fault 1 stayed invisible until #95. Fix: remember_window_size=no (floats must be deterministic) and the sheets ask for their own size — term-sheet.nix reads the focused monitor and hands kitty the px, because px in a rule cannot mean "a fraction of *this* screen" and one pair cannot serve 2560x1440 and the 1366x768 Acer (#131). Those windows keep float/center and deliberately carry no size rule. #141 — the updates click did nothing: whole-swaps hand-wrote `sh -c '$TERMINAL …'` and Waybar has no TERMINAL (home.sessionVariables → login shells only; the bar is spawned by Hyprland). Fixed at the root: `nomarchy-updates upgrade-window` opens its own window, so all five call sites name one env-free command and a theme file stops having an opinion about terminals. checks.waybar-swap-env guards the class. Bernardo asked mid-task for the update window to float — it is now the third caller of the sheet helper (com.nomarchy.updates, 45%x50%). V3 on the dev box: calendar 1536x936, doctor 1408x1008, updates 1152x720 — exactly the intended fractions, floating and centred; #141 driven under `env -i` with no TERMINAL, matching Waybar's real environment; the guard proven by reintroducing the bug. Acer V3 queued. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
52
modules/home/term-sheet.nix
Normal file
52
modules/home/term-sheet.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
# Shared launcher for the floating terminal sheets (#139). Used by waybar.nix
|
||||
# (nomarchy-calendar) and rofi.nix (the doctor sheet) — the classed Kitty
|
||||
# windows hyprland.nix floats and centers.
|
||||
#
|
||||
# Why the size lives here and not in a window rule: Hyprland 0.55.4 silently
|
||||
# ignores a *percentage* `size` rule. Measured on hardware 2026-07-16, both
|
||||
# rule orders, Kitty's own memory disabled so nothing could mask it:
|
||||
# `size 60% 65%` → the window keeps its requested size (no rule applied);
|
||||
# `size 1536 936` → lands exactly, in either order. No `hyprctl configerrors`
|
||||
# either way, which is how it survived the post-0.53 rule rewrite unnoticed.
|
||||
#
|
||||
# Absolute px is not a fix: "a fraction of the screen" is the whole intent, and
|
||||
# one px pair cannot serve a 2560x1440 desk monitor and the 1366x768 Acer that
|
||||
# is live QA (#131). A rule cannot compute it — the monitor is unknown at
|
||||
# eval time — so the sheet asks for its own size instead: read the focused
|
||||
# monitor here, hand Kitty the px, and let it request them. Those windows
|
||||
# therefore carry float/center rules and deliberately no `size` rule.
|
||||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellScriptBin "nomarchy-term-sheet" ''
|
||||
set -u
|
||||
# usage: nomarchy-term-sheet <class> <width%> <height%> <cmd> [args...]
|
||||
[ "$#" -ge 4 ] || { echo "usage: nomarchy-term-sheet <class> <w%> <h%> <cmd> [args...]" >&2; exit 64; }
|
||||
cls="$1"; wpct="$2"; hpct="$3"; shift 3
|
||||
|
||||
# Hyprland reports the monitor in physical px plus the scale it renders at;
|
||||
# Kitty sizes in logical px, so divide before taking the fraction. A sheet
|
||||
# that opens at a clumsy size still beats no sheet, so every failure here
|
||||
# falls back rather than exits: no compositor (a TTY run), no jq answer, or
|
||||
# a nonsense answer all land on a size that fits the smallest panel we ship
|
||||
# on.
|
||||
dims=$(hyprctl monitors -j 2>/dev/null \
|
||||
| ${pkgs.jq}/bin/jq -r --argjson w "$wpct" --argjson h "$hpct" '
|
||||
[ .[] | select(.focused) ][0]
|
||||
| select(. != null)
|
||||
| (.scale // 1) as $s
|
||||
| select($s > 0)
|
||||
| "\((.width / $s * $w / 100) | floor) \((.height / $s * $h / 100) | floor)"' 2>/dev/null) || dims=
|
||||
width=''${dims%% *}
|
||||
height=''${dims##* }
|
||||
case "$width$height" in
|
||||
*[!0-9]*|"") width=800; height=500 ;;
|
||||
esac
|
||||
[ "$width" -ge 320 ] 2>/dev/null || width=800
|
||||
[ "$height" -ge 240 ] 2>/dev/null || height=500
|
||||
|
||||
exec ${pkgs.kitty}/bin/kitty \
|
||||
-o remember_window_size=no \
|
||||
-o initial_window_width="$width" \
|
||||
-o initial_window_height="$height" \
|
||||
--class="$cls" -e "$@"
|
||||
''
|
||||
Reference in New Issue
Block a user