Windawesome plugin to disable WinKey

Sep 8, 2011 at 12:39 PM
Hi Alien282, I was wondering if it was possible to disable/suppress the left or right WinKey with a Windawesome plugin. That way, the WinKey could be used as a modifier key for Windawesome without the standard windows hotkeys getting in the way. At the same time, if you exit windawesome you'd get the old behavior back; so people giving windawesome a try would not have to fiddle with their system settings, registry hacks or 3rd party programs to enable/disable their WinKey.
Coordinator
Sep 8, 2011 at 4:23 PM

Hello,

Well, what you say is certainly possible, but I do not like reinventing the wheel and there are third-party programs (AutoHotkey) which go at great lengths when trying to provide your desired behavior. :) I do not want to try to match their completeness and robustness of implementation, nor do I have the years and years they have spent doing exactly that. :) I would suggest you take a look at AutoHotkey, which is probably the most useful program for Windows, alongside an application-launcher like Find and Run Robot. Then you could read here and here, for example, on how to do what you want. :) Besides, Windawesome allows you to have WinKey mappings, you just have to use ones that aren't colliding with already existing ones. Hope I have given you some useful information. :)

Regards,

Boris

Sep 8, 2011 at 8:22 PM

If I use AutoHotkey to disable the WinKeys, is Windawesome still able to use it as the modifier key?

Coordinator
Sep 8, 2011 at 11:19 PM
Edited Sep 8, 2011 at 11:24 PM

I wrote a huge amount of explanation, then decided to try it and it actually worked... :)

So, in order to use shortcuts that are already used by Windows (like Win + E to open Explorer or Win + D to show the desktop), you have to use left or right-only subscriptions (if you are interested why - I use RegisterHotKey if a general modifier is used and a low-level keyboard hook if one or more left or right-only modifiers are used - and this LL hook actually executes before Window's mappings). If you are using the Ruby config file for the shortcuts, you would do something like that:

subscribe modifiers.LWin, key.E do
	windawesome.quit_application Windawesome::NativeMethods.get_foreground_window
end

This will quit the foreground application when you press the LEFT windows key + E. The RIGHT one + E will still open Explorer. Note that this sometimes leaves the start menu open (I have no idea why) which might get annoying. If you want to execute the default action of the hotkey in addition to yours, you can return false from the function.

If you want to use shortcuts that use the Windows Key but are not in use by Windows or any other program - you can, and should (as it is better), use non-left or right-only modifiers. E.g:

subscribe modifiers.Win, key.Y do
	windawesome.quit_application Windawesome::NativeMethods.get_foreground_window
end

For anything else I would use AutoHotkey. Which exactly hotkeys do you want to map and to what? If you want to use Windawesome functionality with the WinKey, use one of the two ways I described. For anything else, use AutoHotkey! :) Be careful when combining them, though - do not expect that if you have a hotkey in Windawesome and the same hotkey in AutoHotkey that both will work. They might, they might not. Different ones are fine.

Oh, and besides, I personally find the WinKey extremely inconvenient to use - Alt is MUCH better for everything, I think. :) Anyway, does that suit your needs?

Edit: There are a couple of WinKey hotkeys that cannot be changed in this way - most notably Win+L (which locks the machine). Actually, they cannot be changed at all. :)

Sep 9, 2011 at 12:07 AM
Alien282 wrote:
Oh, and besides, I personally find the WinKey extremely inconvenient to use - Alt is MUCH better for everything, I think. :) Anyway, does that suit your needs?

That depends a lot on where your WinKey is located, no? ;)

Anyway, to me the win key was an obvious choice: shift alone cant be used, ctrl and alt are used by many programs. I've been using wmii for a long time now and since the winkey was an unused modifier (on linux) I got used to using it.

Win+[key] for selecting desktops and navigating between programs

Win+Shift+[key] for moving programs around and to different desktops, changing their position etc.

Win+Ctrl+[key] changing wmii's behavior

Win+Alt+[key] launching different programs

… thats basically my setup and it works pretty well for me.

Alien282 wrote:
For anything else I would use AutoHotkey. Which exactly hotkeys do you want to map and to what? If you want to use Windawesome functionality with the WinKey, use one of the two ways I described. For anything else, use AutoHotkey! :) Be careful when combining them, though - do not expect that if you have a hotkey in Windawesome and the same hotkey in AutoHotkey that both will work. They might, they might not. Different ones are fine.

No, I wont combine them. Actually I see no need to use AutoHotkey at all.

I will stick to the LWin solution. I was just thinking that, if you're using windawesome, you're not using window's desktop; so a windawesome plugin would be the right place to to get rid of things that interfere with it.

Coordinator
Sep 9, 2011 at 12:17 AM

I see. So I won't be trying to convert you to the "right" way of using Alt. :D

Try the LWin and RWin solution, yes. See if that works for you. Feel free to write if you have problems with making that work or with any behavior that you expected and didn't get or with something that is missing from Windawesome.

I think that your assumption about "if you're using windawesome, you're not using window's desktop" is not quite correct. :) Windawesome is not a shell replacement on purpose - I actually like explorer.exe and some of its functionality - like the Start menu. But anyways, remapping hotkeys should work, so a plugin might not be needed. You can try it and tell me if everything is fine. :)