blob: 1005e7973e1c5bd6ce183de12b8e39c014061a58 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/usr/bin/env bash
# ==================================================
# KoolDots (2026)
# Project URL: https://github.com/LinuxBeginnings
# License: GNU GPLv3
# SPDX-License-Identifier: GPL-3.0-or-later
# ==================================================
# searchable enabled keybinds using rofi (supports bindd descriptions)
# kill yad to not interfere with this binds
pkill yad || true
# check if rofi is already running
if pidof rofi > /dev/null; then
pkill rofi
fi
# define the config files
config_home="${XDG_CONFIG_HOME:-$HOME/.config}"
hypr_dir="$config_home/hypr"
keybinds_conf="$hypr_dir/configs/Keybinds.conf"
user_keybinds_conf="$hypr_dir/UserConfigs/UserKeybinds.conf"
laptop_conf="$hypr_dir/UserConfigs/Laptops.conf"
lua_keybinds_conf="$hypr_dir/lua/keybinds.lua"
lua_user_keybinds="$hypr_dir/UserConfigs/user_keybinds.lua"
lua_system_keybinds="$hypr_dir/configs/system_keybinds.lua"
lua_legacy_system_keybinds="$hypr_dir/UserConfigs/system_keybinds.lua"
lua_overrides="$hypr_dir/UserConfigs/user_overrides.lua"
rofi_theme="$HOME/.config/rofi/config-keybinds.rasi"
msg='☣️ NOTE ☣️: Clicking with Mouse or Pressing ENTER will have NO function'
# detect active Hyprland config mode (Lua entrypoint vs legacy .conf includes)
lua_entry="$hypr_dir/hyprland.lua"
legacy_lua_entry="$config_home/hyprland.lua"
if [[ -f "$lua_entry" || -f "$legacy_lua_entry" ]]; then
hypr_config_mode="lua"
else
hypr_config_mode="conf"
fi
# collect raw bind lines from available files
if [[ "$hypr_config_mode" == "lua" ]]; then
files=("$lua_keybinds_conf")
if [[ -f "$lua_system_keybinds" ]]; then
files+=("$lua_system_keybinds")
elif [[ -f "$lua_legacy_system_keybinds" ]]; then
files+=("$lua_legacy_system_keybinds")
fi
[[ -f "$lua_user_keybinds" ]] && files+=("$lua_user_keybinds")
[[ -f "$lua_overrides" ]] && files+=("$lua_overrides")
else
files=("$keybinds_conf" "$user_keybinds_conf")
[[ -f "$laptop_conf" ]] && files+=("$laptop_conf")
fi
# Parse binds using the python script for speed
# The last argument must be the user config for override logic to work correctly
display_keybinds=$("$HOME/.config/hypr/scripts/keybinds_parser.py" "${files[@]}")
# Check for suggestions file created by python script
if [[ -f "/tmp/hypr_keybind_suggestions_file" ]]; then
suggestions_file=$(cat "/tmp/hypr_keybind_suggestions_file")
rm "/tmp/hypr_keybind_suggestions_file"
if [[ -n "$suggestions_file" && -f "$suggestions_file" ]]; then
count=$(wc -l < "$suggestions_file")
msg="$msg | Overrides missing unbind: $count (suggestions: $suggestions_file)"
fi
fi
# use rofi to display the keybinds
printf '%s\n' "$display_keybinds" | rofi -dmenu -i -config "$rofi_theme" -mesg "$msg"
|