fix(menu): repair three dead nomarchy-menu leaf actions (Pillar 9 / Component 3)
All checks were successful
Check / eval-and-lint (push) Successful in 6m41s

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>
This commit is contained in:
Bernardo Magri
2026-05-31 14:48:37 +01:00
parent 0fbc3d9c82
commit 3d931a6455
4 changed files with 23 additions and 10 deletions

View File

@@ -1,14 +1,16 @@
#!/bin/bash
set -e
# Check current single_window_aspect_ratio setting
CURRENT_VALUE=$(hyprctl getoption "layout:single_window_aspect_ratio" 2>/dev/null | head -1)
# 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 layout:single_window_aspect_ratio "0 0"
hyprctl keyword dwindle:single_window_aspect_ratio "0 0"
notify-send -u low " Disable single-window square aspect ratio"
else
hyprctl keyword layout:single_window_aspect_ratio "1 1"
hyprctl keyword dwindle:single_window_aspect_ratio "1 1"
notify-send -u low " Enable single-window square aspect"
fi

View File

@@ -1,15 +1,19 @@
#!/bin/bash
set -e
# Toggle the layout on the current active workspace between dwindle and scrolling
# Toggle the tiling layout between Hyprland's two built-in layouts, dwindle
# and master. (The old version read `.tiledLayout` off `hyprctl
# activeworkspace -j` and switched to "scrolling" — but that field doesn't
# exist, so the read was always null, and "scrolling" isn't a real layout
# (`hyprctl layouts` only lists dwindle/master), so the toggle silently
# did nothing.)
ACTIVE_WORKSPACE=$(hyprctl activeworkspace -j | jq -r '.id')
CURRENT_LAYOUT=$(hyprctl activeworkspace -j | jq -r '.tiledLayout')
CURRENT_LAYOUT=$(hyprctl getoption general:layout -j | jq -r '.str')
case "$CURRENT_LAYOUT" in
dwindle) NEW_LAYOUT=scrolling ;;
dwindle) NEW_LAYOUT=master ;;
*) NEW_LAYOUT=dwindle ;;
esac
hyprctl keyword workspace $ACTIVE_WORKSPACE, layout:$NEW_LAYOUT
hyprctl keyword general:layout "$NEW_LAYOUT"
notify-send -u low "󱂬 Workspace layout set to $NEW_LAYOUT"

View File

@@ -204,7 +204,13 @@ show_font_menu() {
}
show_setup_menu() {
local options=" Audio\n Wifi\n󰂯 Bluetooth\n󱐋 Power Profile\n System Sleep\n󰍹 Monitors"
local options=" Audio\n Wifi\n󰂯 Bluetooth"
# Power Profile drives powerprofilesctl, which only exists when
# power-profiles-daemon is running. Laptops force it off in favour of
# TLP and desktops don't enable it, so gate the entry rather than
# offer an action that dies with "command not found".
command -v powerprofilesctl >/dev/null 2>&1 && options="$options\n󱐋 Power Profile"
options="$options\n System Sleep\n󰍹 Monitors"
[[ -f ~/.config/hypr/bindings.conf ]] && options="$options\n Keybindings"
[[ -f ~/.config/hypr/input.conf ]] && options="$options\n Input"
options="$options\n󰱔 DNS\n Security"