Better super key filter in multitasking view (#1523)

Co-authored-by: Ryan Kornheisl <ryan@skarva.tech>
This commit is contained in:
Leo 2023-02-05 14:01:09 +09:00 committed by GitHub
parent 40c7b5b4ca
commit bef947e1b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,7 @@ namespace Gala {
*/
public class MultitaskingView : Actor, ActivatableComponent {
public const int ANIMATION_DURATION = 250;
private const string OPEN_MULTITASKING_VIEW = "dbus-send --session --dest=org.pantheon.gala --print-reply /org/pantheon/gala org.pantheon.gala.PerformAction int32:1";
private GestureTracker multitasking_gesture_tracker;
private GestureTracker workspace_gesture_tracker;
@ -45,11 +46,15 @@ namespace Gala {
Actor workspaces;
Actor dock_clones;
private GLib.Settings gala_behavior_settings;
public MultitaskingView (WindowManager wm) {
Object (wm: wm);
}
construct {
gala_behavior_settings = new GLib.Settings ("org.pantheon.desktop.gala.behavior");
visible = false;
reactive = true;
clip_to_allocation = true;
@ -777,11 +782,17 @@ namespace Gala {
bool keybinding_filter (KeyBinding binding) {
var action = Prefs.get_keybinding_action (binding.get_name ());
// allow super key only when it toggles multitasking view
if (action == KeyBindingAction.OVERLAY_KEY &&
gala_behavior_settings.get_string ("overlay-action") == OPEN_MULTITASKING_VIEW) {
return false;
}
switch (action) {
case KeyBindingAction.WORKSPACE_LEFT:
case KeyBindingAction.WORKSPACE_RIGHT:
case KeyBindingAction.SHOW_DESKTOP:
case KeyBindingAction.OVERLAY_KEY:
case KeyBindingAction.NONE:
return false;
default: