64 lines
1.7 KiB
Bash
Executable File
64 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# jgdeskmngr - pipemenu for deskmngr
|
|
#
|
|
SESSIONDIR="$HOME/.config/deskmngr/"
|
|
mkdir -p $SESSIONDIR
|
|
|
|
out+=("^sep(Desktop session Manager)")
|
|
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_keyspipe=false"
|
|
fi
|
|
printf '%s\n' "${out2[@]}"
|