From 40fb30c13b3e0e80174066b7ccf2dd88fe2a9666 Mon Sep 17 00:00:00 2001 From: JosephArmas Date: Wed, 22 May 2024 13:41:48 -0700 Subject: [PATCH 1/5] feat: Add rofi calculator using qalc command. Result of expression is automatically saved to clipboard. Default keybinding set to mod + alt + c. --- config/hypr/configs/Keybinds.conf | 1 + config/hypr/scripts/RofiCalc.sh | 21 +++++++++++++++++++++ config/rofi/config-calc.rasi | 7 +++++++ 3 files changed, 29 insertions(+) create mode 100755 config/hypr/scripts/RofiCalc.sh create mode 100644 config/rofi/config-calc.rasi diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf index 142de86..bd6e0a9 100644 --- a/config/hypr/configs/Keybinds.conf +++ b/config/hypr/configs/Keybinds.conf @@ -23,6 +23,7 @@ bind = CTRL ALT, P, exec, $scriptsDir/Wlogout.sh bind = $mainMod, H, exec, $scriptsDir/KeyHints.sh # Small help file bind = $mainMod ALT, R, exec, $scriptsDir/Refresh.sh # Refresh waybar, swaync, rofi bind = $mainMod ALT, E, exec, $scriptsDir/RofiEmoji.sh # emoji +bind = $mainMod ALT, C, exec, $scriptsDir/RofiEmoji.sh # calculator bind = $mainMod, S, exec, $scriptsDir/RofiSearch.sh # Google search from Rofi bind = $mainMod SHIFT, B, exec, $scriptsDir/ChangeBlur.sh # Toggle blur settings bind = $mainMod SHIFT, G, exec, $scriptsDir/GameMode.sh # animations ON/OFF diff --git a/config/hypr/scripts/RofiCalc.sh b/config/hypr/scripts/RofiCalc.sh new file mode 100755 index 0000000..3589525 --- /dev/null +++ b/config/hypr/scripts/RofiCalc.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +rofi_config="$HOME/.config/rofi/config-calc.rasi" + + +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/rofi/config-calc.rasi b/config/rofi/config-calc.rasi new file mode 100644 index 0000000..4c7cad2 --- /dev/null +++ b/config/rofi/config-calc.rasi @@ -0,0 +1,7 @@ +@import "~/.config/rofi/config-long.rasi" + +/* ---- Entry ---- */ +entry { + width: 45%; + placeholder: "🧮 Calculate"; +} From 9060d299cbb75d92ef442d8db4cf14f6387542dd Mon Sep 17 00:00:00 2001 From: "Ja.KooLit" <85185940+JaKooLit@users.noreply.github.com> Date: Thu, 23 May 2024 12:08:55 +0900 Subject: [PATCH 2/5] Update Keybinds.conf --- config/hypr/configs/Keybinds.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf index bd6e0a9..1615590 100644 --- a/config/hypr/configs/Keybinds.conf +++ b/config/hypr/configs/Keybinds.conf @@ -23,7 +23,7 @@ bind = CTRL ALT, P, exec, $scriptsDir/Wlogout.sh bind = $mainMod, H, exec, $scriptsDir/KeyHints.sh # Small help file bind = $mainMod ALT, R, exec, $scriptsDir/Refresh.sh # Refresh waybar, swaync, rofi bind = $mainMod ALT, E, exec, $scriptsDir/RofiEmoji.sh # emoji -bind = $mainMod ALT, C, exec, $scriptsDir/RofiEmoji.sh # calculator +bind = $mainMod ALT, C, exec, $scriptsDir/RofiCalc.sh # calculator (qalculate) bind = $mainMod, S, exec, $scriptsDir/RofiSearch.sh # Google search from Rofi bind = $mainMod SHIFT, B, exec, $scriptsDir/ChangeBlur.sh # Toggle blur settings bind = $mainMod SHIFT, G, exec, $scriptsDir/GameMode.sh # animations ON/OFF From da68e757550990968f5d5f4b5cfcca74d7997e4e Mon Sep 17 00:00:00 2001 From: "Ja.KooLit" <85185940+JaKooLit@users.noreply.github.com> Date: Thu, 23 May 2024 12:12:23 +0900 Subject: [PATCH 3/5] Update config-calc.rasi --- config/rofi/config-calc.rasi | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/config/rofi/config-calc.rasi b/config/rofi/config-calc.rasi index 4c7cad2..5924a11 100644 --- a/config/rofi/config-calc.rasi +++ b/config/rofi/config-calc.rasi @@ -1,7 +1,16 @@ -@import "~/.config/rofi/config-long.rasi" +/* ---- 💫 https://github.com/JaKooLit 💫 ---- */ +/* Main Config Calculator */ +/* Submitted by: https://github.com/JosephArmas */ + +@import "~/.config/rofi/config.rasi" /* ---- Entry ---- */ entry { - width: 45%; + width: 27%; placeholder: "🧮 Calculate"; } + +/* ---- Window ---- */ +window { + width: 30%; +} From a3bf20a92a091fe240d530c42b61437301571160 Mon Sep 17 00:00:00 2001 From: "Ja.KooLit" <85185940+JaKooLit@users.noreply.github.com> Date: Thu, 23 May 2024 12:15:06 +0900 Subject: [PATCH 4/5] Update RofiCalc.sh --- config/hypr/scripts/RofiCalc.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/hypr/scripts/RofiCalc.sh b/config/hypr/scripts/RofiCalc.sh index 3589525..d908e2b 100755 --- a/config/hypr/scripts/RofiCalc.sh +++ b/config/hypr/scripts/RofiCalc.sh @@ -1,4 +1,7 @@ #!/bin/bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ +# /* Calculator (using qualculate) and rofi */ +# /* Submitted by: https://github.com/JosephArmas */ rofi_config="$HOME/.config/rofi/config-calc.rasi" From f34a6bf1006bcd3b2584ec69c2ca7ab30b517bc0 Mon Sep 17 00:00:00 2001 From: "Ja.KooLit" <85185940+JaKooLit@users.noreply.github.com> Date: Thu, 23 May 2024 12:16:02 +0900 Subject: [PATCH 5/5] Update RofiCalc.sh --- config/hypr/scripts/RofiCalc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/hypr/scripts/RofiCalc.sh b/config/hypr/scripts/RofiCalc.sh index d908e2b..ff96b3a 100755 --- a/config/hypr/scripts/RofiCalc.sh +++ b/config/hypr/scripts/RofiCalc.sh @@ -1,6 +1,6 @@ #!/bin/bash # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ -# /* Calculator (using qualculate) and rofi */ +# /* Calculator (using qalculate) and rofi */ # /* Submitted by: https://github.com/JosephArmas */ rofi_config="$HOME/.config/rofi/config-calc.rasi"