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

Get current state of CapsLock key? #1391

Open
deranjer opened this issue Oct 11, 2020 · 8 comments
Open

Get current state of CapsLock key? #1391

deranjer opened this issue Oct 11, 2020 · 8 comments
Labels
Keyboard Items for keyboard control

Comments

@deranjer
Copy link

I have a gui where the user needs to create a password. I wish to warn the user if the capslock is on.

I can easily capture capslock key EVENTS, so if I assume capslock is already off, I can warn them if it is turned on, but want to warn the user if the capslock key is on when they launch the app. Is that possible?

@andydotxyz
Copy link
Member

This is not currently possible. The state is passed as a modifier to key events so you could learn about the state as soon as a user presses a key which is nearly as good I hope?

@deranjer
Copy link
Author

Well my concern is if they accidentally launch the program with the CapsLock already engaged, then set the password, then are very confused when the launch the program to enter their set password w/o CapsLock engaged and their password doesn't match, and they don't know why.

Not sure if I could simulate a capslock press to discover the state, then reset it and notify the user if caps lock is on. Not a major concern overall I suppose, but would be nice to have.

@Jacalz
Copy link
Member

Jacalz commented Oct 11, 2020

I could see that being quite useful as well. Might even be useful for fynedesk when we want to have a fancy login screen :)

@stuartmscott
Copy link
Member

I agree @deranjer - there is definitely value here, but this might be outside the control of Fyne as it gets the events from GLFW so might have to request this feature from that project (https://github.com/glfw/glfw) for Desktop, then Mobile is a whole different story (https://github.com/golang/mobile)

@deranjer
Copy link
Author

@stuartmscott The start of this may have been added in 3.3? A status for "Lock Key Query" shows it was completed for 3.3 (which released in 2019).

This is the ticket that was for the lock state of keys: glfw/glfw#946

@andydotxyz
Copy link
Member

I can't see that in the exported Go API in the go-gl/glfw project, might need to work on the upstream API to gain access to this functionality.

@deranjer
Copy link
Author

So the only mention I could find in go-gl/glfw was in input.go
ModCapsLock ModifierKey = C.GLFW_MOD_CAPS_LOCK
It appears to have been added to the 3.3 patch for go-gl/glfw. I have no idea if caps lock was even supported as a key before 3.3, so this appears to just be adding the key bind itself.

@andydotxyz
Copy link
Member

Yes that change is what adds support for capslock modifier, which we added in 1.3.

@andydotxyz andydotxyz added the Keyboard Items for keyboard control label Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Keyboard Items for keyboard control
Projects
None yet
Development

No branches or pull requests

4 participants