127 lines
3.9 KiB
Bash
Executable File
127 lines
3.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# jgdeskmngr - pipemenu for deskmngr
|
|
#
|
|
|
|
case $LANG in
|
|
pl*)
|
|
REMOVE="Usuń to menu z panelu"
|
|
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'
|
|
LEFTPANEL="Lewy panel"
|
|
;;
|
|
es*)
|
|
REMOVE="Eliminar este menú del panel"
|
|
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'
|
|
LEFTPANEL="Left panel"
|
|
;;
|
|
*)
|
|
REMOVE="Remove this menu from panel"
|
|
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'
|
|
LEFTPANEL="Left panel"
|
|
;;
|
|
esac
|
|
|
|
me="jgdeskmngr -s"
|
|
|
|
SESSIONDIR="$HOME/.config/deskmngr/"
|
|
mkdir -p $SESSIONDIR
|
|
|
|
out+=("^sep($DESKMNGR)")
|
|
out+=("$ABOUT,\"\"\"notify-send.sh -u critical -i mbcc '$title' '$help';$me\"\"\"")
|
|
out+=("^sep(<i><small>$SAVED_SESS</small></i>)")
|
|
i="0"
|
|
while IFS= read -r line
|
|
do
|
|
name=$(basename $line .desk)
|
|
out+=(" ${name//_/ },^checkout(sess${i})")
|
|
out2+=("^tag(sess${i})")
|
|
out2+=("^sep($RESTORE_TO)")
|
|
while IFS= read -r linia || [ -n "$linia" ];
|
|
do read -r ID dname< <(echo $linia)
|
|
dname=$(wmctrl -d | grep ^${ID} | cut -d' ' -f13-)
|
|
out2+=("\"\"\" ${dname/&/&}\"\"\",deskmngr -r $name.desk $ID")
|
|
done < <(wmctrl -d|awk '{print $1}')
|
|
out2+=("^sep()" " $EDIT <b>${name//_/ }</b>,geany $SESSIONDIR$name.desk")
|
|
out2+=("^sep()" " $DELETE <b>${name//_/ }</b>,rm -f $SESSIONDIR$name.desk;$me")
|
|
((i=i+1))
|
|
done < <(deskmngr -l)
|
|
|
|
out+=("^sep()" " $OPEN_CNFDIR,pcmanfm ~/.config/deskmngr/")
|
|
out+=("^sep(<i><small>$ADD</small></i>)")
|
|
out+=(" $NEW,deskmngr -s")
|
|
|
|
|
|
### RUN
|
|
if [ $1 == "-s" ]; then
|
|
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
|
|
. $HOME/.config/mabox/mabox.conf
|
|
|
|
out+=("^sep()")
|
|
out+=(" ⮜ $LEFTPANEL,mb-jgtools places")
|
|
|
|
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
|
|
MENU_PADDING_TOP=${jgtools_padding:-0}
|
|
MENU_HALIGN="left"
|
|
jgmenu_icon_size=0
|
|
menu_margin_x=${submenu_spacing:-0}
|
|
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
|
|
[ -z $jgmenu_use_borders ] && menu_border=0
|
|
|
|
mkconfigfile
|
|
|
|
cat << EOF > ${MENU_ITEMS}
|
|
$(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()"
|
|
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_jgdeskmngr=false;mb-jgtools places"
|
|
fi
|
|
printf '%s\n' "${out2[@]}"
|