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 Apr 22, 2024
2 parents 282d385 + 7268382 commit cc5c15d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 125 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ from the repository. The installer will create a link to the repo in
```
> #### ➡️ You will need to restart Gnome shell after installing PaperWM, e.g. logout then login, or restart in place with an `alt-F2` and entering `r` (X11 only).
>
> After logging back in, you will can then enable PaperWM via the `Extensions` application, or by running the following command from the command-line:
> After logging back in, you can then enable PaperWM via the `Extensions` application, or by running the following command from the command-line:
>
> ```bash
> /usr/bin/gnome-extensions enable [email protected]
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.6.3",
"version-name": "46.6.4",
"donations": {
"buymeacoffee": "jaytaala",
"patreon": "valpackett"
Expand Down
15 changes: 14 additions & 1 deletion tiling.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,20 @@ export class Space extends Array {
name: 'panel',
style_class: 'space-workspace-indicator',
});
workspaceIndicator.connect('button-press-event', () => Main.overview.toggle());
signals.connect(workspaceIndicator, 'button-press-event', () => Main.overview.toggle());
signals.connect(workspaceIndicator, 'scroll-event', (_actor, event) => {
let direction = event.get_scroll_direction();
switch (direction) {
case Clutter.ScrollDirection.DOWN:
spaces.selectSequenceSpace(Meta.MotionDirection.DOWN);
Navigator.getNavigator().finish();
break;
case Clutter.ScrollDirection.UP:
spaces.selectSequenceSpace(Meta.MotionDirection.UP);
Navigator.getNavigator().finish();
break;
}
});
this.workspaceIndicator = workspaceIndicator;
let workspaceLabel = new St.Label();
workspaceIndicator.add_child(workspaceLabel);
Expand Down
130 changes: 8 additions & 122 deletions topbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -735,130 +735,16 @@ export const WorkspaceMenu = GObject.registerClass(

if (["NORMAL", "SCROLL"].includes(this.state) &&
type === Clutter.EventType.SCROLL) {
if (!this._navigator) {
this.state = 'SCROLL';
this._navigator = Navigator.getNavigator();
Tiling.spaces.initWorkspaceSequence();
this._enterbox = new Clutter.Actor({ reactive: true });
Main.uiGroup.add_child(this._enterbox);
this._enterbox.set_position(panelBox.x, panelBox.y + panelBox.height + 20);
// eslint-disable-next-line no-undef
this._enterbox.set_size(global.screen_width, global.screen_height);
Main.layoutManager.trackChrome(this._enterbox);

this._navigator.connect('destroy', this._finishWorkspaceSelect.bind(this));

this._enterbox.connect('enter-event', () => {
this._navigator.finish();
});
}

let device = event.get_source_device();
// console.debug(`source: ${device.get_device_type()}`);
let direction = event.get_scroll_direction();
if (direction === Clutter.ScrollDirection.SMOOTH &&
device.get_device_type() !== Clutter.InputDeviceType.POINTER_DEVICE) {
this.state = 'SMOOTH';
}

if (direction === Clutter.ScrollDirection.DOWN) {
const direction = event.get_scroll_direction();
switch (direction) {
case Clutter.ScrollDirection.DOWN:
Tiling.spaces.selectSequenceSpace(Meta.MotionDirection.DOWN);
}
if (direction === Clutter.ScrollDirection.UP) {
Navigator.getNavigator().finish();
break;
case Clutter.ScrollDirection.UP:
Tiling.spaces.selectSequenceSpace(Meta.MotionDirection.UP);
}
}

if (this.state === 'SMOOTH' && type === Clutter.EventType.SCROLL &&
event.get_scroll_direction() === Clutter.ScrollDirection.SMOOTH) {
let spaces = Tiling.spaces;
let active = spaces.activeSpace;

let [, dy] = event.get_scroll_delta();
dy *= active.height * 0.05;
let t = event.get_time();
let v = -dy / (this.time - t);
// console.debug(`v ${v}, dy: ${dy}`);

let firstEvent = false;
if (!this.selected) {
firstEvent = true;
this.selected = spaces.selectedSpace;
}
let mode = Clutter.AnimationMode.EASE_IN_OUT_QUAD;
const StackPositions = Tiling.StackPositions;
const upEdge = 0.385 * active.height;
const downEdge = 0.60 * active.height;
if (dy > 0 &&
this.selected !== active &&
((this.selected.actor.y > upEdge &&
this.selected.actor.y - dy < upEdge) ||
(this.selected.actor.y - dy < StackPositions.up * active.height))
) {
dy = 0;
v = 0.1;
spaces.selectSequenceSpace(Meta.MotionDirection.UP);
this.selected = spaces.selectedSpace;
Easer.removeEase(this.selected.actor);
Easer.addEase(this.selected.actor,
{ scale_x: 0.9, scale_y: 0.9, time: Settings.prefs.animation_time, mode });
} else if (dy < 0 &&
((this.selected.actor.y < downEdge &&
this.selected.actor.y - dy > downEdge) ||
(this.selected.actor.y - dy > StackPositions.down * active.height))
) {
dy = 0;
v = 0.1;
spaces.selectSequenceSpace(Meta.MotionDirection.DOWN);
this.selected = spaces.selectedSpace;
Easer.removeEase(this.selected.actor);
Easer.addEase(this.selected.actor,
{ scale_x: 0.9, scale_y: 0.9, time: Settings.prefs.animation_time, mode });
}

this.selected.actor.y -= dy;
if (this.selected === active) {
let scale = 0.90;
let s = 1 - (1 - scale) * (this.selected.actor.y / (0.1 * this.selected.height));
s = Math.max(s, scale);
Easer.removeEase(this.selected.actor);
this.selected.actor.set_scale(s, s);
}

if (v === 0 && !firstEvent) {
// console.debug(`finish: ${this.velocity}`);
let test;
if (this.velocity > 0)
test = () => this.velocity > 0;
else
test = () => this.velocity < 0;

let y = this.selected.actor.y;
let friction = 0.5;
while (test()) {
let dy = this.velocity * 16;
y -= dy;
// console.debug(`calc target: ${dy} ${y} ${this.velocity}`);
if (this.velocity > 0)
this.velocity -= friction;
else
this.velocity += friction;
}
// console.debug(`zero: ${y/this.selected.height}`);

if (this.selected === active && y <= 0.1 * this.selected.height) {
this._navigator.finish();
return;
} else if (y > downEdge) {
spaces.selectSequenceSpace(Meta.MotionDirection.DOWN);
this.selected = spaces.selectedSpace;
} else {
spaces.selectSequenceSpace(Meta.MotionDirection.DOWN);
spaces.selectSequenceSpace(Meta.MotionDirection.UP);
}
} else {
this.time = t;
this.velocity = v;
Navigator.getNavigator().finish();
break;
}
}

Expand Down

0 comments on commit cc5c15d

Please sign in to comment.