From b478eef5f63d237eda06256bd4508c545bc6bcbe Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sat, 15 Feb 2025 12:45:34 +0900 Subject: updated keybinds search & rofi theme selector scripts --- config/hypr/scripts/KeyBinds.sh | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'config/hypr/scripts/KeyBinds.sh') diff --git a/config/hypr/scripts/KeyBinds.sh b/config/hypr/scripts/KeyBinds.sh index 639dd3a1..324a9d00 100755 --- a/config/hypr/scripts/KeyBinds.sh +++ b/config/hypr/scripts/KeyBinds.sh @@ -1,36 +1,40 @@ #!/bin/bash # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## -# Searchable enabled keybinds using rofi +# searchable enabled keybinds using rofi -# Kill yad to not interfere with this binds +# kill yad to not interfere with this binds pkill yad || true -# Check if rofi is already running +# check if rofi is already running if pidof rofi > /dev/null; then pkill rofi fi -# Define the config files -KEYBINDS_CONF="$HOME/.config/hypr/configs/Keybinds.conf" -USER_KEYBINDS_CONF="$HOME/.config/hypr/UserConfigs/UserKeybinds.conf" -LAPTOP_CONF="$HOME/.config/hypr/UserConfigs/Laptops.conf" +# define the config files +keybinds_conf="$HOME/.config/hypr/configs/Keybinds.conf" +user_keybinds_conf="$HOME/.config/hypr/UserConfigs/UserKeybinds.conf" +laptop_conf="$HOME/.config/hypr/UserConfigs/Laptops.conf" rofi_theme="$HOME/.config/rofi/config-keybinds.rasi" msg='☣️ NOTE ☣️: Clicking with Mouse or Pressing ENTER will have NO function' -# Combine the contents of the keybinds files and filter for keybinds -KEYBINDS=$(cat "$KEYBINDS_CONF" "$USER_KEYBINDS_CONF" | grep -E '^bind') +# combine the contents of the keybinds files and filter for keybinds +keybinds=$(cat "$keybinds_conf" "$user_keybinds_conf" | grep -E '^bind') -# Check if Laptop.conf exists and add its keybinds if present -if [[ -f "$LAPTOP_CONF" ]]; then - LAPTOP_BINDS=$(grep -E '^bind' "$LAPTOP_CONF") - KEYBINDS+=$'\n'"$LAPTOP_BINDS" +# check if laptop.conf exists and add its keybinds if present +if [[ -f "$laptop_conf" ]]; then + laptop_binds=$(grep -E '^bind' "$laptop_conf") + keybinds+=$'\n'"$laptop_binds" fi -# Check for any keybinds to display -if [[ -z "$KEYBINDS" ]]; then - echo "No keybinds found." +# check for any keybinds to display +if [[ -z "$keybinds" ]]; then + echo "no keybinds found." exit 1 fi -# Use rofi to display the keybinds -echo "$KEYBINDS" | rofi -dmenu -i -config "$rofi_theme" -mesg "$msg" +# replace $mainmod with super in the displayed keybinds for rofi +display_keybinds=$(echo "$keybinds" | sed 's/\$mainMod/SUPER/g') + +# use rofi to display the keybinds with the modified content +echo "$display_keybinds" | rofi -dmenu -i -config "$rofi_theme" -mesg "$msg" +s \ No newline at end of file -- cgit v1.2.3