scripts

Various scripts for UNIX-like systems
git clone https://git.tronto.net/scripts
Download | Log | Files | Refs | README

commit c8fc83e3525959abdc1e7ce91477d74bf6b35a72
parent 4e9c45553f24850ea7973d4326ab922db10a96e9
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Mon,  9 May 2022 13:36:39 +0200

Added edit-menu

Diffstat:
MMakefile | 1+
Aedit-menu | 25+++++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -14,6 +14,7 @@ SCRIPTS = addressgrep \ dmenu-unmount \ dmenu-urlselect \ dmenu-websearch \ + edit-menu \ ffmpeg-screenrecord \ ffmpeg-facecam \ mail-checknow \ diff --git a/edit-menu b/edit-menu @@ -0,0 +1,25 @@ +#!/bin/sh + +# A "filter", based on your favorite editor. +# It reads lines from stdin, opens a file containing these lines +# with your favorite editor, and then prints the content of the file +# $EDITMENU to stdout. I have configured my editor to write the +# current line to $EDITMENU when pressing ;; (semicolon twice) like this +# map ;; !!tee -a $EDITMENU^M " For nvi + +# It can be used to replace dmenu or similar menu applications in +# constrained environment. It works even without any (n)curses library, +# assuming you use a suitable editor (like ed). + +editor=${EDITOR:-vi} + +export EDITMENU=$(mktemp) +in=$(mktemp) + +cat > "$in" + +# This is a dirty trick to "help" the editor (vi) understand that it can +# take over the tty to get its input. +$editor "$in" < /dev/tty + +cat $EDITMENU