Skip to content

Commit

Permalink
appIconsDecorator: Do not allow launching any application in updating…
Browse files Browse the repository at this point in the history
… state
  • Loading branch information
3v1n0 committed Aug 24, 2024
1 parent a2f4f4e commit 4d1515c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions appIconsDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ import {
Utils,
} from './imports.js';

import {
Gio,
} from './dependencies/gi.js';

import {
AppDisplay,
Main,
} from './dependencies/shell/ui.js';

export class AppIconsDecorator {
Expand Down Expand Up @@ -85,6 +90,21 @@ export class AppIconsDecorator {
/* eslint-enable no-invalid-this */
});

this._methodInjections.add(AppDisplay.AppIcon.prototype,
'activate', function (originalFunction, ...args) {
/* eslint-disable no-invalid-this */
if (this.updating) {
const icon = Gio.Icon.new_for_string('action-unavailable-symbolic');
Main.osdWindowManager.show(-1, icon,
_('%s is currently updating, cannot launch it!').format(this.name),
null);
return;
}

originalFunction.call(this, ...args);
/* eslint-enable no-invalid-this */
});

const appIconsTypes = [
AppDisplay.AppSearchProvider,
AppDisplay.AppIcon,
Expand Down

0 comments on commit 4d1515c

Please sign in to comment.