2021-05-18 16:48:04 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# jgdeskmngr - pipemenu for deskmngr
|
|
|
|
#
|
2021-05-22 02:00:30 +02:00
|
|
|
|
|
|
|
case $LANG in
|
|
|
|
pl*)
|
|
|
|
REMOVE="Usuń to menu z panelu"
|
2021-05-31 15:00:35 +02:00
|
|
|
DESKMNGR="Menadżer sesji desktopowych"
|
|
|
|
ABOUT="O DeskMngr"
|
|
|
|
SAVED_SESS="Zapisane sesje"
|
|
|
|
RESTORE_TO="Przywróć na pulpit..."
|
|
|
|
EDIT="<b>Edytuj</b> sesję:"
|
|
|
|
DELETE="<b>Usuń</b> sesję:"
|
|
|
|
OPEN_CNFDIR="Otwórz katalog z sesjami"
|
|
|
|
ADD="Dodaj nową..."
|
|
|
|
NEW="<b>Nowa</b> sesja z bieżącego pulpitu jako..."
|
|
|
|
title="DeskMngr - zapisuje i przywraca sesje"
|
|
|
|
help='\nZapisuje rozmiar i pozycję wszystkich okien z bieżącego pulpitu.\n\nSesję możesz otworzyć poźniej na dowolnym pulpicie.\n\n'
|
2021-06-03 14:06:57 +02:00
|
|
|
LEFTPANEL="Lewy panel"
|
2021-05-22 02:00:30 +02:00
|
|
|
;;
|
|
|
|
es*)
|
|
|
|
REMOVE="Eliminar este menú del panel"
|
2021-05-31 15:00:35 +02:00
|
|
|
DESKMNGR="Desktop session Manager"
|
|
|
|
ABOUT="About DeskMngr"
|
|
|
|
SAVED_SESS="Saved sessions"
|
|
|
|
RESTORE_TO="Restore to desktop..."
|
|
|
|
EDIT="<b>Edit</b> session:"
|
|
|
|
DELETE="<b>Delete</b> session:"
|
|
|
|
OPEN_CNFDIR="Open config directory"
|
|
|
|
ADD="Add new..."
|
|
|
|
NEW="<b>New</b> session from current desktop as..."
|
|
|
|
title="DeskMngr - save and restore sessions"
|
|
|
|
help='\nSave all opened windows from active desktop as session.\n\nRestore saved session later on desktop of your choice.\n\n'
|
2021-06-03 14:06:57 +02:00
|
|
|
LEFTPANEL="Left panel"
|
2021-05-22 02:00:30 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
REMOVE="Remove this menu from panel"
|
2021-05-31 15:00:35 +02:00
|
|
|
DESKMNGR="Desktop session Manager"
|
|
|
|
ABOUT="About DeskMngr"
|
|
|
|
SAVED_SESS="Saved sessions"
|
|
|
|
RESTORE_TO="Restore to desktop..."
|
|
|
|
EDIT="<b>Edit</b> session:"
|
|
|
|
DELETE="<b>Delete</b> session:"
|
|
|
|
OPEN_CNFDIR="Open config directory"
|
|
|
|
ADD="Add new..."
|
|
|
|
NEW="<b>New</b> session from current desktop as..."
|
|
|
|
title="DeskMngr - save and restore sessions"
|
|
|
|
help='\nSave all opened windows from active desktop as session.\nRestore saved session later on desktop of your choice.\n\n'
|
2021-06-03 14:06:57 +02:00
|
|
|
LEFTPANEL="Left panel"
|
2021-05-22 02:00:30 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2021-06-03 14:06:57 +02:00
|
|
|
me="jgdeskmngr -s"
|
|
|
|
|
2021-05-18 16:48:04 +02:00
|
|
|
SESSIONDIR="$HOME/.config/deskmngr/"
|
|
|
|
mkdir -p $SESSIONDIR
|
|
|
|
|
2021-05-31 15:00:35 +02:00
|
|
|
out+=("^sep($DESKMNGR)")
|
2021-06-03 14:06:57 +02:00
|
|
|
out+=("$ABOUT,\"\"\"notify-send.sh -u critical -i mbcc '$title' '$help';$me\"\"\"")
|
2021-05-31 15:00:35 +02:00
|
|
|
out+=("^sep(<i><small>$SAVED_SESS</small></i>)")
|
2021-05-18 16:48:04 +02:00
|
|
|
i="0"
|
|
|
|
while IFS= read -r line
|
|
|
|
do
|
|
|
|
name=$(basename $line .desk)
|
2021-06-09 12:25:27 +02:00
|
|
|
out+=(" ${name//_/ },^checkout(sess${i})")
|
2021-05-18 16:48:04 +02:00
|
|
|
out2+=("^tag(sess${i})")
|
2021-05-31 15:00:35 +02:00
|
|
|
out2+=("^sep($RESTORE_TO)")
|
2021-05-18 16:48:04 +02:00
|
|
|
while IFS= read -r linia || [ -n "$linia" ];
|
|
|
|
do read -r ID dname< <(echo $linia)
|
|
|
|
dname=$(wmctrl -d | grep ^${ID} | cut -d' ' -f13-)
|
2021-06-09 12:25:27 +02:00
|
|
|
out2+=("\"\"\" ${dname/&/&}\"\"\",deskmngr -r $name.desk $ID")
|
2021-05-18 16:48:04 +02:00
|
|
|
done < <(wmctrl -d|awk '{print $1}')
|
2021-05-31 15:00:35 +02:00
|
|
|
out2+=("^sep()" " $EDIT <b>${name//_/ }</b>,geany $SESSIONDIR$name.desk")
|
2021-06-03 14:06:57 +02:00
|
|
|
out2+=("^sep()" " $DELETE <b>${name//_/ }</b>,rm -f $SESSIONDIR$name.desk;$me")
|
2021-05-18 16:48:04 +02:00
|
|
|
((i=i+1))
|
|
|
|
done < <(deskmngr -l)
|
|
|
|
|
2021-06-09 12:25:27 +02:00
|
|
|
out+=("^sep()" " $OPEN_CNFDIR,pcmanfm ~/.config/deskmngr/")
|
2021-05-31 15:00:35 +02:00
|
|
|
out+=("^sep(<i><small>$ADD</small></i>)")
|
|
|
|
out+=(" $NEW,deskmngr -s")
|
2021-05-18 16:48:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
### RUN
|
|
|
|
if [ $1 == "-s" ]; then
|
|
|
|
. /usr/bin/pipemenu-standalone.cfg
|
|
|
|
. $HOME/.config/mabox/mabox.conf
|
2021-06-03 14:06:57 +02:00
|
|
|
|
|
|
|
out+=("^sep()")
|
|
|
|
out+=(" ⮜ $LEFTPANEL,mb-jgtools places")
|
|
|
|
|
2021-06-01 13:38:06 +02:00
|
|
|
if [[ $panels_heightpos == "top" ]]; then
|
|
|
|
MENU_VALIGN="top"
|
|
|
|
MENU_MARGIN_Y=${panels_topmargin:-0}
|
|
|
|
elif [[ $panels_heightpos == "bottom" ]]; then
|
|
|
|
MENU_VALIGN="bottom"
|
|
|
|
MENU_MARGIN_Y=${panels_topmargin:-0}
|
|
|
|
else
|
|
|
|
MENU_VALIGN="center"
|
|
|
|
fi
|
2021-05-31 15:00:35 +02:00
|
|
|
MENU_PADDING_TOP=${jgtools_padding:-0}
|
2021-06-01 13:38:06 +02:00
|
|
|
MENU_HALIGN="left"
|
2021-05-18 16:48:04 +02:00
|
|
|
jgmenu_icon_size=0
|
2021-06-01 13:38:06 +02:00
|
|
|
menu_margin_x=${submenu_spacing:-0}
|
2021-05-18 16:48:04 +02:00
|
|
|
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
|
|
|
|
[ -z $jgmenu_use_borders ] && menu_border=0
|
|
|
|
|
|
|
|
mkconfigfile
|
|
|
|
|
2021-05-21 23:15:53 +02:00
|
|
|
cat << EOF > ${MENU_ITEMS}
|
2021-05-18 16:48:04 +02:00
|
|
|
$(printf '%s\n' "${out[@]}")
|
|
|
|
$(printf '%s\n' "${out2[@]}")
|
|
|
|
EOF
|
|
|
|
|
|
|
|
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
printf '%s\n' "${out[@]}"
|
|
|
|
|
|
|
|
if [[ $1 == "-r" ]]; then
|
|
|
|
|
|
|
|
printf '%s\n' "^sep()"
|
2021-05-23 10:20:13 +02:00
|
|
|
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_jgdeskmngr=false;mb-jgtools places"
|
2021-05-18 16:48:04 +02:00
|
|
|
fi
|
|
|
|
printf '%s\n' "${out2[@]}"
|