Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNOME 45 #132

Merged
merged 16 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ jobs:
fail-fast: false
matrix:
version:
- "36"
- "37"
- "38"
- "rawhide"
session:
- "gnome-xsession"
- "gnome-wayland-nested"
Expand Down
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LOCALES_MO = $(patsubst po/%.po,locale/%/LC_MESSAGES/$(NAME).mo,$(LOCALES_PO
# These files will be included in the extension zip file.
ZIP_CONTENT = $(JS_FILES) $(LOCALES_MO) resources/$(NAME).gresource \
schemas/org.gnome.shell.extensions.$(NAME).gschema.xml \
schemas/gschemas.compiled metadata.json LICENSE stylesheet.css
metadata.json LICENSE stylesheet.css

# These five recipes can be invoked by the user.
.PHONY: zip install uninstall pot clean
Expand Down Expand Up @@ -69,11 +69,6 @@ $(ZIP_NAME): $(ZIP_CONTENT)
exit 1; \
fi

# Compiles the gschemas.compiled file from the gschema.xml file.
schemas/gschemas.compiled: schemas/org.gnome.shell.extensions.$(NAME).gschema.xml
@echo "Compiling schemas..."
@glib-compile-schemas schemas

# Compiles the gresource file from the gresources.xml.
resources/$(NAME).gresource: resources/$(NAME).gresource.xml
@echo "Compiling resources..."
Expand Down
64 changes: 34 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ For a list of things changed in previous releases, you can have a look at the [c

## 🎉 Features

![feature01](docs/pics/feature01.gif) <br> **3D Overview:** The extension arranges the workspaces in the overview in a cube-like fashion. | ![feature02](docs/pics/feature02.gif) <br> **3D Workspaces:** Also, when switching workspaces with touch gestures or keyboard shortcuts, the cube is shown.
|:-:|:-:|
![feature03](docs/pics/feature03.gif) <br> **Click and drag the desktop to rotate the cube:** You can click and drag anywhere on the desktop to start rotating the cube! | ![feature04](docs/pics/feature04.gif) <br> **Click and drag the panel to rotate the cube:** You can also trigger the cube by dragging on the panel. This is useful with maximized windows.
![feature05](docs/pics/feature05.gif) <br> **Click and drag the overview to rotate the cube:** You can also click and drag the overview's background to rotate the cube. | ![feature06](docs/pics/feature06.gif) <br> **Explode the cube on vertical rotations:** If you rotate the cube up or down, the 3D effect will become more intense.
![feature07](docs/pics/feature07.gif) <br> **Smooth transitions between Desktop, Overview, and App Drawer:** If you enter the app-drawer mode, the cube will be unfolded. | ![feature08](docs/pics/feature08.gif) <br> **Dynamic workspaces:** The extension supports any number of workspaces. So it's actually not a cube most of the time...
![feature09](docs/pics/feature09.gif) <br> **Background panoramas:** You can select an image which will be used as 360° skybox. | ![feature10](docs/pics/feature10.gif) <br> **Drag windows to other workspaces:** You can directly drag windows to adjacent workspaces. This also works in the overview.
| ![feature01](docs/pics/feature01.gif) <br> **3D Overview:** The extension arranges the workspaces in the overview in a cube-like fashion. | ![feature02](docs/pics/feature02.gif) <br> **3D Workspaces:** Also, when switching workspaces with touch gestures or keyboard shortcuts, the cube is shown. |
| :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| ![feature03](docs/pics/feature03.gif) <br> **Click and drag the desktop to rotate the cube:** You can click and drag anywhere on the desktop to start rotating the cube! | ![feature04](docs/pics/feature04.gif) <br> **Click and drag the panel to rotate the cube:** You can also trigger the cube by dragging on the panel. This is useful with maximized windows. |
| ![feature05](docs/pics/feature05.gif) <br> **Click and drag the overview to rotate the cube:** You can also click and drag the overview's background to rotate the cube. | ![feature06](docs/pics/feature06.gif) <br> **Explode the cube on vertical rotations:** If you rotate the cube up or down, the 3D effect will become more intense. |
| ![feature07](docs/pics/feature07.gif) <br> **Smooth transitions between Desktop, Overview, and App Drawer:** If you enter the app-drawer mode, the cube will be unfolded. | ![feature08](docs/pics/feature08.gif) <br> **Dynamic workspaces:** The extension supports any number of workspaces. So it's actually not a cube most of the time... |
| ![feature09](docs/pics/feature09.gif) <br> **Background panoramas:** You can select an image which will be used as 360° skybox. | ![feature10](docs/pics/feature10.gif) <br> **Drag windows to other workspaces:** You can directly drag windows to adjacent workspaces. This also works in the overview. |

## 🪲 Limitations

Issues are tracked [here on GitHub](https://github.com/Schneegans/Desktop-Cube/issues). There are currently two main known limitations:
* **No wrap-around:** In GNOME Shell, it is not possible to change from the last to the first workspace. The Desktop-Cube extension does not change this.
* **Bad multi-monitor support on X11:** On X11, GNOME Shell uses the same projection and view matrices for all monitors. The extension can modify these matrices so that the projection center of the virtual camera is in front of the current monitor. However, the cube looks somewhat sheared on setups with multiple monitors if the cube is shown on all monitors.

- **No wrap-around:** In GNOME Shell, it is not possible to change from the last to the first workspace. The Desktop-Cube extension does not change this.
- **Bad multi-monitor support on X11:** On X11, GNOME Shell uses the same projection and view matrices for all monitors. The extension can modify these matrices so that the projection center of the virtual camera is in front of the current monitor. However, the cube looks somewhat sheared on setups with multiple monitors if the cube is shown on all monitors.

## 💞 These People _love_ this Extension

Expand All @@ -64,15 +64,13 @@ Maxence Sebald<br>
<!-- <a href="https://github.com/sponsors/Schneegans">Become the first!</a><br> -->
</p>


<h3 align="center">🏅 Previous Sponsors and One-Time Donators</h3>
<p align="center">
<a href="https://github.com/dennis1248">Dennis ten Hoove</a><br>
<a href='https://github.com/trival'>Thomas Gorny</a><br>
<a href="https://twitter.com/tjiiik">tj3k</a>
</p>


Do you want to show that you love it too? You may <a href="https://github.com/sponsors/Schneegans">become a sponsor for as little as 1$ / month</a>!
If you like this extension, you may also want to try one of my other extensions: [🔥 Burn-My-Windows](https://github.com/Schneegans/Burn-My-Windows) or [🍰 Fly-Pie](https://github.com/Schneegans/Fly-Pie/)!

Expand Down Expand Up @@ -104,7 +102,7 @@ gnome-extensions install desktop-cube@schneegans.git.luolix.top.zip

Then restart GNOME Shell with <kbd>Alt</kbd> + <kbd>F2</kbd>, <kbd>r</kbd> + <kbd>Enter</kbd>.
Or logout / login if you are on Wayland.
Then you can enable the extension with the *Gnome Tweak Tool*, the *Extensions* application or with this command:
Then you can enable the extension with the _Gnome Tweak Tool_, the _Extensions_ application or with this command:

```bash
gnome-extensions enable desktop-cube@schneegans.github.com
Expand All @@ -120,6 +118,12 @@ git clone https://github.com/Schneegans/Desktop-Cube.git
cd Desktop-Cube
```

If your GNOME Shell version is <= 45, you will have to checkout the `gnome-42-44` branch:

```bash
git checkout gnome-42-44
```

Now you will have to install the extension.
The `make` command below compiles the locales, schemas and resources, creates a zip file of the extension and finally installs it with the `gnome-extensions` tool.

Expand All @@ -129,7 +133,7 @@ make install

Then restart GNOME Shell with <kbd>Alt</kbd> + <kbd>F2</kbd>, <kbd>r</kbd> + <kbd>Enter</kbd>.
Or logout / login if you are on Wayland.
Then you can enable the extension with the *Gnome Tweak Tool*, the *Extensions* application or with this command:
Then you can enable the extension with the _Gnome Tweak Tool_, the _Extensions_ application or with this command:

```bash
gnome-extensions enable desktop-cube@schneegans.github.com
Expand All @@ -139,24 +143,24 @@ gnome-extensions enable desktop-cube@schneegans.github.com

That's great!
Here are some basic rulles to get you started:
Commits should start with a Capital letter and should be written in present tense (e.g. __:tada: Add cool new feature__ instead of __:tada: Added cool new feature__).
Commits should start with a Capital letter and should be written in present tense (e.g. **:tada: Add cool new feature** instead of **:tada: Added cool new feature**).
You should also start your commit message with **one** applicable emoji.
This does not only look great but also makes you rethink what to add to a commit. Make many but small commits!

Emoji | Description
------|------------
:tada: `:tada:` | When you added a cool new feature.
:wrench: `:wrench:` | When you added a piece of code.
:recycle: `:recycle:` | When you refactored a part of the code.
:sparkles: `:sparkles:` | When you applied clang-format.
:globe_with_meridians: `:globe_with_meridians:` | When you worked on translations.
:art: `:art:` | When you improved / added assets like themes.
:lipstick: `:lipstick:` | When you worked on the UI of the preferences dialog.
:rocket: `:rocket:` | When you improved performance.
:memo: `:memo:` | When you wrote documentation.
:beetle: `:beetle:` | When you fixed a bug.
:revolving_hearts: `:revolving_hearts:` | When a new sponsor is added or credits are updated.
:heavy_check_mark: `:heavy_check_mark:` | When you worked on checks or adjusted the code to be compliant with them.
:twisted_rightwards_arrows: `:twisted_rightwards_arrows:` | When you merged a branch.
:fire: `:fire:` | When you removed something.
:truck: `:truck:` | When you moved / renamed something.
| Emoji | Description |
| --------------------------------------------------------- | ------------------------------------------------------------------------- |
| :tada: `:tada:` | When you added a cool new feature. |
| :wrench: `:wrench:` | When you added a piece of code. |
| :recycle: `:recycle:` | When you refactored a part of the code. |
| :sparkles: `:sparkles:` | When you applied clang-format. |
| :globe_with_meridians: `:globe_with_meridians:` | When you worked on translations. |
| :art: `:art:` | When you improved / added assets like themes. |
| :lipstick: `:lipstick:` | When you worked on the UI of the preferences dialog. |
| :rocket: `:rocket:` | When you improved performance. |
| :memo: `:memo:` | When you wrote documentation. |
| :beetle: `:beetle:` | When you fixed a bug. |
| :revolving_hearts: `:revolving_hearts:` | When a new sponsor is added or credits are updated. |
| :heavy_check_mark: `:heavy_check_mark:` | When you worked on checks or adjusted the code to be compliant with them. |
| :twisted_rightwards_arrows: `:twisted_rightwards_arrows:` | When you merged a branch. |
| :fire: `:fire:` | When you removed something. |
| :truck: `:truck:` | When you moved / renamed something. |
13 changes: 13 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ SPDX-License-Identifier: CC-BY-4.0

# Changelog of the Desktop Cube Extension

## [Desktop Cube 18](https://github.com/schneegans/Desktop-Cube/releases/tag/v18)

**Release Date:** 2023-09-09

#### Major Changes

- This is the first release of the Desktop-Cube supporting GNOME 45. This required a [major refactoring](https://github.com/Schneegans/Desktop-Cube/pull/132/files) of the code base as GJS now uses ESM modules. As a consequence, this version is not compatible with older versions of GNOME Shell anymore. The old code base is still available on the `gnome-42-44` branch and if new features are added (especially translations), they can be backported to this branch.
- With GNOME 45, it is not possible anymore to override the UI animation durations. Therefore, the following settings had to be removed:
- Transition time from desktop to overview.
- Transition time from overview to app drawer.
- Transition time between workspaces.
- The Skybox now uses `Clutter.Effect` instead of `Shell.GLSLEffect` as a base class. This should improve the performance slightly, as it does not require painting to an offscreen buffer any more.

## [Desktop Cube 17](https://github.com/schneegans/Desktop-Cube/releases/tag/v17)

**Release Date:** 2023-06-09
Expand Down
82 changes: 23 additions & 59 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@

'use strict';

const {Clutter, Graphene, GObject, Shell, St, Meta, Gio} = imports.gi;

const Util = imports.misc.util;
const Main = imports.ui.main;
const Layout = imports.ui.layout;
const WorkspacesView = imports.ui.workspacesView.WorkspacesView;
const FitMode = imports.ui.workspacesView.FitMode;
const WorkspaceAnimationController =
imports.ui.workspaceAnimation.WorkspaceAnimationController;

const ExtensionUtils = imports.misc.extensionUtils;
const Me = imports.misc.extensionUtils.getCurrentExtension();
const utils = Me.imports.src.utils;
const DragGesture = Me.imports.src.DragGesture.DragGesture;
const Skybox = Me.imports.src.Skybox.Skybox;
import Gio from 'gi://Gio';
import Meta from 'gi://Meta';
import Clutter from 'gi://Clutter';
import Graphene from 'gi://Graphene';
import GObject from 'gi://GObject';
import Shell from 'gi://Shell';
import St from 'gi://St';

import * as Util from 'resource:///org/gnome/shell/misc/util.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import {PressureBarrier} from 'resource:///org/gnome/shell/ui/layout.js';
import {WorkspacesView, FitMode} from 'resource:///org/gnome/shell/ui/workspacesView.js';
import {WorkspaceAnimationController} from 'resource:///org/gnome/shell/ui/workspaceAnimation.js';
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';

import * as utils from './src/utils.js';
import {DragGesture} from './src/DragGesture.js';
import {Skybox} from './src/Skybox.js';

//////////////////////////////////////////////////////////////////////////////////////////
// This extensions tweaks the positioning of workspaces in overview mode and while //
Expand All @@ -38,11 +41,8 @@ const MAX_VERTICAL_ROTATION = 50;
// Spacing to the screen sides of the vertically rotated cube.
const PADDING_V_ROTATION = 0.2;

class Extension {
// The constructor is called once when the extension is loaded, not enabled.
constructor() {
this._lastWorkspaceWidth = 0;
}
export default class DesktopCube extends Extension {
_lastWorkspaceWidth = 0;

// ------------------------------------------------------------------------ public stuff

Expand All @@ -51,7 +51,7 @@ class Extension {
enable() {

// Store a reference to the settings object.
this._settings = ExtensionUtils.getSettings();
this._settings = this.getSettings();

// We will monkey-patch these methods. Let's store the original ones.
this._origUpdateWorkspacesState = WorkspacesView.prototype._updateWorkspacesState;
Expand All @@ -61,40 +61,9 @@ class Extension {
this._origPrepSwitch = WorkspaceAnimationController.prototype._prepareWorkspaceSwitch;
this._origFinalSwitch = WorkspaceAnimationController.prototype._finishWorkspaceSwitch;

// We may also override these animation times.
this._origWorkspaceSwitchTime = imports.ui.workspacesView.WORKSPACE_SWITCH_TIME;
this._origToOverviewTime = imports.ui.overview.ANIMATION_TIME;
this._origToAppDrawerTime = imports.ui.overviewControls.SIDE_CONTROLS_ANIMATION_TIME;

// We will use extensionThis to refer to the extension inside the patched methods of
// the WorkspacesView.
// We will use extensionThis to refer to the extension inside the patched methods.
const extensionThis = this;

// Connect the animation times to our settings.
const loadAnimationTimes = () => {
{
const t = this._settings.get_int('overview-transition-time');
imports.ui.overview.ANIMATION_TIME = (t > 0 ? t : this._origToOverviewTime);
}
{
const t = this._settings.get_int('appgrid-transition-time');
imports.ui.overviewControls.SIDE_CONTROLS_ANIMATION_TIME =
(t > 0 ? t : this._origToAppDrawerTime);
}
{
const t = this._settings.get_int('workspace-transition-time');
imports.ui.workspacesView.WORKSPACE_SWITCH_TIME =
(t > 0 ? t : this._origWorkspaceSwitchTime);
}
};

this._settings.connect('changed::overview-transition-time', loadAnimationTimes);
this._settings.connect('changed::appgrid-transition-time', loadAnimationTimes);
this._settings.connect('changed::workspace-transition-time', loadAnimationTimes);

loadAnimationTimes();


// -----------------------------------------------------------------------------------
// ------------------------------- cubify the overview -------------------------------
// -----------------------------------------------------------------------------------
Expand Down Expand Up @@ -598,8 +567,7 @@ class Extension {
// ignore this parameter. Instead, we check for the correct action mode in the trigger
// handler.
this._pressureBarrier =
new Layout.PressureBarrier(this._settings.get_int('edge-switch-pressure'),
Layout.HOT_CORNER_PRESSURE_TIMEOUT, 0);
new PressureBarrier(this._settings.get_int('edge-switch-pressure'), 1000, 0);

// Update pressure threshold when the corresponding settings key changes.
this._settings.connect('changed::edge-switch-pressure', () => {
Expand Down Expand Up @@ -764,10 +732,6 @@ class Extension {
WorkspaceAnimationController.prototype._prepareWorkspaceSwitch = this._origPrepSwitch;
WorkspaceAnimationController.prototype._finishWorkspaceSwitch = this._origFinalSwitch;

imports.ui.workspacesView.WORKSPACE_SWITCH_TIME = this._origWorkspaceSwitchTime;
imports.ui.overview.ANIMATION_TIME = this._origToOverviewTime;
imports.ui.overviewControls.SIDE_CONTROLS_ANIMATION_TIME = this._origToAppDrawerTime;

// Remove all drag-to-rotate gestures.
this._removeDesktopDragGesture();
this._removePanelDragGesture();
Expand Down
4 changes: 1 addition & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"gettext-domain": "desktop-cube",
"settings-schema": "org.gnome.shell.extensions.desktop-cube",
"shell-version": [
"42",
"43",
"44"
"45"
],
"url": "https://github.com/Schneegans/Desktop-Cube",
"version": 18
Expand Down
Loading