From d57c8f635f59149ea99209371ddf25dd21d0c126 Mon Sep 17 00:00:00 2001
From: Frost-Phoenix <67cyril6767@gmail.com>
Date: Fri, 12 Jan 2024 17:36:41 +0100
Subject: [PATCH] add keybind to view them all

---
 modules/home/hyprland/config.nix         | 3 +++
 modules/home/scripts/scripts/keybinds.sh | 6 ++++++
 2 files changed, 9 insertions(+)
 create mode 100755 modules/home/scripts/scripts/keybinds.sh

diff --git a/modules/home/hyprland/config.nix b/modules/home/hyprland/config.nix
index 6f3fcf0..5f97911 100644
--- a/modules/home/hyprland/config.nix
+++ b/modules/home/hyprland/config.nix
@@ -132,6 +132,9 @@ in
 
       # ----------------------------------------------------------------
       
+      # show keybinds list
+      bind = $mainMod, F1, exec, ~/.config/hypr/keybind
+
       # keybindings
       bind = $mainMod, Return, exec, kitty
       bind = ALT, Return, exec, kitty --title float_kitty
diff --git a/modules/home/scripts/scripts/keybinds.sh b/modules/home/scripts/scripts/keybinds.sh
new file mode 100755
index 0000000..c1837e1
--- /dev/null
+++ b/modules/home/scripts/scripts/keybinds.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+config_file=~/.config/hypr/hyprland.conf
+keybinds=$(grep -oP '(?<=bind = ).*' $config_file)
+keybinds=$(echo "$keybinds" | sed 's/,\([^,]*\)$/ = \1/' | sed 's/, exec//g' | sed 's/^,//g')
+wofi -dmenu -p "Keybinds" <<< "$keybinds"