dotfiles/de/home/.config/sway/scripts/sway-htpc-menu
2025-01-21 22:59:18 -08:00

24 lines
525 B
Bash
Executable file

#!/bin/bash
swaymsg fullscreen disable
if pgrep wofi;then
killall wofi
fi
sel_app=$(wofi --show drun -O alphabetical -a --insensitive --allow-images)
[[ -z ${sel_app} ]] && exit 1
app_name=$(basename "${sel_app[0]}")
ws_nums=($(swaymsg -t get_workspaces | jq -r '.[].num'))
for n in {1..10};do
if [[ ! $( printf "%s\n" ${ws_nums[@]} | fgrep -w ${n} ) ]];then
swaymsg workspace "${n}"
notify-send "Launching ${app_name}"
${sel_app[@]}
exit
fi
done
notify-send "All workspaces are currently in use"