Regenerated
This commit is contained in:
@@ -1,25 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# layout-selector.sh
|
||||
# Cycles through layouts using Wofi for selection, commits on key choice
|
||||
# Select a workspace layout using Wofi, shows description, applies with layoutmsg
|
||||
|
||||
# Hyprland workspace info
|
||||
CURRENT_WS=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
CURRENT_LAYOUT=$(hyprctl workspaces -j | jq -r ".[] | select(.id==$CURRENT_WS) | .layout")
|
||||
# Define layouts and descriptions
|
||||
declare -A LAYOUTS=(
|
||||
[dwindle]="舘 Dwindle: Auto-tiling, windows shrink progressively"
|
||||
[master]=" Master: One main window, others stacked"
|
||||
[scrolling]=" Scrolling: Vertical list, scroll through windows"
|
||||
[monocle]=" Monocle: One window fills the screen"
|
||||
[floating]=" Floating: Free move & resize"
|
||||
)
|
||||
ORDER=(dwindle master scrolling monocle floating)
|
||||
|
||||
# Define your layouts (change as you like)
|
||||
LAYOUTS=("master-stack" "monocle" "bsp" "grid" "floating")
|
||||
# Prepare Wofi menu: show "layoutname: description"
|
||||
MENU_ITEMS=()
|
||||
for key in "${ORDER[@]}"; do
|
||||
MENU_ITEMS+=("$key: ${LAYOUTS[$key]}")
|
||||
done
|
||||
|
||||
# Show selection menu via Wofi
|
||||
CHOICE=$(printf '%s\n' "${LAYOUTS[@]}" | wofi --dmenu --prompt "Select Layout")
|
||||
CHOICE=$(printf '%s\n' "${MENU_ITEMS[@]}" | wofi --dmenu --prompt "Select Layout")
|
||||
|
||||
# If user cancelled
|
||||
# Exit if cancelled
|
||||
[ -z "$CHOICE" ] && exit 0
|
||||
|
||||
# Skip if already current layout
|
||||
[ "$CHOICE" == "$CURRENT_LAYOUT" ] && exit 0
|
||||
# Extract layout name from selection (before colon)
|
||||
LAYOUT_NAME="${CHOICE%%:*}"
|
||||
|
||||
# Apply the layout
|
||||
hyprctl dispatch workspace "$CURRENT_WS" layout "$CHOICE"
|
||||
# Apply layout via layoutmsg
|
||||
hyprctl dispatch layoutmsg setlayout "$LAYOUT_NAME"
|
||||
|
||||
# Show OSD feedback
|
||||
hyprctl dispatch oSD "Layout: $CHOICE" 2000
|
||||
hyprctl dispatch oSD "Layout: $LAYOUT_NAME" 2000
|
||||
|
||||
Reference in New Issue
Block a user