mabox-pipemenus/usr/bin/jghistory-pipe

50 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
case $LANG in
pl*)
HISTHELPER="Ściągawka z historii"
NOTHING="Niczego tu nie ma... Otwórz terminal (W-t) i wykonaj jakieś polecenie"
;;
es*)
HISTHELPER="Historia breve"
NOTHING="Nada que ver aquí...Abrir la terminal (W-t) y ejecutar algunos comandos"
;;
*)
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
echo "^sep($HISTHELPER)" >/tmp/history_list.csv
if [ -f ~/.bash_history ]; then
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 "\"\"\"$NOTHING\"\"\",exo-open --launch TerminalEmulator" >>/tmp/history_list.csv
fi
### RUN
if [ $1 == "-s" ]; then
. /usr/bin/pipemenu-standalone.cfg
MENU_PADDING_TOP=0
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}