diff --git a/.SRCINFO b/.aur-scripts/wofi-calc-git/.SRCINFO similarity index 100% rename from .SRCINFO rename to .aur-scripts/wofi-calc-git/.SRCINFO diff --git a/aur-scripts/wofi-calc-git/PKGBUILD b/.aur-scripts/wofi-calc-git/PKGBUILD similarity index 100% rename from aur-scripts/wofi-calc-git/PKGBUILD rename to .aur-scripts/wofi-calc-git/PKGBUILD diff --git a/aur-scripts/wofi-calc-git/push-version.sh b/.aur-scripts/wofi-calc-git/push-version.sh similarity index 58% rename from aur-scripts/wofi-calc-git/push-version.sh rename to .aur-scripts/wofi-calc-git/push-version.sh index 99ab45b..aab8a53 100755 --- a/aur-scripts/wofi-calc-git/push-version.sh +++ b/.aur-scripts/wofi-calc-git/push-version.sh @@ -1,13 +1,15 @@ # Description: Generates a new aur release. +# WARNING: make sure you push all changes before running this. +# or you may experience inconsistences. # Generate the checksums automatically -sed -i "s/^sha256sums=.*/$(makepkg -g -f -p PKGBUILD)/" PKGBUILD +sed -i "s/^sha256sums=.*/$(makepkg -g -f -p PKGBUILD)/" ./PKGBUILD # Generate pagkage metadata -makepkg --printsrcinfo > .SRCINFO +makepkg --printsrcinfo > ./.SRCINFO # Push it to AUR -git add PKGBUILD .SRCINFO +git add ./PKGBUILD ./.SRCINFO git commit -m "New version" git push ssh://aur@aur.archlinux.org/wofi-calc-git.git master diff --git a/aur-scripts/wofi-calc-git/wofi-calc.sh b/.aur-scripts/wofi-calc-git/wofi-calc.sh similarity index 100% rename from aur-scripts/wofi-calc-git/wofi-calc.sh rename to .aur-scripts/wofi-calc-git/wofi-calc.sh diff --git a/aur-scripts/wofi-calc-git/.SRCINFO b/.aur-scripts/wofi-calc/.SRCINFO similarity index 100% rename from aur-scripts/wofi-calc-git/.SRCINFO rename to .aur-scripts/wofi-calc/.SRCINFO diff --git a/aur-scripts/wofi-calc/PKGBUILD b/.aur-scripts/wofi-calc/PKGBUILD similarity index 100% rename from aur-scripts/wofi-calc/PKGBUILD rename to .aur-scripts/wofi-calc/PKGBUILD diff --git a/aur-scripts/wofi-calc/push-version.sh b/.aur-scripts/wofi-calc/push-version.sh similarity index 82% rename from aur-scripts/wofi-calc/push-version.sh rename to .aur-scripts/wofi-calc/push-version.sh index 115a00d..b9a601e 100755 --- a/aur-scripts/wofi-calc/push-version.sh +++ b/.aur-scripts/wofi-calc/push-version.sh @@ -1,4 +1,6 @@ # Description: Generates a new aur release. +# WARNING: make sure you push all changes before running this. +# or you may experience inconsistences. #----------------------------------------------------------------------------- # TODO: On github/gitlab, create automation to create git version per tag @@ -13,10 +15,10 @@ sed -i "s/^sha256sums=.*/$(makepkg -g -f -p PKGBUILD)/" ./PKGBUILD git tag $(printf "v1.0.r%s" "$(git rev-list --count HEAD)") # Generate pagkage metadata -makepkg --printsrcinfo > .SRCINFO +makepkg --printsrcinfo > ./.SRCINFO # Push it to AUR -git add PKGBUILD .SRCINFO +git add ./PKGBUILD ./.SRCINFO git commit -m "New version" git push ssh://aur@aur.archlinux.org/wofi-calc.git master diff --git a/.aur-scripts/wofi-calc/wofi-calc.sh b/.aur-scripts/wofi-calc/wofi-calc.sh new file mode 100644 index 0000000..72fea60 --- /dev/null +++ b/.aur-scripts/wofi-calc/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