Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions files/usr/share/cinnamon/applets/[email protected]/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -1321,14 +1321,42 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
}

_updateKeybinding() {
Main.keybindingManager.addHotKey("overlay-key-" + this.instance_id, this.overlayKey, Lang.bind(this, function() {
if (!Main.overview.visible && !Main.expo.visible) {
if (this.forceShowPanel && !this.isOpen) {
this.panel.peekPanel();
const binds = this.overlayKey.split('::').map(e => e ? e : '::');
for (let i = 0; i < binds.length; i++) {
const bind = binds[i];
Main.keybindingManager.addHotKey(`overlay-key-${i}-${this.instance_id}`, bind, Lang.bind(this, function() {
const instancesWithSameBinding = this._getInstancesWithSameOverlayBinding(bind);
if (!instancesWithSameBinding.length || this._mouseOnSameMonitor(this.actor)) {
this.toggleOverlay();
return;
}
this.menu.toggle_with_options(this.enableAnimation);
const matchingInstance = instancesWithSameBinding.find(instance => this._mouseOnSameMonitor(instance.actor));
(matchingInstance ?? this).toggleOverlay();
}));
}
}

_getInstancesWithSameOverlayBinding(bind) {
const instances = Main.AppletManager.getRunningInstancesForUuid("[email protected]");
return instances.filter(instance => {
if (instance === this) return false;
return instance.overlayKey.split('::').includes(bind);
});
}

_mouseOnSameMonitor(actor) {
const mouseMonitor = Main.layoutManager.currentMonitor.index;
const actorMonitor = Main.layoutManager.findMonitorIndexForActor(actor);
return mouseMonitor === actorMonitor;
}

toggleOverlay() {
if (!Main.overview.visible && !Main.expo.visible) {
if (this.forceShowPanel && !this.isOpen) {
this.panel.peekPanel();
}
}));
this.menu.toggle_with_options(this.enableAnimation);
}
}

_updateCategoryHover() {
Expand Down