Browse Source

feat: Add rofi calculator using qalc command. Result of expression is automatically saved to clipboard. Default keybinding set to mod + alt + c.

pull/296/head
JosephArmas 2 years ago
parent
commit
40fb30c13b
  1. 1
      config/hypr/configs/Keybinds.conf
  2. 21
      config/hypr/scripts/RofiCalc.sh
  3. 7
      config/rofi/config-calc.rasi

1
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

21
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

7
config/rofi/config-calc.rasi

@ -0,0 +1,7 @@
@import "~/.config/rofi/config-long.rasi"
/* ---- Entry ---- */
entry {
width: 45%;
placeholder: "🧮 Calculate";
}
Loading…
Cancel
Save