Regenerated

This commit is contained in:
2026-04-11 16:10:40 +02:00
parent 99ac636a53
commit a64217bfee
14 changed files with 721 additions and 458 deletions
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
bt_connected=""
while read -r _ mac name_rest; do
if [ "$(bluetoothctl info "$mac" | awk '/Connected:/ {print $2}')" = "yes" ]; then
bt_connected+="$name_rest\n"
fi
done < <(bluetoothctl devices)
# icon
if [ -n "$bt_connected" ]; then
icon=""
tooltip=$(printf "%b" "$bt_connected")
else
icon=""
tooltip="No devices connected"
fi
# ALWAYS produce valid JSON
printf '{"text": "%s", "tooltip": "%s"}\n' "$icon" "$tooltip"
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# Auto-adjust scrolling column width based on window count
# Widths: 1 window = fullscreen (handled by hyprland)
# 2 windows = 0.5 each
# 3+ windows = 0.329 each
get_window_count() {
local ws_id=$1
hyprctl clients -j | jq "[.[] | select(.workspace.id == $ws_id)] | length"
}
get_active_workspace() {
hyprctl activeworkspace -j | jq -r '.id'
}
set_column_width() {
local width=$1
hyprctl dispatch layoutmsg "colresize all $width"
}
handle_event() {
local event=$1
case "$event" in
openwindow*|closewindow*|movewindow*)
ws_id=$(get_active_workspace)
count=$(get_window_count "$ws_id")
if [ "$count" -le 1 ]; then
# fullscreen_on_one_column handles this
:
elif [ "$count" -eq 2 ]; then
set_column_width 0.5
else
set_column_width 0.329
fi
;;
esac
}
# Listen to hyprland socket events
socket="/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
socat -U - "UNIX-CONNECT:$socket" | while read -r line; do
handle_event "$line"
done
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Get focused monitor name
focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused==true) | .name')
monitor="${WAYBAR_OUTPUT_NAME:-$focused_monitor}"
# Hide if not focused monitor
if [ "$monitor" != "$focused_monitor" ]; then
jq -c -n '{text:"", class:"hidden"}'
exit 0
fi
# Get active workspace on this monitor
active_ws=$(hyprctl monitors -j | jq -r \
".[] | select(.name==\"$monitor\") | .activeWorkspace.id")
# Get clients
clients=$(hyprctl clients -j | jq -r \
".[] | select(.workspace.id==$active_ws) | \"\(.title)\"")
count=$(echo "$clients" | grep -c '\S')
# Hide if 0 or 1 clients — no point showing window switcher
if [ "$count" -le 1 ]; then
jq -c -n '{text:"", class:"hidden"}'
exit 0
fi
tooltip=$(echo "$clients" | sed 's/^/• /' | paste -sd '\n' -)
jq -c -n \
--arg text "$count" \
--arg tooltip "$tooltip" \
--arg class "active" \
'{text:$text, tooltip:$tooltip, class:$class}'
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
clients=$(hyprctl clients -j | jq -r \
".[] | select(.workspace.id==$active_ws) | \"\(.address)|\(.title)\"")
choice=$(echo "$clients" | cut -d'|' -f2 | wofi -dmenu -j -p "Active apps" --style ~/.config/wofi/style.css)
[ -z "$choice" ] && exit 0
addr=$(echo "$clients" | grep "|$choice" | head -n1 | cut -d'|' -f1)
hyprctl dispatch focuswindow address:$addr
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# layout-selector.sh
# Select a workspace layout using Wofi, shows description, applies with layoutmsg
# 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)
# 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' "${MENU_ITEMS[@]}" | wofi --dmenu --prompt "Select Layout")
# Exit if cancelled
[ -z "$CHOICE" ] && exit 0
# Extract layout name from selection (before colon)
LAYOUT_NAME="${CHOICE%%:*}"
# Apply layout via layoutmsg
hyprctl dispatch layoutmsg setlayout "$LAYOUT_NAME"
# Show OSD feedback
hyprctl dispatch oSD "Layout: $LAYOUT_NAME" 2000