From 31ec360d1c86f64ac59d8a93d8a80d26c00bc9ab Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Fri, 25 Sep 2020 10:42:23 +0200 Subject: [PATCH] history helper --- usr/bin/jgespanso-pipe | 6 ++++-- usr/bin/jghistory-pipe | 34 +++++++++++++++++++++++++++++++++ usr/bin/pipemenu-standalone.cfg | 4 ++-- 3 files changed, 40 insertions(+), 4 deletions(-) create mode 100755 usr/bin/jghistory-pipe diff --git a/usr/bin/jgespanso-pipe b/usr/bin/jgespanso-pipe index 86a3cc4..27c1be0 100755 --- a/usr/bin/jgespanso-pipe +++ b/usr/bin/jgespanso-pipe @@ -29,7 +29,7 @@ echo "^sep(Espanso - text expander)" >/tmp/espanso_list.csv while read -r line ; do IFS='-' read -r id string <<< "$line" - printf "\"\"\"%-12s %s\"\"\",espanso match exec %s\n" $id "$string" $id >> $MENU_ITEMS + printf "\"\"\"%-12s %s\"\"\",espanso match exec %s\n" $id "$string" $id >> $MENU_ITEMS done < <(espanso match list) echo "^sep($CONFIGURE)" >>/tmp/espanso_list.csv echo "$EDITCONF, geany ~/.config/espanso/default.yml" >>/tmp/espanso_list.csv @@ -42,7 +42,9 @@ if [ $1 == "-s" ]; then MENU_PADDING_TOP=0 MENU_HALIGN="center" -MENU_VALIGN="center" +MENU_VALIGN="top" +MENU_MARGIN_Y=30 +MENU_MARGIN_X=30 jgmenu_icon_size=0 JGWIDTH=500 #MENU_HEIGHT_MAX=600 diff --git a/usr/bin/jghistory-pipe b/usr/bin/jghistory-pipe new file mode 100755 index 0000000..0e008ee --- /dev/null +++ b/usr/bin/jghistory-pipe @@ -0,0 +1,34 @@ +#!/bin/bash + + + +MENU_ITEMS=/tmp/history_list.csv +trap "rm -f $MENU_ITEMS" EXIT +echo "^sep(History helper)" >/tmp/history_list.csv +while read -r line ; do + + printf "\"\"\"%s\"\"\",xdotool type --delay 0 \"%s\"\n" "$line" "$line" >> $MENU_ITEMS +done < <(cat ~/.bash_history|sort|uniq) + +### RUN +if [ $1 == "-s" ]; then +. /usr/bin/pipemenu-standalone.cfg + +MENU_PADDING_TOP=0 +MENU_HALIGN="center" +MENU_VALIGN="top" +MENU_MARGIN_Y=30 +MENU_MARGIN_X=30 +jgmenu_icon_size=0 +JGWIDTH=500 +#MENU_HEIGHT_MAX=600 +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} + diff --git a/usr/bin/pipemenu-standalone.cfg b/usr/bin/pipemenu-standalone.cfg index 3aa2746..7f62305 100644 --- a/usr/bin/pipemenu-standalone.cfg +++ b/usr/bin/pipemenu-standalone.cfg @@ -36,8 +36,8 @@ terminal_exec = terminator terminal_args = -e tabs = ${TABS:-220} menu_border = ${menu_border:-0} -menu_margin_x = 0 -menu_margin_y = 0 +menu_margin_x = ${MENU_MARGIN_X:-0} +menu_margin_y = ${MENU_MARGIN_Y:-0} menu_width = $JGWIDTH menu_height_min = ${MENU_HEIGHT_MIN:-0} menu_height_max = ${MENU_HEIGHT_MAX:-0}