Skip to content

Commit

Permalink
update for GNOME 47
Browse files Browse the repository at this point in the history
uses `Cogl.Color` instead of `Clutter.Color``
  • Loading branch information
razielanarki committed Aug 20, 2024
1 parent 7af6ce4 commit 31f995e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
11 changes: 6 additions & 5 deletions appIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@


import Clutter from 'gi://Clutter';
import Cogl from 'gi://Cogl';
import GLib from 'gi://GLib';
import Gio from 'gi://Gio';
import Graphene from 'gi://Graphene';
Expand Down Expand Up @@ -1049,13 +1050,13 @@ export const TaskbarAppIcon = GObject.registerClass({

_getRunningIndicatorColor(isFocused) {
let color;
const fallbackColor = new Clutter.Color({ red: 82, green: 148, blue: 226, alpha: 255 });
const fallbackColor = new Cogl.Color({ red: 82, green: 148, blue: 226, alpha: 255 })

if (SETTINGS.get_boolean('dot-color-dominant')) {
let dce = new Utils.DominantColorExtractor(this.app);
let palette = dce._getColorPalette();
if (palette) {
color = Clutter.color_from_string(palette.original)[1];
color = Cogl.Color.from_string(palette.original)[1];
} else { // unable to determine color, fall back to theme
let themeNode = this._dot.get_theme_node();
color = themeNode.get_background_color();
Expand All @@ -1069,7 +1070,7 @@ export const TaskbarAppIcon = GObject.registerClass({
if(!isFocused && SETTINGS.get_boolean('dot-color-unfocused-different'))
dotColorSettingPrefix = 'dot-color-unfocused-';

color = Clutter.color_from_string(SETTINGS.get_string(dotColorSettingPrefix + (this._getRunningIndicatorCount() || 1) ))[1];
color = Cogl.color_from_string(SETTINGS.get_string(dotColorSettingPrefix + (this._getRunningIndicatorCount() || 1) ))[1];
} else {
// Re-use the style - background color, and border width and color -
// of the default dot
Expand Down Expand Up @@ -1132,8 +1133,8 @@ export const TaskbarAppIcon = GObject.registerClass({
} else {
let blackenedLength = (1 / 48) * areaSize; // need to scale with the SVG for the stacked highlight
let darkenedLength = isFocused ? (2 / 48) * areaSize : (10 / 48) * areaSize;
let blackenedColor = new Clutter.Color({ red: bodyColor.red * .3, green: bodyColor.green * .3, blue: bodyColor.blue * .3, alpha: bodyColor.alpha });
let darkenedColor = new Clutter.Color({ red: bodyColor.red * .7, green: bodyColor.green * .7, blue: bodyColor.blue * .7, alpha: bodyColor.alpha });
let blackenedColor = new Cogl.Color({ red: bodyColor.red * .3, green: bodyColor.green * .3, blue: bodyColor.blue * .3, alpha: bodyColor.alpha });
let darkenedColor = new Cogl.Color({ red: bodyColor.red * .7, green: bodyColor.green * .7, blue: bodyColor.blue * .7, alpha: bodyColor.alpha });
let solidDarkLength = areaSize - darkenedLength;
let solidLength = solidDarkLength - blackenedLength;

Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"uuid": "[email protected]",
"name": "Dash to Panel",
"description": "An icon taskbar for the Gnome Shell. This extension moves the dash into the gnome main panel so that the application launchers and system tray are combined into a single panel, similar to that found in KDE Plasma and Windows 7+. A separate dock is no longer needed for easy access to running and favorited applications.\n\nFor a more traditional experience, you may also want to use Tweak Tool to enable Windows > Titlebar Buttons > Minimize & Maximize.\n\nFor the best support, please report any issues on Github. Dash-to-panel is developed and maintained by @jderose9 and @charlesg99.",
"shell-version": [ "46" ],
"shell-version": [ "47" ],
"url": "https://github.com/home-sweet-gnome/dash-to-panel",
"gettext-domain": "dash-to-panel",
"version": 9999,
Expand Down
5 changes: 3 additions & 2 deletions progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import Cairo from 'cairo';
import Gio from 'gi://Gio';
import Clutter from 'gi://Clutter';
import Cogl from 'gi://Cogl';
import Pango from 'gi://Pango';
import St from 'gi://St';
import * as Utils from './utils.js';
Expand Down Expand Up @@ -405,13 +406,13 @@ export const ProgressIndicator = class {
if (hasColor)
this._progressbar_background = color
else
this._progressbar_background = new Clutter.Color({red: 204, green: 204, blue: 204, alpha: 255});
this._progressbar_background = new Cogl.Color({red: 204, green: 204, blue: 204, alpha: 255});

[hasColor, color] = node.lookup_color('-progress-bar-border', false);
if (hasColor)
this._progressbar_border = color;
else
this._progressbar_border = new Clutter.Color({red: 230, green: 230, blue: 230, alpha: 255});
this._progressbar_border = new Cogl.Color({red: 230, green: 230, blue: 230, alpha: 255});

this._updateProgressOverlay();
}
Expand Down
3 changes: 2 additions & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

import Clutter from 'gi://Clutter';
import Cogl from 'gi://Cogl';
import GdkPixbuf from 'gi://GdkPixbuf';
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
Expand Down Expand Up @@ -317,7 +318,7 @@ export const removeKeybinding = function(key) {
};

export const getrgbColor = function(color) {
color = typeof color === 'string' ? Clutter.color_from_string(color)[1] : color;
color = typeof color === 'string' ? Cogl.color_from_string(color)[1] : color;

return { red: color.red, green: color.green, blue: color.blue };
};
Expand Down

0 comments on commit 31f995e

Please sign in to comment.