kinto
kinto copied to clipboard
CMD + L should focus the address bar in browsers on Windows
Is your feature request related to a problem? Please describe.
Typically on macOS in browsers, hitting CMD + L
will focus the browser. Currently, Kinto doesn't do this. I looked into it a little and it seems it's a slightly more complicated problem than it first seems. If you have it enabled, Windows + L
will lock your machine, and this can't be overridden by AHK. However, disabling the lockscreen entirely still doesn't seem to work with Kinto. However, I feel there are users who are using this on their work issued laptops who might not be able to do this.
Describe the solution you'd like
I'd like it to at least function with the lockscreen turned off, but preferably Kinto would remap the lockscreen shortcut to CMD + CTRL+ Q
like on macOS and CMD + L
behaves like CTRL + L
.
Describe alternatives you've considered I've also looked into having AHK make registry tweaks to have this work, but was unable to get this working correctly. Plus I imagine most users don't want a script to be constantly changing registry entries.
Kinto used to do some registry remaps, but I was able to successfully remove that without issue, although initially it looked like that was the best way to swap Ctrl with Alt or Super/Win. It certainly isn't though, in particular if you ever swap keyboards from Apple to Windows style it creates a nightmare that requires log offs and log ons.
I do need to do something though to stop Cmd + L from causing the lockscreen to appear, I do agree with that. Additionally I plan to work on adding a feature or 2 to the Keyboard Manager from Powertoys because I have noticed that while Autohotkey does not work with RDP.. Powertoys does and that to be me would be a very important feature to have as part of Kinto and I don't think there is any way to get there with AHK. Kinto may still use a combination of both to map everything or offer 2 different modes.
In most respects Autohotkey is capable of doing everything that needs to happen and Powertoys Keyboard Manager may be the lesser of the 2 and yet the only realistic option for RDP sessions using Microsoft's remote based solutions.
I will look into this later.
I would love it if this feature were available -- specifically for running locally and using browsers; the RDP aspect of this doesn't really matter to me.
I'd like to note that someone on the AHK forums seems to have gotten the necessary registry manipulation working.
This seems genuinely horrible, to the point where I don't trust myself to get it working. But if got it working well enough to support in Kinto I'd give it a go.
Thank you!
That does look useful to solving the lock remap. Will take another look soon, also I worked out the RDP issues in the latest releases & it’s documented in the readme.
So in reality.. Powertoys keyboard manager has nothing over AHK &/or Kinto.
I know that this has not been addressed yet, but as a workaround is there any keyboard shortcut that will focus the address bar on browsers? Since ctrl+L stops working too and now I have no way to get to the address bar without using my trackpad.
I feel like this whole thread needs the clarification that this is only a problem on Apple keyboards, where the key that is used as "Cmd" is an actual Cmd key, and is treated by Windows as the "Windows" key, thus triggering the lock screen when you use Cmd+L.
On a PC keyboard the "Cmd" key is the physical Alt key (remapped to be Ctrl), so this isn't an issue unless trying to use the equivalent of Option+L on the physical Windows+L keys.
@pathsny
The right-side Ctrl key on an Apple keyboard is working for me for Ctrl+L to focus the web browser address bar. The left-side Ctrl key... either does nothing, or sometimes actually invokes the Windows lock screen. The situation is similar in the file explorer. So if you're willing to use the Ctrl key on the right side for this, there's your alternative. Bonus, the right Ctrl key is much closer to the "L" key, so you can do the combo with one hand much more easily.
The reason for this difference between the keys is eluding me at the moment. The way the config file is changed in the Windows/AHK version when changing keyboard types seems much more complicated than what happens in the Linux version, so I'm not sure exactly what's happening.
Edit: This is why:
; $LWin::LCtrl ; MacModifiers
; $RWin::RCtrl ; MacModifiers
; $LCtrl::LWin ; MacModifiers
So only the left Ctrl key is remapped to a Win key when using an Apple keyboard.
Great clarification! Unfortunately I do have an Apple keyboard, so this does affect me. Since I have to keep switching between a mac and this machine, I'm hoping to get them pretty consistent so my muscle memory doesn't fail me. I'm trying to create the mapping so that using "Cmd+L" (where Cmd is the key right next to the space bar) takes me to the address bar. Thanks for suggesting the work around!
That said, I've made some progress and I wonder if I could get some help on the last bit of it.
-
I've applied the registry tweak pointed to by @mambocab and so now I'm able to successfully trap cmd+l and take an action (such as display a message box). I do it this way
$^l:: Msgbox "I got you" return
-
I'm also able to get to the address bar by adding code right after the Msgbox. (Without the send code, this doesnt happen).
$^l::
MsgBox "I got you!"
send ^{l}
return
- However, when I take out the bit with the MsgBox, nothing happens. What do you think may be going on here?
I'm afraid I'm not that interested in messing with the registry tweak, but what happens if you just use this one line instead of the multi-line?
$^l::send ^{l}
I also seemed to have nothing happening after merely commenting out the MsgBox line. This one liner works on my PC keyboard. I made sure it was doing something different by replacing the "{L}" with "{K}", which causes the address bar to act like a search box (or gets hijacked by websites like GitHub for a custom search dialog).
Since I haven't done the registry tweak, this doesn't work on my external Apple keyboard.
It's my understanding that the registry tweak completely disables the ability to lock the computer, so I feel like that's not recommended. Unless you're talking about the whole dynamic editing procedure in AHK.
I used the registry tweak, but I understand that it's not recommended. That said there is potential for building a solution for everyone using the dynamic procedure.
I did try using the one liner but unfortunately that did not work either. That said, when I searched for similar issues I found this thread which suggested that the issue was something to do with focus being lost. So I tried this code which seems to be working.
$^l:: ; Go to the address bar
WinGet, winid ,, A
WinActivate ahk_id %winid%
WinWaitActive ahk_id %winid%
send ^{l}
return
@pathsny
there is potential for building a solution for everyone using the dynamic procedure
As much as I love a good solution that works for everyone, disabling the ability to lock the computer and potentially leaving it in that state if the app crashes, is problematic. A lot of extra checks would have to be put in place (like during the shutdown procedure), and it would still probably need to be an optional feature for the user to enable.
this code which seems to be working
That is an interesting find. The AHK forums are full of workarounds like that for all kinds of different situations. I'll have to try that code and see if it will allow the left Ctrl key to be usable in the same way as RCtrl.
@pathsny
That code does allow the left Ctrl key to be used to access the address bar, finally, similar to the right Ctrl key.
#IfWinActive ahk_group browsers
; Go to the address bar
; $<#l:: ; MacModifiers
; WinGet, winid ,, A ; MacModifiers
; WinActivate ahk_id %winid% ; MacModifiers
; WinWaitActive ahk_id %winid% ; MacModifiers
; send ^{l} ; MacModifiers
; return ; MacModifiers
; Page Navigation
Since it references the key with "<#" (Left Win key) symbols, I had to add the "; MacModifiers" at the end so the lines only become active when an Apple keyboard is in use.
Seems to work now. So that should allow either Ctrl key on an Apple keyboard to be used to access the address bar, whether or not the registry tweak is used.
Something similar should allow the Ctrl key to be used for this function with other keyboard types as well.