From 57121a4bddf834545613b38dfa8510a1e7060d3c Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Thu, 23 May 2024 20:27:41 +0900 Subject: RofiCalc script moved to UserScripts --- config/hypr/UserScripts/RofiCalc.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 config/hypr/UserScripts/RofiCalc.sh (limited to 'config/hypr/UserScripts') 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 -- cgit v1.2.3