diff --git a/hypr/conf/keybindings/default.conf b/hypr/conf/keybindings/default.conf index d9dc297..76be5ee 100644 --- a/hypr/conf/keybindings/default.conf +++ b/hypr/conf/keybindings/default.conf @@ -7,27 +7,27 @@ $mainMod = SUPER # Applications -bind = $mainMod, RETURN, exec, ~/dotfiles/.settings/terminal.sh -bind = $mainMod, B, exec, ~/dotfiles/.settings/browser.sh +bind = $mainMod, RETURN, exec, ~/dotfiles/.settings/terminal.sh # Open the terminal +bind = $mainMod, B, exec, ~/dotfiles/.settings/browser.sh # Open the browser +bind = $mainMod, E, exec, ~/dotfiles/.settings/filemanager.sh # Open the filemanager # Windows -bind = $mainMod, Q, killactive -bind = $mainMod, F, fullscreen -bind = $mainMod, E, exec, ~/dotfiles/.settings/filemanager.sh -bind = $mainMod, T, togglefloating -bind = $mainMod SHIFT, T, exec, ~/dotfiles/hypr/scripts/toggleallfloat.sh -bind = $mainMod, J, togglesplit -bind = $mainMod, left, movefocus, l -bind = $mainMod, right, movefocus, r -bind = $mainMod, up, movefocus, u -bind = $mainMod, down, movefocus, d -bindm = $mainMod, mouse:272, movewindow -bindm = $mainMod, mouse:273, resizewindow -bind = $mainMod SHIFT, right, resizeactive, 100 0 -bind = $mainMod SHIFT, left, resizeactive, -100 0 -bind = $mainMod SHIFT, up, resizeactive, 0 -100 -bind = $mainMod SHIFT, down, resizeactive, 0 100 -bind = $mainMod, G, togglegroup +bind = $mainMod, Q, killactive # Kill active window +bind = $mainMod, F, fullscreen # Set active window to fullscreen +bind = $mainMod, T, togglefloating # Toggle active windows into floating mode +bind = $mainMod SHIFT, T, exec, ~/dotfiles/hypr/scripts/toggleallfloat.sh # Toggle all windows into floating mode +bind = $mainMod, J, togglesplit # Toggle split +bind = $mainMod, left, movefocus, l # Move focus left +bind = $mainMod, right, movefocus, r # Move focus right +bind = $mainMod, up, movefocus, u # Move focus up +bind = $mainMod, down, movefocus, d # Move focus down +bindm = $mainMod, mouse:272, movewindow # Move window with the mouse +bindm = $mainMod, mouse:273, resizewindow # Resize window with the mouse +bind = $mainMod SHIFT, right, resizeactive, 100 0 # Increase window width with keyboard +bind = $mainMod SHIFT, left, resizeactive, -100 0 # Reduce window width with keyboard +bind = $mainMod SHIFT, down, resizeactive, 0 100 # Increase window height with keyboard +bind = $mainMod SHIFT, up, resizeactive, 0 -100 # Reduce window height with keyboard +bind = $mainMod, G, togglegroup # Toggle window group # Actions bind = $mainMod SHIFT, A, exec, ~/dotfiles/hypr/scripts/toggle-animations.sh diff --git a/hypr/scripts/keybindings.sh b/hypr/scripts/keybindings.sh index bcf5dff..d4edd07 100755 --- a/hypr/scripts/keybindings.sh +++ b/hypr/scripts/keybindings.sh @@ -21,13 +21,29 @@ config_file=${config_file/source=~/} config_file="/home/$USER$config_file" echo "Reading from: $config_file" -# ----------------------------------------------------- -# Parse keybindings -# ----------------------------------------------------- -keybinds=$(grep -oP '(?<=bind = ).*' $config_file) -keybinds=$(echo "$keybinds" | sed 's/$mainMod/SUPER/g'| sed 's/,\([^,]*\)$/ = \1/' | sed 's/, exec//g' | sed 's/^,//g') -# ----------------------------------------------------- -# Show keybindings in rofi -# ----------------------------------------------------- +keybinds="" + +# Detect Start String +while read -r line +do + if [[ "$line" == "bind"* ]]; then + + line="$(echo "$line" | sed 's/$mainMod/SUPER/g')" + line="$(echo "$line" | sed 's/bind = //g')" + line="$(echo "$line" | sed 's/bindm = //g')" + + IFS='#' + read -a strarr <<<"$line" + kb_str=${strarr[0]} + cm_str=${strarr[1]} + + IFS=',' + read -a kbarr <<<"$kb_str" + + item="${kbarr[0]} + ${kbarr[1]}"$'\r'"${cm_str:1}" + keybinds=$keybinds$item$'\n' + fi +done < "$config_file" + sleep 0.2 -rofi -dmenu -i -replace -p "Keybinds" -config ~/dotfiles/rofi/config-compact.rasi <<< "$keybinds" \ No newline at end of file +rofi -dmenu -i -markup -eh 2 -replace -p "Keybinds" -config ~/dotfiles/rofi/config-compact.rasi <<< "$keybinds" \ No newline at end of file