Skip to content

Commit

Permalink
[workspace-scroller@ori] V1.0.2 Add Desktop Cube & Flipper support (#801
Browse files Browse the repository at this point in the history
)

* Add the ability to use the Desktop Cube or Flipper extension to animate the workspace switch
  • Loading branch information
klangman authored Dec 22, 2024
1 parent b7ca661 commit 9a447ee
Show file tree
Hide file tree
Showing 18 changed files with 718 additions and 433 deletions.
24 changes: 23 additions & 1 deletion workspace-scroller@ori/files/workspace-scroller@ori/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const Main = imports.ui.main;
const Settings = imports.ui.settings;
const St = imports.gi.St;
const Clutter = imports.gi.Clutter;
const ExtensionSystem = imports.ui.extensionSystem;

let workspaceScroller;

Expand Down Expand Up @@ -38,6 +39,22 @@ function Area(x, y, dx, dy, actionUp, actionDown) {
this._init(x, y, dx, dy, actionUp, actionDown);
}

function getWorkspaceSwitcherExt() {
let workspaceSwitcherExt;
// Check if one of the workspace switcher extensions are installed or if the state has changed since we last checked
if (ExtensionSystem.runningExtensions.indexOf('DesktopCube@yare') > -1 ) {
workspaceSwitcherExt = ExtensionSystem.extensions['DesktopCube@yare']['5.4']['extension'];
} else if (ExtensionSystem.runningExtensions.indexOf('Flipper@connerdev') > -1) {
workspaceSwitcherExt = ExtensionSystem.extensions['Flipper@connerdev']['5.4']['extension'];
}
// Make sure the switcher extension has the required API to allow us to change to any arbitrary workspace
if (workspaceSwitcherExt && typeof workspaceSwitcherExt.ExtSwitchToWorkspace !== "function") {
workspaceSwitcherExt = null;
}
return workspaceSwitcherExt
}


/**
* Initialize scroll action area
*/
Expand Down Expand Up @@ -85,7 +102,12 @@ Area.prototype.slide = function (shift) {
workspace = global.screen.get_workspace_by_index(index);

if (workspace != null) {
workspace.activate(global.get_current_time());
let workspaceSwitcherExt = (workspaceScroller.settings.settings.getValue("useSwitcherExtension"))?getWorkspaceSwitcherExt():null;
if (workspaceSwitcherExt) {
workspaceSwitcherExt.ExtSwitchToWorkspace(workspace);
} else {
workspace.activate(global.get_current_time());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Workspace Scroller",
"version": "1.0.1",
"version": "1.0.2",
"description": "Switch workspaces using mouse scroll at screen edges.",
"cinnamon-version": [
"2.4",
Expand Down
26 changes: 22 additions & 4 deletions workspace-scroller@ori/files/workspace-scroller@ori/po/ca.po
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SOME DESCRIPTIVE TITLE.
# WORKSPACE SCROLLER
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Odyssey <[email protected]>, 2024
Expand All @@ -7,8 +7,9 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-03-02 22:28+0000\n"
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
"extensions/issues\n"
"POT-Creation-Date: 2024-12-22 17:57-0500\n"
"PO-Revision-Date: 2024-07-25 18:55+0200\n"
"Last-Translator: Odyssey <[email protected]>\n"
"Language-Team: \n"
Expand All @@ -24,7 +25,9 @@ msgstr "Desplaçador de l'espai de treball"

#. metadata.json->description
msgid "Switch workspaces using mouse scroll at screen edges."
msgstr "Canvieu d'espai de treball utilitzant el desplaçament del ratolí per les vores de la pantalla."
msgstr ""
"Canvieu d'espai de treball utilitzant el desplaçament del ratolí per les "
"vores de la pantalla."

#. settings-schema.json->edgesHeader->description
msgid "Edges"
Expand Down Expand Up @@ -171,3 +174,18 @@ msgstr "píxels"
#. settings-schema.json->cornerSize->description
msgid "Corners areas size: "
msgstr "Mida de l'àrea de les cantonades: "

#. settings-schema.json->generalHeader->description
msgid "General"
msgstr ""

#. settings-schema.json->useSwitcherExtension->description
msgid "Use a workspace switcher extension if installed"
msgstr ""

#. settings-schema.json->useSwitcherExtension->tooltip
msgid ""
"Allow a Cinnamon extension to animate the workspace change. This option has "
"no effect unless a compatible extension is installed. Requires Desktop Cube "
"2.0.2 or Flipper 2.0.0 and Cinnamon 5.4 or better."
msgstr ""
Loading

0 comments on commit 9a447ee

Please sign in to comment.