a11y: Don't set WM theme

We've been using GTK to draw server-side decorations according to the
GTK theme for a long time, so no need to configure the HighContrast
theme for a setting we don't use.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/377
This commit is contained in:
Florian Müllner 2019-01-30 23:00:35 +01:00
parent 43a19739ab
commit c47e672eea

View File

@ -29,7 +29,6 @@ const KEY_VISUAL_BELL = 'visual-bell';
const DESKTOP_INTERFACE_SCHEMA = 'org.gnome.desktop.interface'; const DESKTOP_INTERFACE_SCHEMA = 'org.gnome.desktop.interface';
const KEY_GTK_THEME = 'gtk-theme'; const KEY_GTK_THEME = 'gtk-theme';
const KEY_ICON_THEME = 'icon-theme'; const KEY_ICON_THEME = 'icon-theme';
const KEY_WM_THEME = 'theme';
const KEY_TEXT_SCALING_FACTOR = 'text-scaling-factor'; const KEY_TEXT_SCALING_FACTOR = 'text-scaling-factor';
const HIGH_CONTRAST_THEME = 'HighContrast'; const HIGH_CONTRAST_THEME = 'HighContrast';
@ -132,7 +131,6 @@ class ATIndicator extends PanelMenu.Button {
_buildHCItem() { _buildHCItem() {
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA }); let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
let wmSettings = new Gio.Settings({ schema_id: WM_SCHEMA });
interfaceSettings.connect('changed::' + KEY_GTK_THEME, () => { interfaceSettings.connect('changed::' + KEY_GTK_THEME, () => {
let value = interfaceSettings.get_string(KEY_GTK_THEME); let value = interfaceSettings.get_string(KEY_GTK_THEME);
if (value == HIGH_CONTRAST_THEME) { if (value == HIGH_CONTRAST_THEME) {
@ -149,35 +147,25 @@ class ATIndicator extends PanelMenu.Button {
if (value != HIGH_CONTRAST_THEME) if (value != HIGH_CONTRAST_THEME)
iconTheme = value; iconTheme = value;
}); });
wmSettings.connect('changed::' + KEY_WM_THEME, () => {
let value = wmSettings.get_string(KEY_WM_THEME);
if (value != HIGH_CONTRAST_THEME)
wmTheme = value;
});
let gtkTheme = interfaceSettings.get_string(KEY_GTK_THEME); let gtkTheme = interfaceSettings.get_string(KEY_GTK_THEME);
let iconTheme = interfaceSettings.get_string(KEY_ICON_THEME); let iconTheme = interfaceSettings.get_string(KEY_ICON_THEME);
let wmTheme = wmSettings.get_string(KEY_WM_THEME);
let hasHC = (gtkTheme == HIGH_CONTRAST_THEME); let hasHC = (gtkTheme == HIGH_CONTRAST_THEME);
let highContrast = this._buildItemExtended( let highContrast = this._buildItemExtended(
_("High Contrast"), _("High Contrast"),
hasHC, hasHC,
interfaceSettings.is_writable(KEY_GTK_THEME) && interfaceSettings.is_writable(KEY_GTK_THEME) &&
interfaceSettings.is_writable(KEY_ICON_THEME) && interfaceSettings.is_writable(KEY_ICON_THEME),
wmSettings.is_writable(KEY_WM_THEME),
enabled => { enabled => {
if (enabled) { if (enabled) {
interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME); interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME);
interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME); interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME);
wmSettings.set_string(KEY_WM_THEME, HIGH_CONTRAST_THEME);
} else if(!hasHC) { } else if(!hasHC) {
interfaceSettings.set_string(KEY_GTK_THEME, gtkTheme); interfaceSettings.set_string(KEY_GTK_THEME, gtkTheme);
interfaceSettings.set_string(KEY_ICON_THEME, iconTheme); interfaceSettings.set_string(KEY_ICON_THEME, iconTheme);
wmSettings.set_string(KEY_WM_THEME, wmTheme);
} else { } else {
interfaceSettings.reset(KEY_GTK_THEME); interfaceSettings.reset(KEY_GTK_THEME);
interfaceSettings.reset(KEY_ICON_THEME); interfaceSettings.reset(KEY_ICON_THEME);
wmSettings.reset(KEY_WM_THEME);
} }
}); });
return highContrast; return highContrast;