Skip to content

Commit

Permalink
Merge branch 'develop' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
jtaala committed Aug 2, 2024
2 parents a21aa55 + 4d1bcd5 commit fd31a03
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 8 deletions.
52 changes: 51 additions & 1 deletion Settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
<property name="lower">0.00</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.1</property>
</object>
<object class="GtkAdjustment" id="drift_speed_adjustment">
<property name="upper">15</property>
<property name="lower">0</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="drag_drift_speed_adjustment">
<property name="upper">15</property>
Expand Down Expand Up @@ -1254,6 +1260,50 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">False</property>
<property name="focusable">False</property>
<child>
<object class="GtkGrid">
<property name="focusable">False</property>
<property name="tooltip_text" translatable="yes">Sets the drift speed (px/ms) when using "drifting view to the left/right" keybinds.</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel">
<property name="focusable">False</property>
<property name="hexpand">1</property>
<property name="label" translatable="yes">Drift speed (px/ms) when using "viewport drift" keybinds</property>
<property name="use_markup">1</property>
<property name="xalign">0</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkSpinButton" id="drift_speed_spin">
<property name="width_chars">3</property>
<property name="max_width_chars">3</property>
<property name="adjustment">drift_speed_adjustment</property>
<property name="numeric">1</property>
<property name="snap_to_ticks">1</property>
<property name="update_policy">always</property>
<layout>
<property name="column">1</property>
<property name="row">0</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">False</property>
Expand All @@ -1271,7 +1321,7 @@
<object class="GtkLabel">
<property name="focusable">False</property>
<property name="hexpand">1</property>
<property name="label" translatable="yes">Window drag (at edge) drift speed (px/ms)</property>
<property name="label" translatable="yes">Drift speed (px/ms) when dragging windows (at edge)</property>
<property name="use_markup">1</property>
<property name="xalign">0</property>
<layout>
Expand Down
2 changes: 1 addition & 1 deletion gestures.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export function update(space, dx, t) {
space.cloneContainer.x -= dx;
space.targetX = space.cloneContainer.x;

// Check which target windew will be selected if we releas the swipe at this
// Check which target window will be selected if we release the swipe at this
// moment
dx = Lib.sum(dxs.slice(-3));
let v = dx / (t - dts.slice(-3)[0]);
Expand Down
9 changes: 5 additions & 4 deletions keybindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ export function setupActions(settings) {
registerMinimapAction("switch-up", (mw, space) => space.switchUp(false));
registerMinimapAction("switch-down", (mw, space) => space.switchDown(false));

registerNavigatorAction("drift-left", (mw, space) => space.driftLeft());
registerNavigatorAction("drift-right", (mw, space) => space.driftRight());

registerMinimapAction("switch-right-loop", (mw, space) => space.switchRight(true));
registerMinimapAction("switch-left-loop", (mw, space) => space.switchLeft(true));
registerMinimapAction("switch-up-loop", (mw, space) => space.switchUp(true));
Expand All @@ -207,7 +210,6 @@ export function setupActions(settings) {
registerNavigatorAction("switch-down-or-else-workspace", Tiling.switchDownOrElseWorkspace);

registerMinimapAction("switch-first", Tiling.activateFirstWindow);

registerMinimapAction("switch-second", (mw, space) => Tiling.activateNthWindow(1, space));
registerMinimapAction("switch-third", (mw, space) => Tiling.activateNthWindow(2, space));
registerMinimapAction("switch-fourth", (mw, space) => Tiling.activateNthWindow(3, space));
Expand All @@ -218,7 +220,6 @@ export function setupActions(settings) {
registerMinimapAction("switch-ninth", (mw, space) => Tiling.activateNthWindow(8, space));
registerMinimapAction("switch-tenth", (mw, space) => Tiling.activateNthWindow(9, space));
registerMinimapAction("switch-eleventh", (mw, space) => Tiling.activateNthWindow(10, space));

registerMinimapAction("switch-last", Tiling.activateLastWindow);

registerMinimapAction("switch-global-right", (mw, space) => space.switchGlobalRight());
Expand Down Expand Up @@ -383,7 +384,7 @@ export function impliedOptions(options) {
export function registerAction(actionName, handler, options) {
options = impliedOptions(options);

let {
const {
settings,
opensNavigator,
} = options;
Expand All @@ -399,7 +400,7 @@ export function registerAction(actionName, handler, options) {
// actionId, mutterName and keyHandler will be set if/when the action is bound
}

let action = {
const action = {
id: Meta.KeyBindingAction.NONE,
name: actionName,
mutterName,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"url": "https://github.com/paperwm/PaperWM",
"settings-schema": "org.gnome.shell.extensions.paperwm",
"shell-version": [ "45", "46" ],
"version-name": "46.14.0",
"version-name": "46.15.0",
"donations": {
"buymeacoffee": "jaytaala",
"patreon": "valpackett"
Expand Down
12 changes: 12 additions & 0 deletions navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class ActionDispatcher {
this.signals.connect(this.actor, 'key-release-event', this._keyReleaseEvent.bind(this));

this.keyPressCallbacks = [];
this.keyReleaseCallbacks = [];

this._noModsTimeoutId = null;
this._doActionTimeout = null;
Expand All @@ -103,6 +104,16 @@ class ActionDispatcher {
*/
addKeypressCallback(handler) {
this.keyPressCallbacks.push(handler);
return this;
}

/**
* Adds a signal to this dispatcher. Will be destroyed when this
* dispatcher is destroyed.
*/
addKeyReleaseCallback(handler) {
this.keyReleaseCallbacks.push(handler);
return this;
}

show(_backward, binding, mask) {
Expand Down Expand Up @@ -198,6 +209,7 @@ class ActionDispatcher {
this._resetNoModsTimeout();
}

this.keyReleaseCallbacks.forEach(callback => callback());
return Clutter.EVENT_STOP;
}

Expand Down
1 change: 1 addition & 0 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ class SettingsWidget {
hFric.connect('value-changed', fricChanged);

doubleValueChanged('animation_time_spin', 'animation-time');
intValueChanged('drift_speed_spin', 'drift-speed');
intValueChanged('drag_drift_speed_spin', 'drag-drift-speed');
percentValueChanged('minimap_scale_spin', 'minimap-scale');
percentValueChanged('window_switcher_preview_scale_spin', 'window-switcher-preview-scale');
Expand Down
2 changes: 2 additions & 0 deletions prefsKeybinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const actions = {
'switch-right-loop',
'switch-up-loop',
'switch-down-loop',
'drift-left',
'drift-right',
'switch-global-left',
'switch-global-right',
'switch-global-up',
Expand Down
Binary file modified schemas/gschemas.compiled
Binary file not shown.
15 changes: 15 additions & 0 deletions schemas/org.gnome.shell.extensions.paperwm.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@
<default><![CDATA[['<Super>Left']]]></default>
<summary>Switch to the left window</summary>
</key>

<key type="as" name="drift-left">
<default><![CDATA[['<Ctrl><Shift>Left']]]></default>
<summary>Drift tiling viewport to the left</summary>
</key>
<key type="as" name="drift-right">
<default><![CDATA[['<Ctrl><Shift>Right']]]></default>
<summary>Drift tiling viewport to the right</summary>
</key>

<key type="as" name="switch-up">
<default><![CDATA[['<Super>Up']]]></default>
<summary>Switch to the window above</summary>
Expand Down Expand Up @@ -703,6 +713,11 @@
<summary>Duration of animations in seconds</summary>
</key>

<key type="i" name="drift-speed">
<default>2</default>
<summary>Drift speed (px/ms) when using "drifting view to the left/right" keybinds</summary>
</key>

<key type="i" name="drag-drift-speed">
<default>2</default>
<summary>Drift speed (px/ms) when mouse is at edge of montior when dragging windows</summary>
Expand Down
1 change: 1 addition & 0 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function enable(extension) {
'workspace-colors',
'default-background',
'animation-time',
'drift-speed',
'drag-drift-speed',
'default-show-top-bar',
'swipe-sensitivity',
Expand Down
33 changes: 32 additions & 1 deletion tiling.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ let gsettings, backgroundSettings, interfaceSettings;
let displayConfig;
let saveState;
let startupTimeoutId, timerId, fullscreenStartTimeout, stackSlurpTimeout, workspaceChangeTimeouts;
let monitorChangeTimeout;
let monitorChangeTimeout, driftTimeout;
let workspaceSettings;
export let inGrab;
export function enable(extension) {
Expand Down Expand Up @@ -217,6 +217,8 @@ export function disable() {
workspaceChangeTimeouts = null;
Utils.timeout_remove(monitorChangeTimeout);
monitorChangeTimeout = null;
Utils.timeout_remove(driftTimeout);
driftTimeout = null;

grabSignals.destroy();
grabSignals = null;
Expand Down Expand Up @@ -1260,6 +1262,35 @@ export class Space extends Array {
ensureViewport(metaWindow, space);
}

_drift(dx) {
if (dx === 0) {
return;
}
if (this.drifting) {
return;
}
this.drifting = true;

// stop drifting on key_release
Navigator.getActionDispatcher(Clutter.GrabState.KEYBOARD)
.addKeyReleaseCallback(() => {
Utils.timeout_remove(driftTimeout);
this.drifting = null;
});

Utils.timeout_remove(driftTimeout);
driftTimeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1, () => {
Gestures.update(this, dx, 1);
this.selectedWindow = Gestures.findTargetWindow(this, dx < 0 ? -1 : 1);
ensureViewport(this.selectedWindow, this);
return true;
});
}

driftLeft() { this._drift(-1 * Settings.prefs.drift_speed); }
driftRight() { this._drift(Settings.prefs.drift_speed); }


/**
* Return the x position of the visible element of this window.
*/
Expand Down

0 comments on commit fd31a03

Please sign in to comment.