valinet / sws

sws (Simple Window Switcher) is an Alt-Tab replacement for Windows
GNU General Public License v2.0
66 stars 9 forks source link

Allow remapping #4

Open yaserahmady opened 2 years ago

yaserahmady commented 2 years ago

Hello there!

Thanks for your work on Simple Window Switcher. Coming from macOS, the cmd + \ shortcut was something much needed on Windows.

I was wondering if you could consider allowing a setting to change the default modifier alt to ctrl so that people like me could have ctrl+ tab and ctrl + \ and feel at home even on Windows.

valinet commented 2 years ago

Hi

It’s a bit more complicated than that: on Windows, Ctrl + something is offered for applications to consume. For example, Ctrl+Tab switches tabs in any browser (behaves like an in-app Alt-Tab basically), so yeah, I don’t know how to approach this. It may interfere with other applications, that’s my main gripe with it.

Thanks

yaserahmady commented 2 years ago

I totally understand what you're saying and I think those are fair points. Honestly if it wasn't for multiple years of muscle memory with the Command ⌘ key and the fact I think it's a better placement for a meta key, I too would think the same.

I think your alternative switcher looks good, is configurable and works really well. Since I have absolutely no knowledge in programming desktop software, especially for Windows, and you're doing FOSS work: it's up to you if you want to consider it.

Possible implementation

The issue with most other solutions (except for Alt-Tab Terminator) is that the alt+tab remap is wonky. I think it's because it's possibly a complicated event loop to check for. Often those solutions fail to release some key and the system get's stuck because every new keypress is registered as alt+whatever.

I think a correct implementation should suppress the original system behaviour shortcut and reregister the shortcut substituting the switcher. Or possibly firing before the system can detect the shortcut like the Interception driver also implemented in the keyboard remapper capsicain.

Is there any interest?

Looks like there's quite a few people that want a similar desktop experience on Windows to what they had on macOS.

Random threads of people asking for the feature:

Other implementations

Alt-Tab Terminator allows for remapping the trigger shortcuts for both the apps switcher and the same-app windows switcher. It also supresses/hijacks the system behaviour for the shortcuts. The problems are: the app has a gigantic UI, it's not FOSS (costs 20$) and the website has been down for some time.

OtQ8GDxj1Z

Workarounds

One could remap alt-tab with AutoHotKey or Microsoft PowerToys. I described 4 methods and their issues on a repo with my keyboard remappings using capsicain and AutoHotKey.

mileyvirus commented 2 years ago

I'd also like a setting to remap the modifier. If the maintainer decides against it, where's the code that listens for the shortcut so I can build my own version?

valinet commented 2 years ago

I'd also like a setting to remap the modifier. If the maintainer decides against it, where's the code that listens for the shortcut so I can build my own version?

https://github.com/valinet/sws/blob/master/SimpleWindowSwitcher/sws_WindowSwitcher.c#L590

mileyvirus commented 2 years ago

Thanks @valinet, so I'd change all the MOD_ALTs to MOD_CONTROL and then follow the instructions to compile it. It doesn't look like a standalone application though, is it?

valinet commented 2 years ago

Well, yeah, probably, I can't say for sure, I haven't tested this yet. There'd be 2 options:

Beware that changing alt to ctrl there will just change this app's shortucts, not actually swap ctrl with alt at an OS level.