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

Prompt Autofocus Support #86

Open
TheWisker opened this issue Nov 15, 2024 · 1 comment
Open

Prompt Autofocus Support #86

TheWisker opened this issue Nov 15, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@TheWisker
Copy link

Environment

  • OS: ArchLinux
  • web-greeter version: 3.5.3

Description of feature

When making some changes and improvements to Shikai Theme, I wanted to implement an autofocus feature for the password prompt, which would focus the prompt when the theme gets loaded, so the user does not have to click on it manually. In theory, this is something simple to do and, consequently, I achieved it by adding the following code to get triggered on the prompt load event:

setTimeout(() => {document.getElementById("password").focus();}, 250);

The problem is this only seems to work when running the greeter on a single monitor or inside a session with and without the -d flag.

What I could deduct from some tests I did is that when using more than one monitor each monitor behaves like a separate tab/window and only one of them has 'focus'. As the .focus() function only gives focus to the element if the tab is active, the element does not get focused. Particularly, in my situation, the secondary screen, that only shows a wallpaper, appears to be the one focused, thus preventing the primary screen, that has the prompt, to get focused/active and the .focus() function to have any effect. My mouse always appears on the secondary screen and sometimes when I click on the primary screen the .focus() function seems to take effect as the prompt gets focused.

Possible solutions

This is a list of possible solutions I came with:

  • Set the primary screen to get focused/active by default
  • Add a configuration option to select which screen gets focus on greeter start
  • Add some method in the API to change focus from one screen to another

The list of solutions is based on the assumption that all of my deductions are correct and the greeter does work like that internally. In case I'm wrong feel free to correct me :)

Thanks for making the greeter

@JezerM
Copy link
Owner

JezerM commented Nov 19, 2024

Hi! I made an update in the master branch to focus the primary screen at start. Let me know if it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants