diff options
| -rw-r--r-- | config/hypr/configs/Keybinds.conf | 10 | ||||
| -rw-r--r-- | config/hypr/configs/system_keybinds.lua | 17 | ||||
| -rw-r--r-- | config/hypr/lua/keybinds.lua | 19 | ||||
| -rwxr-xr-x | copy.sh | 65 | ||||
| -rw-r--r-- | docs/Keybinds.md | 3 |
5 files changed, 86 insertions, 28 deletions
diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf index 7a7712bc..612ecc95 100644 --- a/config/hypr/configs/Keybinds.conf +++ b/config/hypr/configs/Keybinds.conf @@ -133,16 +133,13 @@ bindd = $mainMod ALT, S, Toggle scrolling V/H, exec, bash -c '[[ $(hyprctl getop ################### -# qs-hyproverview # +# qs-hyprview # ################### - # "smartgrid", "justified", "masonry", "bands", "hero", "spiral" # "satellite", "staggered", "columnar", "vortex", "random" +# SUPER CTRL+Tab is reserved for Hyprview; bound after Tab workspace/group binds below. $layout = 'smartgrid' -# Or, using XDG_CONFIG_HOME: -bindd = $mainMod SHIFT, tab, Toggle HyprView, exec, $scriptsDir/toggle-qs-hyprview.sh $layout - # Cycle windows; if floating bring to top bindd = ALT, Tab, Cycle next window, cyclenext bindd = ALT, Tab, Bring active to top, bringactivetotop @@ -197,8 +194,8 @@ bindd = $mainMod ALT, down, Swap window down, swapwindow, d bindd = $mainMod, G, Toggle group, togglegroup # Navigate within a group +# SUPER CTRL+Tab is Hyprview Toggle (not change active in group) bindd = $mainMod, Tab, Change Group Forward, changegroupactive, f -bindd = $mainMod CTRL, tab, Change active in group, changegroupactive bindd = $mainMod SHIFT, Tab, Change Group Back, changegroupactive, b # Move window into/out of group @@ -220,6 +217,7 @@ bindd = $mainMod, down, Focus down (layout-aware), exec, $scriptsDir/LayoutKeybi # Workspaces related bindd = $mainMod, tab, Next workspace, workspace, m+1 bindd = $mainMod SHIFT, tab, Previous workspace, workspace, m-1 +bindd = $mainMod CTRL, tab, Hyprview Toggle, exec, $scriptsDir/toggle-qs-hyprview.sh $layout # Special workspace bindd = $mainMod SHIFT, U, Move to special workspace, movetoworkspace, special diff --git a/config/hypr/configs/system_keybinds.lua b/config/hypr/configs/system_keybinds.lua index 9e6e7ebd..b8f66666 100644 --- a/config/hypr/configs/system_keybinds.lua +++ b/config/hypr/configs/system_keybinds.lua @@ -521,15 +521,9 @@ bind( ), { description = "toggle scrolling V/H" } ) +-- Hyprview: SUPER CTRL+Tab (bound later after workspace/group Tab binds) -- "smartgrid", "justified", "masonry", "bands", "hero", "spiral" -- "satellite", "staggered", "columnar", "vortex", "random" -local qs_hyprview_layout = "smartgrid" -bind( - "CTRL", - "tab", - exec_cmd("$HOME/.config/hypr/scripts/toggle-qs-hyprview.sh"), - { description = "qs-hyprview toggle" } -) bind("ALT", "Tab", dispatch("cyclenext", ""), { description = "cycle next window" }) bind("ALT", "Tab", dispatch("bringactivetotop", ""), { description = "bring active to top" }) bind( @@ -661,7 +655,7 @@ bind("SUPER ALT", "up", dispatch("swapwindow", "u"), { description = "swap windo bind("SUPER ALT", "down", dispatch("swapwindow", "d"), { description = "swap window down" }) bind("SUPER", "G", dispatch("togglegroup", ""), { description = "toggle group" }) bind("SUPER", "Tab", dispatch("changegroupactive", "f"), { description = "Change Group Forward" }) -bind("SUPER CTRL", "tab", dispatch("changegroupactive", ""), { description = "change active in group" }) +-- SUPER CTRL+Tab is Hyprview Toggle (not change active in group) bind("SUPER SHIFT", "Tab", dispatch("changegroupactive", "b"), { description = "Change Group Back" }) bind("SUPER CTRL", "K", dispatch("moveintogroup", "l"), { description = "Move left into group" }) bind("SUPER CTRL", "L", dispatch("moveintogroup", "r"), { description = "Move Right into group" }) @@ -692,6 +686,13 @@ bind( ) bind("SUPER", "tab", dispatch("workspace", "m+1"), { description = "next workspace" }) bind("SUPER SHIFT", "tab", dispatch("workspace", "m-1"), { description = "previous workspace" }) +local qs_hyprview_layout = "smartgrid" +bind( + "SUPER CTRL", + "tab", + exec_cmd("$HOME/.config/hypr/scripts/toggle-qs-hyprview.sh " .. qs_hyprview_layout), + { description = "Hyprview Toggle" } +) bind("SUPER SHIFT", "U", dispatch("movetoworkspace", "special"), { description = "move to special workspace" }) bind("SUPER", "U", dispatch("togglespecialworkspace", ""), { description = "toggle special workspace" }) bind("SUPER", "code:10", dispatch("workspace", "1"), { description = "workspace 1" }) diff --git a/config/hypr/lua/keybinds.lua b/config/hypr/lua/keybinds.lua index 6dd188c3..5c1db96e 100644 --- a/config/hypr/lua/keybinds.lua +++ b/config/hypr/lua/keybinds.lua @@ -325,16 +325,10 @@ bind( ), { description = "toggle scrolling V/H" } ) --- Section: qs-hyprview expose controls +-- Section: Hyprview expose controls -- "smartgrid", "justified", "masonry", "bands", "hero", "spiral" -- "satellite", "staggered", "columnar", "vortex", "random" -local qs_hyprview_layout = "smartgrid" -bind( - "SUPER SHIFT", - "tab", - exec_cmd("$HOME/.config/hypr/scripts/toggle-qs-hyprview.sh " .. qs_hyprview_layout), - { description = "qs-hyprview toggle" } -) +-- Bound later (after SUPER SHIFT/CTRL tab workspace/group binds) so the combo is not overwritten. local col_width_presets = { 0.25, 0.33, 0.5, 0.66, 0.75, 1.0 } local function _as_number(v) if type(v) == "number" then @@ -607,7 +601,6 @@ bind( ) bind("SUPER", "G", dispatch("togglegroup", ""), { description = "toggle group" }) bind("SUPER", "Tab", dispatch("changegroupactive", "f"), { description = "Change Group Forward" }) -bind("SUPER CTRL", "tab", dispatch("changegroupactive", ""), { description = "change active in group" }) bind("SUPER SHIFT", "Tab", dispatch("changegroupactive", "b"), { description = "Change Group Back" }) bind("SUPER CTRL", "J", dispatch("moveintogroup", "l"), { description = "Move left into group" }) bind("SUPER CTRL", "H", dispatch("moveoutofgroup", ""), { description = "Move active out of group" }) @@ -653,6 +646,14 @@ bind( -- ) bind("SUPER", "tab", dispatch("workspace", "e+1"), { description = "next workspace" }) bind("SUPER SHIFT", "tab", dispatch("workspace", "e-1"), { description = "previous workspace" }) +-- Hyprview: SUPER CTRL+Tab (avoids SUPER SHIFT+Tab used by previous workspace / group back) +local qs_hyprview_layout = "smartgrid" +bind( + "SUPER CTRL", + "tab", + exec_cmd("$HOME/.config/hypr/scripts/toggle-qs-hyprview.sh " .. qs_hyprview_layout), + { description = "Hyprview Toggle" } +) bind("SUPER SHIFT", "U", dispatch("movetoworkspace", "special"), { description = "move to special workspace" }) bind("SUPER", "U", dispatch("togglespecialworkspace", ""), { description = "toggle special workspace" }) bind("SUPER", "code:10", dispatch("workspace", "1"), { description = "workspace 1" }) @@ -79,6 +79,8 @@ actcheckbox=black,cyan ' fi MIN_EXPRESS_VERSION="2.3.18" +# Hyprland Lua config requires Hyprland 0.55+. +MIN_LUA_HYPRLAND_VERSION="0.55" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DOTFILES_DIR="$SCRIPT_DIR" export DOTFILES_DIR @@ -252,6 +254,51 @@ version_gte() { [ "$1" = "$(echo -e "$1\n$2" | sort -V | tail -n1)" ] } +# Parse installed Hyprland version (e.g. 0.55.4) from hyprctl/Hyprland. +get_hyprland_version() { + local ver="" + local raw="" + + if command -v hyprctl >/dev/null 2>&1; then + raw="$(hyprctl version 2>/dev/null | head -n1 || true)" + fi + if [ -z "$raw" ] && command -v Hyprland >/dev/null 2>&1; then + raw="$(Hyprland --version 2>/dev/null | head -n1 || true)" + fi + if [ -z "$raw" ] && command -v hyprland >/dev/null 2>&1; then + raw="$(hyprland --version 2>/dev/null | head -n1 || true)" + fi + + # Prefer Tag: vX.Y.Z when present in full output + if command -v hyprctl >/dev/null 2>&1; then + ver="$(hyprctl version 2>/dev/null | sed -n 's/^Tag: v\([0-9][0-9.]*\).*/\1/p' | head -n1 || true)" + fi + if [ -z "$ver" ] && [ -n "$raw" ]; then + ver="$(printf '%s\n' "$raw" | sed -n 's/.*[Hh]yprland[[:space:]]\+v\?\([0-9][0-9.]*\).*/\1/p' | head -n1)" + fi + + printf '%s' "$ver" +} + +hyprland_supports_lua() { + local ver + ver="$(get_hyprland_version)" + if [ -z "$ver" ]; then + return 1 + fi + version_gte "$ver" "$MIN_LUA_HYPRLAND_VERSION" +} + +warn_hyprland_too_low_for_lua() { + local log="${1:-/dev/null}" + local ver + ver="$(get_hyprland_version)" + if [ -z "$ver" ]; then + ver="unknown" + fi + echo "${WARN} Hyprland Version ${ver} is too low. Installing Hyprlang config, upgrade Hyprland and re-run copy.sh" 2>&1 | tee -a "$log" +} + get_installed_dotfiles_version() { local hypr_dir="${XDG_CONFIG_HOME:-$HOME/.config}/hypr" if [ -d "$hypr_dir" ]; then @@ -613,8 +660,15 @@ printf "\n%.0s" {1..1} prompt_express_upgrade "$EXPRESS_SUPPORTED" "$LOG" # Upgrade/express: confirm Hyprlang -> Lua migration (default yes). +# Lua requires Hyprland 0.55+; otherwise stay on Hyprlang. if [ "$RUN_MODE" = "upgrade" ] || [ "$RUN_MODE" = "express" ]; then - prompt_lua_migration "$LOG" + if hyprland_supports_lua; then + prompt_lua_migration "$LOG" + else + MIGRATE_HYPR_TO_LUA=0 + export MIGRATE_HYPR_TO_LUA + warn_hyprland_too_low_for_lua "$LOG" + fi fi set -e @@ -637,9 +691,14 @@ printf "${INFO} - Copying dotfiles ${SKY_BLUE}second${RESET} part\n" copy_phase2 "$LOG" preserve_custom_sddm_configs "$LOG" ensure_lua_keybinds "$LOG" -# Fresh copy defaults to Lua config (Hyprland next release is Lua-only). +# Fresh copy defaults to Lua config when Hyprland is 0.55+. +# Older Hyprland keeps Hyprlang (.conf) entrypoint. if [ "$RUN_MODE" = "install" ]; then - enable_fresh_install_lua_config "$LOG" + if hyprland_supports_lua; then + enable_fresh_install_lua_config "$LOG" + else + warn_hyprland_too_low_for_lua "$LOG" + fi fi printf "\\n%.0s" {1..1} # waybar-weather config handling: diff --git a/docs/Keybinds.md b/docs/Keybinds.md index c3bd9971..19fd5d08 100644 --- a/docs/Keybinds.md +++ b/docs/Keybinds.md @@ -114,7 +114,6 @@ Source: `config/hypr/configs/Keybinds.conf` - `SUPER + G` — Toggle group - `SUPER + Tab` — Group forward - `SUPER + SHIFT + Tab` — Group back -- `SUPER + CTRL + Tab` — Change active in group - `SUPER + CTRL + J` — Move into group (left) - `SUPER + CTRL + L` — Move into group (right) - `SUPER + CTRL + H` — Move out of group @@ -143,7 +142,7 @@ Source: `config/hypr/configs/Keybinds.conf` - `SUPER + CTRL + F9/F10/F11/F12` — Move current workspace to monitor left/right/up/down ## Overview / Alt-Tab -- `SUPER + SHIFT + Tab` — Toggle qs-hyprview +- `SUPER + CTRL + Tab` — Hyprview Toggle - `ALT + Tab` — Cycle next + bring active to top (intentional pair) ## Screenshots |
