aboutsummaryrefslogtreecommitdiffstats
path: root/.config/herbstluftwm/calc.sh
diff options
context:
space:
mode:
Diffstat (limited to '.config/herbstluftwm/calc.sh')
-rwxr-xr-x.config/herbstluftwm/calc.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/.config/herbstluftwm/calc.sh b/.config/herbstluftwm/calc.sh
index 358f43d..142065e 100755
--- a/.config/herbstluftwm/calc.sh
+++ b/.config/herbstluftwm/calc.sh
@@ -5,8 +5,30 @@ in="first"
prompt="calc:"
pi="3.1415926535897932384626433832795028841971694"
e="2.7182818284590452353602874713526624977572471"
+
+# check first word for special commands
+command_check() {
+ case "$(echo $1 | cut -d ' ' -f 1)" in
+ "y")
+ echo "$2" | tr -d '~' | xclip -selection clipboard
+ return 1
+ ;;
+ "yank")
+ echo "$2" | tr -d '~' | xclip -selection clipboard
+ return 1
+ ;;
+
+ *)
+ return 0
+ ;;
+ esac
+}
+
while [ "$in" != "" ]; do
in=$(echo "" | dmenu -q -h 18 -nb $1 -nf $2 -sb $3 -sf $4 -p "$prompt")
+ if [[ $(command_check "$in" "$acc") -eq 1 ]]; then
+ break
+ fi
# replace "ans" with the previous value
in=$(echo $in | sed -e "s/ans/$acc/g")