2024-05-20 17:46:52 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-07-17 09:26:45 +00:00
|
|
|
modes="monitor-std
|
|
|
|
monitor-single
|
|
|
|
monitor-single-sec
|
2024-06-24 13:25:15 +00:00
|
|
|
zellij"
|
2024-05-20 17:46:52 +00:00
|
|
|
|
2024-07-17 09:26:45 +00:00
|
|
|
portalo_mode_monitor () {
|
|
|
|
echo "Loading portalo monitor layout ${1:-std}"
|
2024-08-16 14:20:41 +00:00
|
|
|
yadm config --unset-all local.class monitor-*
|
2024-05-20 17:46:52 +00:00
|
|
|
|
2024-07-17 09:26:45 +00:00
|
|
|
if [ -n "$1" ]; then
|
|
|
|
yadm config --add local.class "$1"
|
|
|
|
fi
|
2024-08-21 14:34:57 +00:00
|
|
|
|
|
|
|
swaymsg reload
|
2024-05-20 17:46:52 +00:00
|
|
|
}
|
|
|
|
|
2024-06-24 13:25:15 +00:00
|
|
|
portalo_mode_zellij () {
|
|
|
|
layout_dir="$HOME/.config/zellij/layouts"
|
2024-06-13 16:29:58 +00:00
|
|
|
layouts=$(\ls -1 "$layout_dir")
|
|
|
|
layout=$(echo "$layouts" | $DMENU -p "layout")
|
|
|
|
if [ -n "$layout" ]; then
|
2024-06-24 13:25:15 +00:00
|
|
|
$TERMINAL -e zellij --layout="$layout_dir/$layout"
|
2024-06-13 16:29:58 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2024-05-20 17:46:52 +00:00
|
|
|
if [ -z "$1" ]; then
|
|
|
|
mode=$(echo "$modes" | $DMENU -p "mode")
|
|
|
|
else
|
|
|
|
mode=$1
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $mode in
|
2024-08-16 14:20:41 +00:00
|
|
|
"monitor-std") portalo_mode_monitor ;;
|
|
|
|
"monitor-"*) portalo_mode_monitor "$mode" ;;
|
2024-06-24 13:25:15 +00:00
|
|
|
"zellij") portalo_mode_zellij ;;
|
2024-05-20 17:46:52 +00:00
|
|
|
*) echo "'$mode' is not a valid mode (single, std)" ;;
|
|
|
|
esac
|