mabox-pipemenus/usr/bin/jghistory-pipe

58 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
case $LANG in
pl*)
TYPE_TO_SEARCH="pisz, aby wyszukać"
HISTHELPER="Ściągawka z historii"
NOTHING="Niczego tu nie ma... Otwórz terminal (W-t) i wykonaj jakieś polecenie"
;;
es*)
TYPE_TO_SEARCH="Buscar"
HISTHELPER="Historia breve"
NOTHING="Nada que ver aquí...Abrir la terminal (W-t) y ejecutar algunos comandos"
;;
*)
TYPE_TO_SEARCH="Type to filter"
HISTHELPER="History helper"
NOTHING="Nothing to see here... Open terminal (W-t) and run some commands"
;;
esac
MENU_ITEMS=/tmp/history_list.csv
trap "rm -f $MENU_ITEMS" EXIT
if [ -f ~/.bash_history ]; then
echo "@search,,10,5,292,20,4,left,top,auto,#262626,\"\"\"<big></big> <i>$TYPE_TO_SEARCH</i>\"\"\"" >/tmp/history_list.csv
echo "^sep($HISTHELPER)" >>/tmp/history_list.csv
while read -r line ; do
printf "\"\"\"<b>%s</b>\"\"\",xdotool type --delay 0 \'%s\'\n" "$line" "$line" >> $MENU_ITEMS
done < <(cat ~/.bash_history|sort|uniq)
else
echo "^sep($HISTHELPER)" >/tmp/history_list.csv
echo "\"\"\"$NOTHING\"\"\",exo-open --launch TerminalEmulator" >>/tmp/history_list.csv
fi
### RUN
if [ $1 == "-s" ]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
MENU_PADDING_TOP=24
MENU_HALIGN="center"
MENU_VALIGN="top"
MENU_MARGIN_Y=40
jgmenu_icon_size=0
JGWIDTH=500
mkconfigfile
jgmenu --config-file=${CONFIG_FILE} --csv-file=/tmp/history_list.csv 2>/dev/null
rm -f /tmp/history_list.csv
exit 0
fi
#cat ${CONFIG_FILE}
cat ${MENU_ITEMS}