mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Merge branch 'master' of https://github.com/jackwickham/dash-to-panel into jackwickham-master
This commit is contained in:
64
Settings.ui
64
Settings.ui
@@ -1263,6 +1263,70 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listbox_preview_middle_click_close">
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid_preview_middle_click_close">
|
||||
<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="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="preview_middle_click_close_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Middle click to close window</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>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="preview_middle_click_close_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="preview_middle_click_close_description">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Middle click on the preview to close the window.</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">40</property>
|
||||
<property name="xalign">0</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
5
prefs.js
5
prefs.js
@@ -443,6 +443,10 @@ const Settings = new Lang.Class({
|
||||
this._builder.get_object('listboxrow_peek_mode_opacity'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings.bind('preview-middle-click-close',
|
||||
this._builder.get_object('preview_middle_click_close_switch'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._builder.get_object('enter_peek_mode_timeout_spinbutton').set_value(this._settings.get_int('enter-peek-mode-timeout'));
|
||||
|
||||
@@ -467,6 +471,7 @@ const Settings = new Lang.Class({
|
||||
this._builder.get_object('enter_peek_mode_timeout_spinbutton').set_value(this._settings.get_int('enter-peek-mode-timeout'));
|
||||
this._settings.set_value('peek-mode-opacity', this._settings.get_default_value('peek-mode-opacity'));
|
||||
this._builder.get_object('peek_mode_opacity_spinbutton').set_value(this._settings.get_int('peek-mode-opacity'));
|
||||
this._settings.set_value('preview-middle-click-close', this._settings.get_default_value('preview-middle-click-close'));
|
||||
|
||||
} else {
|
||||
// remove the settings box so it doesn't get destroyed;
|
||||
|
||||
@@ -230,6 +230,11 @@
|
||||
<summary>Window peeking mode opacity</summary>
|
||||
<description>All windows except for the peeked one have their opacity set to the same value.</description>
|
||||
</key>
|
||||
<key type="b" name="preview-middle-click-close">
|
||||
<default>false</default>
|
||||
<summary>Middle click preview to close window</summary>
|
||||
<description>Middle click on the window preview to close that window</description>
|
||||
</key>
|
||||
<key type="i" name="tray-size">
|
||||
<default>0</default>
|
||||
<summary>Tray font size</summary>
|
||||
|
||||
101
windowPreview.js
101
windowPreview.js
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
|
||||
const BoxPointer = imports.ui.boxpointer;
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const GLib = imports.gi.GLib;
|
||||
const Gtk = imports.gi.Gtk;
|
||||
@@ -30,9 +31,12 @@ const Main = imports.ui.main;
|
||||
const Mainloop = imports.mainloop;
|
||||
const Meta = imports.gi.Meta;
|
||||
const PopupMenu = imports.ui.popupMenu;
|
||||
const RemoteMenu = imports.ui.remoteMenu;
|
||||
const Signals = imports.signals;
|
||||
const Shell = imports.gi.Shell;
|
||||
const St = imports.gi.St;
|
||||
const Tweener = imports.ui.tweener;
|
||||
const WindowMenu = imports.ui.windowMenu;
|
||||
const Workspace = imports.ui.workspace;
|
||||
const Shell = imports.gi.Shell;
|
||||
|
||||
@@ -559,6 +563,8 @@ const thumbnailPreview = new Lang.Class({
|
||||
Lang.bind(this, this._onLeave));
|
||||
this.actor.connect('motion-event',
|
||||
Lang.bind(this, this._onMotionEvent));
|
||||
|
||||
this._previewMenuPopupManager = new previewMenuPopupManager(window, this.actor);
|
||||
},
|
||||
|
||||
_onEnter: function(actor, event) {
|
||||
@@ -779,6 +785,37 @@ const thumbnailPreview = new Lang.Class({
|
||||
}));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_onButtonReleaseEvent: function(actor, event) {
|
||||
this.actor.remove_style_pseudo_class ('active');
|
||||
switch (event.get_button()) {
|
||||
case 1:
|
||||
// Left click
|
||||
this.activate(event);
|
||||
break;
|
||||
case 2:
|
||||
// Middle click
|
||||
if (this._getTopMenu()._dtpSettings.get_boolean('preview-middle-click-close')) {
|
||||
this._closeWindow();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// Right click
|
||||
this.showContextMenu(event);
|
||||
break;
|
||||
}
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
|
||||
showContextMenu: function(event) {
|
||||
let coords = event.get_coords();
|
||||
this._previewMenuPopupManager.showWindowMenuForWindow({
|
||||
x: coords[0],
|
||||
y: coords[1],
|
||||
width: 0,
|
||||
height: 0
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1043,3 +1080,67 @@ const thumbnailPreviewList = new Lang.Class({
|
||||
return windowA.get_stable_sequence() > windowB.get_stable_sequence();
|
||||
}
|
||||
});
|
||||
|
||||
const previewMenuPopup = new Lang.Class({
|
||||
Name: 'previewMenuPopup',
|
||||
Extends: WindowMenu.WindowMenu,
|
||||
|
||||
_init: function(window, sourceActor) {
|
||||
this.parent(window, sourceActor);
|
||||
|
||||
let side = Taskbar.getPosition();
|
||||
this._arrowSide = side;
|
||||
this._boxPointer._arrowSide = side;
|
||||
this._boxPointer._userArrowSide = side;
|
||||
}
|
||||
|
||||
// Otherwise, just let the parent do its thing?
|
||||
});
|
||||
|
||||
const previewMenuPopupManager = new Lang.Class({
|
||||
Name: 'previewMenuPopupManagerTest',
|
||||
|
||||
_init: function(window, source) {
|
||||
this._manager = new PopupMenu.PopupMenuManager({ actor: Main.layoutManager.dummyCursor });
|
||||
|
||||
this._sourceActor = new St.Widget({ reactive: true, visible: false });
|
||||
this._sourceActor.connect('button-press-event', Lang.bind(this,
|
||||
function() {
|
||||
this._manager.activeMenu.toggle();
|
||||
}));
|
||||
Main.uiGroup.add_actor(this._sourceActor);
|
||||
|
||||
this.window = window;
|
||||
},
|
||||
|
||||
showWindowMenuForWindow: function(rect) {
|
||||
let menu = new previewMenuPopup(this.window, this._sourceActor);
|
||||
let window = this.window;
|
||||
|
||||
this._manager.addMenu(menu);
|
||||
|
||||
menu.connect('activate', function() {
|
||||
window.check_alive(global.get_current_time());
|
||||
});
|
||||
let destroyId = window.connect('unmanaged',
|
||||
function() {
|
||||
menu.close();
|
||||
});
|
||||
|
||||
this._sourceActor.set_size(Math.max(1, rect.width), Math.max(1, rect.height));
|
||||
this._sourceActor.set_position(rect.x, rect.y);
|
||||
|
||||
this._sourceActor.show();
|
||||
|
||||
menu.open(BoxPointer.PopupAnimation.NONE);
|
||||
menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||
menu.connect('open-state-changed', Lang.bind(this, function(menu_, isOpen) {
|
||||
if (isOpen)
|
||||
return;
|
||||
|
||||
this._sourceActor.hide();
|
||||
menu.destroy();
|
||||
window.disconnect(destroyId);
|
||||
}));
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user