diff options
Diffstat (limited to 'config/hypr/lua')
| -rw-r--r-- | config/hypr/lua/env.lua | 6 | ||||
| -rw-r--r-- | config/hypr/lua/keybind_helpers.lua | 23 | ||||
| -rw-r--r-- | config/hypr/lua/keybinds.lua | 154 | ||||
| -rw-r--r-- | config/hypr/lua/settings.lua | 2 | ||||
| -rw-r--r-- | config/hypr/lua/startup.lua | 19 | ||||
| -rw-r--r-- | config/hypr/lua/user_keybinds_helper.lua | 22 | ||||
| -rw-r--r-- | config/hypr/lua/user_overrides.lua | 31 | ||||
| -rw-r--r-- | config/hypr/lua/workspaces.lua | 4 |
8 files changed, 227 insertions, 34 deletions
diff --git a/config/hypr/lua/env.lua b/config/hypr/lua/env.lua index 348bf5db..cc248c20 100644 --- a/config/hypr/lua/env.lua +++ b/config/hypr/lua/env.lua @@ -9,7 +9,7 @@ -- - config/hypr/configs/ENVariables.conf -- - config/hypr/UserConfigs/ENVariables.conf (active values only) -hl.env("DOTS_VERSION", "2.3.24") +hl.env("DOTS_VERSION", "2.3.25") hl.env("GDK_BACKEND", "wayland,x11,*") hl.env("QT_QPA_PLATFORM", "wayland;xcb") hl.env("CLUTTER_BACKEND", "wayland") @@ -19,8 +19,8 @@ hl.env("XDG_SESSION_TYPE", "wayland") hl.env("QT_AUTO_SCREEN_SCALE_FACTOR", "1") hl.env("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1") hl.env("QT_QPA_PLATFORMTHEME", "qt6ct") -hl.env("QT_STYLE_OVERRIDE", "kvantum") -hl.env("QT_QUICK_CONTROLS_STYLE", "org.hyprland.style") +hl.env("QT_STYLE_OVERRIDE", "Fusion") +hl.env("QT_QUICK_CONTROLS_STYLE", "Basic") hl.env("GDK_SCALE", "1") hl.env("QT_SCALE_FACTOR", "1") hl.env("MOZ_ENABLE_WAYLAND", "1") diff --git a/config/hypr/lua/keybind_helpers.lua b/config/hypr/lua/keybind_helpers.lua index 92dc952b..97618d8f 100644 --- a/config/hypr/lua/keybind_helpers.lua +++ b/config/hypr/lua/keybind_helpers.lua @@ -112,17 +112,29 @@ local function dispatch(name, args) return raw_dispatch_cmd(args) end - if name == "killactive" and window_api.close then - return window_api.close() + if name == "killactive" then + if window_api.close then + return window_api.close() + end + if window_api.kill then + return window_api.kill() + end + return raw_dispatch_cmd("killactive") end if name == "togglefloating" and window_api.float then return window_api.float({ action = "toggle" }) end - if name == "fullscreen" and window_api.fullscreen then + if name == "fullscreen" then + if window_api.fullscreen then + if args == "1" then + return window_api.fullscreen({ mode = "maximized" }) + end + return window_api.fullscreen({ mode = "fullscreen" }) + end if args == "1" then - return window_api.fullscreen({ mode = "maximized" }) + return exec_cmd("hyprctl dispatch 'hl.dsp.window.fullscreen({ mode = \"maximized\" })'") end - return window_api.fullscreen({ mode = "fullscreen" }) + return exec_cmd("hyprctl dispatch 'hl.dsp.window.fullscreen({ mode = \"fullscreen\" })'") end if name == "pseudo" and window_api.pseudo then return window_api.pseudo() @@ -315,6 +327,7 @@ local keys_to_unbind = { "SUPER + V", "SUPER + W", "SUPER + P", + "SUPER + R", "SUPER + N", "SUPER + T", "SUPER + X", diff --git a/config/hypr/lua/keybinds.lua b/config/hypr/lua/keybinds.lua index 6bf71e47..3730e825 100644 --- a/config/hypr/lua/keybinds.lua +++ b/config/hypr/lua/keybinds.lua @@ -59,18 +59,33 @@ keybind_helpers.unbind_default_keys() -- ================================================== -- Section: Application launchers and utility scripts local app_binds = { - { "SUPER", "D", "pkill rofi || true && rofi -show drun -modi drun,filebrowser,run,window", "app launcher" }, + { + "SUPER", + "D", + "pkill rofi || true; $HOME/.config/hypr/scripts/RofiFocusedWallpaperLink.sh >/dev/null 2>&1 || true; rofi -show drun -modi drun,filebrowser,run,window", + "app launcher", + }, { "SUPER", "B", 'xdg-open "https://"', "open default browser" }, { "SUPER", "A", "$HOME/.config/hypr/scripts/OverviewToggle.sh", "desktop overview" }, - { "SUPER", "Return", "kitty", "Open terminal" }, - { "SUPER", "E", "thunar", "file manager" }, + { "SUPER", "Return", "$HOME/.config/hypr/scripts/LaunchTerminal.sh '$term'", "Open terminal" }, + { + "SUPER", + "E", + "$HOME/.config/hypr/scripts/LaunchFileManager.sh '$files' '$term'", + "file manager", + }, { "SUPER", "C", "$HOME/.config/hypr/scripts/rofi-ssh-menu.sh", "SSH session manager" }, { "SUPER", "T", "$HOME/.config/hypr/scripts/ThemeChanger.sh", "Global theme switcher using Wallust" }, { "SUPER", "H", "$HOME/.config/hypr/scripts/KeyHints.sh", "help / cheat sheet" }, { "SUPER ALT", "R", "$HOME/.config/hypr/scripts/Refresh.sh", "refresh bar and menus" }, { "SUPER ALT", "E", "$HOME/.config/hypr/scripts/RofiEmoji.sh", "emoji menu" }, { "SUPER", "S", "$HOME/.config/hypr/scripts/RofiSearch.sh", "web search" }, - { "SUPER CTRL", "S", "rofi -show window", "window switcher" }, + { + "SUPER CTRL", + "S", + "$HOME/.config/hypr/scripts/RofiFocusedWallpaperLink.sh >/dev/null 2>&1 || true; rofi -show window", + "window switcher", + }, { "SUPER ALT", "O", "$HOME/.config/hypr/scripts/ChangeBlur.sh", "toggle blur" }, { "SUPER SHIFT", "G", "$HOME/.config/hypr/scripts/GameMode.sh", "toggle game mode" }, { "SUPER ALT", "L", "$HOME/.config/hypr/scripts/ChangeLayout.sh toggle", "toggle layouts" }, @@ -122,12 +137,12 @@ local app_binds = { { "SUPER ALT", "B", "$HOME/.config/hypr/scripts/WaybarLayout.sh", "waybar layout menu" }, { "SUPER", "N", "$HOME/.config/hypr/scripts/Hyprsunset.sh toggle", "Toggle Hyprsunset - night light" }, { "SUPER SHIFT", "M", "$HOME/.config/hypr/UserScripts/RofiBeats.sh", "online music" }, - { "SUPER", "W", "$HOME/.config/hypr/UserScripts/WallpaperSelect.sh", "select wallpaper" }, - { "SUPER SHIFT", "W", "$HOME/.config/hypr/UserScripts/WallpaperEffects.sh", "wallpaper effects" }, - { "CTRL ALT", "W", "$HOME/.config/hypr/UserScripts/WallpaperRandom.sh", "random wallpaper" }, + { "SUPER", "W", "$HOME/.config/hypr/scripts/WallpaperSelect.sh", "select wallpaper" }, + { "SUPER SHIFT", "W", "$HOME/.config/hypr/scripts/WallpaperEffects.sh", "wallpaper effects" }, + { "CTRL ALT", "W", "$HOME/.config/hypr/scripts/WallpaperRandom.sh", "random wallpaper" }, { "SUPER SHIFT", "K", "$HOME/.config/hypr/scripts/KeyBinds.sh", "search keybinds" }, { "SUPER SHIFT", "A", "$HOME/.config/hypr/scripts/Animations.sh", "animations menu" }, - { "SUPER SHIFT", "O", "$HOME/.config/hypr/UserScripts/ZshChangeTheme.sh", "change oh-my-zsh theme" }, + { "SUPER SHIFT", "R", "$HOME/.config/hypr/scripts/ZshChangeTheme.sh", "change oh-my-zsh theme" }, { "SUPER ALT", "C", "$HOME/.config/hypr/UserScripts/RofiCalc.sh", "calculator" }, } for _, app in ipairs(app_binds) do @@ -196,7 +211,7 @@ end -- Section: Window/session controls bind("SUPER SHIFT", "F", dispatch("fullscreen", ""), { description = "fullscreen" }) -bind("SUPER CTRL", "F", dispatch("fullscreen", "1"), { description = "maximize window" }) +bind("SUPER", "F", dispatch("fullscreen", "1"), { description = "maximize window" }) bind("SUPER", "SPACE", dispatch("togglefloating", ""), { description = "Float current window" }) bind("SUPER CTRL", "O", dispatch("setprop", "active opaque toggle"), { description = "toggle active window opacity" }) bind( @@ -256,12 +271,17 @@ bind( -- Section: Layout and tiling controls bind("SUPER CTRL", "D", dispatch("layoutmsg", "removemaster"), { description = "remove master" }) bind("SUPER", "I", dispatch("layoutmsg", "addmaster"), { description = "add master" }) -bind("SUPER", "j", exec_cmd("$HOME/.config/hypr/scripts/LuaCycleWindow.sh next"), { description = "cycle next" }) +bind( + "SUPER", + "j", + exec_cmd("$HOME/.config/hypr/scripts/LayoutKeybindDispatch.sh cycle-next"), + { description = "cycle next (layout-aware)" } +) bind( "SUPER", "k", - exec_cmd("$HOME/.config/hypr/scripts/LuaCycleWindow.sh previous"), - { description = "cycle previous" } + exec_cmd("$HOME/.config/hypr/scripts/LayoutKeybindDispatch.sh cycle-prev"), + { description = "cycle previous (layout-aware)" } ) bind("SUPER CTRL", "Return", dispatch("layoutmsg", "swapwithmaster"), { description = "swap with master" }) bind("SUPER SHIFT", "I", dispatch("layoutmsg", "togglesplit"), { description = "toggle split (dwindle)" }) @@ -305,6 +325,88 @@ bind( ), { description = "toggle scrolling V/H" } ) +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 + return v + end + if type(v) == "string" then + return tonumber(v) + end + return nil +end +local function _window_width(win) + if type(win) ~= "table" then + return nil + end + local sz = win.size + if type(sz) == "number" then + return sz + end + if type(sz) == "table" then + return _as_number(sz[1] or sz.width or sz.w) + end + return nil +end +local function _monitor_width(win) + local mon = type(win) == "table" and win.monitor or nil + if type(mon) == "table" then + local w = _as_number(mon.width or mon.w or (type(mon.size) == "table" and (mon.size[1] or mon.size.width))) + if w ~= nil then + return w + end + end + if hl.get_active_monitor then + local active_mon = hl.get_active_monitor() + if type(active_mon) == "table" then + local w = _as_number(active_mon.width or active_mon.w or (type(active_mon.size) == "table" and (active_mon.size[1] or active_mon.size.width))) + if w ~= nil then + return w + end + end + end + return nil +end +bind("SUPER", "R", function() + local ws = hl.get_active_workspace and hl.get_active_workspace() or nil + local ws_layout = ws and (ws.tiled_layout or ws.tiledLayout) or nil + if ws_layout ~= "scrolling" then + return + end + + local w = hl.get_active_window and hl.get_active_window() or nil + local col = w ~= nil and w.layout and w.layout.column or nil + local current_width = nil + if type(col) == "table" then + current_width = _as_number(col.width) + else + current_width = _as_number(col) + end + if type(current_width) ~= "number" then + local ww = _window_width(w) + local mw = _monitor_width(w) + if type(ww) == "number" and type(mw) == "number" and mw > 0 then + current_width = ww / mw + end + end + if type(current_width) ~= "number" or current_width <= 0 then + return + end + if current_width > 1 then + current_width = 1 + end + + local closest, best = 1, math.huge + for i, v in ipairs(col_width_presets) do + local diff = math.abs(v - current_width) + if diff < best then + best, closest = diff, i + end + end + + local nextIdx = closest % #col_width_presets + 1 + hl.dispatch(hl.dsp.layout("colresize " .. tostring(col_width_presets[nextIdx]))) +end, { description = "cycle column width preset (scrolling)" }) bind("ALT", "Tab", exec_cmd("$HOME/.config/hypr/scripts/LuaCycleWindow.sh next"), { description = "cycle next window" }) -- Section: Audio, media, and hardware keys @@ -511,10 +613,30 @@ bind("SUPER SHIFT", "Tab", dispatch("changegroupactive", "b"), { description = " bind("SUPER CTRL", "K", dispatch("moveintogroup", "l"), { description = "Move left into group" }) bind("SUPER CTRL", "L", dispatch("moveintogroup", "r"), { description = "Move Right into group" }) bind("SUPER CTRL", "H", dispatch("moveoutofgroup", ""), { description = "Move active out of group" }) -bind("SUPER", "left", dispatch("movefocus", "l"), { description = "focus left" }) -bind("SUPER", "right", dispatch("movefocus", "r"), { description = "focus right" }) -bind("SUPER", "up", dispatch("movefocus", "u"), { description = "focus up" }) -bind("SUPER", "down", dispatch("movefocus", "d"), { description = "focus down" }) +bind( + "SUPER", + "left", + exec_cmd("$HOME/.config/hypr/scripts/LayoutKeybindDispatch.sh focus-left"), + { description = "focus left (layout-aware)" } +) +bind( + "SUPER", + "right", + exec_cmd("$HOME/.config/hypr/scripts/LayoutKeybindDispatch.sh focus-right"), + { description = "focus right (layout-aware)" } +) +bind( + "SUPER", + "up", + exec_cmd("$HOME/.config/hypr/scripts/LayoutKeybindDispatch.sh focus-up"), + { description = "focus up (layout-aware)" } +) +bind( + "SUPER", + "down", + exec_cmd("$HOME/.config/hypr/scripts/LayoutKeybindDispatch.sh focus-down"), + { description = "focus down (layout-aware)" } +) -- Section: Workspace navigation and assignment -- Keep legacy relative workspace focus script binds commented for rollback during Lua API migration. diff --git a/config/hypr/lua/settings.lua b/config/hypr/lua/settings.lua index 78ae61e2..eaa5aeeb 100644 --- a/config/hypr/lua/settings.lua +++ b/config/hypr/lua/settings.lua @@ -159,7 +159,7 @@ hl.config({ hl.config({ cursor = { sync_gsettings_theme = true, - no_hardware_cursors = 2, + no_hardware_cursors = 0, enable_hyprcursor = true, warp_on_change_workspace = 2, no_warps = true, diff --git a/config/hypr/lua/startup.lua b/config/hypr/lua/startup.lua index 6c189113..1fa4df82 100644 --- a/config/hypr/lua/startup.lua +++ b/config/hypr/lua/startup.lua @@ -25,9 +25,18 @@ local function exec_once(cmd) local key = cmd:gsub("[^%w_.-]", "_"):sub(1, 80) local marker = "/tmp/hypr-lua-exec-once-" .. session .. "-" .. key local log = "/tmp/hypr-lua-startup-" .. key .. ".log" - local readiness = "runtime=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}; export XDG_RUNTIME_DIR=\"$runtime\"; for _ in $(seq 1 200); do if [ -n \"$WAYLAND_DISPLAY\" ] && [ -S \"$runtime/$WAYLAND_DISPLAY\" ]; then break; fi; for sock in \"$runtime\"/wayland-[0-9]*; do [ -S \"$sock\" ] || continue; case \"$(basename \"$sock\")\" in *awww*) continue ;; esac; export WAYLAND_DISPLAY=\"$(basename \"$sock\")\"; break 2; done; sleep 0.1; done; if [ -n \"$HYPRLAND_INSTANCE_SIGNATURE\" ]; then hypr_sock=\"$runtime/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket.sock\"; for _ in $(seq 1 200); do [ -S \"$hypr_sock\" ] && break; sleep 0.1; done; fi" + local readiness = + 'runtime=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}; export XDG_RUNTIME_DIR="$runtime"; for _ in $(seq 1 200); do if [ -n "$WAYLAND_DISPLAY" ] && [ -S "$runtime/$WAYLAND_DISPLAY" ]; then break; fi; for sock in "$runtime"/wayland-[0-9]*; do [ -S "$sock" ] || continue; case "$(basename "$sock")" in *awww*) continue ;; esac; export WAYLAND_DISPLAY="$(basename "$sock")"; break 2; done; sleep 0.1; done; if [ -n "$HYPRLAND_INSTANCE_SIGNATURE" ]; then hypr_sock="$runtime/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket.sock"; for _ in $(seq 1 200); do [ -S "$hypr_sock" ] && break; sleep 0.1; done; fi' local inner = readiness .. "; " .. cmd - local script = "[ -e " .. shell_quote(marker) .. " ] || { touch " .. shell_quote(marker) .. " && sh -lc " .. shell_quote(inner) .. " >>" .. shell_quote(log) .. " 2>&1 & }" + local script = "[ -e " + .. shell_quote(marker) + .. " ] || { touch " + .. shell_quote(marker) + .. " && sh -lc " + .. shell_quote(inner) + .. " >>" + .. shell_quote(log) + .. " 2>&1 & }" os.execute("sh -lc " .. shell_quote(script)) end -- Prefer lifecycle-hook orchestration for clarity while keeping exec_once @@ -39,9 +48,11 @@ local startup_commands = { "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP", scriptsDir .. "/Polkit.sh", "nm-applet", - "nm-tray", + -- nm-tray now optional for ubuntu + -- "nm-tray", "swaync", scriptsDir .. "/PortalHyprland.sh", + "sh $HOME/.config/hypr/scripts/ApplyThemeMode.sh", "sh " .. scriptsDir .. "/WaybarStartup.sh", "qs -c overview", "hypridle", @@ -67,5 +78,5 @@ end -- Optional startup examples retained from the original config: -- exec_once("mpvpaper '*' -o \"load-scripts=no no-audio --loop\" \"\"") --- exec_once(userScripts .. "/WallpaperAutoChange.sh " .. wallDir) +-- exec_once(scriptsDir .. "/WallpaperAutoChange.sh " .. wallDir) -- exec_once(userScripts .. "/RainbowBorders.sh") diff --git a/config/hypr/lua/user_keybinds_helper.lua b/config/hypr/lua/user_keybinds_helper.lua index f9d4aa0c..66398bd9 100644 --- a/config/hypr/lua/user_keybinds_helper.lua +++ b/config/hypr/lua/user_keybinds_helper.lua @@ -125,14 +125,26 @@ local function dispatch(name, args) if name == "exec" then return exec_cmd(args) end - if name == "killactive" and window_api.close then - return window_api.close() + if name == "killactive" then + if window_api.close then + return window_api.close() + end + if window_api.kill then + return window_api.kill() + end + return raw_dispatch_cmd("killactive") end - if name == "fullscreen" and window_api.fullscreen then + if name == "fullscreen" then + if window_api.fullscreen then + if args == "1" then + return window_api.fullscreen({ mode = "maximized" }) + end + return window_api.fullscreen({ mode = "fullscreen" }) + end if args == "1" then - return window_api.fullscreen({ mode = "maximized" }) + return exec_cmd("hyprctl dispatch 'hl.dsp.window.fullscreen({ mode = \"maximized\" })'") end - return window_api.fullscreen({ mode = "fullscreen" }) + return exec_cmd("hyprctl dispatch 'hl.dsp.window.fullscreen({ mode = \"fullscreen\" })'") end if name == "movefocus" and dsp and dsp.focus then return function() diff --git a/config/hypr/lua/user_overrides.lua b/config/hypr/lua/user_overrides.lua index 42502315..149962d5 100644 --- a/config/hypr/lua/user_overrides.lua +++ b/config/hypr/lua/user_overrides.lua @@ -11,6 +11,36 @@ local configHome = os.getenv("XDG_CONFIG_HOME") or ((os.getenv("HOME") or "") .. local hyprDir = configHome .. "/hypr" local systemDir = hyprDir .. "/configs" local userDir = configHome .. "/hypr/UserConfigs" +local function has_kvantum_qml_module() + local cmd = "find /usr/lib /usr/lib64 /usr/share -type d -path '*/qml/*/kvantum' -print -quit 2>/dev/null" + local pipe = io.popen(cmd, "r") + if not pipe then + return false + end + local output = pipe:read("*a") or "" + pipe:close() + return output:match("%S") ~= nil +end + +local function apply_qt_style_fallbacks() + if not hl or not hl.env then + return + end + + if has_kvantum_qml_module() then + return + end + + local style_override = (os.getenv("QT_STYLE_OVERRIDE") or ""):lower() + if style_override == "kvantum" or style_override == "kvantum-dark" then + hl.env("QT_STYLE_OVERRIDE", "Fusion") + end + + local quick_controls = (os.getenv("QT_QUICK_CONTROLS_STYLE") or ""):lower() + if quick_controls == "kvantum" then + hl.env("QT_QUICK_CONTROLS_STYLE", "Basic") + end +end local function load_optional(path) local ok, err = pcall(dofile, path) @@ -61,6 +91,7 @@ end if not loaded_user_split then load_optional(userDir .. "/user_overrides.lua") -- legacy single-file support end +apply_qt_style_fallbacks() -- Legacy compatibility: import UserKeybinds.conf when user_keybinds.lua is missing. do diff --git a/config/hypr/lua/workspaces.lua b/config/hypr/lua/workspaces.lua index 287326ca..0ed3d8bf 100644 --- a/config/hypr/lua/workspaces.lua +++ b/config/hypr/lua/workspaces.lua @@ -10,3 +10,7 @@ -- Example: -- hl.workspace_rule({ workspace = "1", monitor = "eDP-1" }) +-- hl.workspace_rule({ workspace = "1", monitor = "HDMI-A-1", layout = "scrolling" }) +-- hl.workspace_rule({ workspace = "1", monitor = "HDMI-A-1", layout = "dwindle" }) +-- hl.workspace_rule({ workspace = "1", monitor = "HDMI-A-1", layout = "master" }) +-- hl.workspace_rule({ workspace = "1", monitor = "HDMI-A-1", layout = "monocle" }) |
