mabox-pipemenus/usr/bin/jgespanso-pipe

92 lines
2.6 KiB
Plaintext
Raw Permalink Normal View History

2020-09-24 18:42:59 +02:00
#!/bin/bash
case $LANG in
pl*)
2020-09-26 14:54:15 +02:00
TYPE_TO_SEARCH="pisz, aby wyszukać"
2020-09-24 18:42:59 +02:00
CONFIGURE="Konfiguracja Espanso"
EDITCONF="Edytuj domyślny plik konfiguracyjny"
OPENCONFDIR="Otwórz katalog z konfiguracją"
DOCU="Dokumentacja <b>Espanso</b> (online)"
2021-09-04 22:53:28 +02:00
LIST="Lista wyzwalaczy:"
2020-09-24 18:42:59 +02:00
;;
es*)
2020-09-26 14:54:15 +02:00
TYPE_TO_SEARCH="Buscar"
2020-09-24 18:42:59 +02:00
CONFIGURE="Configurar Espanso"
EDITCONF="Editar archivo x defecto"
OPENCONFDIR="Abrir el directorio"
DOCU="Leer <b>Documentacion</b> de Espanso (en línea)"
2021-09-04 22:53:28 +02:00
LIST="List of triggers:"
2020-09-24 18:42:59 +02:00
;;
*)
2020-09-26 14:54:15 +02:00
TYPE_TO_SEARCH="Type to filter"
2020-09-24 18:42:59 +02:00
CONFIGURE="Configure Espanso"
EDITCONF="Edit default config file"
OPENCONFDIR="Open config directory"
DOCU="Read <b>Espanso</b> documentation (online)"
2021-09-04 22:53:28 +02:00
LIST="List of triggers:"
2020-09-24 18:42:59 +02:00
;;
esac
MENU_ITEMS=/tmp/espanso_list.csv
trap "rm -f $MENU_ITEMS" EXIT
2020-09-25 16:06:39 +02:00
2024-02-02 14:45:14 +01:00
if ! pgrep -x "espanso" > /dev/null
2020-09-25 16:06:39 +02:00
then
2020-09-26 14:54:15 +02:00
echo "^sep(Espanso - text expander)" >/tmp/espanso_list.csv
2021-05-30 12:26:18 +02:00
echo "Espanso not running! Run it first by: espanso start,^term(espanso start)" >>/tmp/espanso_list.csv
2020-09-25 16:06:39 +02:00
else
2020-09-26 14:54:15 +02:00
echo "@search,,10,5,292,20,4,left,top,auto,#262626,\"\"\"<big></big> <i>$TYPE_TO_SEARCH</i>\"\"\"" >/tmp/espanso_list.csv
echo "^sep(Espanso - text expander)" >>/tmp/espanso_list.csv
2021-09-04 22:53:28 +02:00
echo "^sep($CONFIGURE)" >>/tmp/espanso_list.csv
2024-01-30 20:49:07 +01:00
echo "$OPENCONFDIR,pcmanfm ~/.config/espanso/" >>/tmp/espanso_list.csv
2021-09-04 22:53:28 +02:00
echo "$DOCU,exo-open --launch WebBrowser https://espanso.org/docs/" >>/tmp/espanso_list.csv
echo "^sep($LIST)" >>/tmp/espanso_list.csv
2020-09-24 18:42:59 +02:00
while read -r line ; do
IFS='-' read -r id string <<< "$line"
2024-02-02 14:45:14 +01:00
#printf "\"\"\"<b><tt>%-12s</tt></b> <i>%s</i>\"\"\",xdotool type %s\n" $id "${string//</&lt;}" $id >> $MENU_ITEMS
string="${string//</&lt;}"
string="${string//&/&amp;}"
printf "\"\"\"<b><tt>%-12s</tt></b> <i>%s</i>\"\"\",xdotool type %s\n" $id "${string}" $id >> $MENU_ITEMS
2020-09-24 18:42:59 +02:00
done < <(espanso match list)
2021-09-04 22:53:28 +02:00
2020-09-24 18:42:59 +02:00
2020-09-25 16:06:39 +02:00
fi
2020-09-24 18:42:59 +02:00
### RUN
if [ $1 == "-s" ]; then
2021-09-24 01:40:09 +02:00
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
2021-06-01 02:01:25 +02:00
. $HOME/.config/mabox/mabox.conf
2020-09-24 18:42:59 +02:00
2021-06-01 02:01:25 +02:00
MENU_PADDING_TOP=${jgtools_padding:-0}
2020-09-26 14:54:15 +02:00
MENU_PADDING_TOP=24
2020-09-24 18:42:59 +02:00
MENU_HALIGN="center"
2020-09-25 10:42:23 +02:00
MENU_VALIGN="top"
2020-09-25 16:06:39 +02:00
MENU_MARGIN_Y=40
2020-09-24 18:42:59 +02:00
jgmenu_icon_size=0
JGWIDTH=500
2021-09-04 22:53:28 +02:00
MENU_HEIGHT_MAX=600
2021-06-01 02:01:25 +02:00
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
2020-09-24 18:42:59 +02:00
mkconfigfile
jgmenu --config-file=${CONFIG_FILE} --csv-file=/tmp/espanso_list.csv 2>/dev/null
rm -f /tmp/espanso_list.csv
exit 0
fi
#cat ${CONFIG_FILE}
#cat ${MENU_ITEMS}
if [ $1 == "-r" ]; then
echo "<i>$REMOVE</i>,mb-setvar places_softwarepipe=false" >> /tmp/espanso_list.csv
fi
cat "${MENU_ITEMS}"