dotfiles

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

commit c66febddee6b1d4bdbafc2b44db32a4427819d06
parent 3c3fe4a7e13a729126a77db5bf60811af7c53dc9
Author: Ed van Bruggen <edvb54@gmail.com>
Date:   Tue, 12 May 2015 18:58:01 -0700

Add dmenu-calc.sh to bin/ directory

Diffstat:
bin/dmenu-calc.sh | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/bin/dmenu-calc.sh b/bin/dmenu-calc.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Caluctor using dmenu as interface + +__dmenu_calc() { + result=$(xclip -o -sel clip | dmenu -p Calc | xargs echo | bc 2>&1) + if [[ $result ]]; then # if result is not empty (the last one), copy to clipboard + echo $result | xclip -sel clip + fi +} + +# run dmenu calculator while the result is not empty +while : ; do + __dmenu_calc + [[ $result ]] || break +done