mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-06-28 13:10:05 +00:00
Make pressure barrier optional (false by default for now)
Set to false until we can figure out a good way to get it to work for multiple monitors.
This commit is contained in:
Binary file not shown.
@@ -221,6 +221,11 @@
|
||||
<summary>Replace the Activities text with the current workspace name</summary>
|
||||
</key>
|
||||
|
||||
<key type="b" name="pressure-barrier">
|
||||
<default>false</default>
|
||||
<summary>Enable pressure barriers at the monitor edges</summary>
|
||||
</key>
|
||||
|
||||
<key type="as" name="workspace-colors">
|
||||
<default><![CDATA[['#314E6C', '#565248', '#445632', '#663822',
|
||||
'#494066', '#826647', '#4B6983', '#807D74', '#5D7555', '#884631',
|
||||
|
||||
@@ -19,8 +19,9 @@ var KEYBINDINGS_KEY = 'org.gnome.Shell.Extensions.PaperWM.Keybindings';
|
||||
var META_KEY_ABOVE_TAB = 0x2f7259c9;
|
||||
|
||||
var prefs = {};
|
||||
['window-gap', 'vertical-margin', 'horizontal-margin',
|
||||
'workspace-colors', 'default-background', 'animation-time', 'use-workspace-name' ]
|
||||
['window-gap', 'vertical-margin', 'horizontal-margin', 'workspace-colors',
|
||||
'default-background', 'animation-time', 'use-workspace-name',
|
||||
'pressure-barrier']
|
||||
.forEach((k) => setState(null, k));
|
||||
|
||||
function setVerticalMargin() {
|
||||
|
||||
@@ -11,7 +11,8 @@ var utils = Extension.imports.utils;
|
||||
var debug = utils.debug;
|
||||
var Minimap = Extension.imports.minimap;
|
||||
|
||||
var prefs = Extension.imports.settings.prefs;
|
||||
var Settings = Extension.imports.settings;
|
||||
var prefs = Settings.prefs;
|
||||
|
||||
/*
|
||||
The stack overlay decorates the top stacked window with its icon and
|
||||
@@ -142,13 +143,11 @@ class ClickOverlay {
|
||||
this.signals.destroy();
|
||||
for (let overlay of [this.left, this.right]) {
|
||||
let actor = overlay.overlay;
|
||||
[overlay.pressId, overlay.releaseId, overlay.enterId,
|
||||
overlay.leaveId].forEach(id => actor.disconnect(id));
|
||||
overlay.signals.destroy();
|
||||
if (overlay.clone)
|
||||
overlay.clone.destroy();
|
||||
actor.destroy();
|
||||
overlay.removeBarrier();
|
||||
overlay.pressureBarrier.destroy();
|
||||
}
|
||||
this.enterMonitor.destroy();
|
||||
}
|
||||
@@ -176,28 +175,19 @@ var StackOverlay = new Lang.Class({
|
||||
overlay.height = this.monitor.height - panelBox.height - prefs.vertical_margin;
|
||||
overlay.width = Tiling.stack_margin;
|
||||
|
||||
this.pressId = overlay.connect('button-release-event', () => {
|
||||
this.signals = new utils.Signals();
|
||||
this.signals.connect(overlay, 'button-release-event', () => {
|
||||
Main.activateWindow(this.target);
|
||||
if (this.clone)
|
||||
this.clone.destroy();
|
||||
return true;
|
||||
});
|
||||
|
||||
this.enterId = overlay.connect('enter-event', this.triggerPreview.bind(this));
|
||||
this.leaveId = overlay.connect('leave-event', this.removePreview.bind(this));
|
||||
this.signals.connect(overlay, 'enter-event', this.triggerPreview.bind(this));
|
||||
this.signals.connect(overlay,'leave-event', this.removePreview.bind(this));
|
||||
this.signals.connect(Settings.settings, 'changed::pressure-barrier',
|
||||
this.updateBarrier.bind(this, true));
|
||||
|
||||
const Layout = imports.ui.layout;
|
||||
this.pressureBarrier = new Layout.PressureBarrier(100, 0.25*1000, Shell.ActionMode.NORMAL);
|
||||
// Show the overlay on fullscreen windows when applying pressure to the edge
|
||||
// The above leave-event handler will take care of hiding the overlay
|
||||
this.pressureBarrier.connect('trigger', () => {
|
||||
this.pressureBarrier._reset();
|
||||
this.pressureBarrier._isTriggered = false;
|
||||
if (this._removeBarrierTimeoutId > 0)
|
||||
Mainloop.source_remove(this._removeBarrierTimeoutId);
|
||||
this._removeBarrierTimeoutId = Mainloop.timeout_add(100, this.removeBarrier.bind(this));
|
||||
overlay.show();
|
||||
});
|
||||
this.updateBarrier();
|
||||
|
||||
global.window_group.add_child(overlay);
|
||||
@@ -254,15 +244,32 @@ var StackOverlay = new Lang.Class({
|
||||
if (this.pressureBarrier)
|
||||
this.pressureBarrier.removeBarrier(this.barrier);
|
||||
this.barrier.destroy();
|
||||
this.pressureBarrier.destroy();
|
||||
this.barrier = null;
|
||||
}
|
||||
this._removeBarrierTimeoutId = 0;
|
||||
},
|
||||
|
||||
updateBarrier: function() {
|
||||
if (this.barrier)
|
||||
updateBarrier: function(force) {
|
||||
if (force)
|
||||
this.removeBarrier();
|
||||
|
||||
if (this.barrier || !prefs.pressure_barrier)
|
||||
return;
|
||||
|
||||
const Layout = imports.ui.layout;
|
||||
this.pressureBarrier = new Layout.PressureBarrier(100, 0.25*1000, Shell.ActionMode.NORMAL);
|
||||
// Show the overlay on fullscreen windows when applying pressure to the edge
|
||||
// The above leave-event handler will take care of hiding the overlay
|
||||
this.pressureBarrier.connect('trigger', () => {
|
||||
this.pressureBarrier._reset();
|
||||
this.pressureBarrier._isTriggered = false;
|
||||
if (this._removeBarrierTimeoutId > 0)
|
||||
Mainloop.source_remove(this._removeBarrierTimeoutId);
|
||||
this._removeBarrierTimeoutId = Mainloop.timeout_add(100, this.removeBarrier.bind(this));
|
||||
overlay.show();
|
||||
});
|
||||
|
||||
const overlay = this.overlay;
|
||||
let workArea = Main.layoutManager.getWorkAreaForMonitor(this.monitor.index);
|
||||
let monitor = this.monitor;
|
||||
|
||||
Reference in New Issue
Block a user