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

Switch among windows with Super+numbers / Win+1, 2, 3 etc #5561

Closed
dandv opened this issue Aug 16, 2016 · 24 comments
Closed

Switch among windows with Super+numbers / Win+1, 2, 3 etc #5561

dandv opened this issue Aug 16, 2016 · 24 comments

Comments

@dandv
Copy link
Contributor

dandv commented Aug 16, 2016

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.

PS: I've asked on the forums, and on Unix&Linux.SE, but no luck.

@mainmachine
Copy link

I rely on Super+$(type search term), which is one thing that appealed to me about Cinnamon coming from Windows several years back, but I'm not familiar with these key combos - do they open a new instance of the applications you listed, or do they switch between them, like an app specific alt-tab?

@dandv
Copy link
Contributor Author

dandv commented Aug 17, 2016

Super + <search term> means releasing Super.

Super+1 means holding Super while pressing 1. If you switch between the same few apps all the time (e.g. a browser and an IDE or code editor) and have other apps in the background (music player, system monitor and whatnot), you'll wonder how you've ever lived without the ability to instantly switch to any window you want. Alt+Tabbing past the apps you don't want to switch to, takes several times longer.

That keyboard shortcut saves me probably 5 seconds per minute on the average, so ~40 minutes a day.

If you use any apps that have an option to launch only one instance, e.g. Double Commander as your file manager, you can try out the shortcut already. Unity and Windows 7 also implement it.

@mainmachine
Copy link

This is one reason why I prefer any application that has internal tabbing, so I can manage multiple instances of say a terminal emulator in a single taskbar instance - this keeps alt-tab fairly slim for me, among other benefits. There are also a ton of different options for alt-tab behavior which might be more appealing to you than the traditional alt-tab. I use "Timeline (3D)" which looks quite nice and is very quick to get to what you want to get to (also a native part of Cinnamon).

If you're looking for Windows 7 workflow parity, Cinnamon is about the closest you'll get, KDE is probably second, but you may have to look beyond the defaults.

@dandv
Copy link
Contributor Author

dandv commented Aug 17, 2016

I just want to switch to my file manager with Win+1, my IDE with Win+2, and my todo app with Win+3. These are the first three apps in my taskbar.

Is it possible to create an applet or extension to do this?

@mainmachine
Copy link

I'm sure it's possible, although as you've seen, the default behavior in cinnamon for a launcher hotkey combo is to launch a new instance of the application if it's already open, rather than switch to an existing instance of the application.

I guess you're trying to keep parity with your workflow from Win 7 (correct me if I'm wrong), but I think what you'll find is there are other workflows which don't exist on that platform that you might like better, for instance, multiple workspaces. I typically have an email client, web browser (or two), and a terminal app open, and additionally skype, file manager, and sometimes word processor, spreadsheet or some other apps open. If I need to run a VM for some application, I switch to the secondary workspace and launch it there, along with a terminal, so the VM/terminal combo is on the second workspace, and my main workspace is the stuff I need to do the majority of my work. Easy ALT+CTRL+L/R arrow to switch between them.

You could bind the Super+1, etc to several workspaces, then have your applications on each of these. There is even a gnome extension to auto open whatever apps were open when you shutdown, although I can't remember what it's called...

@mainmachine
Copy link

mainmachine commented Aug 22, 2016

Here's where you would set the Super+X keys to tie to each workspace easily:

screenshot from 2016-08-22 00-22-34

(This is under Settings > Keyboard)

I know it's not exactly what you're looking for, but it is an alternative you might find useful.

@dandv
Copy link
Contributor Author

dandv commented Aug 22, 2016

I guess you're trying to keep parity with your workflow from Win 7 (correct me if I'm wrong)

I'm trying to keep parity with my workflow from Unity.

I very much welcome workspaces being a native feature in DEs (vs. Windows, where I used tools like Virtual Dimension), and I've been using Ctrl+Alt+arrows to switch among workspaces.

What I want is to switch as quickly as possible among a small set of applications - mainly file manager, text editor, TODO/GTD tool, IDE and maybe browser.

I tried splitting those apps one per workspace, and that worked somewhat. Is there a way to disable the sliding animation when switching among workspaces, as with Compiz in Ubuntu?

It's a little artificial, still. With one window per workspace, I no longer see the other windows I had open next to it. I use workspaces to switch context, e.g. between coding and answering emails, but copy/pasting a snippet of code from my text editor into the IDE is part of the same context, and so is adding a TODO item while coding.

BTW, KDE has this feature.

@xenopeek
Copy link
Contributor

Related issues are #5516, #4557 and #3883.

@JosephMcc
Copy link
Contributor

The other issues are close enough to close this as a duplicate.

@dandv
Copy link
Contributor Author

dandv commented Aug 25, 2016

Oddly enough, there are at least two applets that do this to some extent, and an entire thread on the forum. I'm surprised nobody has suggested them so far.

  1. Window List with App Grouping - doesn't handle unpinning though
  2. Window List with Hotkey - doesn't handle reordering

@mainmachine
Copy link

It's a little artificial, still. With one window per workspace, I no longer see the other windows I had open next to it. I use workspaces to switch context, e.g. between coding and answering emails, but copy/pasting a snippet of code from my text editor into the IDE is part of the same context, and so is adding a TODO item while coding.

My solution to this is to use the "Always on Visible Workspace" option from the windows header right click menu.

AFAIK extensions and applets are written in JS for Cinnamon, so if you know JS, then you could look at making this functionality, or contributing to one of these applets that almost does what you want - or fork it and do that...

@dandv
Copy link
Contributor Author

dandv commented Aug 31, 2016

I've just posted a $100 bounty to have this issue solved.

@dandv
Copy link
Contributor Author

dandv commented Sep 2, 2016

AFAIK extensions and applets are written in JS for Cinnamon, so if you know JS

I know JS, but I think the code is way too complicated, over 1300 lines to assign shortcuts to windows?!

@mainmachine
Copy link

How many lines should it take? 😉

Honestly, having never delved into the code of a DE I wouldn't know how complex it would be, but I would not be surprised if there's a lot in there you wouldn't expect on the outset.

The Sane Menu replacement is 2775 lines - is that to much or to little? Without delving into the code, I couldn't judge whether it's efficiently coded or not, or if there are features and provisions that aren't obvious bby what I expect it to do.

@ChrisAntaki
Copy link

@dandv I found a partial solution. If you install the "wmctrl" program, you can use it to switch to already opened programs. For instance, wmctrl -x -a "Chrome" gives focus to Chrome, and wmctrl -x -a "Terminal" gives focus to the Terminal. After finding these working commands, I assigned them to Keyboard Shortcuts. An image of the shortcuts screen is attached. Hope this helps!

screenshot from 2017-05-03 10 48 50

@ChrisAntaki
Copy link

ChrisAntaki commented May 3, 2017

If you'd like to switch to the program, or open the program if it wasn't already, the solution is a bit more involved.

  1. Create an executable .sh file that contains an expression like wmctrl -x -a "Terminal" || gnome-terminal.
  2. Create a Keyboard Shortcut and set its command to the .sh file's absolute path.

Note: Remember to make the .sh file executable with the chmod +x command.

@nirrub
Copy link

nirrub commented May 21, 2017

You can map Super + Num with the use of this thing:
https://github.com/mkropat/jumpapp
So you can do something like map Super + 1 to "jumpapp nemo" so that it either raises the file manager window or launches it if it's closed.

@xueeinstein
Copy link

My solution is to use customized tools run-or-raise and switch-windows.

run-or-raise either active the already opened application window or directly open a new application session if it doesn't open yet.

switch-windows support to switch windows using shortcuts like Super + k and Super + j in the Awesome window manager.

screenshot from 2018-05-13 11-08-54

@xdavidliu
Copy link

xdavidliu commented Sep 21, 2019

My solution is to use customized tools run-or-raise and switch-windows.

This works perfectly.

@smurphos
Copy link
Contributor

Grouped Window List in Cinnamon 4.x has native support for this with pinned applications.

@nof8
Copy link

nof8 commented Dec 19, 2019

Seems like it was broken in Linux Mint 19.3 :(

@agalitsyn
Copy link

I confirm, updated to 19.3 yesterday and it no longer working

@frostfred
Copy link

Yep, 19.3 broke this hotkeys

@xenopeek
Copy link
Contributor

Locking this issue as #9028 is opened for this on 19.3.

@linuxmint linuxmint locked as off-topic and limited conversation to collaborators Dec 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests