2021-05-18 16:48:04 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# jgdesktops
|
|
|
|
#
|
2021-05-22 02:00:30 +02:00
|
|
|
case $LANG in
|
|
|
|
pl*)
|
|
|
|
REMOVE="Usuń to menu z panelu"
|
|
|
|
;;
|
|
|
|
es*)
|
|
|
|
REMOVE="Eliminar este menú del panel"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
REMOVE="Remove this menu from panel"
|
|
|
|
;;
|
|
|
|
esac
|
2021-05-18 16:48:04 +02:00
|
|
|
|
|
|
|
currdesk=$(wmctrl -d | grep "*" | awk '{print $1}')
|
|
|
|
#out+=("^sep(Okna i pulpity)")
|
|
|
|
|
|
|
|
i=0
|
|
|
|
|
|
|
|
while IFS= read -r linia || [ -n "$linia" ];
|
|
|
|
do
|
|
|
|
name=""
|
|
|
|
read -r ID name< <(echo $linia)
|
|
|
|
#declare -g "arr$ID"=("$name, wmctrl -s $ID")
|
|
|
|
dname=$(wmctrl -d | grep ^${ID} | cut -d' ' -f13-)
|
|
|
|
if [[ "$ID" = "$currdesk" ]]; then
|
|
|
|
out+=("^sep(<i><small>${dname/&/&} (active)</small></i>)")
|
|
|
|
|
|
|
|
else
|
2021-05-22 02:00:30 +02:00
|
|
|
out+=("^sep(<i><small>${dname/&/&}</small></i>)" " <i>Go to... </i>,wmctrl -s $ID")
|
2021-05-18 16:48:04 +02:00
|
|
|
fi
|
|
|
|
while IFS= read -r line
|
|
|
|
do
|
|
|
|
read -r id DESK host title< <(echo $line)
|
|
|
|
if [[ "$DESK" = "$ID" ]]; then
|
|
|
|
trimmed=${title:0:60}
|
|
|
|
out+=("\"\"\"[ ${trimmed/&/&} ]\"\"\",wmctrl -i -a $id")
|
|
|
|
fi
|
|
|
|
done < <(wmctrl -l| grep -v " -1")
|
|
|
|
done < <(wmctrl -d|awk '{print $1" "$10" "$11}')
|
|
|
|
|
|
|
|
# Gracefully close windows on any desktop or all windows
|
|
|
|
|
|
|
|
if [ $(wmctrl -l | awk $2 '!/-1/ {print $2}' | uniq |wc -l) -gt 0 ];then
|
|
|
|
out+=("^sep(Windows Killer)")
|
|
|
|
out+=("Gracefully close all windows on...,^checkout(killwin)")
|
|
|
|
out2+=("^tag(killwin)" "^sep(Close all windows on...)")
|
|
|
|
for i in $(wmctrl -l | awk $2 '!/-1/ {print $2}' |sort| uniq)
|
|
|
|
do
|
|
|
|
dname=$(wmctrl -d | grep ^${i} | cut -d' ' -f13-)
|
|
|
|
out2+=("Desktop ${dname/&/&},killwindows $i")
|
|
|
|
done
|
|
|
|
out2+=("^sep()" "All Desktops,killwindows all")
|
|
|
|
fi
|
|
|
|
out+=("^sep(Manage Desktops)")
|
|
|
|
desktops=$(wmctrl -d |wc -l)
|
2021-05-21 23:15:53 +02:00
|
|
|
out+=(" <b>Add new</b> desktop,wmctrl -n $((desktops+1))")
|
|
|
|
out+=(" <b>Remove last</b> desktop,wmctrl -n $((desktops-1))")
|
2021-05-18 16:48:04 +02:00
|
|
|
out+=("^sep()")
|
|
|
|
out+=("Desktop session Manager,jgdeskmngr -s")
|
|
|
|
|
|
|
|
|
|
|
|
### RUN
|
2021-05-22 02:00:30 +02:00
|
|
|
if [[ $1 == "-s" ]]; then
|
2021-05-18 16:48:04 +02:00
|
|
|
. /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()"
|
2021-05-23 10:20:13 +02:00
|
|
|
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_jgdesktops=false;mb-jgtools places"
|
2021-05-18 16:48:04 +02:00
|
|
|
fi
|
|
|
|
printf '%s\n' "${out2[@]}"
|