Compare commits
2 Commits
citadel
...
wip/fmuell
Author | SHA1 | Date | |
---|---|---|---|
|
c43e8f41e8 | ||
|
8853408748 |
@ -38,6 +38,14 @@
|
||||
load all extensions regardless of the versions they claim to support.
|
||||
</description>
|
||||
</key>
|
||||
<key name="enable-hot-corners" type="b">
|
||||
<default>false</default>
|
||||
<summary>Enable hot corners</summary>
|
||||
<description>
|
||||
If true, the overview can be accessed by moving the mouse to the
|
||||
top-left corner.
|
||||
</description>
|
||||
</key>
|
||||
<key name="favorite-apps" type="as">
|
||||
<default>[ 'epiphany.desktop', 'evolution.desktop', 'rhythmbox.desktop', 'shotwell.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop' ]</default>
|
||||
<summary>List of desktop file IDs for favorite applications</summary>
|
||||
|
@ -6,6 +6,7 @@ const Signals = imports.signals;
|
||||
const Background = imports.ui.background;
|
||||
const BackgroundMenu = imports.ui.backgroundMenu;
|
||||
const LoginManager = imports.misc.loginManager;
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
|
||||
const DND = imports.ui.dnd;
|
||||
const Main = imports.ui.main;
|
||||
@ -19,6 +20,11 @@ var BACKGROUND_FADE_ANIMATION_TIME = 1.0;
|
||||
var HOT_CORNER_PRESSURE_THRESHOLD = 100; // pixels
|
||||
var HOT_CORNER_PRESSURE_TIMEOUT = 1000; // ms
|
||||
|
||||
// trigger attempts after which we offer to enable the corner
|
||||
var HOT_CORNER_TRIGGER_THRESHOLD = 2;
|
||||
// maximum time between trigger attempts
|
||||
var HOT_CORNER_TRIGGER_TIMEOUT = 1; // s
|
||||
|
||||
function isPopupMetaWindow(actor) {
|
||||
switch(actor.meta_window.get_window_type()) {
|
||||
case Meta.WindowType.DROPDOWN_MENU:
|
||||
@ -1091,6 +1097,11 @@ var HotCorner = class HotCorner {
|
||||
// multiple times due to an accidental jitter.
|
||||
this._entered = false;
|
||||
|
||||
// Count how often the disabled hot corner would have been triggered
|
||||
// in a particular interval; this is used to offer the user to enable
|
||||
// the corner when passing a threshold.
|
||||
this._triggerCount = 0;
|
||||
|
||||
this._monitor = monitor;
|
||||
|
||||
this._x = x;
|
||||
@ -1234,10 +1245,48 @@ var HotCorner = class HotCorner {
|
||||
this._animRipple(this._ripple3, 0.35, 1.0, 0.0, 0.3, 1);
|
||||
}
|
||||
|
||||
_resetTriggerTimeout() {
|
||||
if (this._triggerTimeoutId)
|
||||
GLib.source_remove(this._triggerTimeoutId);
|
||||
|
||||
this._triggerTimeoutId = GLib.timeout_add_seconds(
|
||||
GLib.PRIORITY_DEFAULT,
|
||||
HOT_CORNER_TRIGGER_TIMEOUT,
|
||||
() => {
|
||||
this._triggerCount = 0;
|
||||
|
||||
this._triggerTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
}
|
||||
|
||||
_showEnableNotification() {
|
||||
let source = new MessageTray.SystemNotificationSource();
|
||||
Main.messageTray.add(source);
|
||||
let notification = new MessageTray.Notification(source,
|
||||
_('Are you trying to access the activities overview?'),
|
||||
_('GNOME can open the overview every time the pointer is moved to the corner'));
|
||||
notification.setTransient(true);
|
||||
notification.addAction(_('Enable corner gesture'), () => {
|
||||
global.settings.set_boolean('enable-hot-corners', true);
|
||||
});
|
||||
source.notify(notification);
|
||||
}
|
||||
|
||||
_toggleOverview() {
|
||||
if (this._monitor.inFullscreen && !Main.overview.visible)
|
||||
return;
|
||||
|
||||
if (!global.settings.get_boolean('enable-hot-corners')) {
|
||||
this._resetTriggerTimeout();
|
||||
this._triggerCount++;
|
||||
|
||||
if (this._triggerCount >= HOT_CORNER_TRIGGER_THRESHOLD)
|
||||
this._showEnableNotification();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (Main.overview.shouldToggleByCornerOrButton()) {
|
||||
this._rippleAnimation();
|
||||
Main.overview.toggle();
|
||||
|
Loading…
Reference in New Issue
Block a user