diff options
| author | Ja.KooLit <85185940+JaKooLit@users.noreply.github.com> | 2024-05-24 13:52:30 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-24 13:52:30 +0900 |
| commit | 5acf937b57fd0c25baf26cae45e0f15862ab7d52 (patch) | |
| tree | dbcae5ec4d6c9199dcb482f313bef2bf461edb4f /config/hypr/UserScripts/RofiCalc.sh | |
| parent | 912f18dd534ea7244b7e453e65a84344b34b15b0 (diff) | |
| parent | 06d66be192eeb6f844d7069d05ffc34653352791 (diff) | |
Merge pull request #300 from JaKooLit/development
Pre-release stage: Development to Main
Diffstat (limited to 'config/hypr/UserScripts/RofiCalc.sh')
| -rwxr-xr-x | config/hypr/UserScripts/RofiCalc.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/config/hypr/UserScripts/RofiCalc.sh b/config/hypr/UserScripts/RofiCalc.sh new file mode 100755 index 00000000..355130de --- /dev/null +++ b/config/hypr/UserScripts/RofiCalc.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ +# /* Calculator (using qalculate) and rofi */ +# /* Submitted by: https://github.com/JosephArmas */ + +rofi_config="$HOME/.config/rofi/config-calc.rasi" + +# Kill Rofi if already running before execution +if pgrep -x "rofi" >/dev/null; then + pkill rofi + exit 0 +fi + +# main function + +while true; do + result=$( + rofi -i -dmenu \ + -config "$rofi_config" \ + -mesg "$result = $calc_result" + ) + + if [ $? -ne 0 ]; then + exit + fi + + if [ -n "$result" ]; then + calc_result=$(qalc -t "$result") + echo "$calc_result" | wl-copy + fi +done |
