Created
December 21, 2019 02:25
-
-
Save pawitp/fb74c6da0a8e9e5f6738669c8e502195 to your computer and use it in GitHub Desktop.
Patch to bring back Super+<Num> shortcut on Linux Mint 19.3. This is a partial revert of https://github.com/linuxmint/cinnamon/commit/94719c2cf1525f17b38bc7356d46d5b6bb5eab59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ruw [email protected]/appGroup.js [email protected]/appGroup.js | |
--- [email protected]/appGroup.js 2019-12-12 18:46:55.000000000 +0700 | |
+++ [email protected]/appGroup.js 2019-12-21 09:10:38.809467280 +0700 | |
@@ -780,6 +780,33 @@ | |
return false; | |
} | |
+ onAppKeyPress() { | |
+ if (this.groupState.isFavoriteApp && this.groupState.metaWindows.length === 0) { | |
+ this.launchNewInstance(); | |
+ } else { | |
+ if (this.appKeyTimeout) { | |
+ clearTimeout(this.appKeyTimeout); | |
+ this.appKeyTimeout = 0; | |
+ } | |
+ if (this.groupState.metaWindows.length > 1) { | |
+ if (!this.hoverMenu) this.initThumbnailMenu(); | |
+ this.hoverMenu.open(true); | |
+ } else { | |
+ this.listState.trigger('closeAllHoverMenus'); | |
+ } | |
+ this.windowHandle(); | |
+ this.appKeyTimeout = setTimeout(() => { | |
+ if (this.groupState.thumbnailMenuEntered) { | |
+ clearTimeout(this.appKeyTimeout); | |
+ this.appKeyTimeout = 0; | |
+ return; | |
+ } | |
+ this.hoverMenu.close(true); | |
+ this.appKeyTimeout = 0; | |
+ }, this.state.settings.showAppsOrderTimeout); | |
+ } | |
+ } | |
+ | |
windowHandle() { | |
if (this.groupState.lastFocused.appears_focused) { | |
if (this.groupState.metaWindows.length > 1) { | |
diff -ruw [email protected]/applet.js [email protected]/applet.js | |
--- [email protected]/applet.js 2019-12-12 18:46:55.000000000 +0700 | |
+++ [email protected]/applet.js 2019-12-21 09:06:27.783530554 +0700 | |
@@ -357,6 +357,7 @@ | |
if (this.state.appletReady && this.state.panelEditMode) { | |
return; | |
} | |
+ this.bindAppKeys(); | |
this.state.set({appletReady: true}); | |
} | |
@@ -405,6 +406,7 @@ | |
on_applet_removed_from_panel() { | |
this.state.set({willUnmount: true}); | |
+ this.unbindAppKeys(); | |
this.signals.disconnectAllSignals(); | |
for (let i = 0, len = this.appLists.length; i < len; i++) { | |
if (this.appLists[i]) { | |
@@ -435,6 +437,36 @@ | |
} | |
} | |
+ bindAppKeys() { | |
+ this.unbindAppKeys(); | |
+ | |
+ for (let i = 1; i < 10; i++) { | |
+ this.bindAppKey(i); | |
+ } | |
+ } | |
+ | |
+ unbindAppKeys() { | |
+ for (let i = 1; i < 10; i++) { | |
+ Main.keybindingManager.removeHotKey('launch-app-key-' + i); | |
+ Main.keybindingManager.removeHotKey('launch-new-app-key-' + i); | |
+ } | |
+ } | |
+ | |
+ bindAppKey(i) { | |
+ Main.keybindingManager.addHotKey('launch-app-key-' + i, '<Super>' + i, () => this.onAppKeyPress(i)); | |
+ Main.keybindingManager.addHotKey('launch-new-app-key-' + i, '<Super><Shift>' + i, () => | |
+ this.onNewAppKeyPress(i) | |
+ ); | |
+ } | |
+ | |
+ onAppKeyPress(number) { | |
+ this.getCurrentAppList().onAppKeyPress(number); | |
+ } | |
+ | |
+ onNewAppKeyPress(number) { | |
+ this.getCurrentAppList().onNewAppKeyPress(number); | |
+ } | |
+ | |
handleMonitorWindowsPrefsChange(value) { | |
} | |
diff -ruw [email protected]/appList.js [email protected]/appList.js | |
--- [email protected]/appList.js 2019-12-12 18:46:55.000000000 +0700 | |
+++ [email protected]/appList.js 2019-12-21 09:09:18.606717948 +0700 | |
@@ -94,6 +94,16 @@ | |
if (typeof cb === 'function') cb(); | |
} | |
+ onAppKeyPress(number) { | |
+ if (!this.appList[number - 1]) return; | |
+ this.appList[number - 1].onAppKeyPress(number); | |
+ } | |
+ | |
+ onNewAppKeyPress(number) { | |
+ if (number > this.appList.length) return; | |
+ this.appList[number - 1].launchNewInstance(); | |
+ } | |
+ | |
// Gets a list of every app on the current workspace | |
getSpecialApps() { | |
this.specialApps = []; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I love you. Thanks.