Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark / light mode Macos #22

Closed
pragma-git opened this issue Feb 2, 2021 · 10 comments
Closed

Dark / light mode Macos #22

pragma-git opened this issue Feb 2, 2021 · 10 comments

Comments

@pragma-git
Copy link

Thanks once more for such a great editor!

Intro

Working in dark mode in the MacOs system (and probably other systems too) it is annoying with a single application that does not adhere, and that does not have an obvious way of changing to dark mode. It is possible that I have missed how to do this

Changing color theme works. BUT, it is only the text area that changes (all the rest of the GUI is light).

Digging around, I found that dark mode is in principle implemented, and that there are indeed two different css:

/Applications/Geany.app/Contents/Resources/share/themes/Mojave-light-solid/gtk-3.0/gtk.css
/Applications/Geany.app/Contents/Resources/share/themes/Mojave-light-solid/gtk-3.0/gtk-dark.css
but I am not aware of a way to tell Geany which one should be active (gtk.css is on by default)

What works: It is possible to rename gtk-dark.css to gtk.css, and then Geany looks beatiful in Dark mode.

Request: Listen to the system setting, with option to override to dark/light mode from the settings menu. As a last resource (not as good) allow and document a "less hacky" way to change to dark mode, such as a setting in geany.conf

(Tested on Geany 1.36 with GTK+ v3.24.10 and Glib v2.60.6 runtime libraries)

@elextr
Copy link
Member

elextr commented Feb 2, 2021

Except for the editing window, Geany follows your GTK theme, so on systems where GTK theming is set by the system (like my Linux Mint here) it just works if your machine is set to a dark theme, so the problem is basically Macos specific where GTK doesn't follow the system theme it seems. Will transfer to the Geany-OSX issues.

@elextr elextr transferred this issue from geany/geany Feb 2, 2021
@codebrainz
Copy link
Member

As a last resource (not as good) allow and document a "less hacky" way to change to dark mode...

If you set the GTK_THEME environment variable you should be able to switch to the dark version, for example setting the environment variable to GTK_THEME=Mojave-light-solid:dark should work. There are a few other ways using settings.ini file and gsettings as well, but I'm not really sure what's available/included in the Macos bundle.

@JanAxelssonTest
Copy link

The solution #22 (comment) works from command line
export GTK_THEME=Mojave-light-solid:dark; open -a geany

BUT, it does not work in normal Mac workflow. That is, double-clicking a file which opens with Geany, makes light mode. Also starting Geany from the dock defaults to light mode

There is a settings.ini in the Macos bundle. Adding the following allows for dark-mode works:
gtk-application-prefer-dark-theme=true

I don't think gsettings exist for Macos.

For the average user, I think the best solution would be to keep Macos bundle intact. To reiterate: now two bundle-based alternatives exists (gtk-application-prefer-dark-theme=true, or changing gtk-dark.css file names as in original post #22 (comment)). At least theoretically, maybe one of these could be jacked into to allow dark-mode setting from inside Geany menus?

Willing to test-drive if you don't have a Mac available

@elextr
Copy link
Member

elextr commented Feb 3, 2021

That is, double-clicking a file which opens with Geany, makes light mode. Also starting Geany from the dock defaults to light mode

I'm totally macos illiterate, but I would have thought these can be modified to do the setting of GTK_THEME.

The problem with adding it into a menu in Geany will be that its a macos special since other systems provide their own methods of setting themes, and we don't want conflicts, if its gonna work, it better do it the system way.

A better place to add an option might be in the macos launcher, then it may work in all situations, thats something a macos expert like @techee will have to comment on.

@JanAxelssonTest
Copy link

  1. I do understand that you wish to keep the code the same, but I do disagree that having the suggested setting would disrupt cross-platform conformity. To clairfy the setting I talk about: I think having the possibility to force light/dark for the single Geany application may be useful for some people (also on platforms where you pick up system setting). Such an option would also solve the Macos issue, without disturbing the cross-platform.

  2. Regarding adding the setting in a non-Macos fashion (like from the dock), would not follow the standard, but I understand how you think. One such possibility could be to add an extra Mac-specific setting-menu where settings on Macos are normally situated (under the Geany application name; @techee would know). That way, the normal Geany Edit/Settings menu would not need to be touched. Just a suggestion!

@codebrainz
Copy link
Member

From this comment:

The main feature of this release is that I made a few things configurable (probably the most interesting one is the dark/light theme) using a config file which is created when you start Geany under ~/.config/geany/geany_mac.conf. The default value for the theme is to use your macOS settings so if you use the dark theme system-wise, it will be picked automatically for you. Note that if you previously set the theme using the .config/gtk-3.0/settings.ini file, you'll have to remove this file first, otherwise it overrides the settings specified in ~/config/geany/geany_mac.conf.

@JanAxelssonTest
Copy link

I can confirm that version 1.37 works as anticipated (problem reported for version 1.36, which I thought was latest).

@elextr
Copy link
Member

elextr commented Feb 4, 2021

@pragma-git does it work for you?

@techee
Copy link
Member

techee commented Feb 4, 2021

Basically the quote @codebrainz mentioned should describe how theme picking works - and at least on my machine theme selection works automatically for 1.37.

@pragma-git
Copy link
Author

Yes it works very well (sorry I used the wrong account when answering above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants