52 lines
1.0 KiB
Bash
Executable File
52 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
# Copyright 2022 Sxmo Contributors
|
|
|
|
. sxmo_common.sh
|
|
. sxmo_hook_icons.sh
|
|
|
|
set -e
|
|
|
|
_movetowssubmenu() {
|
|
for ws in $(seq "${SXMO_WORKSPACE_WRAPPING:-4}"); do
|
|
printf "%s Move to WS %s\n" "$ws" "$ws"
|
|
done
|
|
}
|
|
|
|
dwmwmmenu() {
|
|
WMINDEX=0
|
|
|
|
while : ; do
|
|
CHOICES="$(
|
|
cat <<EOF
|
|
$icon_cls Close Menu
|
|
$(_movetowssubmenu)
|
|
$icon_rld Shift stack
|
|
$icon_grd Toggle Layout
|
|
$icon_trh Kill window
|
|
EOF
|
|
)"
|
|
PICKED="$(printf "%s" "$CHOICES" | dmenu -I "$WMINDEX" -p "WM Menu")"
|
|
WMINDEX="$(($(printf "%s" "$CHOICES" | grep -nm1 "^$PICKED$" | cut -d: -f1) -1))"
|
|
case "$PICKED" in
|
|
""|"$icon_cls Close Menu")
|
|
return
|
|
;;
|
|
?" Move to WS "?)
|
|
sxmo_wm.sh moveworkspace "${PICKED%" Move to WS "?}"
|
|
;;
|
|
"$icon_rld Shift stack")
|
|
sxmo_wm.sh switchfocus
|
|
;;
|
|
"$icon_grd Toggle Layout")
|
|
sxmo_wm.sh togglelayout
|
|
;;
|
|
"$icon_trh Kill window")
|
|
sxmo_killwindow.sh
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
dwmwmmenu
|