mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-15 00:34:05 +09:00
finish overview click-to-exit feature
This commit is contained in:
45
Settings.ui
45
Settings.ui
@@ -6125,6 +6125,51 @@
|
|||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBoxRow" id="clicktoexit_row">
|
||||||
|
<property name="width_request">100</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="clicktoexit_grid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">12</property>
|
||||||
|
<property name="margin_right">12</property>
|
||||||
|
<property name="margin_top">12</property>
|
||||||
|
<property name="margin_bottom">12</property>
|
||||||
|
<property name="row_spacing">6</property>
|
||||||
|
<property name="column_spacing">32</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="clicktoexit_switch">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="clicktoexit_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="label" translatable="yes">Click empty space to close overview</property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBoxRow" id="group_apps_row">
|
<object class="GtkListBoxRow" id="group_apps_row">
|
||||||
<property name="width_request">100</property>
|
<property name="width_request">100</property>
|
||||||
|
|||||||
189
overview.js
189
overview.js
@@ -33,6 +33,7 @@ const Gdk = imports.gi.Gdk;
|
|||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const IconGrid = imports.ui.iconGrid;
|
const IconGrid = imports.ui.iconGrid;
|
||||||
|
const ViewSelector = imports.ui.viewSelector;
|
||||||
|
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
|
|
||||||
@@ -59,70 +60,9 @@ var dtpOverview = Utils.defineClass({
|
|||||||
this._optionalWorkspaceIsolation();
|
this._optionalWorkspaceIsolation();
|
||||||
this._optionalHotKeys();
|
this._optionalHotKeys();
|
||||||
this._optionalNumberOverlay();
|
this._optionalNumberOverlay();
|
||||||
|
this._optionalClickToExit();
|
||||||
this._toggleDash();
|
this._toggleDash();
|
||||||
|
|
||||||
Main.overview._overview.reactive = true;
|
|
||||||
|
|
||||||
this._clickAction = new Clutter.ClickAction();
|
|
||||||
this._clickAction.connect('clicked', (obj, obj2) => {
|
|
||||||
|
|
||||||
if(this._appPageSwiping)
|
|
||||||
return;
|
|
||||||
|
|
||||||
let visibleView;
|
|
||||||
Main.overview.viewSelector.appDisplay._views.every(function(v, index) {
|
|
||||||
if (v.view.actor.visible) {
|
|
||||||
visibleView = index;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
if(Main.overview.viewSelector._showAppsButton.checked) {
|
|
||||||
if(Me.settings.get_boolean('animate-show-apps')) {
|
|
||||||
let view = Main.overview.viewSelector.appDisplay._views[visibleView].view;
|
|
||||||
view.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this, function() {
|
|
||||||
Main.overview.viewSelector._appsPage.hide();
|
|
||||||
Main.overview.hide();
|
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
Main.overview.hide();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Main.overview.toggle();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Main.overview._overview.add_action(this._clickAction);
|
|
||||||
|
|
||||||
|
|
||||||
if(Main.overview.viewSelector.appDisplay._views[1].view._swipeTracker) {
|
|
||||||
this._signalsHandler.add([
|
|
||||||
Main.overview.viewSelector.appDisplay._views[1].view._swipeTracker,
|
|
||||||
'begin',
|
|
||||||
Lang.bind(this, this._onAppPageSwipeBegin)
|
|
||||||
],[
|
|
||||||
Main.overview.viewSelector.appDisplay._views[1].view._swipeTracker,
|
|
||||||
'end',
|
|
||||||
Lang.bind(this, this._onAppPageSwipeEnd)
|
|
||||||
]);
|
|
||||||
} else if(Main.overview.viewSelector.appDisplay._views[1].view._panAction) {
|
|
||||||
this._signalsHandler.add([
|
|
||||||
Main.overview.viewSelector.appDisplay._views[1].view._panAction,
|
|
||||||
'gesture-begin',
|
|
||||||
Lang.bind(this, this._onAppPageSwipeBegin)
|
|
||||||
],[
|
|
||||||
Main.overview.viewSelector.appDisplay._views[1].view._panAction,
|
|
||||||
'gesture-cancel',
|
|
||||||
Lang.bind(this, this._onAppPageSwipeEnd)
|
|
||||||
],[
|
|
||||||
Main.overview.viewSelector.appDisplay._views[1].view._panAction,
|
|
||||||
'gesture-end',
|
|
||||||
Lang.bind(this, this._onAppPageSwipeEnd)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._signalsHandler.add([
|
this._signalsHandler.add([
|
||||||
Me.settings,
|
Me.settings,
|
||||||
'changed::stockgs-keep-dash',
|
'changed::stockgs-keep-dash',
|
||||||
@@ -133,14 +73,13 @@ var dtpOverview = Utils.defineClass({
|
|||||||
disable: function () {
|
disable: function () {
|
||||||
this._signalsHandler.destroy();
|
this._signalsHandler.destroy();
|
||||||
this._injectionsHandler.destroy();
|
this._injectionsHandler.destroy();
|
||||||
|
|
||||||
Main.overview._overview.remove_action(this._clickAction);
|
|
||||||
|
|
||||||
this._toggleDash(true);
|
this._toggleDash(true);
|
||||||
|
|
||||||
// Remove key bindings
|
// Remove key bindings
|
||||||
this._disableHotKeys();
|
this._disableHotKeys();
|
||||||
this._disableExtraShortcut();
|
this._disableExtraShortcut();
|
||||||
|
this._disableClickToExit();
|
||||||
},
|
},
|
||||||
|
|
||||||
_toggleDash: function(visible) {
|
_toggleDash: function(visible) {
|
||||||
@@ -461,9 +400,127 @@ var dtpOverview = Utils.defineClass({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_optionalClickToExit: function() {
|
||||||
|
this._clickToExitEnabled = false;
|
||||||
|
if (Me.settings.get_boolean('overview-click-to-exit'))
|
||||||
|
this._enableClickToExit();
|
||||||
|
|
||||||
|
this._signalsHandler.add([
|
||||||
|
Me.settings,
|
||||||
|
'changed::overview-click-to-exit',
|
||||||
|
Lang.bind(this, function() {
|
||||||
|
if (Me.settings.get_boolean('overview-click-to-exit'))
|
||||||
|
Lang.bind(this, this._enableClickToExit)();
|
||||||
|
else
|
||||||
|
Lang.bind(this, this._disableClickToExit)();
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_enableClickToExit: function() {
|
||||||
|
if (this._clickToExitEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._oldOverviewReactive = Main.overview._overview.reactive
|
||||||
|
|
||||||
|
Main.overview._overview.reactive = true;
|
||||||
|
|
||||||
|
this._clickAction = new Clutter.ClickAction();
|
||||||
|
this._clickAction.connect('clicked', () => {
|
||||||
|
|
||||||
|
if(this._appPageSwiping)
|
||||||
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
|
|
||||||
|
let [x, y] = global.get_pointer();
|
||||||
|
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
|
||||||
|
|
||||||
|
let activePage = Main.overview.viewSelector.getActivePage();
|
||||||
|
if (activePage == ViewSelector.ViewPage.APPS) {
|
||||||
|
|
||||||
|
if(pickedActor != Main.overview._overview
|
||||||
|
&& pickedActor != Main.overview.viewSelector.appDisplay._views[1].view._scrollView
|
||||||
|
&& pickedActor != Main.overview.viewSelector.appDisplay._views[1].view._grid) {
|
||||||
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
let visibleView;
|
||||||
|
Main.overview.viewSelector.appDisplay._views.every(function(v, index) {
|
||||||
|
if (v.view.actor.visible) {
|
||||||
|
visibleView = index;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if(Me.settings.get_boolean('animate-show-apps')) {
|
||||||
|
let view = Main.overview.viewSelector.appDisplay._views[visibleView].view;
|
||||||
|
view.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this, function() {
|
||||||
|
Main.overview.viewSelector._appsPage.hide();
|
||||||
|
Main.overview.hide();
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
Main.overview.hide();
|
||||||
|
}
|
||||||
|
} else if (activePage == ViewSelector.ViewPage.WINDOWS) {
|
||||||
|
|
||||||
|
if(pickedActor == Main.overview._overview._controls._thumbnailsBox
|
||||||
|
|| pickedActor == Main.overview._overview._controls.dash._container) {
|
||||||
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
}
|
||||||
|
Main.overview.toggle();
|
||||||
|
} else {
|
||||||
|
Main.overview.toggle();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Main.overview._overview.add_action(this._clickAction);
|
||||||
|
|
||||||
|
|
||||||
|
if(Main.overview.viewSelector.appDisplay._views[1].view._swipeTracker) {
|
||||||
|
this._signalsHandler.addWithLabel('clickToExit', [
|
||||||
|
Main.overview.viewSelector.appDisplay._views[1].view._swipeTracker,
|
||||||
|
'begin',
|
||||||
|
Lang.bind(this, this._onAppPageSwipeBegin)
|
||||||
|
],[
|
||||||
|
Main.overview.viewSelector.appDisplay._views[1].view._swipeTracker,
|
||||||
|
'end',
|
||||||
|
Lang.bind(this, this._onAppPageSwipeEnd)
|
||||||
|
]);
|
||||||
|
} else if(Main.overview.viewSelector.appDisplay._views[1].view._panAction) {
|
||||||
|
this._signalsHandler.addWithLabel('clickToExit', [
|
||||||
|
Main.overview.viewSelector.appDisplay._views[1].view._panAction,
|
||||||
|
'gesture-begin',
|
||||||
|
Lang.bind(this, this._onAppPageSwipeBegin)
|
||||||
|
],[
|
||||||
|
Main.overview.viewSelector.appDisplay._views[1].view._panAction,
|
||||||
|
'gesture-cancel',
|
||||||
|
Lang.bind(this, this._onAppPageSwipeEnd)
|
||||||
|
],[
|
||||||
|
Main.overview.viewSelector.appDisplay._views[1].view._panAction,
|
||||||
|
'gesture-end',
|
||||||
|
Lang.bind(this, this._onAppPageSwipeEnd)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._clickToExitEnabled = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
_disableClickToExit: function () {
|
||||||
|
if(!this._clickToExitEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Main.overview._overview.remove_action(this._clickAction);
|
||||||
|
Main.overview._overview.reactive = this._oldOverviewReactive;
|
||||||
|
|
||||||
|
this._signalsHandler.removeWithLabel('clickToExit');
|
||||||
|
|
||||||
|
this._clickToExitEnabled = false;
|
||||||
|
},
|
||||||
|
|
||||||
_onAppPageSwipeBegin: function() {
|
_onAppPageSwipeBegin: function() {
|
||||||
this._appPageSwiping = true;
|
this._appPageSwiping = true;
|
||||||
return true;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAppPageSwipeEnd: function() {
|
_onAppPageSwipeEnd: function() {
|
||||||
@@ -472,6 +529,6 @@ var dtpOverview = Utils.defineClass({
|
|||||||
0,
|
0,
|
||||||
() => this._appPageSwiping = false
|
() => this._appPageSwiping = false
|
||||||
]);
|
]);
|
||||||
return true;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
5
prefs.js
5
prefs.js
@@ -1355,6 +1355,11 @@ const Settings = new Lang.Class({
|
|||||||
'active',
|
'active',
|
||||||
Gio.SettingsBindFlags.DEFAULT);
|
Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
|
||||||
|
this._settings.bind('overview-click-to-exit',
|
||||||
|
this._builder.get_object('clicktoexit_switch'),
|
||||||
|
'active',
|
||||||
|
Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
|
||||||
this._settings.bind('group-apps',
|
this._settings.bind('group-apps',
|
||||||
this._builder.get_object('group_apps_switch'),
|
this._builder.get_object('group_apps_switch'),
|
||||||
'active',
|
'active',
|
||||||
|
|||||||
@@ -526,6 +526,11 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<summary>Provide workspace isolation</summary>
|
<summary>Provide workspace isolation</summary>
|
||||||
<description>Dash shows only windows from the current workspace</description>
|
<description>Dash shows only windows from the current workspace</description>
|
||||||
|
</key>
|
||||||
|
<key type="b" name="overview-click-to-exit">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Close overview by clicking in empty space</summary>
|
||||||
|
<description>Close overview or app grid by clicking in empty space</description>
|
||||||
</key>
|
</key>
|
||||||
<key type="b" name="group-apps">
|
<key type="b" name="group-apps">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
|
|||||||
Reference in New Issue
Block a user