Workspace grid (2D) and switcher

UUID: workspace-grid@hernejj
Last edited:
3 days ago 2024-12-18, 10:05
Last commit: [a6065ddd] workspace-grid@hernejj: Add Finnish translation (#6693)

2D workspace grid and switcher for Cinnamon

README

Close

Workspace grid (2D) and switcher v0.8

2D workspace grid and switcher for Cinnamon Desktop Environment

Author: Jason J. Herne (hernejj@gmail.com) Homepage: http://github.com/hernejj/workspace-grid-cinnamon-applet

Description

This is a Cinnamon applet that implements a 2D workspace grid and provides a workspace switcher that understands multiple rows. In addition, the standard keyboard shortcuts for workspace up/down navigation are modified to actually switch workspaces instead of bringing up the Cinnamon Workspace Expo and Overview.

Portions of this code were adapted from the workspace-switcher@cinnamon.org applet created by the Cinnamon Team.

Portions of this code were adapted from the Gnome Shell Frippery Bottom Panel extension created by rmyorston: https://extensions.gnome.org/extension/3/bottom-panel/

Compatibility

This applet has been tested to be compatible with the following versions of Cinnamon and Linux distributions: Linux Mint 17 - Cinnamon 2.2 Linux Mint 16 - Cinnamon 2.0

Installing

  1. Place the "workspace-grid@hernejj" folder in the ".local/share/cinnamon/applets" folder in your home directory.

  2. Restart Cinnamon either by using Alt+F2, then hit 'r' then the enter key. Or simply log out and log back in.

  3. Start the "Cinnamon Settings" program, go to the Applets section and look for the entry named "Workspace grid (2D) and switcher". Check the checkbox to the left of this entry to enable this applet.

Setting the Number of Workspaces

This applet allows you to configure the number or rows and columns in your workspace grid. Just right click on the applet and choose "Configure..." and a dialog will appear. Enter the number of columns and rows you want and click the close button. The maximum number of workspaces supported by this applet is 12 columns by 6 rows.

Choosing the Style

There are currently two visual styles to choose from.

Single Row: Workspaces are shown to you a single row at a time. A Row indicator is present to let you know what row you are in.

Grid: A grid view of all existing workspaces. The workspaces in this style can get quite small if you have more than a few rows.

Navigating

You can navigate between your workspaces using the standard system keyboard shortcuts. By default they are as listed:

switch-to-workspace-up      Ctrl+Alt+Up_Arrow
switch-to-workspace-down    Ctrl+Alt+Down_Arrow
switch-to-workspace-left    Ctrl+Alt+Left_Arrow
switch-to-workspace-right   Ctrl+Alt+Right_Arrow

You can also click on the workspace or the row indicator lines within the switcher to navigate directly to a specific workspace or row.

You can also place your mouse over the switcher and use the scroll wheel to navigate forward and backward in the workspace grid.

By default, this applet conflicts with and disables the Expo and Scale keyboard shortcuts. There is a setting in the settings dialog to disable this behavior.

WARNING: Using Expo (or anything other than this applet) for adding/removing workspaces will cause Cinnamon to crash! While using this applet ONLY add/remove desktops via the applet's settings window.

License

This application is released under the GNU General Public License v2. A full copy of the license can be found here: http://www.gnu.org/licenses/gpl.txt
Thank you for using free software!

Change Log

v0.8:

  • Bugfix: Fixed mouse scrolling when scrolling by column. v0.7:
  • Added setting to choose direction to move when using mouse wheel
  • Bugfix: Stop trying to handle externally +/- desktops. Was broken!
  • Bugfix: Deregister event handlers when switching ui styles v0.6:
  • Multiple visual styles to choose from: single row and grid
  • Maximum number of columns increased from 6 to 12.
  • Remove reliance on external stylesheet and performance limiting hack
  • Applet colors now based on Cinnamon theme
  • Bugfix: Watch for and correct any externally added/removed desktops v0.5:
  • Added support for Cinnamon Settings API.
  • Added option to keep original scale/expo keyboard shortcuts
  • Removed hackish "configuration icon".
  • Removed old style key binding registration. Breaks on very old distros. v0.4:
  • compat: Remove right-click to configure for Cinnamon 2.2 compatibility
  • Compat: Add configuration via left-click on new icon.
  • Don't override theme style for better theme integration.
  • Workaround for "theme change makes row indicator disappear" bug. v0.3:
  • Bugfix: Removed css junk that was messing up bottom panel style.
  • Bugfix: Allow applet to properly resize with bottom panel. v0.2:
  • Added key binding support for Linux Mint 13 & Cinnamon 1.4.0.
  • Added some debug logging to assist with future incompatibility problems. v0.1:
  • Initial release.

Log In To Comment!

28 Comments

Texcaliber
Texcaliber-2 months ago
Fresh Mint 22 (Cinnamon 6.2.9) install, simple config and applet works well. I never needed \ used multiple workspaces before, this makes switching easy.
Smilenator
Smilenator-1 year ago
I have upgraded my Cinnamon to v5.8.4 and there are some changes needed to make this applet working: 1. `Meta.ScreenCorner.TOPLEFT` is deprecated now, it can be replaced with 0 in the WorkspaceController.js 2. There should be 3 parameters instead of 4: `function switchWorkspace(display, window, binding)` without `screen` in the applet.js
sunbum82
sunbum82-2 years ago
I've been using this for years and I love it. However, with the most recent linux mint (Mint 21) I'm having the following issue: After restoring from suspend, all windows end up on the same workspace (in particular, the first one). So if you have 4 workspaces, and one window open on each, then you suspend the machine, after you come back from suspend all 4 windows will be on workspace 1. I hope this is fixed soon...
Jacob Martin
Jacob Martin-2 years ago
Been using this spice for years. I cannot live without it. Thank you so much!! Please please please keep it upgraded for newer versions! Much love
pzim
pzim-2 years ago
Last commit #4405 broke Cinnamon 4.8.6. I had to enter this command in terminal to restore my 4 workspaces: ```gsettings set org.cinnamon.desktop.wm.preferences num-workspaces '4' ``` Until it works again, I use the Smart Panel extension instead of this applet
vagrale13
vagrale13-2 years ago
Same problem. Until the problem fixed with an update, you can rename folder /.local/share/cinnamon/applets/workspace-grid@hernejj/5.2 to /.local/share/cinnamon/applets/workspace-grid@hernejj/5.0
pzim
pzim-2 years ago
There is a little problem : When I remove the applet, i loose my 4 workspaces. I must execute this : gsettings set org.cinnamon.desktop.wm.preferences num-workspaces '4' to restore my 4 workspaces again.
pzim
pzim-2 years ago
Last commit #4410 works very well now. Thank you, I love your applet ;-)
mvdberge
mvdberge-2 years ago
Great plugin, love it! Still, it is broken with Cinnamon 5.4 because of new keybindings of Cinnamon. Please have a look at it - thanks a lot! :-)
Marek
Marek-3 years ago
Update: [Errno 13] No access 'sv.po'
Shawn Tabai
Shawn Tabai-5 years ago
I love this applet, but it recently started to misbehave after a system update. I now get a notification about a startup error in Cinnamon. The Ctrl+Alt+Up/Down hotkeys seem to be the only thing affected, but that's the feature I use the most. I tried going into Keyboard settings and disabled existing bindings for those keys to window/workspace selection, but still no luck. In logs, I see the following: [LookingGlass/error] workspace-grid@hernejj exception: Error: first argument to Lang.bind() must be an object, not undefined Any reason why this might happen?
vbendeb
vbendeb-5 years ago
There used to be a way to name workspaces, but I don't see it any more, is it still possible to rename workspaces?
ionics
ionics-5 years ago
Thank you for this app! worked like a charm on Linux Mint 19 Cinnamon! i couldn't live without grid workspaces! Thank you so much!
Sergedel
Sergedel-5 years ago
OK with andrew u frank. ... And when I activate it, the number of workspaces is reset to 1 (or 2?)
andrew u frank
andrew u frank-5 years ago
I would prefer - a graphical, greatly reduced representation of the workspace - not the numbers. - a method to move a window between the workspaces with dragging the mouse both these options are in xfce window-switcher (check it out).
Jean-Yves Moyen
Jean-Yves Moyen-6 years ago
It looks like Cinnamon 3.8.8 on Debian 4.17 broke the switch up/switch down shortcuts :-( Immediately after a large upgrade yesterday, Ctrl+Alt+Up/Down were again grabbed by Cinnamon for toggling Expo and the Workspace selection. I've been digging a bit into dconf-editor and compared with another machine where I'm still at Cinnamon 3.6. The only difference I've seen is that in the cinnamon config app, in the Keyboard/Shortcuts/General menu, these were named "toggle expo" and "toggle [something]" in 3.6 and are now named "Show the window selection screen" and "show the workspace selection screen" in 3.8. I guess this is a purely cosmetic change which doesn't really impact things, and there are likely some deeper changes in Cinnamon that actually prevent that applet to grab the shortcuts. Anyway, it looks like it's now impossible for me to have shortcuts for switching up/down (changing them in dconf-editor only gives more shortcut for expo…) which makes the applet somewhat useless :-( I hope this is not too difficult to fix and you can fix it soon. I'm so use to having a workspaces grid, and needing to grab the mouse in order to switch (whether clicking on the applet, mouse scrolling, …) really breaks my workflow :-(
Jean-Yves Moyen
Jean-Yves Moyen-6 years ago
Somehow, it's working again now… :puzzled:
David Dreggors
David Dreggors-6 years ago
Another idea I have is maybe showing the grid layout in OSD. In Gnome extension workspace-grid you have an option to show the grid on screen when switching rather than in a tiny section on a bar. It highlights the window you are on and shows it move as you do for a second or so. Basically exactly what you have in the bar at bottom but up in the center of the screen as an on-screen-display overlay. https://extensions.gnome.org/extension/484/workspace-grid/
David Dreggors
David Dreggors-6 years ago
I am new to this applet, I like it a lot. I notice though that I have the option to wrap around horizontally from say desktop 3 to desktop 1 via ctrl+alt+right (3x3 grid), however I cannot wrap vertically even if I set to use vertical navigation disabling Expo. For instance going from desktop 1 (top left) to desktop 7 (bottom left) I would expect that I would be able to press ctrl+alt+up.... no dice. Any way we can include wrapping vertically in a future update?
Yoonsoo P. Bach
Yoonsoo P. Bach-6 years ago
I'm glad there is an applet for this... I think this should be available by default from Cinnamon. Two suggestions: (1) I don't necessarily want Expo view, but at least I want to move my Google Chrome window from workspace i to j. Right click does not show usual "Move to Another Workspace". When I used xUbuntu, I could use `ctrl+alt+j` to move it to jth workspace. Moreover, when I turn on "Use Keyboard shortcuts to switch desktop rows" option, `ctrl+alt+up` and `alt+F1` both do not work, so I cannot use Expo view, which I thought is the last option I could move my Chrome to the jth workspace... (2) Minor cosmetic (design) issue: When moving from row i to row j (i.e., when number of rows > 1), the windows do not swipe up/down, but rather diagonal direction, which makes me a bit confused. Except for these, I'm very satisfied with this applet :) Thanks for your effort!
David Guild
David Guild-6 years ago
I have an idea about the weird diagonal motion; see my comment below.
CosmicTachyon
CosmicTachyon-6 years ago
Great applet. Thank you. It would be nice if the colour of the grid (the box and lines) could be set by the user.
2dxb
2dxb-6 years ago
When the vertical panel, creeps out the edges.
Tomáš Polešovský
Hi, to change shortcut assignments: 1, Install "dconf-tools" package and launch dconf-editor program 2, Navigate to org.cinnamon.desktop.keybindings.wm 3, Change switch-to-workspace-up, switch-to-workspace-down, switch-to-workspace-left, switch-to-workspace-right If it doesn't help try with org.gnome.desktop.keybindings.wm
Gérard Bigot
Gérard Bigot-7 years ago
Bonjour, Je suis très content de cette applet. Elle correspond à ce que j'en attends, excepté un tout petit détail sans gravité : - l'encombrement (100 × 22 pour 3 écrans) dans mon tableau de bord (1366 × 22). Si parmi les options il était possible de redimensionner l'applet en hauteur et en largeur, ce serait parfait. Encore merci pour votre généreux travail. Hello, I'm very happy with this applet. It corresponds to what I expect, except a tiny detail without gravity: - clutter (100 × 22 for 3 screens) in my dashboard (1366 × 22). If among the options it was possible to resize the applet in height and width, it would be perfect. Thank you again for your generous work.
KevinNielson
KevinNielson-7 years ago
Love this applet; it gives me my fix for compiz-style switching without giving up cinnamon. I've noticed that the swish sound is still present for the horizontal changes, but isn't present for vertical changes. Is it possible to put the swish sound on both types of workspace switches? Also, the vertical switches have the strange effect of animating from the left, in addition to their upward or downward movement. Is this a configuration issue, or a bug?
David Guild
David Guild-6 years ago
I have the same extra left-motion on vertical switches. I think this is caused by a bug in the underlying gnome framework. There's a method which (among other things) translates the workspace row/column delta into an enum (UP, DOWN, UP_LEFT, etc). It does this by first checking left/right, setting "direction" if there's horizontal motion; then checking up/down, modifying "direction" by adding vertical motion to its current value (left/right/null). The logic seems like it should work, but I noticed that the conditional ordering for the final value is: > if (!dir) dir=UP > else if (dir==RIGHT) dir=UP_RIGHT > else dir=UP_LEFT Vertical-only motion should hit the first line - but if it doesn't, we'd get UP_LEFT (or DOWN_LEFT; it's the same in both places). That neatly matches what we see. I don't know _why_ the "!dir" isn't taken, but it matches the weird motion. (My suspicion is that it has something to do with the fact that "direction" is an enum and "0" isn't a valid enum-value.) https://github.com/GNOME/mutter/blob/ffca9b999dfd96de66144cccb9cc450a4e382232/src/core/workspace.c#L599-L632
David Guild
David Guild-6 years ago
/** * Quick hack to fix vertical motion when switching workspaces. * All this does is intercept UP_LEFT and DOWN_LEFT motion and forcibly replace with UP and DOWN. * Installation: (1) Find the workspace-grid@hernejj dir (probably in ~/.local/share/cinnamon/applets/). * (2) Create a sibling directory; name it whatever. In that dir, paste this as 'applet.js'. * (3) Create a 'metadata.json' in your dir. I copied the one from workspace-grid and changed all the values. ("uuid" is probably the only one that matters, but I'd also change the name .) * (4) Go to "add applets to panel". You should see a new applet. Enable it. If everything worked right, up/down motion should be fixed. */ const Applet = imports.ui.applet; const Lang = imports.lang; const Meta = imports.gi.Meta; const Main = imports.ui.main; function fixedSwitchWorkspace(cinnamonwm, from, to, dir) { // HACK: If you actually want diagonal motions, change this to re-derive 'dir' based on from/to. if (dir == Meta.MotionDirection.UP_LEFT) { dir = Meta.MotionDirection.UP; } else if (dir == Meta.MotionDirection.DOWN_LEFT) { dir = Meta.MotionDirection.DOWN; } // Call the original switchWorkspace function. Main.wm._switchWorkspace(cinnamonwm, from, to, dir) } function MyApplet(orientation, panel_height, instance_id) { this._init(orientation, panel_height, instance_id); } MyApplet.prototype = { __proto__: Applet.Applet.prototype, _init: function(metadata, orientation, panel_height, instanceId) { Applet.Applet.prototype._init.call( this, orientation, panel_height, instanceId); }, on_applet_added_to_panel: function () { this.handler_id = global.window_manager.connect( 'switch-workspace', fixedSwitchWorkspace); }, on_applet_removed_from_panel: function() { if (this.handler_id) { global.window_manager.disconnect(this.handler_id); } global.window_manager.connect( 'switch-workspace', Lang.bind(Main.wm, Main.wm._switchWorkspace)); }, }; function main(metadata, orientation, panel_height, instance_id) { return new MyApplet(orientation, panel_height, instance_id); }