Files
Nomarchy/features/scripts/utils/nomarchy-hyprland-workspace-layout-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

20 lines
671 B
Bash
Executable File

#!/bin/bash
set -e
# 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.)
CURRENT_LAYOUT=$(hyprctl getoption general:layout -j | jq -r '.str')
case "$CURRENT_LAYOUT" in
dwindle) NEW_LAYOUT=master ;;
*) NEW_LAYOUT=dwindle ;;
esac
hyprctl keyword general:layout "$NEW_LAYOUT"
notify-send -u low "󱂬 Workspace layout set to $NEW_LAYOUT"