pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.62k stars 518 forks source link

[FR] add autoswitching to dark-theme on Linux #1049

Closed ildar closed 4 years ago

ildar commented 4 years ago

in the latest ZBS release the autoswitching to dark-theme was implemented on MaxOSX. Should be quite possible to do the same on Linux.

Note: GTK theme switching currently works on the fly and changes toolbars/menubar etc. But the code pane etc. remain unchanged.

pkulchenko commented 4 years ago

There is not much I can do, as this is supposed to be handled by wxwidgets that should trigger wxEVT_SYS_COLOUR_CHANGED event.

Can you apply the following patch (against 1.90) to confirm that this event is triggered when theme switching happens?

diff --git a/src/editor/commands.lua b/src/editor/commands.lua
index ac7adae3..fa0a2162 100644
--- a/src/editor/commands.lua
+++ b/src/editor/commands.lua
@@ -842,6 +842,7 @@ ide.editorApp:Connect(wx.wxEVT_ACTIVATE_APP,
 frame:Connect(wx.wxEVT_SYS_COLOUR_CHANGED,
   function(event)
     event:Skip()
+ide:Print("Triggered wxEVT_SYS_COLOUR_CHANGED")
     local default = StylesGetDefault()
     local mt = getmetatable(ide.config.styles)
     if mt then

If it does get triggered, then we'll have to check the logic in StylesGetDefault to make sure that the dark mode is properly detected.

ildar commented 4 years ago

Well, I see the message when the theme is changed.

pkulchenko commented 4 years ago

ok, that's good. What does wx.wxSystemSettings.GetAppearance():IsDark() return when you run it in the Local console with light and dark themes selected in the OS?

ildar commented 4 years ago

wx.wxSystemSettings.GetAppearance():IsDark() [string "wx.wxSystemSettings.GetAppearance():IsDark()"]:1: attempt to call field 'GetAppearance' (a nil value) wx.wxSystemSettings.GetAppearance nil = wx.wxSystemSettings { GetColour = function() --[[..skipped..]] end, GetFont = function() --[[..skipped..]] end, GetMetric = function() --[[..skipped..]] end, GetScreenType = function() --[[..skipped..]] end, HasFeature = function() --[[..skipped..]] end, SetScreenType = function() --[[..skipped..]] end } --[[table: 0x8352f0]]

xenomeno commented 4 years ago

Hello,

Is there a way to force the ZBStudio to run in Dark Mode(system.lua/user.lua)?

Thank ypu

On Thu, Apr 16, 2020 at 10:30 PM Paul Kulchenko notifications@github.com wrote:

ok, that's good. What does wx.wxSystemSettings.GetAppearance():IsDark() return when you run it in the Local console with light and dark themes selected in the OS?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pkulchenko/ZeroBraneStudio/issues/1049#issuecomment-614851482, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJDCPI7KPFECIB2H5U5EXMTRM5MFDANCNFSM4MJPIJVA .

-- Danko Jordanov https://vimeo.com/xenomeno/StuntDemo https://vimeo.com/xenomeno/ http://www.imdb.com/name/nm1242406/ http://www.youtube.com/user/xenomeno79

pkulchenko commented 4 years ago

[string "wx.wxSystemSettings.GetAppearance():IsDark()"]:1: attempt to call field 'GetAppearance' (a nil value)

@ildar, hm, GetAppearance is supposed to be in wxwidgets 3.1.3, so if you are running v1.90, it should already be present. Are you using a system library for wxlua by any chance? Can you check the version of wxwidgets/wxlua in the About screen of the IDE?

Is there a way to force the ZBStudio to run in Dark Mode(system.lua/user.lua)?

@xenomeno, yes, you can check the instructions here: https://studio.zerobrane.com/doc-styles-color-schemes#color-schemes

ildar commented 4 years ago

Yes, I'm using system set of binaries. I'll check bundled ones tomorrow. Sorry and thanks.

ildar commented 4 years ago

Paul, I'm really sorry! I just tested and (bundled) ZBS appeared to fully switch to dark when the theme is switched. No additional changes required. In my case I only need to upgrade wx to 3.1.3 and everything should be fine. Thank you for your support.

pkulchenko commented 4 years ago

No problem; glad it's resolved!