-
-
Notifications
You must be signed in to change notification settings - Fork 28
Add HiDPI support for Plymouth boot #330
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
71cb927
9c48ddc
bea8944
6f115ea
02cd7bd
03cf5da
1716781
0701853
ab61f47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,3 +49,6 @@ subdir('skel') | |
|
|
||
| # GTK settings | ||
| subdir('gtk') | ||
|
|
||
| # Plymouth HiDPI support | ||
| subdir('plymouth') | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Configure Plymouth for HiDPI screens | ||
| install_data( | ||
| 'plymouth-hidpi.sh', | ||
| install_dir: '/usr/local/bin', | ||
|
||
| install_mode: 'rwxr-xr-x' | ||
| ) | ||
|
|
||
| install_data( | ||
| 'plymouth-hidpi.service', | ||
| install_dir: '/etc/systemd/system' | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [Unit] | ||
| Description=Configure Plymouth for HiDPI screens | ||
| After=graphical.target | ||
| Requires=graphical.target | ||
|
|
||
| [Service] | ||
| Type=oneshot | ||
| Environment="DISPLAY=:0" | ||
| ExecStart=/usr/local/bin/plymouth-hidpi.sh | ||
| ExecStartPost=/bin/bash -c 'if [ $? -eq 0 ]; then systemctl disable plymouth-hidpi.service; rm -f /etc/systemd/system/plymouth-hidpi.service /usr/local/bin/plymouth-hidpi.sh; fi' | ||
|
|
||
| [Install] | ||
| WantedBy=graphical.target | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/bin/bash | ||
|
|
||
| CONFIG_FILE="/etc/plymouth/plymouthd.conf" | ||
| HIDPI_THRESHOLD=180 # Min DPI of a HiDPI screen | ||
|
|
||
| TIMEOUT=300 # Set the maximum wait time in seconds | ||
| ELAPSED=0 | ||
|
|
||
| # Wait until Gala is running or timeout occurs | ||
| while ! pgrep -x "gala" > /dev/null && [ $ELAPSED -lt $TIMEOUT ]; do | ||
| sleep 1 | ||
| ((ELAPSED++)) | ||
| done | ||
|
|
||
| if [ $ELAPSED -ge $TIMEOUT ]; then | ||
| echo "Timeout reached while waiting for Gala to start" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Get current DPI | ||
| export DISPLAY=":0" | ||
| DPI=$(xrdb -query | grep dpi | awk '{print $2}') | ||
lenemter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| create_config() { | ||
| cat <<EOF > "$CONFIG_FILE" | ||
| [Daemon] | ||
| DeviceScale=1 | ||
| EOF | ||
| logger -t plymouth-hidpi "Created new config: '$CONFIG_FILE' with HiDPI setting" | ||
| } | ||
|
|
||
| apply_hidpi_setting() { | ||
| if [[ "$DPI" -ge "$HIDPI_THRESHOLD" ]]; then | ||
| if [[ ! -f "$CONFIG_FILE" ]]; then | ||
| create_config | ||
|
|
||
| # Apply the changes | ||
| update-initramfs -u | ||
| logger -t plymouth-hidpi "Updated initramfs after HiDPI change" | ||
| else | ||
| logger -t plymouth-hidpi "HiDPI config file already exists, no changes made" | ||
| fi | ||
| else | ||
| logger -t plymouth-hidpi "Skipped HiDPI settings (DPI: $DPI, Threshold: $HIDPI_THRESHOLD)" | ||
| fi | ||
| } | ||
|
|
||
| apply_hidpi_setting | ||
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.
It will probably be nice if there is a meson option to disable this (because I package this on NixOS and we don't enable plymouth by default and don't configure plymouth this way in a immutable system... 😂 )
Uh oh!
There was an error while loading. Please reload this page.
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.
Sure no probs. It's added. Please check the latest commit
Plymouth HiDPI support can be disabled by running Meson with a command like:
meson setup builddir -Denable-plymouth-hidpi=false