87 lines
2.3 KiB
Plaintext
87 lines
2.3 KiB
Plaintext
|
#!/bin/bash
|
||
|
# jgdesktops
|
||
|
#
|
||
|
|
||
|
|
||
|
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
|
||
|
out+=("^sep(<i><small>${dname/&/&}</small></i>)" "<i>Go to... </i><b>${dname/&/&}</b>,wmctrl -s $ID")
|
||
|
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)
|
||
|
out+=("Add new desktop,wmctrl -n $((desktops+1))")
|
||
|
out+=("Remove last desktop,wmctrl -n $((desktops-1))")
|
||
|
out+=("^sep()")
|
||
|
out+=("Desktop session Manager,jgdeskmngr -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[@]}"
|
||
|
#printf '%s\n' "${out[@]}" > $HOME/.config/mabox/shortkeys.csv
|
||
|
|
||
|
if [[ $1 == "-r" ]]; then
|
||
|
printf '%s\n' "^sep()"
|
||
|
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_keyspipe=false"
|
||
|
fi
|
||
|
printf '%s\n' "${out2[@]}"
|