Skip to content

Commit 3ea82c2

Browse files
authored
Merge branch 'main' into lenemter/fix-dock
2 parents 1891276 + 3ca07f8 commit 3ea82c2

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

src/ShellClients/HideTracker.vala

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class Gala.HideTracker : Object {
1515
public unowned PanelWindow panel { get; construct; }
1616
public Pantheon.Desktop.HideMode hide_mode { get; set; default = NEVER; }
1717

18+
private Clutter.PanAction pan_action;
19+
1820
private bool hovered = false;
1921

2022
private bool overlap = false;
@@ -60,6 +62,15 @@ public class Gala.HideTracker : Object {
6062
});
6163

6264
display.get_workspace_manager ().active_workspace_changed.connect (schedule_update);
65+
66+
pan_action = new Clutter.PanAction () {
67+
n_touch_points = 1,
68+
pan_axis = X_AXIS
69+
};
70+
pan_action.gesture_begin.connect (check_valid_gesture);
71+
pan_action.pan.connect (on_pan);
72+
73+
display.get_stage ().add_action_full ("panel-swipe-gesture", CAPTURE, pan_action);
6374
}
6475

6576
//Can be removed with mutter > 45
@@ -184,7 +195,7 @@ public class Gala.HideTracker : Object {
184195
hovered = window_has_pointer () && window_actor.visible;
185196
#endif
186197

187-
if (should_hide && !hovered) {
198+
if (should_hide && !hovered && !panel.window.has_focus ()) {
188199
// Don't hide if we have transients, e.g. an open popover, dialog, etc.
189200
var has_transients = false;
190201
panel.window.foreach_transient (() => {
@@ -201,4 +212,33 @@ public class Gala.HideTracker : Object {
201212
show ();
202213
}
203214
}
215+
216+
private bool check_valid_gesture () {
217+
if (panel.anchor != BOTTOM) {
218+
debug ("Swipe to reveal is currently only supported for bottom anchors");
219+
return false;
220+
}
221+
222+
float y;
223+
pan_action.get_press_coords (0, null, out y);
224+
225+
var monitor_geom = display.get_monitor_geometry (panel.window.get_monitor ());
226+
if ((y - monitor_geom.y - monitor_geom.height).abs () < 50) { // Only start if the gesture starts near the bottom of the monitor
227+
return true;
228+
}
229+
230+
return false;
231+
}
232+
233+
private bool on_pan () {
234+
float delta_y;
235+
pan_action.get_motion_delta (0, null, out delta_y);
236+
237+
if (delta_y < 0) { // Only allow swipes upwards
238+
panel.window.focus (pan_action.get_last_event (0).get_time ());
239+
show ();
240+
}
241+
242+
return false;
243+
}
204244
}

0 commit comments

Comments
 (0)