summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsparkida <[email protected]>2022-01-15 23:14:19 +0000
committerLuke from DC <[email protected]>2023-01-18 04:15:33 +0000
commitd83cb24a27b1864be035868354a806287dbfaa92 (patch)
tree1e8987cd34887cdde1d31ad59f1dabcf7d57dc85
parentdcd5d21e4c53f1670b33cec78c96bdd3da87037d (diff)
downloadmarco-d83cb24a27b1864be035868354a806287dbfaa92.tar.bz2
marco-d83cb24a27b1864be035868354a806287dbfaa92.tar.xz
Add setting to raise windows on alt+tab popup
-rw-r--r--src/core/keybindings.c19
-rw-r--r--src/core/prefs.c17
-rw-r--r--src/include/common.h1
-rw-r--r--src/include/prefs.h2
-rw-r--r--src/org.mate.marco.gschema.xml5
5 files changed, 41 insertions, 3 deletions
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 2f782fa3..fb3131c2 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -2128,12 +2128,16 @@ process_tab_grab (MetaDisplay *display,
return TRUE;
key = meta_ui_tab_popup_get_selected (screen->tab_popup);
- prev_window = meta_display_lookup_x_window (display, (Window) key);
+ prev_window = meta_display_lookup_x_window (display, (Window) key);
action = display_get_keybinding_action (display,
keysym,
event->xkey.keycode,
display->grab_mask);
+ gboolean raise_windows;
+ raise_windows = meta_prefs_get_alt_tab_raise_windows ();
+ gboolean escaped_alt_tab = FALSE;
+
/* Cancel when alt-Escape is pressed during using alt-Tab, and vice
* versa.
*/
@@ -2153,6 +2157,15 @@ process_tab_grab (MetaDisplay *display,
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
/* carry on */
break;
+ case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
+ // handle escape pressed when using raise_windows with alt+tab
+ // in order to restore selected window in stack
+ if (raise_windows)
+ {
+ escaped_alt_tab = TRUE;
+ break;
+ }
+ return FALSE;
default:
return FALSE;
}
@@ -2223,7 +2236,7 @@ process_tab_grab (MetaDisplay *display,
case META_KEYBINDING_ACTION_CYCLE_WINDOWS:
case META_KEYBINDING_ACTION_CYCLE_GROUP:
popup_not_showing = TRUE;
- key_used = TRUE;
+ key_used = !escaped_alt_tab;
break;
case META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD:
case META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD:
@@ -2288,7 +2301,7 @@ process_tab_grab (MetaDisplay *display,
else if (direction == UP)
meta_ui_tab_popup_up (screen->tab_popup);
- if (popup_not_showing)
+ if (popup_not_showing || raise_windows)
{
/* We can't actually change window focus, due to the grab.
* but raise the window.
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 1198113a..032bba8f 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -56,6 +56,7 @@
#define KEY_GENERAL_CENTER_NEW_WINDOWS "center-new-windows"
#define KEY_GENERAL_ICON_SIZE "icon-size"
#define KEY_GENERAL_ALT_TAB_MAX_COLUMNS "alt-tab-max-columns"
+#define KEY_GENERAL_ALT_TAB_RAISE_WINDOWS "alt-tab-raise-windows"
#define KEY_GENERAL_ALT_TAB_EXPAND_TO_FIT_TITLE "alt-tab-expand-to-fit-title"
#define KEY_COMMAND_SCHEMA "org.mate.Marco.keybinding-commands"
@@ -121,6 +122,7 @@ static char *cursor_theme = NULL;
static int cursor_size = 24;
static int icon_size = META_DEFAULT_ICON_SIZE;
static int alt_tab_max_columns = META_DEFAULT_ALT_TAB_MAX_COLUMNS;
+static gboolean alt_tab_raise_windows = META_DEFAULT_ALT_TAB_RAISE_WINDOWS;
static gboolean alt_tab_expand_to_fit_title = META_DEFAULT_ALT_TAB_EXPAND_TO_FIT_TITLE;
static gboolean use_force_compositor_manager = FALSE;
static gboolean force_compositor_manager = FALSE;
@@ -458,6 +460,12 @@ static MetaBoolPreference preferences_bool[] =
&alt_tab_expand_to_fit_title,
META_DEFAULT_ALT_TAB_EXPAND_TO_FIT_TITLE,
},
+ { "alt-tab-raise-windows",
+ KEY_GENERAL_SCHEMA,
+ META_PREF_ALT_TAB_RAISE_WINDOWS,
+ &alt_tab_raise_windows,
+ META_DEFAULT_ALT_TAB_RAISE_WINDOWS,
+ },
{ NULL, NULL, 0, NULL, FALSE },
};
@@ -1162,6 +1170,12 @@ meta_prefs_get_alt_tab_expand_to_fit_title (void)
}
gboolean
+meta_prefs_get_alt_tab_raise_windows (void)
+{
+ return alt_tab_raise_windows;
+}
+
+gboolean
meta_prefs_is_in_skip_list (char *class)
{
GList *item;
@@ -1682,6 +1696,9 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_ALT_TAB_EXPAND_TO_FIT_TITLE:
return "ALT_TAB_EXPAND_TO_FIT_TITLE";
+ case META_PREF_ALT_TAB_RAISE_WINDOWS:
+ return "ALT_TAB_RAISE_WINDOWS";
+
case META_PREF_COMPOSITING_MANAGER:
return "COMPOSITING_MANAGER";
diff --git a/src/include/common.h b/src/include/common.h
index 3c768099..9febd63c 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -351,6 +351,7 @@ typedef enum
#define META_MIN_ALT_TAB_MAX_COLUMNS 1
#define META_MAX_ALT_TAB_MAX_COLUMNS 64
+#define META_DEFAULT_ALT_TAB_RAISE_WINDOWS FALSE
#define META_DEFAULT_ALT_TAB_EXPAND_TO_FIT_TITLE FALSE
#endif
diff --git a/src/include/prefs.h b/src/include/prefs.h
index 3fbb5f57..efb2242b 100644
--- a/src/include/prefs.h
+++ b/src/include/prefs.h
@@ -62,6 +62,7 @@ typedef enum
META_PREF_CURSOR_SIZE,
META_PREF_ICON_SIZE,
META_PREF_ALT_TAB_MAX_COLUMNS,
+ META_PREF_ALT_TAB_RAISE_WINDOWS,
META_PREF_ALT_TAB_EXPAND_TO_FIT_TITLE,
META_PREF_COMPOSITING_MANAGER,
META_PREF_COMPOSITING_FAST_ALT_TAB,
@@ -137,6 +138,7 @@ int meta_prefs_get_cursor_size (void);
int meta_prefs_get_icon_size (void);
int meta_prefs_get_alt_tab_max_columns (void);
gboolean meta_prefs_get_alt_tab_expand_to_fit_title (void);
+gboolean meta_prefs_get_alt_tab_raise_windows (void);
gboolean meta_prefs_get_compositing_manager (void);
gboolean meta_prefs_get_compositing_fast_alt_tab (void);
gboolean meta_prefs_get_center_new_windows (void);
diff --git a/src/org.mate.marco.gschema.xml b/src/org.mate.marco.gschema.xml
index def0e15f..a1297ad0 100644
--- a/src/org.mate.marco.gschema.xml
+++ b/src/org.mate.marco.gschema.xml
@@ -218,6 +218,11 @@
<summary>Expand the alt-tab popup window to fit longer window titles</summary>
<description>The popup window may be expanded up to the width determined by the config parameter 'alt-tab-max-columns'.</description>
</key>
+ <key name="alt-tab-raise-windows" type="b">
+ <default>false</default>
+ <summary>Raise windows to surface while cycling alt-tab popup</summary>
+ <description>While using the popup window, selected windows will be raised to make them easy to identify.</description>
+ </key>
</schema>
<schema id="org.mate.Marco.workspace-names" path="/org/mate/marco/workspace-names/">