summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Lopez2021-09-25 01:09:00 +0200
committerAdrian Lopez2021-09-25 01:09:20 +0200
commit614eb29f47e161bad213e1ad5445b61253f46268 (patch)
tree87c350bbda0f34d3ba883bfd6c291148fc2fa3c0
parent125f9f9d86ed12e9f007d2895cd552c3c5777f67 (diff)
downloadaur-614eb29f47e161bad213e1ad5445b61253f46268.tar.gz
Credits added to LICENSE
-rw-r--r--LICENSE27
-rw-r--r--README.md14
-rwxr-xr-xwofi-calc.sh34
3 files changed, 75 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000000..feaf3e41e1c
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,27 @@
+MIT License
+
+Copyright (c) 2021
+packager - Adrian Lopez
+Original authors:
+- stvsu
+- pierenn
+
+Source: https://todo.sr.ht/~scoopta/wofi/49
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 00000000000..e58206637b5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,14 @@
+# wofi-calc
+A simple calculator for wofi, inspired in rofi-calc.
+
+## Install from AUR
+
+ yay -S wofi-calc
+
+## Install from github
+
+ makepkg -sri
+
+## To use it run
+
+ wofi-calc
diff --git a/wofi-calc.sh b/wofi-calc.sh
new file mode 100755
index 00000000000..72fea609aca
--- /dev/null
+++ b/wofi-calc.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+RESULT_FILE="$HOME/.config/qalculate/qalc.result.history"
+if [ ! -f "$RESULT_FILE" ]; then
+ touch $RESULT_FILE
+fi
+
+LAST_WOFI=""
+QALC_RET=""
+while :
+do
+ qalc_hist=`tac $RESULT_FILE | head -1000`
+ WOFI_RET=`wofi --sort-order=default --cache-file=/dev/null -d -p calc <<< "$qalc_hist"`
+
+ rtrn=$?
+
+ if test "$rtrn" = "0"; then
+ if [[ "$WOFI_RET" =~ .*=.* ]]; then
+ RESULT=`echo "$WOFI_RET" | awk {'print $NF'}`
+ wl-copy "$RESULT"
+ exit 0
+ else
+ QALC_RET=`qalc "$WOFI_RET"`
+ LAST_WOFI=$WOFI_RET
+ echo $QALC_RET >> $RESULT_FILE
+ fi
+ else
+ if [ ! -z "$LAST_WOFI" ]; then
+ RESULT=`qalc -t "$LAST_WOFI"`
+ wl-copy "$RESULT"
+ fi
+ exit 0
+ fi
+done