mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Merge branch 'overview-click-exit'
This commit is contained in:
45
Settings.ui
45
Settings.ui
@@ -6217,6 +6217,51 @@
|
||||
</child>
|
||||
</object>
|
||||
</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>
|
||||
<object class="GtkListBoxRow" id="group_apps_row">
|
||||
<property name="width_request">100</property>
|
||||
|
||||
142
overview.js
142
overview.js
@@ -32,16 +32,22 @@ const Gtk = imports.gi.Gtk;
|
||||
const Gdk = imports.gi.Gdk;
|
||||
const Gio = imports.gi.Gio;
|
||||
const Mainloop = imports.mainloop;
|
||||
const IconGrid = imports.ui.iconGrid;
|
||||
const ViewSelector = imports.ui.viewSelector;
|
||||
|
||||
const Meta = imports.gi.Meta;
|
||||
|
||||
const GS_HOTKEYS_KEY = 'switch-to-application-';
|
||||
|
||||
//timeout names
|
||||
const T1 = 'swipeEndTimeout';
|
||||
|
||||
var dtpOverview = Utils.defineClass({
|
||||
Name: 'DashToPanel.Overview',
|
||||
|
||||
_init: function() {
|
||||
this._numHotkeys = 10;
|
||||
this._timeoutsHandler = new Utils.TimeoutsHandler();
|
||||
},
|
||||
|
||||
enable : function(panel) {
|
||||
@@ -54,8 +60,9 @@ var dtpOverview = Utils.defineClass({
|
||||
this._optionalWorkspaceIsolation();
|
||||
this._optionalHotKeys();
|
||||
this._optionalNumberOverlay();
|
||||
this._optionalClickToExit();
|
||||
this._toggleDash();
|
||||
|
||||
|
||||
this._signalsHandler.add([
|
||||
Me.settings,
|
||||
'changed::stockgs-keep-dash',
|
||||
@@ -72,6 +79,7 @@ var dtpOverview = Utils.defineClass({
|
||||
// Remove key bindings
|
||||
this._disableHotKeys();
|
||||
this._disableExtraShortcut();
|
||||
this._disableClickToExit();
|
||||
},
|
||||
|
||||
_toggleDash: function(visible) {
|
||||
@@ -390,5 +398,137 @@ var dtpOverview = Utils.defineClass({
|
||||
|
||||
this._panel.intellihide.release(Intellihide.Hold.TEMPORARY);
|
||||
}));
|
||||
},
|
||||
|
||||
_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() {
|
||||
this._appPageSwiping = true;
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
_onAppPageSwipeEnd: function() {
|
||||
this._timeoutsHandler.add([
|
||||
T1,
|
||||
0,
|
||||
() => this._appPageSwiping = false
|
||||
]);
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
});
|
||||
|
||||
5
prefs.js
5
prefs.js
@@ -1377,6 +1377,11 @@ const Settings = new Lang.Class({
|
||||
'active',
|
||||
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._builder.get_object('group_apps_switch'),
|
||||
'active',
|
||||
|
||||
@@ -536,6 +536,11 @@
|
||||
<default>false</default>
|
||||
<summary>Provide workspace isolation</summary>
|
||||
<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 type="b" name="group-apps">
|
||||
<default>true</default>
|
||||
|
||||
Reference in New Issue
Block a user