Beautify DTP

- Remove dead/future code in order to re-add it when support for GTK variables arrives
- This fixes the "Ignoring length property that isn't a number" warnings
This commit is contained in:
Hirnmoder
2025-01-27 19:21:12 +01:00
parent f1585fb3bc
commit e64f3b437e
2 changed files with 135 additions and 148 deletions

View File

@@ -242,10 +242,10 @@ export const TaskbarAppIcon = GObject.registerClass({
this._onSwitchWorkspace.bind(this));
this._hoverChangeId = this.connect('notify::hover', () => this._onAppIconHoverChanged());
if (!this._checkGtkVersion_cssVariables()) {
this._hoverChangeId2 = this.connect('notify::hover', () => this._onAppIconHoverChanged_GtkWorkaround());
this._pressedChangedId = this.connect('notify::pressed', () => this._onAppIconPressedChanged_GtkWorkaround());
}
this._dtpSettingsSignalIds = [
SETTINGS.connect('changed::animate-appicon-hover', this._onAnimateAppiconHoverChanged.bind(this)),
@@ -282,11 +282,10 @@ export const TaskbarAppIcon = GObject.registerClass({
SETTINGS.connect('changed::group-apps-underline-unfocused', this._settingsChangeRefresh.bind(this)),
];
if (!this._checkGtkVersion_cssVariables()) {
this._dtpSettingsSignalIds = this._dtpSettingsSignalIds.concat([
SETTINGS.connect('changed::highlight-appicon-hover-border-radius', () => this._setIconStyle(this._isFocusedWindow())),
]);
}
this._progressIndicator = new Progress.ProgressIndicator(this, panel.progressManager);
@@ -483,16 +482,14 @@ export const TaskbarAppIcon = GObject.registerClass({
const background_color = SETTINGS.get_string('highlight-appicon-hover-background-color');
const pressed_color = SETTINGS.get_string('highlight-appicon-pressed-background-color');
const border_radius = SETTINGS.get_int('highlight-appicon-hover-border-radius');
if (this._checkGtkVersion_cssVariables()) {
this._container.set_style(`--dtp-hover-background-color: ${background_color}; --dtp-hover-border-radius: ${border_radius}px; --dtp-pressed-background-color: ${pressed_color};`);
} else {
// Some trickery needed to get the same effect
// Some trickery needed to get the effect
const br = `border-radius: ${border_radius}px;`;
this._appicon_normalstyle = br;
this._container.set_style(this._appicon_normalstyle);
this._appicon_hoverstyle = `background-color: ${background_color}; ${br}`;
this._appicon_pressedstyle = `background-color: ${pressed_color}; ${br}`;
}
if (SETTINGS.get_boolean('highlight-appicon-hover')) {
this._container.remove_style_class_name('no-highlight');
} else {
@@ -503,14 +500,6 @@ export const TaskbarAppIcon = GObject.registerClass({
}
}
_checkGtkVersion_cssVariables() {
// Support for CSS variables was added in GTK 4.16
// However, using them is still impossible within an extension [Gnome version 47]
return false;
return Gtk.get_major_version() >= 5 ||
(Gtk.get_major_version() == 4 && Gtk.get_minor_version() >= 16);
}
_onAppIconHoverChanged_GtkWorkaround() {
if (this.hover && this._appicon_hoverstyle) {
this._container.set_style(this._appicon_hoverstyle);
@@ -1751,10 +1740,12 @@ export const ShowAppsIconWrapper = class extends EventEmitter {
let customIconPath = SETTINGS.get_string('show-apps-icon-file');
this.realShowAppsIcon.icon.createIcon = function (size) {
this._iconActor = new St.Icon({ icon_name: 'view-app-grid-symbolic',
this._iconActor = new St.Icon({
icon_name: 'view-app-grid-symbolic',
icon_size: size,
style_class: 'show-apps-icon',
track_hover: true });
track_hover: true
});
if (customIconPath) {
this._iconActor.gicon = new Gio.FileIcon({ file: Gio.File.new_for_path(customIconPath) });

View File

@@ -42,14 +42,11 @@
#dashtopanelScrollview .overview-tile:focus .dtp-container {
background-color: rgba(238, 238, 236, 0.1);
border-radius: 0px;
background-color: var(--dtp-hover-background-color);
border-radius: var(--dtp-hover-border-radius);
}
#dashtopanelScrollview .overview-tile:hover .dtp-container > .dtp-dots-container,
#dashtopanelScrollview .overview-tile:focus .dtp-container > .dtp-dots-container {
border-radius: 0px;
border-radius: var(--dtp-hover-border-radius);
}
.dashtopanelMainPanel .dash-item-container .show-apps:hover {
@@ -72,7 +69,6 @@
#dashtopanelScrollview .overview-tile:active .dtp-container {
background-color: rgba(238, 238, 236, 0.18);
background-color: var(--dtp-pressed-background-color);
}
#dashtopanelScrollview .overview-tile .favorite {