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/UserConfigs/UserKeybinds.conf | 2 +- config/hypr/UserScripts/RofiCalc.sh | 31 +++++++++++++++++++++++++++++++ config/hypr/scripts/RofiCalc.sh | 31 ------------------------------- 3 files changed, 32 insertions(+), 32 deletions(-) create mode 100755 config/hypr/UserScripts/RofiCalc.sh delete mode 100755 config/hypr/scripts/RofiCalc.sh diff --git a/config/hypr/UserConfigs/UserKeybinds.conf b/config/hypr/UserConfigs/UserKeybinds.conf index f3d03df8..85f3c1c3 100644 --- a/config/hypr/UserConfigs/UserKeybinds.conf +++ b/config/hypr/UserConfigs/UserKeybinds.conf @@ -21,7 +21,7 @@ bind = $mainMod, A, exec, pkill rofi || true && ags -t 'overview' bind = $mainMod, Return, exec, $term # Launch terminal bind = $mainMod, T, exec, $files # Launch file manager -bind = $mainMod ALT, C, exec, $scriptsDir/RofiCalc.sh # calculator (qalculate) +bind = $mainMod ALT, C, exec, $UserScripts/RofiCalc.sh # calculator (qalculate) # pyprland bind = $mainMod SHIFT, Return, exec, pypr toggle term # Dropdown terminal 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 diff --git a/config/hypr/scripts/RofiCalc.sh b/config/hypr/scripts/RofiCalc.sh deleted file mode 100755 index 355130de..00000000 --- a/config/hypr/scripts/RofiCalc.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/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