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

How to or feature request..? Programmatically change desktop with animation #384

Open
asdf23 opened this issue Jun 18, 2022 · 5 comments
Open

Comments

@asdf23
Copy link

asdf23 commented Jun 18, 2022

I can change the desktop or "workspace" programmatically with wmctrl -s 1 but it doesn't play the animation. I want to change desktops and play the animation connecting this feature so some other joystick thing I have. Possible?

@smurphos
Copy link

You can use these commands for next / previous workspace with annimation

dbus-send --dest=org.Cinnamon --print-reply /org/Cinnamon org.Cinnamon.switchWorkspaceRight
dbus-send --dest=org.Cinnamon --print-reply /org/Cinnamon org.Cinnamon.switchWorkspaceLeft

I don't think there a dbus method to jump to a specific workspace... there is this which adds a new workspace and switches to it (with animation)

dbus-send --dest=org.Cinnamon --print-reply /org/Cinnamon org.Cinnamon.JumpToNewWorkspace

Your other option would be to assign keyboard shortcuts for specific workspaces (via Keyboards settings app) and use xdotool

@ghost
Copy link

ghost commented Jun 18, 2022

There are also switchWorkspaceDown and switchWorkspaceUp commands besides the Left/Right mentioned above.

In javascript you can switch to any existing workspace by using
global.screen.get_workspace_by_index(idx).activate(global.get_current_time());
where idx is an integer between 1 0 and current number of workspaces minus 1.
However I'm not sure about animation since I have all animations disabled on my system.

@asdf23
Copy link
Author

asdf23 commented Jun 19, 2022

You can use these commands for next / previous workspace with annimation

dbus-send --dest=org.Cinnamon --print-reply /org/Cinnamon org.Cinnamon.switchWorkspaceRight dbus-send --dest=org.Cinnamon --print-reply /org/Cinnamon org.Cinnamon.switchWorkspaceLeft

Thanks for the post, this doesn't work, but it does do something slight different than wmctrl -s 1.

wmctrl - shows sliding animation (Not Desktop Cube)
dbus-send --dest=org.Cinnamon - shows sliding animation (Not Desktop Cube) and flashes the desktop name
Ctrl + Left/Right (Mapped to "Switch to Left Workspace) - Shows the animation also flashes the desktop name

@asdf23
Copy link
Author

asdf23 commented Jun 19, 2022

In javascript you can switch to any existing workspace by using global.screen.get_workspace_by_index(idx).activate(global.get_current_time()); where idx is an integer between 1 0 and current number of workspaces minus 1. However I'm not sure about animation since I have all animations disabled on my system.

I'm not sure how I would be able to execute javascript in this manner. Maybe I could setup a node.js program and reference something? I'd be willing to write a program to make DesktopCube work

@ghost
Copy link

ghost commented Jun 20, 2022

You should've provided all necessary details from the first time.
So, if I understand you correctly you want to switch workspaces using a joystick or similar device while having the Desktop Cube animation type playing. Is that right?

In that case, first of all you have to install and enable the Desktop Cube extension and make sure it works by the standard means - that is the hotkeys/shortcuts assigned to it: Ctrl+Alt+Left/Right by default.

Once you have that working correctly you need to map the joystick - or whatever other device you want - actions to those respective hotkeys/shortcuts. That is, when you tilt joytick left it would send the Ctrl+Alt+Left key combo, and similar for right. Or whatever other assignment you want.

Unfortunately I have neither a joystick to test nor experience with such devices or related software so you'd have to do some research yourself. Many years ago there was QJoyPad, a software that could map gaming devices to keyboard but it's not being actively developed. Also no idea how the current Linux kernel deals with such devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants