diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-07-14 08:48:41 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:40:35 -0700 |
| commit | 5284ac303bd72b707430808d0d8d298f00f0ac83 (patch) | |
| tree | 62b3727913ee895807d7e70397de88e11d6ab4bf /config/hypr | |
| parent | 1bee358fb4c082ab9a3c0dd311d669712309ffee (diff) | |
Fixed startup for qs-hyprview in LUA
Signed-off-by: Don Williams <don.e.williams@gmail.com>
Diffstat (limited to 'config/hypr')
| -rw-r--r-- | config/hypr/lua/startup.lua | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/config/hypr/lua/startup.lua b/config/hypr/lua/startup.lua index 5f7d3b02..10369d6f 100644 --- a/config/hypr/lua/startup.lua +++ b/config/hypr/lua/startup.lua @@ -14,67 +14,67 @@ local userScripts = "$HOME/.config/hypr/UserScripts" local wallDir = "$HOME/Pictures/wallpapers" local session = os.getenv("HYPRLAND_INSTANCE_SIGNATURE") or "default" local function shell_quote(value) - return "'" .. tostring(value):gsub("'", "'\\''") .. "'" + return "'" .. tostring(value):gsub("'", "'\\''") .. "'" end local function exec_once(cmd) - -- Why this wrapper exists: - -- 1) Enforce once-per-Hypr-session startup behavior using marker files. - -- 2) Avoid startup race conditions by waiting for Wayland/Hypr sockets. - -- 3) Capture per-command logs to simplify troubleshooting in user setups. + -- Why this wrapper exists: + -- 1) Enforce once-per-Hypr-session startup behavior using marker files. + -- 2) Avoid startup race conditions by waiting for Wayland/Hypr sockets. + -- 3) Capture per-command logs to simplify troubleshooting in user setups. - 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 inner = readiness .. "; " .. cmd - 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)) + 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 inner = readiness .. "; " .. cmd + 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 -- reliability semantics for real-world startup behavior. local startup_commands = { - scriptsDir .. "/WallpaperDaemon.sh", - "$HOME/.config/hypr/initial-boot.sh", - "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP", - "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP", - scriptsDir .. "/Polkit.sh", - "nm-applet", - -- nm-tray now optional for ubuntu - -- "nm-tray", - "swaync", - scriptsDir .. "/PortalHyprland.sh", - "sh $HOME/.config/hypr/scripts/ApplyThemeMode.sh", - "sh " .. scriptsDir .. "/WaybarStartup.sh", - 'qs --log-rules "qt.qpa.wayland.textinput.warning=false" -c overview', - 'qs --log-rules "qt.qpa.wayland.textinput.warning=false" -c qs-hyprview', - "hypridle", - scriptsDir .. "/Hyprsunset.sh init", - -- NOTE: Dropterminal is currently certified only with kitty. Not all terminals behave correctly as a dropdown. - scriptsDir .. "/Dropterminal.sh --startup kitty", - "wl-paste --type text --watch cliphist store", - "wl-paste --type image --watch cliphist store", + scriptsDir .. "/WallpaperDaemon.sh", + "$HOME/.config/hypr/initial-boot.sh", + "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP", + "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP", + scriptsDir .. "/Polkit.sh", + "nm-applet", + -- nm-tray now optional for ubuntu + -- "nm-tray", + "swaync", + scriptsDir .. "/PortalHyprland.sh", + "sh $HOME/.config/hypr/scripts/ApplyThemeMode.sh", + "sh " .. scriptsDir .. "/WaybarStartup.sh", + 'qs --log-rules "qt.qpa.wayland.textinput.warning=false" -c overview', + 'qs --log-rules "qt.qpa.wayland.textinput.warning=false" -p $HOME/.config/quickshell/qs-hyprview', + "hypridle", + scriptsDir .. "/Hyprsunset.sh init", + -- NOTE: Dropterminal is currently certified only with kitty. Not all terminals behave correctly as a dropdown. + scriptsDir .. "/Dropterminal.sh --startup kitty", + "wl-paste --type text --watch cliphist store", + "wl-paste --type image --watch cliphist store", } local function run_startup_commands() - for _, cmd in ipairs(startup_commands) do - exec_once(cmd) - end + for _, cmd in ipairs(startup_commands) do + exec_once(cmd) + end end if hl and hl.on then - hl.on("hyprland.start", run_startup_commands) + hl.on("hyprland.start", run_startup_commands) else - -- Compatibility fallback for older/limited runtimes without hl.on. - run_startup_commands() + -- Compatibility fallback for older/limited runtimes without hl.on. + run_startup_commands() end -- Optional startup examples retained from the original config: |
