81 lines
2.1 KiB
Bash
Executable File
81 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# jgdeskmngr - pipemenu for deskmngr
|
|
#
|
|
|
|
case $LANG in
|
|
pl*)
|
|
REMOVE="Usuń to menu z panelu"
|
|
;;
|
|
es*)
|
|
REMOVE="Eliminar este menú del panel"
|
|
;;
|
|
*)
|
|
REMOVE="Remove this menu from panel"
|
|
;;
|
|
esac
|
|
|
|
|
|
SESSIONDIR="$HOME/.config/deskmngr/"
|
|
mkdir -p $SESSIONDIR
|
|
|
|
help='\nSave all opened windows from active desktop as session.\nRestore saved session later on desktop of your choice.\n\n (beta)'
|
|
|
|
out+=("^sep(Desktop session Manager)")
|
|
out+=("About DeskMngr,\"\"\"notify-send.sh -u critical -i mbcc 'DeskMngr - save and restore sessions' '$help'\"\"\"")
|
|
out+=("^sep(<i><small>Saved sessions </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 desktop...)")
|
|
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()" " <b>Edit</b> session: <b>${name//_/ }</b>,geany $SESSIONDIR$name.desk")
|
|
out2+=("^sep()" " <b>Delete</b> session: <b>${name//_/ }</b>,rm -f $SESSIONDIR$name.desk")
|
|
((i=i+1))
|
|
done < <(deskmngr -l)
|
|
|
|
out+=("^sep()" " Open config directory,pcmanfm ~/.config/deskmngr/")
|
|
out+=("^sep(<i><small>Add new...</small></i>)")
|
|
out+=(" <b>New</b> session from current desktop as ...,deskmngr -s")
|
|
|
|
|
|
### RUN
|
|
if [ $1 == "-s" ]; then
|
|
. /usr/bin/pipemenu-standalone.cfg
|
|
. $HOME/.config/mabox/mabox.conf
|
|
|
|
MENU_PADDING_TOP=0
|
|
MENU_HALIGN="center"
|
|
MENU_VALIGN="center"
|
|
jgmenu_icon_size=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[@]}"
|