Skip to content

Commit

Permalink
refactor: Made a small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
anaximeno committed May 17, 2024
1 parent 59faf0b commit abb0ce8
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions files/usr/share/cinnamon/applets/[email protected]/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,12 @@ class WindowGraph {

this.drawingArea.connect('repaint', this.onRepaint.bind(this));

this._icon = undefined;
this._icon = this.showIcon ? undefined : this.getIcon();

if (this.showIcon) {
const [x, y] = this.calcIconPos();
this._icon = this.getIcon();
this._icon.set_x(x);
this._icon.set_y(y);
this.icon.set_x(x);
this.icon.set_y(y);
}
}

Expand Down Expand Up @@ -246,8 +245,8 @@ class WindowGraph {

if (this.showIcon) {
const [x, y] = this.calcIconPos(rect);
this._icon.set_x(x);
this._icon.set_y(y);
this.icon.set_x(x);
this.icon.set_y(y);
}
}

Expand Down Expand Up @@ -430,11 +429,10 @@ class WorkspaceGraph extends WorkspaceButton {
}

update(options = {}) {
const signal = options.signal;
const stateChanged = options.stateChanged;

if ((signal == "position-changed" || signal == "size-changed") &&
this.focusGraph &&
this.focusGraph.metaWindow.has_focus()
if ((stateChanged == "position-changed" || stateChanged == "size-changed") &&
this.focusGraph && this.focusGraph.metaWindow.has_focus()
) {
this.focusGraph.update(options);
} else {
Expand Down Expand Up @@ -634,9 +632,9 @@ class CinnamonWorkspaceSwitcher extends Applet.Applet {
this._onWindowsStateChanged("focus-changed");
}

_onWindowsStateChanged(signal) {
_onWindowsStateChanged(stateChanged) {
let button = this.buttons[global.workspace_manager.get_active_workspace_index()];
button.update({signal: signal});
button.update({stateChanged: stateChanged});
}

on_applet_removed_from_panel() {
Expand Down

0 comments on commit abb0ce8

Please sign in to comment.