Unverified Commit cc8d0352 authored by Erik Reider's avatar Erik Reider Committed by GitHub

Add `ignore-gtk-theme` config option + default to user CSS priority (#587)

* Always use the default GTK theme to allow for a more consistent theming experience * Default to USER CSS priority
parent a63e0fa5
......@@ -9,6 +9,12 @@ swaync - Configuration file
Using a text editor with a JSON language server is recommended when editing the
config file to be able to detect config errors
*ignore-gtk-theme* ++
type: bool ++
default: true ++
description: Unsets the GTK_THEME environment variable, fixing a lot of ++
issues with GTK themes ruining the users custom CSS themes.
*positionX* ++
type: string ++
default: right ++
......
{
"$schema": @JSONPATH@,
"ignore-gtk-theme": true,
"positionX": "right",
"positionY": "top",
"layer": "overlay",
"control-center-layer": "top",
"layer-shell": true,
"layer-shell-cover-screen": true,
"cssPriority": "application",
"cssPriority": "highest",
"control-center-margin-top": 0,
"control-center-margin-bottom": 0,
"control-center-margin-right": 0,
......
......@@ -60,8 +60,8 @@ namespace SwayNotificationCenter {
public int get_priority () {
switch (this) {
case APPLICATION:
default:
return Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION;
default:
case USER:
return Gtk.STYLE_PROVIDER_PRIORITY_USER;
}
......@@ -316,7 +316,7 @@ namespace SwayNotificationCenter {
/** Get the static singleton and reload the config */
public static unowned ConfigModel init (string ? path) {
_path = Functions.get_config_path (path);
_path = path;
reload_config ();
return _instance;
}
......@@ -358,11 +358,16 @@ namespace SwayNotificationCenter {
_path = path;
debug (_instance.to_string ());
app.config_reload (previous_config, m);
if (app != null) {
app.config_reload (previous_config, m);
}
}
/* Properties */
/** Unsets the GTK_THEME env variable when true */
public bool ignore_gtk_theme { get; set; default = true; }
/** The notifications and controlcenters horizontal alignment */
public PositionX positionX { // vala-lint=naming-convention
get; set; default = PositionX.RIGHT;
......@@ -390,7 +395,7 @@ namespace SwayNotificationCenter {
/** The CSS loading priority */
public CssPriority cssPriority { // vala-lint=naming-convention
get; set; default = CssPriority.APPLICATION;
get; set; default = CssPriority.USER;
}
/** The timeout for notifications with NORMAL priority */
......
......@@ -8,6 +8,11 @@
"type": "string",
"description": "Pointer to the schema against which this document should be validated."
},
"ignore-gtk-theme": {
"type": "boolean",
"description": "Unsets the GTK_THEME environment variable, fixing a lot of issues with GTK themes ruining the users custom CSS themes.",
"default": true
},
"positionX": {
"type": "string",
"description": "Horizontal position of control center and notification window",
......@@ -32,8 +37,8 @@
},
"cssPriority": {
"type": "string",
"description": "Which GTK priority to use when loading the default and user CSS files. Pick \"user\" to override XDG_CONFIG_HOME/gtk-3.0/gtk.css",
"default": "application",
"description": "Which GTK priority to use when loading the default and user CSS files. Pick \"user\" to override XDG_CONFIG_HOME/gtk-4.0/gtk.css",
"default": "highest",
"enum": ["application", "user"]
},
"positionY": {
......
......@@ -39,7 +39,6 @@ namespace SwayNotificationCenter {
return;
}
activated = true;
ConfigModel.init (config_path);
Functions.load_css (style_path);
hold ();
......@@ -74,9 +73,6 @@ namespace SwayNotificationCenter {
}
public static int main (string[] args) {
Gtk.init ();
Adw.init ();
if (args.length > 0) {
for (uint i = 1; i < args.length; i++) {
string arg = args[i];
......@@ -107,6 +103,16 @@ namespace SwayNotificationCenter {
}
}
ConfigModel.init (config_path);
// Fixes custom themes messing with the default/custom CSS styling
if (ConfigModel.instance.ignore_gtk_theme) {
Environment.unset_variable ("GTK_THEME");
}
Gtk.init ();
Adw.init ();
Functions.init ();
self_settings = new Settings ("org.erikreider.swaync");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment