Show HN: Switch windows of same app with hotkey (alt + `)
github.comIs there this exact same app but with a window image preview like alt-tab does?
FYI in macOS you can do this using ⌘ + `
I'm assuming most of you know this but just in case
FYI, this is configurable via System Preferences → Keyboard → Shortcuts → Keyboard → Move focus to active or next window.
to exapnd, there are three similar shortcuts (add shift to reverse order):
this last one needs manual configuration iirc, and this is what mine is configured to. it's the one that acts most like "switch back to the last active context". however, the system is somewhat unintuitive about how it designates the "next" window (especially if you intermingle all three shortcuts), so it's not very reliable.1. ⌘⇥ (cmd-tab) - regular mac app switching 2. ⌘-`(cmd-grave) - "Move focus to next window" 3. ⌥⌘⇥ (opt-cmd-tab) - "Move focus to active or next window"Doesn't work when windows are in full screen..
Does not work in all keyboard layouts though. One more reason to use US layout.
I have bound it to ⌘. (command + period)
Surely you can re-map it though.
You can remap it in system preferences. For a UK keyboard it makes the most sense to map it to “section” which is directly above tab.
I map that key (without Cmd) to Escape on my Touch Bar MacBook... The best, yet should be unnecessary, key map tweak.
I can't recommend BetterTouchTool enough for touch bars. You can setup custom buttons, gestures, widgets, etc.
On mine I do: - A button to show desktop at the top left, so I can tap it, start dragging something, and tap again to drag things into windows
- some common function keys for editing
- links to work webpages and note files I use frequently
- Some shortcuts to system stuff: play/pause media, silence notifications, take a screen shot, etc.
- swiping with 2 fingers controls volume, 3 for screen brightness, 4 for keyboard backlight.
All of these have become second nature, and turned the touchbar from a nuisance to disappointment future macbooks won't have them anymore.
Obviously it still may not be useful to you, but it might be worth trying the demo as long as you're stuck with it for now.
I did that on my old TouchBar Mac too, life saving. As soon as they brought out one with an escape key I replaced it. And again when the new ones came out with no TouchBar at all. What a farce the TouchBar was.
I’ve been using a third party piece of software called witch from many tricks to do window switching!
Wasn’t aware this is natively supported in OSX, and doesn’t seem to be working.
Nice work! I’ve shared an equivalent with HN as well: https://neosmart.net/blog/2017/easy-window-switcher/
The hardest part for me was getting it to work on all the keyboard layouts, but that seems to be done with an update we released a couple of weeks ago.
Anyone know of a roughly equivalent utility or config setting that lets one do Windows-style app-independent window switching on Macs?
I use https://alt-tab-macos.netlify.app/
Without it alt-tabbing is near useless for me on macOS.
How is alt-tabbing near useless? I find it quite easy/simple. The fact that I often have my left hand on the keyboard and my right hand on the mouse makes it even easier with a quick cmd-tab while leaving the cmd key pressed so that I can mouse click the app icon I want directly without mulitple cmd-tab clicks to cycle to what I want very convenient.
> How is alt-tabbing near useless?
I think the parent refers to MacOS/Gnome treating alt-tab as a "switch program" shortcut, not a "switch window" shortcut. I find it very convenient to press "alt-tab" to go to the previously-focused window, or "alt-tab-tab" to the even-previously focused window.
It's much easier for me to think in terms of context switches (go back to my N-previous activity) than have to consciously evaluate whether i want to switch window of the same app or switch app.
>i want to switch window of the same app or switch app.
That sounds like a total nightmare to have the same keyboard shortcut do 2 different things. Cmd-Tab switches app, Cmd-` switches windows in an app. I just don't understand how that is difficult. Then again, some people find math hard, others find it easy. To each their own.
MacOS is app centric and Windows is document-centric, in large part because of the differences in window management. MacOS window management encourages users to focus on which app is open, leading to users talking about apps rather than documents (I made it in Keynote, Pages, or Numbers). Windows windows management encourages users to focus on which document is open, leading to users talking about documents rather than apps (it's a Word Doc, an Excel Sheet, a PowerPoint Deck). The difference is subtle but significant. If you're a long time MacOS user, you can't imagine not just knowing what app your document/window is hosted in. If you're a long time Windows user, you can't imagine mentally sorting your windows by which app launched them.
This difference almost certainly has its roots back in the dawn of the original Macintosh, which could only run one application at a time and context-switching or Multi-Tasking had to be explicitly added to the OS after the fact[0]. Windows, which was developed later, was designed as an inherently multi-application OS from the beginning. Today, it's pretty much only in the windows management where you still see the vestiges of those original differences.
> I just don't understand how that is difficult.
It's not difficult, but why do they make it difficult to "just go to the previous window", whose default shortcut was alt-tab on almost all systems (windows + gnome + kde)?
Maybe you have a specific workflow with a specific set of apps you use in a specific order in which case your brain is hard-wired to know whether you'd like to switch app or window within an app. I personally find it much easier when i don't have to think about it and can just "go back" to what i was doing previously.
You seem to have the concept in your mind of open windows vs open apps. I've never thought of it like that, and always have the concept of apps in mind. Not thinking of apps seems as foreign to me as grouping windows as apps seems foreign to you. It would be interesting to see the differences between how either was learned to really grok the difference.
> You seem to have the concept in your mind of open windows vs open apps. I've never thought of it like that, and always have the concept of apps in mind.
For me, windows windows tend to be for discrete tasks. E.g., on one space I have a browser for coding stuff, and on another space I'll have a browser for email/chat. So it's important that I can switch to a specific browser window, rather than my viewport being dragged over to another space because that's the last browser I looked at. Same for code editor windows.
macOS' keyboard shortcuts aren't good for this workflow. I understand Mac prefers gesture- or mouse-oriented solutions like Mission Control, but that's a much less ergonomic approach for my needs.
Everybody that didn't start with mac has that concept of open windows, it shouldn't come as a surprise. If you like the way Apple tells you to do it, it works great. If you don't like it, Apple is bent on taking away customisation options one by one.
I also find the window management in Osx terrible. Thankfully a couple of third-party apps (BetterTouchTool and AltTab) fixes most of the issues.
I'm happy with my mac, but if those third-party solutions stop working, I'd switch back to linux in a heartbeat.
> Then again, some people find math hard, others find it easy. To each their own.
Way to be condescending. The presented opinion is clearly reasonable, as is yours.
No condescension intended. It was just a regocnition that what someone finds instinctual others find less so. It was one of the lessons not learned until much later in life for me that allowed me to become much less frustrated when working with others.
You got it wrong, this is not about finding something more difficult or less instinctual, this is about personal preference.
Let's say you have three browser windows, three terminal windows, and three file manager windows. Also, each window corresponds to a project/task, such that the logical groups are really (browser1, terminal1, files1), etc. Make sense?
Next, you want to show all of the windows from a single task, each one at the highest focus relative to all other windows of the same application.
Only being able to switch applications, rather than individual windows, makes this a tedious, manual process.
I hear you say, "just use..."
- Multiple workspaces: does not play well with changing multi-monitor setups. Does not persist across restarts. (Last time I tried anyway)
- Expose: this is not a keyboard-shortcut friendly interface. Windows-style alt-tab lists are predictable and linear, Expose window arrangements are not.
I just want the interface I already know, that works perfectly for this situation.
The multi-monitor stuff is much better now. I’d revisit. It persists for me across display configuration changes.
Thanks. In the mean time, I've started using the alt-tab tool. This makes my Mac OS experience more closely match my Linux experience, which I also find important now that I'm using both machines with the same KVM devices, on a switch.
As the other comments mentioned it's due to application instead of window switching. I find it frustrating to alt-tab to some application with no windows (because I closed it but on macOS that doesn't close the app), which only makes the top bar change and is not my intention 99.9% of the time. AltTab instead has sane defaults and allows a lot of customization including multiple shortcuts for different purposes.
The understanding of an app quitting when the last window is closed is something that I go back and forth on if I like it or not. I think it really depends on the app. Launching Adobe apps take long enough that it is annoying to need to relaunch them, so I really appreciate that they don't quit on close of last window. Yet apps like Lightroom must totally relaunch just to switch to a new library which is extremely frustrating.
So it seems to me that Cmd-Tab is less of the offender to you than the app not behaving as you prefer when there are no active windows. Seems like your ire is slightly misdirected.
I use Contexts ( https://contexts.co/ ) which works great.
You get per-window switching, with the normal picker modal (so you bring only your desired window to the front, and not every window you cycle through like Cmd-`).
As a bonus, Contexts has an option to only choose from windows on your current "space", which is really important for me.
You can find it under System Preferences > Keyboard > Shortcuts, in the Keyboard section. The shortcut name is "Move focus to next window". It will automatically cycle the windows in reverse order adding shift to the shortcut.
Is this not something that is enabled by default on all macOS installs? Cmd + ` has been something I've used for ever. No 3rd party app required.
They are looking for the exact opposite, a shortcut that will only switch between different apps. Cmd+` only switches between windows of the same app, and I believe cmd+tab switches between windows of any app.
No, Cmd+Tab switches between apps not windows within all apps.
Classic win32 programming mistake on this line: https://github.com/sigoden/windows-switcher/blob/f2088e7f05a.... `GetMessage` can return a negative value when there is an error but before the program is quitting, see https://docs.microsoft.com/en-us/windows/win32/api/winuser/n....
The first time I remember something like this on linux was on Ubuntu's Unity in 2012. It is also the default on Ubuntu 20.04, so I think it was enabled the whole time for the last 10 years. Anyone knows if KDE also does that and, if yes, since when?
I just tried on Plasma 5.24.2 and yes, it seems this is a feature. I'm happy this exists, I never knew about it.
Shortcuts being CTRL-dependent on Windows is _the_ main reason I do not use it on any of my machines.
MacOS' ⌘-dependent (CMD?) shortcuts are much more ergonomic. I use my thumb to trigger shortcuts, vs on Windows having to use my pinky's knuckle.
On Linux you can emulate this same behavior by switching ctrl/alt/win keys (gnome-tweaks has this option). One thing I am unable to emulate, however, is ALT+left/right arrow for home/end.
You can swap keys on Windows too. So, hooray! You can use Windows on any of your machines!
I do not understand. What does this add, that my desktop environment does not already provide? Why should I download and use this instead? Most desktop environments I know already allow me to set a key binding for this task.
I think it adds the thumbnails? I’m puzzled as well, gotta admit even after switching to Mac Mini last year, from Ubuntu & Windows, I didn’t even pay attention to that.
On the other hand, the Win + (number) shortcuts I can’t live without and there are very few solutions on macOS which surprises me, because those min/max/switch shortcuts ate incredibly simple and intuitive.
This is for Windows, I don't use Windows often but last I checked this wasn't built into the OS.
Nice! If you can also make alt+tab select apps instead of all windows, I might try using Windows again.
This is already a thing on KDE Plasma.
Seeing tools like this make me so glad that I use KDE. I'm sure that Windows is great for developers, developers, developers but as an end user I want something comfortable yet configurable, that looks nice too.
Which operating system is this intended for?
Windows is my guess, based on the source.