1

Asked on the forums, but no luck. How can I switch among windows using the Win key plus the numbers 1 through 9, like in Windows or in Ubuntu's Unity?

These keyboard shortcut have saved me tons of time over the years, and I find it surprising that such a popular desktop environment like Cinnamon doesn't implement them by default. I have my file manager always open as the first window, my terminal window as #2, IDE as #3, browser as #4.

Assigning manually Win+1/2/3/etc. is a non-starter, because it will always launch a new instance of the app. Some apps might have a "one instance only" option, but that's the exception, and even then, you'll see the flicker of the new instance being launched and then killed.

1

What you are asking is in fact possible with a simple hack. In my case, I wanted to bind Super+2 to "either switch to emacs if possible, otherwise open it". To get this working in Cinnamon, first sudo apt install wmctrl (or whatever other method to install packages on your Linux distro), then, with emacs (or whatever application you want to bind) open, do wmctrl -x -l to get a list of your current open windows: I got

0x0440013f  0 emacs.Emacs           username-debian-x1 emacs@username-debian-x1

Now take that emacs.Emacs and write the following bash script:,

#!/usr/bin/env bash
wmctrl -x -a emacs.Emacs || emacs

and put it somewhere like ~/Documents/switch-emacs.sh, then do a chmod +x on that file to enable execution, then in the Cinnamon keyboard settings, you can create a custom command and select that shell script, then bind Super+2 (or whatever you want) to it. This should work immediately (tested on Cinnamon on Debian 10 buster stable).

Source: a comment found on Github

Note the reason that we needed to put it in a shell script instead of just typing the wmctrl command directly into the custom command is because the || operator doesn't seem to work correctly when passed directly to the keyboard shortcut.

Update: It seems that as of cinnamon version 4.2.4-1 (and possibly earlier), this Super+number "open or switch to" feature is builtin to Cinnamon, and works out of the box without needing the hack above. However, as of September 2019, only rolling distros like Arch have cinnamon versions this new; with Mint, Ubuntu, and Debian, you still need to use the hack above (as of Sept 2019), until cinnamon version numbers for those roll forward enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.