mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 00:11:59 +02:00
Use new PiP icons when available
Use the new "pip-in" and "pip-out" GNOME symbolic icons if user theme has them for enter/leave floating mode button. When icon is unavailable on the host, old icon will be used instead.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { Gio, GLib, GObject, Gtk } = imports.gi;
|
||||
const { Gio, GLib, GObject, Gdk, Gtk } = imports.gi;
|
||||
const Debug = imports.src.debug;
|
||||
const FileOps = imports.src.fileOps;
|
||||
const Misc = imports.src.misc;
|
||||
@@ -144,15 +144,26 @@ class ClapperAppBase extends Gtk.Application
|
||||
|
||||
_onIconThemeChanged(gtkSettings)
|
||||
{
|
||||
const iconTheme = gtkSettings.gtk_icon_theme_name;
|
||||
const iconThemeName = gtkSettings.gtk_icon_theme_name;
|
||||
const window = this.active_window;
|
||||
const hasAdwIcons = window.has_css_class('adwicons');
|
||||
|
||||
if(iconTheme === 'Adwaita' || iconTheme === 'Default') {
|
||||
if(iconThemeName === 'Adwaita' || iconThemeName === 'Default') {
|
||||
if(!hasAdwIcons)
|
||||
window.add_css_class('adwicons');
|
||||
}
|
||||
else if(hasAdwIcons)
|
||||
window.remove_css_class('adwicons');
|
||||
|
||||
const display = Gdk.Display.get_default();
|
||||
if(!display) return;
|
||||
|
||||
const iconTheme = Gtk.IconTheme.get_for_display(display);
|
||||
if(!iconTheme) return;
|
||||
|
||||
const { headerBar } = window.child.revealerTop;
|
||||
if(!headerBar) return;
|
||||
|
||||
headerBar._onIconThemeChanged(iconTheme);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user