-
I have a script which I use to toggle between dark/light mode a few times a day using I'd like to avoid using subprocess to listen on events from gsettings in lite-xl. I looked at some of the code for lite-xl but I'm not a programmer and I'm guaranteed to miss something. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Why? That would probably be the simplest way.
Not really. But you could use the If the script is purely time-based, you could replicate it as a Lite XL plugin. If this is about the same toggle that directs https://wiki.libsdl.org/SDL3/SDL_GetSystemTheme, when we port to SDL3 we'll add a listener for that. |
Beta Was this translation helpful? Give feedback.
-
For anyone interested, here is my solution. -- mod-version:3
local core = require "core"
local gsettings = process.start({
"sh", "-c",
"gsettings get org.gnome.desktop.interface color-scheme;" ..
"gsettings monitor org.gnome.desktop.interface color-scheme"
})
core.add_thread(function()
while gsettings:running() do
local color_scheme = gsettings:read_stdout()
if string.find(color_scheme, "default") then
core.reload_module("colors.summer")
elseif string.find(color_scheme, "dark") then
core.reload_module("colors.default")
end
coroutine.yield(1)
end
end) |
Beta Was this translation helpful? Give feedback.
Why? That would probably be the simplest way.
Not really. But you could use the
dirmonitor
functionality to check if a file has been modified, and act accordingly.If the script is purely time-based, you could replicate it as a Lite XL plugin.
If this is about the same toggle that directs https://wiki.libsdl.org/SDL3/SDL_GetSystemTheme, when we port to SDL3 we'll add a listener for that.