mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
apprt/gtk: support dark window decorations with GtkWindow
Add support for the dark GtkWindow variant when `window-theme` is `dark` or `auto`.
This commit is contained in:
@ -221,6 +221,9 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
|||||||
switch (config.@"window-theme") {
|
switch (config.@"window-theme") {
|
||||||
.system, .light => {},
|
.system, .light => {},
|
||||||
.dark => {
|
.dark => {
|
||||||
|
const settings = c.gtk_settings_get_default();
|
||||||
|
c.g_object_set(@ptrCast(@alignCast(settings)), "gtk-application-prefer-dark-theme", true, @as([*c]const u8, null));
|
||||||
|
|
||||||
c.gtk_css_provider_load_from_resource(
|
c.gtk_css_provider_load_from_resource(
|
||||||
provider,
|
provider,
|
||||||
"/com/mitchellh/ghostty/style-dark.css",
|
"/com/mitchellh/ghostty/style-dark.css",
|
||||||
@ -234,6 +237,9 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
|||||||
.auto, .ghostty => {
|
.auto, .ghostty => {
|
||||||
const lum = config.background.toTerminalRGB().perceivedLuminance();
|
const lum = config.background.toTerminalRGB().perceivedLuminance();
|
||||||
if (lum <= 0.5) {
|
if (lum <= 0.5) {
|
||||||
|
const settings = c.gtk_settings_get_default();
|
||||||
|
c.g_object_set(@ptrCast(@alignCast(settings)), "gtk-application-prefer-dark-theme", true, @as([*c]const u8, null));
|
||||||
|
|
||||||
c.gtk_css_provider_load_from_resource(
|
c.gtk_css_provider_load_from_resource(
|
||||||
provider,
|
provider,
|
||||||
"/com/mitchellh/ghostty/style-dark.css",
|
"/com/mitchellh/ghostty/style-dark.css",
|
||||||
|
Reference in New Issue
Block a user