windowManager: Add shortcuts to open new window of nth pinned app
Add new shortcuts to open a new instance of an app by pressing Super + Ctrl + Number. This is analogous to ctrl-activating (LMB/Enter) an app icon. Close https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4129 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1829>
This commit is contained in:
parent
d3a18be0f2
commit
d429ab5e08
@ -41,5 +41,41 @@
|
||||
description="Activate pinned app 9"
|
||||
hidden="true"/>
|
||||
|
||||
<KeyListEntry name="open-new-window-application-1"
|
||||
description="Open new window of pinned app 1"
|
||||
hidden="true"/>
|
||||
|
||||
<KeyListEntry name="open-new-window-application-2"
|
||||
description="Open new window of pinned app 2"
|
||||
hidden="true"/>
|
||||
|
||||
<KeyListEntry name="open-new-window-application-3"
|
||||
description="Open new window of pinned app 3"
|
||||
hidden="true"/>
|
||||
|
||||
<KeyListEntry name="open-new-window-application-4"
|
||||
description="Open new window of pinned app 4"
|
||||
hidden="true"/>
|
||||
|
||||
<KeyListEntry name="open-new-window-application-5"
|
||||
description="Open new window of pinned app 5"
|
||||
hidden="true"/>
|
||||
|
||||
<KeyListEntry name="open-new-window-application-6"
|
||||
description="Open new window of pinned app 6"
|
||||
hidden="true"/>
|
||||
|
||||
<KeyListEntry name="open-new-window-application-7"
|
||||
description="Open new window of pinned app 7"
|
||||
hidden="true"/>
|
||||
|
||||
<KeyListEntry name="open-new-window-application-8"
|
||||
description="Open new window of pinned app 8"
|
||||
hidden="true"/>
|
||||
|
||||
<KeyListEntry name="open-new-window-application-9"
|
||||
description="Open new window of pinned app 9"
|
||||
hidden="true"/>
|
||||
|
||||
</KeyListEntries>
|
||||
|
||||
|
@ -235,6 +235,42 @@
|
||||
<default>["<Super>9"]</default>
|
||||
<summary>Switch to application 9</summary>
|
||||
</key>
|
||||
<key name="open-new-window-application-1" type="as">
|
||||
<default>["<Super><Control>1"]</default>
|
||||
<summary>Open a new instance of application 1</summary>
|
||||
</key>
|
||||
<key name="open-new-window-application-2" type="as">
|
||||
<default>["<Super><Control>2"]</default>
|
||||
<summary>Open a new instance of application 2</summary>
|
||||
</key>
|
||||
<key name="open-new-window-application-3" type="as">
|
||||
<default>["<Super><Control>3"]</default>
|
||||
<summary>Open a new instance of application 3</summary>
|
||||
</key>
|
||||
<key name="open-new-window-application-4" type="as">
|
||||
<default>["<Super><Control>4"]</default>
|
||||
<summary>Open a new instance of application 4</summary>
|
||||
</key>
|
||||
<key name="open-new-window-application-5" type="as">
|
||||
<default>["<Super><Control>5"]</default>
|
||||
<summary>Open a new instance of application 5</summary>
|
||||
</key>
|
||||
<key name="open-new-window-application-6" type="as">
|
||||
<default>["<Super><Control>6"]</default>
|
||||
<summary>Open a new instance of application 6</summary>
|
||||
</key>
|
||||
<key name="open-new-window-application-7" type="as">
|
||||
<default>["<Super><Control>7"]</default>
|
||||
<summary>Open a new instance of application 7</summary>
|
||||
</key>
|
||||
<key name="open-new-window-application-8" type="as">
|
||||
<default>["<Super><Control>8"]</default>
|
||||
<summary>Open a new instance of application 8</summary>
|
||||
</key>
|
||||
<key name="open-new-window-application-9" type="as">
|
||||
<default>["<Super><Control>9"]</default>
|
||||
<summary>Open a new instance of application 9</summary>
|
||||
</key>
|
||||
<key name="show-screenshot-ui" type="as">
|
||||
<default>["Print"]</default>
|
||||
<summary>Take a screenshot interactively</summary>
|
||||
|
@ -819,6 +819,60 @@ export class WindowManager {
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._switchToApplication.bind(this));
|
||||
|
||||
this.addKeybinding('open-new-window-application-1',
|
||||
new Gio.Settings({schema_id: SHELL_KEYBINDINGS_SCHEMA}),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._openNewApplicationWindow.bind(this));
|
||||
|
||||
this.addKeybinding('open-new-window-application-2',
|
||||
new Gio.Settings({schema_id: SHELL_KEYBINDINGS_SCHEMA}),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._openNewApplicationWindow.bind(this));
|
||||
|
||||
this.addKeybinding('open-new-window-application-3',
|
||||
new Gio.Settings({schema_id: SHELL_KEYBINDINGS_SCHEMA}),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._openNewApplicationWindow.bind(this));
|
||||
|
||||
this.addKeybinding('open-new-window-application-4',
|
||||
new Gio.Settings({schema_id: SHELL_KEYBINDINGS_SCHEMA}),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._openNewApplicationWindow.bind(this));
|
||||
|
||||
this.addKeybinding('open-new-window-application-5',
|
||||
new Gio.Settings({schema_id: SHELL_KEYBINDINGS_SCHEMA}),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._openNewApplicationWindow.bind(this));
|
||||
|
||||
this.addKeybinding('open-new-window-application-6',
|
||||
new Gio.Settings({schema_id: SHELL_KEYBINDINGS_SCHEMA}),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._openNewApplicationWindow.bind(this));
|
||||
|
||||
this.addKeybinding('open-new-window-application-7',
|
||||
new Gio.Settings({schema_id: SHELL_KEYBINDINGS_SCHEMA}),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._openNewApplicationWindow.bind(this));
|
||||
|
||||
this.addKeybinding('open-new-window-application-8',
|
||||
new Gio.Settings({schema_id: SHELL_KEYBINDINGS_SCHEMA}),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._openNewApplicationWindow.bind(this));
|
||||
|
||||
this.addKeybinding('open-new-window-application-9',
|
||||
new Gio.Settings({schema_id: SHELL_KEYBINDINGS_SCHEMA}),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._openNewApplicationWindow.bind(this));
|
||||
|
||||
global.stage.connect('scroll-event', (stage, event) => {
|
||||
const allowedModes = Shell.ActionMode.NORMAL;
|
||||
if ((allowedModes & Main.actionMode) === 0)
|
||||
@ -1656,19 +1710,30 @@ export class WindowManager {
|
||||
return Main.sessionMode.hasOverview;
|
||||
}
|
||||
|
||||
_switchToApplication(display, window, binding) {
|
||||
_getNthFavoriteApp(n) {
|
||||
if (!this._allowFavoriteShortcuts())
|
||||
return;
|
||||
return null;
|
||||
|
||||
let [, , , target] = binding.get_name().split('-');
|
||||
let apps = AppFavorites.getAppFavorites().getFavorites();
|
||||
let app = apps[target - 1];
|
||||
const apps = AppFavorites.getAppFavorites().getFavorites();
|
||||
return apps[n];
|
||||
}
|
||||
|
||||
_switchToApplication(display, window, binding) {
|
||||
const [, , , target] = binding.get_name().split('-');
|
||||
const app = this._getNthFavoriteApp(target - 1);
|
||||
if (app) {
|
||||
Main.overview.hide();
|
||||
app.activate();
|
||||
}
|
||||
}
|
||||
|
||||
_openNewApplicationWindow(display, window, binding) {
|
||||
const [, , , , target] = binding.get_name().split('-');
|
||||
const app = this._getNthFavoriteApp(target - 1);
|
||||
if (app)
|
||||
app.open_new_window(-1);
|
||||
}
|
||||
|
||||
_toggleCalendar() {
|
||||
Main.panel.toggleCalendar();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user