diff options
| author | JaKooLit <jimmielovejay@gmail.com> | 2024-05-23 20:27:41 +0900 |
|---|---|---|
| committer | JaKooLit <jimmielovejay@gmail.com> | 2024-05-23 20:27:41 +0900 |
| commit | 57121a4bddf834545613b38dfa8510a1e7060d3c (patch) | |
| tree | 6eaa500f223b2359f35583fe8700abf5c2745f76 /config/hypr/UserScripts | |
| parent | 8a36a291b396f843b91da1970f1d162c23a05c13 (diff) | |
RofiCalc script moved to UserScripts
Diffstat (limited to 'config/hypr/UserScripts')
| -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 |
