mirror of
https://github.com/elementary/gala.git
synced 2024-09-11 15:15:39 +03:00
Enable Alt + ~
to switch between windows of the same application (#1602)
This commit is contained in:
parent
a630015b89
commit
75469b6321
@ -12,6 +12,18 @@
|
||||
</description>
|
||||
|
||||
<releases>
|
||||
<release version="7.0.3" date="2023-04-03" urgency="medium">
|
||||
<description>
|
||||
<p>Improvements:</p>
|
||||
<ul>
|
||||
<li>Updated translations</li>
|
||||
</ul>
|
||||
</description>
|
||||
<issues>
|
||||
<issue url="https://github.com/elementary/gala/issues/536">Enable "Alt + ~" to switch between windows of the same application</issue>
|
||||
</issues>
|
||||
</release>
|
||||
|
||||
<release version="7.0.2" date="2023-04-03" urgency="medium">
|
||||
<description>
|
||||
<p>Improvements:</p>
|
||||
|
@ -198,7 +198,13 @@ namespace Gala {
|
||||
}
|
||||
|
||||
if (!opened) {
|
||||
var windows_exist = collect_windows (display, workspace);
|
||||
bool windows_exist;
|
||||
if (binding.get_name ().has_prefix ("switch-group")) {
|
||||
windows_exist = collect_current_windows (display, workspace);
|
||||
} else {
|
||||
windows_exist = collect_all_windows (display, workspace);
|
||||
}
|
||||
|
||||
if (!windows_exist) {
|
||||
return;
|
||||
}
|
||||
@ -213,31 +219,59 @@ namespace Gala {
|
||||
next_window (display, workspace, backward);
|
||||
}
|
||||
|
||||
private bool collect_windows (Meta.Display display, Meta.Workspace? workspace) {
|
||||
private bool collect_all_windows (Meta.Display display, Meta.Workspace? workspace) {
|
||||
var windows = display.get_tab_list (Meta.TabList.NORMAL, workspace);
|
||||
|
||||
if (windows == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var current_window = display.get_tab_current (Meta.TabList.NORMAL, workspace);
|
||||
unowned var current_window = display.get_tab_current (Meta.TabList.NORMAL, workspace);
|
||||
|
||||
container.width = -1;
|
||||
container.destroy_all_children ();
|
||||
|
||||
foreach (var window in windows) {
|
||||
foreach (unowned var window in windows) {
|
||||
var icon = new WindowIcon (window, ICON_SIZE * scaling_factor);
|
||||
if (window == current_window) {
|
||||
cur_icon = icon;
|
||||
}
|
||||
|
||||
icon.set_pivot_point (0.5f, 0.5f);
|
||||
container.add_child (icon);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool collect_current_windows (Meta.Display display, Meta.Workspace? workspace) {
|
||||
var windows = display.get_tab_list (Meta.TabList.NORMAL, workspace);
|
||||
if (windows == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
unowned var current_window = display.get_tab_current (Meta.TabList.NORMAL, workspace);
|
||||
if (current_window == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
container.width = -1;
|
||||
container.destroy_all_children ();
|
||||
|
||||
unowned var window_tracker = ((WindowManagerGala) wm).window_tracker;
|
||||
var app = window_tracker.get_app_for_window (current_window);
|
||||
foreach (unowned var window in windows) {
|
||||
if (window_tracker.get_app_for_window (window) == app) {
|
||||
var icon = new WindowIcon (window, ICON_SIZE * scaling_factor);
|
||||
if (window == current_window) {
|
||||
cur_icon = icon;
|
||||
}
|
||||
|
||||
container.add_child (icon);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void open_switcher () {
|
||||
var display = wm.get_display ();
|
||||
|
||||
@ -343,6 +377,8 @@ namespace Gala {
|
||||
case Meta.KeyBindingAction.SWITCH_APPLICATIONS_BACKWARD:
|
||||
case Meta.KeyBindingAction.SWITCH_WINDOWS:
|
||||
case Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD:
|
||||
case Meta.KeyBindingAction.SWITCH_GROUP:
|
||||
case Meta.KeyBindingAction.SWITCH_GROUP_BACKWARD:
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
|
@ -280,9 +280,6 @@ namespace Gala {
|
||||
Meta.KeyBinding.set_custom_handler ("move-to-workspace-left", (Meta.KeyHandlerFunc) handle_move_to_workspace);
|
||||
Meta.KeyBinding.set_custom_handler ("move-to-workspace-right", (Meta.KeyHandlerFunc) handle_move_to_workspace);
|
||||
|
||||
Meta.KeyBinding.set_custom_handler ("switch-group", () => {});
|
||||
Meta.KeyBinding.set_custom_handler ("switch-group-backward", () => {});
|
||||
|
||||
/*shadows*/
|
||||
InternalUtils.reload_shadow ();
|
||||
var shadow_settings = new GLib.Settings (Config.SCHEMA + ".shadows");
|
||||
@ -325,6 +322,8 @@ namespace Gala {
|
||||
Meta.KeyBinding.set_custom_handler ("switch-applications-backward", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
|
||||
Meta.KeyBinding.set_custom_handler ("switch-windows", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
|
||||
Meta.KeyBinding.set_custom_handler ("switch-windows-backward", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
|
||||
Meta.KeyBinding.set_custom_handler ("switch-group", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
|
||||
Meta.KeyBinding.set_custom_handler ("switch-group-backward", (Meta.KeyHandlerFunc) winswitcher.handle_switch_windows);
|
||||
}
|
||||
|
||||
if (plugin_manager.window_overview_provider == null
|
||||
|
@ -190,7 +190,7 @@ public class Gala.WindowTracker : GLib.Object {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Gala.App get_app_for_window (Meta.Window window) {
|
||||
public Gala.App get_app_for_window (Meta.Window window) {
|
||||
unowned Meta.Window? transient_for = window.get_transient_for ();
|
||||
if (transient_for != null) {
|
||||
return get_app_for_window (transient_for);
|
||||
|
Loading…
Reference in New Issue
Block a user