-
Notifications
You must be signed in to change notification settings - Fork 5
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
Display monitor hotplugging v2 #199
Merged
Merged
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6f311c8
Initial HDMI hotplugging efforts
knuton a5f6b5f
Version that works on QEMU
yfyf 19bf369
Allow xrandr to fail and only set primary display on success
yfyf 0b4145b
Remove TODO
yfyf 3415498
Handle primary screen and screen size changes in kiosk
yfyf b1d2db7
Don't do anything if no connected outputs are found
yfyf 1b5bad3
Remove extra newline
yfyf 557d95d
Maintain the geometryChanged connection as a state variable
yfyf cb06ae9
Add test for checking that kiosk responds to screen changes gracefully
yfyf 4212df8
Fix: use QueuedConnection to avoid blocking other Qt signal receivers
yfyf 35eb638
Add integration test for kiosk output scaling based on screen mode
yfyf 7c31677
Mention the correct subject in comments
yfyf 507f0d9
Ensure proper rendering of test grid in Firefox
yfyf a2a360e
Remove cursor to make screens match pixel-perfectly
yfyf 829ee43
Sanity-check the rendered HTML
yfyf d3b96a0
Remove trailing whitespace
yfyf a8770c3
Remove obsolete comment
yfyf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
set -euo pipefail | ||
|
||
SCALING_PREF=$(cat /var/lib/gui-localization/screen-scaling 2>/dev/null || echo "default") | ||
readonly SCALING_PREF | ||
|
||
CONNECTED_OUTPUTS=$(xrandr | grep ' connected' | awk '{ print $1 }') | ||
readonly CONNECTED_OUTPUTS | ||
|
||
echo -e "Connected outputs:\n$CONNECTED_OUTPUTS\n" | ||
|
||
scaling_pref_params="" | ||
|
||
echo "Using scaling preference '$SCALING_PREF'" | ||
|
||
case "$SCALING_PREF" in | ||
"default" | "full-hd") | ||
scaling_pref_params=(--mode 1920x1080) | ||
;; | ||
"native") | ||
scaling_pref_params=(--auto) | ||
;; | ||
*) | ||
scaling_pref_params=(--auto) | ||
;; | ||
esac | ||
|
||
if [ -z "$CONNECTED_OUTPUTS" ]; then | ||
|
||
echo "No connected outputs found. Attempting to apply xrandr globally." | ||
xrandr --auto # this is kind of useless? | ||
|
||
else | ||
|
||
|
||
first_functional_output="" | ||
for output in $CONNECTED_OUTPUTS; do | ||
if [ -z "$first_functional_output" ]; then | ||
if xrandr --output "$output" --primary "${scaling_pref_params[@]}"; then | ||
first_functional_output=$output | ||
echo "Configured display $output as primary" | ||
else | ||
echo "Failed to configure display $output" | ||
fi | ||
else | ||
xrandr --output "$output" \ | ||
--same-as "$first_functional_output" \ | ||
"${scaling_pref_params[@]}" || echo "Failed to configure display $output" | ||
fi | ||
done | ||
fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From xrandr man pages:
For disconnected but enabled outputs, this will disable them.
So if all are disconnected, this will simply disable them. I suggest to replace this with a warning, unless there's some reason to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this in b1d2db7