nt

Unnamed repository; edit this file 'description' to name the repository.
git clone git://edryd.org/nt
Log | Files | Refs | LICENSE

commit 2d037383fdc12d7a19c6d2dd5af3d03fb7f2d5b9
parent 26f43a235f233e0922cf7297bbf63932d8d4c8b9
Author: Ed van Bruggen <edvb54@gmail.com>
Date:   Fri, 19 May 2017 22:32:28 -0700

Add dmenu_nt script, use dmenu as a UI

Diffstat:
dmenu_nt | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/dmenu_nt b/dmenu_nt @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# dmenu_nt - dmenu interface for nt +# See LICENSE file for copyright and license details + +prompt="nt" +cmd="nt $1" +height=$($cmd -l | wc -l) +maxheight=20 + +while + if [ "$height" -gt "$maxheight" ]; then height="$maxheight"; fi; + note=$($cmd -l | dmenu $2 -l "$height" -p "$prompt:" ); +[ -n "$note" ]; do + $cmd -l | grep -q "^$note" + if [ $? = 0 ]; then + $cmd -dy "$note" + if [ "$height" -lt "$maxheight" ]; then height=$((height-1)); fi; + else + $cmd "$note" + height=$((height+1)) + fi +done + +exit 0