-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a timeout when calling
setxkbmap
(#1249)
## Problem - When calling `setxkbmap` in development the `root` user might not have access to the `:0` X display. - Maybe there is XDM running or another user is logged in. In that case `setxkbmap` prints ``` Authorization required, but no authorization protocol specified ``` error message in an infinite loop and gets stuck. - Additionally the $DISPLAY might be already set so we should honor that value (e.g. when you manually start the web server from terminal) ## Solution - Use the [subprocess](https://crates.io/crates/subprocess) crate to limit the execution time - Use the current `DISPLAY` value when already set ### SSH X Forwarding Problem We need to set the display for the `setxkbmap` call when running on the Live ISO because when running Agama from systemd service the `DISPLAY` is not set but we need to access the locally running web browser so we have to explicitly set the `:0` value. When the web server is started manually from a terminal we should keep the current value if it is already set. But using the current `DISPLAY` value might behave a bit unexpectedly when you login to the system via SSH with X forwarding enabled. In that case the `setxkbmap` call will query and set (!) keyboard of the remote X server. That might be quite confusing. Sure, that is a corner case, but if you select some exotic layout with complete different mapping like Dvorak then it might not be trivial to restore your original layout. When using X forwarding the `DISPLAY` is set to something like `localhost:10.0`, so we should use it only when it starts with `:` character which means the local X server. ## Testing - Tested manually --------- Co-authored-by: Imobach González Sosa <igonzalezsosa@suse.com>
- Loading branch information
Showing
4 changed files
with
109 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters