Repository navigation
Expand file tree
/
Copy pathxscale-early.lua
More file actions
39 lines (35 loc) · 1.49 KB
/
Copy pathxscale-early.lua
File metadata and controls
39 lines (35 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- xscale, before Omarchy's defaults load: keeps Omarchy's GDK_SCALE out of a
-- session where xscale's Hyprland scales X11 apps
-- (https://github.com/ParkerrDev/xscale).
--
-- Omarchy sets GDK_SCALE (2, or the lowest monitor scale once one is chosen
-- in the monitor panel) so that X11 apps, shown pixel for pixel, come out the
-- right size on one monitor. With xscale they are already drawn at the
-- highest monitor's scale and shown at their logical size, and xscale tells
-- the toolkits that scale through XSETTINGS and the X resources, as GNOME
-- does. GDK_SCALE on top of that is counted twice: GTK takes its text size
-- from Xft/DPI as it is once GDK_SCALE fixes its scale, and Steam and
-- Chromium multiply the two, so both come out twice their size.
--
-- Only Omarchy's own defaults are left out: a GDK_SCALE set in
-- ~/.config/hypr still applies. Without xscale's Hyprland (before the next
-- login, or after `xscale restore`) nothing changes.
if hl.get_config("xwayland:scale") == nil or hl.env == _G.xscale_env then
return
end
local env = hl.env
local function from_omarchy_defaults()
if type(debug) ~= "table" or type(debug.getinfo) ~= "function" then
return true
end
local caller = debug.getinfo(3, "S")
local source = caller and caller.source or ""
return source:find("/default/hypr/", 1, true) ~= nil
end
_G.xscale_env = function(name, value, ...)
if name == "GDK_SCALE" and from_omarchy_defaults() then
return
end
return env(name, value, ...)
end
hl.env = _G.xscale_env