Files
Nomarchy/features/scripts/utils/nomarchy-hyprland-window-single-square-aspect-toggle
Bernardo Magri 3d931a6455
All checks were successful
Check / eval-and-lint (push) Successful in 6m41s
fix(menu): repair three dead nomarchy-menu leaf actions (Pillar 9 / Component 3)
Found by driving the menu's observable actions live in a VM with the real
session env imported. All three are also bound to keybindings.

1. nomarchy-hyprland-window-single-square-aspect-toggle (1-Window Ratio,
   SUPER CTRL BACKSPACE): read/set layout:single_window_aspect_ratio, which
   is "no such option" in Hyprland 0.52.1 — the option lives under dwindle:.
   The getoption returned nothing and the keyword set was silently dropped,
   so the toggle did nothing. Point it at dwindle:single_window_aspect_ratio.

2. nomarchy-hyprland-workspace-layout-toggle (Workspace Layout, SUPER L):
   read .tiledLayout off `hyprctl activeworkspace -j` (no such key → always
   null) and switched to "scrolling" (not a built-in layout — hyprctl
   layouts lists only dwindle/master), so it silently no-op'd. Rewrite to
   toggle the real general:layout between dwindle and master.

3. show_setup_menu offered Power Profile unconditionally, but powerprofilesctl
   is absent everywhere (power-profiles-daemon is force-off on laptop in
   favour of TLP and never enabled on desktop), so the entry died with
   "command not found". Gate it behind `command -v powerprofilesctl`.

Verified (1) and (2) against live Hyprland in the VM: aspect flips
[0,0]<->[1,1], layout flips dwindle<->master.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 14:48:37 +01:00

17 lines
687 B
Bash
Executable File

#!/bin/bash
set -e
# single_window_aspect_ratio lives under the dwindle namespace (the default
# layout), not a bare `layout:` — `hyprctl getoption layout:…` returns
# "no such option" and the keyword set is silently dropped.
CURRENT_VALUE=$(hyprctl getoption "dwindle:single_window_aspect_ratio" 2>/dev/null | head -1)
# Parse vec2 output: "vec2: [1, 1]" or "vec2: [0, 0]"
if [[ $CURRENT_VALUE == *"[1, 1]"* ]]; then
hyprctl keyword dwindle:single_window_aspect_ratio "0 0"
notify-send -u low " Disable single-window square aspect ratio"
else
hyprctl keyword dwindle:single_window_aspect_ratio "1 1"
notify-send -u low " Enable single-window square aspect"
fi