master
Daniel Napora 2021-05-21 23:15:53 +02:00
parent 202a241940
commit 739cdc382d
3 changed files with 102 additions and 9 deletions

94
usr/bin/jgdeskgrid 100755
View File

@ -0,0 +1,94 @@
#!/bin/bash
# jgdeskgrid - configure DeskGrid from menu
#
. ~/.config/mabox/mabox.conf
CONFIG_DIR="$HOME/.config/deskgrid"
CONFIG_FILE="$CONFIG_DIR/deskgrid.conf"
mkdir -p $CONFIG_DIR
if [ ! -f $CONFIG_FILE ]; then
cat <<EOF > ${CONFIG_FILE}
# Gap between windows in pixels (reasonable values: 0 8 16 24)
gap=16
# Grid columns (12 16 24)
grid_x=16
# Grid rows (6 12 16)
grid_y=12
#
titlebar_height=18
#Notifications true or false
notifications=true
# Outer gap (disable if you use WM margins)
show_outer_gap=true
# Only for clicksnap action
activate_window=false
EOF
fi
source <(grep = $CONFIG_FILE)
GAP=${gap:-16}
GRID_X=${grid_x:-16}
GRID_Y=${grid_y:-12}
TITLEBAR_HEIGHT=${titlebar_height:-18}
me="mb-jgtools $jgtools_last"
out+=("^sep(DeskGrid)")
out+=("Show image helper,drawgrid")
#out+=("About,")
out+=("^sep(Configuration)")
out+=("Columns [ <b>$GRID_X</b> ],^checkout(columns)")
out+=("Rows [ <b>$GRID_Y</b> ],^checkout(rows)")
out+=("Gap between windows [ <b>$GAP</b> ],^checkout(gap)")
out+=("Show outer gap [ <b>$show_outer_gap</b> ],^checkout(outer)")
out+=("Notifications [ <b>$notifications</b> ],^checkout(notify)")
out+=("^sep()")
out+=("Edit config file ,geany $CONFIG_FILE")
out+=("^tag(columns)")
for i in 8 12 16 24 32; do out+=("$(printf "<tt>%3s</tt>,%s" "$i" "mb-setvar grid_x=${i} $CONFIG_FILE;$me")");done
out+=("^tag(rows)")
for i in 6 8 12 16 24; do out+=("$(printf "<tt>%3s</tt>,%s" "$i" "mb-setvar grid_y=${i} $CONFIG_FILE;$me")");done
out+=("^tag(gap)")
for i in 0 2 4 8 12 16 24 32 40; do out+=("$(printf "<tt>%3s</tt>,%s" "$i" "mb-setvar gap=${i} $CONFIG_FILE;$me")");done
out+=("^tag(outer)")
out+=("$(printf "<tt>%3s</tt>,%s" "true" "mb-setvar show_outer_gap=true $CONFIG_FILE;$me")")
out+=("$(printf "<tt>%3s</tt>,%s" "false" "mb-setvar show_outer_gap=false $CONFIG_FILE;$me")")
out+=("^tag(notify)")
out+=("$(printf "<tt>%3s</tt>,%s" "true" "mb-setvar notifications=true $CONFIG_FILE;$me")")
out+=("$(printf "<tt>%3s</tt>,%s" "false" "mb-setvar notifications=false $CONFIG_FILE;$me")")
### 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_jgdeskgrid=false"
fi
printf '%s\n' "${out2[@]}"

View File

@ -10,13 +10,13 @@ i="0"
while IFS= read -r line
do
name=$(basename $line .desk)
out+=(" ${name//_/ },^checkout(sess${i})")
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/&/&amp;}\"\"\",deskmngr -r $name.desk $ID")
out2+=("\"\"\"  ${dname/&/&amp;}\"\"\",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")
@ -25,7 +25,7 @@ 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")
out+=("  <b>New</b> session from current desktop as ...,deskmngr -s")
### RUN
@ -43,7 +43,7 @@ jgmenu_icon_size=0
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
cat << EOF > ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF

View File

@ -18,7 +18,7 @@ if [[ "$ID" = "$currdesk" ]]; then
out+=("^sep(<i><small>${dname/&/&amp;} (active)</small></i>)")
else
out+=("^sep(<i><small>${dname/&/&amp;}</small></i>)" "<i>Go to... </i><b>${dname/&/&amp;}</b>,wmctrl -s $ID")
out+=("^sep(<i><small>${dname/&/&amp;}</small></i>)" "<i>Go to... </i><b>${dname/&/&amp;}</b>,wmctrl -s $ID")
fi
while IFS= read -r line
do
@ -45,8 +45,8 @@ if [ $(wmctrl -l | awk $2 '!/-1/ {print $2}' | uniq |wc -l) -gt 0 ];then
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+=("  <b>Add new</b> desktop,wmctrl -n $((desktops+1))")
out+=("  <b>Remove last</b> desktop,wmctrl -n $((desktops-1))")
out+=("^sep()")
out+=("Desktop session Manager,jgdeskmngr -s")
@ -77,10 +77,9 @@ 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"
printf '%s\n' "<i>$REMOVE</i>,mb-setvar places_jgdesktops=false"
fi
printf '%s\n' "${out2[@]}"