Files
omarchycn/default/hypr/envs.lua
T
Ryan Hughes 4f031e10c8 Propagate OMARCHY_PATH and PATH to Hyprland-spawned processes; dev-link-aware paths.lua
Two related fixes for omarchy-dev-link to actually affect Hyprland keybinds:

default/hypr/paths.lua: prefer /etc/omarchy.conf over the process env.
hyprctl setenv updates Hyprland's process env, but the user-reported case
shows it doesn't reach bind-exec dispatchers because their env is
captured at config-load time. Reading the dev-link conf directly means
paths.omarchy_path is correct on every hyprctl reload regardless of
whether the launching Hyprland session re-read its env.

default/hypr/envs.lua: explicitly hl.env("OMARCHY_PATH", ...) and
hl.env("PATH", "$OMARCHY_PATH/bin:$PATH") so keybind dispatchers (and
everything else spawned by Hyprland) inherit the dev-link values. PATH
is built with a dedup pass so reloads don't accumulate the bin/ prefix.

Tested locally: paths.lua reads /etc/omarchy.conf correctly; lua syntax
of both files validates with luac -p.
2026-06-04 18:34:35 -04:00

55 lines
1.7 KiB
Lua

local paths = require("default.hypr.paths")
local require_optional = require("default.hypr.require_optional")
-- GUM environment variables for styling purposes.
require_optional.module("omarchy.current.theme.gum_env")
-- Cursor size.
hl.env("XCURSOR_SIZE", "24")
hl.env("HYPRCURSOR_SIZE", "24")
-- Force all apps to use Wayland.
hl.env("GDK_BACKEND", "wayland,x11,*")
hl.env("QT_QPA_PLATFORM", "wayland;xcb")
hl.env("QT_STYLE_OVERRIDE", "kvantum")
hl.env("MOZ_ENABLE_WAYLAND", "1")
hl.env("ELECTRON_OZONE_PLATFORM_HINT", "wayland")
hl.env("OZONE_PLATFORM", "wayland")
hl.env("XDG_SESSION_TYPE", "wayland")
-- Allow better support for screen sharing (Google Meet, Discord, etc).
hl.env("XDG_CURRENT_DESKTOP", "Hyprland")
hl.env("XDG_SESSION_DESKTOP", "Hyprland")
-- Use XCompose file.
hl.env("XCOMPOSEFILE", paths.home .. "/.XCompose")
-- Propagate OMARCHY_PATH and PATH to processes spawned by Hyprland (keybinds,
-- dispatchers, autostart). hyprctl setenv doesn't reach the env captured for
-- bind exec at config-load time, so omarchy-dev-link reaches this via
-- hyprctl reload re-running envs.lua with the new paths.omarchy_path.
hl.env("OMARCHY_PATH", paths.omarchy_path)
-- Prepend $OMARCHY_PATH/bin to PATH, deduping any prior occurrence so
-- reloads don't accumulate duplicates.
local bin_dir = paths.omarchy_path .. "/bin"
local current_path = os.getenv("PATH") or "/usr/local/bin:/usr/bin"
local kept = {}
for entry in current_path:gmatch("[^:]+") do
if entry ~= bin_dir then
table.insert(kept, entry)
end
end
table.insert(kept, 1, bin_dir)
hl.env("PATH", table.concat(kept, ":"))
hl.config({
xwayland = {
force_zero_scaling = true,
},
ecosystem = {
no_update_news = true,
},
})