One of the things I have come to like about Linux is its workspaces — or, if you prefer, virtual desktops. I actually get a little frustrated when I’m at work, or working in the VPN and remote desktop to work, when I’m in Windows and I don’t have them. Yesterday, for example, after upgrading Fedora and logging in to work to set up the week’s liquidation lists, I really wanted to be able to move Excel, with the spreadsheet I was using, to a different workspace, but I could not.
It occurs to me now that what I should have done — and have done, when working in my usual Linux Mint environment — is to have Excel open full screen in the remote desktop and have the spreadsheet open in OpenOffice on a different workspace on my local machine. But, honestly, I didn’t need to have the windows “stacked” for more than about twenty minutes, so it wasn’t a big deal. Anyway, I digress…
One of the things I love about CTWM, an old school Linux window manager I like to use, is the way it handles workspaces. The Workspace Manager resides on the screen, it has little maps in each miniature workspace that tell you what applications are open, and you can drag applications from one workspace to another. I then implemented menus and keyboard shortcuts, using the wmctrl
command, to move between workspaces quickly and move applications from one workspace to another workspace with just a keystroke. Super/Windows key and number to move to a workspace, add the Shift key as well to move a window to that specific workspace. Nice, quick little system.
But I couldn’t do this in Cinnamon, the flagship desktop environment for Linux Mint. I liked having workspaces in Mint, and I use them, regularly, but they weren’t always convenient. I have my remote desktop to Diamond set up to always open on Workspace 3, but that’s because I launch a script to launch it, and I wrote in a wmctrl
command into that script.
Over the weekend, it occurred to me that I could set up keyboard shortcuts in Cinnamon, same as my CTWM shortcuts. And then I discovered that Cinnamon does the drag-and-drop in its workspace manager — the Expo view — which is brought up with a default keyboard shortcut of its own (Ctrl + Alt + Up).
While I set the keyboard shortcuts manually, I also wrote a bash script to set them up automatically. It’s not the most interesting script in the world, but it does what I need it to do.
#!/bin/bash
# Cinnamon Workspace Keyboard Shortcuts
# Defines i3-style keyboard shortcuts to move to specific workspaces
# and move windows to specific workspaces.
# Switch to workspace: Super + Number
gsettings set org.cinnamon.desktop.keybindings.wm switch-to-workspace-1 "['
gsettings set org.cinnamon.desktop.keybindings.wm switch-to-workspace-2 "['
gsettings set org.cinnamon.desktop.keybindings.wm switch-to-workspace-3 "['
gsettings set org.cinnamon.desktop.keybindings.wm switch-to-workspace-4 "['
gsettings set org.cinnamon.desktop.keybindings.wm switch-to-workspace-5 "['
gsettings set org.cinnamon.desktop.keybindings.wm switch-to-workspace-6 "['
# Move to workspace: Shift + Super + Number
gsettings set org.cinnamon.desktop.keybindings.wm move-to-workspace-1 "['
gsettings set org.cinnamon.desktop.keybindings.wm move-to-workspace-2 "['
gsettings set org.cinnamon.desktop.keybindings.wm move-to-workspace-3 "['
gsettings set org.cinnamon.desktop.keybindings.wm move-to-workspace-4 "['
gsettings set org.cinnamon.desktop.keybindings.wm move-to-workspace-5 "['
gsettings set org.cinnamon.desktop.keybindings.wm move-to-workspace-6 "['
The one thing I cannot do in the script is to turn off Cinnamon’s native Super+Number behavior. If you have the Grouped Window List applet in a panel to have app launchers, as I do, Super+Number behaves like that key combination on Windows, launching the application that would correspond to that number, counting from the left. To turn this off, open Cinnamon Settings, go to Applets (under Preferences), and in the window that opens scroll down to Grouped Window List and clear the gears icon at right. This will open up a window, and under Hot Keys, uncheck the toggle for “Enable Super+<number> shortcut to switch/open apps.” gsettings
won’t touch that; this is buried in a JS file in the /.config
directory.
And now I can do wild and efficient things with workspaces from my keyboard in Cinnamon.
What ho, Jeeves! 🙂