feat: add monitor resize helper

This commit is contained in:
Ben Grande 2025-01-27 18:32:18 +01:00
parent 599f044d58
commit 07e2321290
No known key found for this signature in database
GPG Key ID: 00C64E14F51F9E56
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,25 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# https://www.qubes-os.org/doc/gui-configuration/#video-ram-adjustment-for-high-resolution-displays
set -eu
if ! command -v xrandr >/dev/null; then
print '%s\n' "missing program: xrandr" >&2
exit 1
fi
gui_mem="$(xrandr --listactivemonitors |
awk -F'[ /x]' '/^\s+[0-9]+/{if($4>max) max=$4; sum+=$6}
END {print max*sum*4/1024}')"
if test "${gui_mem}" = "0"; then
exit
fi
qvm-features dom0 gui-videoram-min "${gui_mem}"
qvm-features dom0 gui-videoram-overhead 0

View File

@ -1,5 +1,5 @@
{#
SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-FileCopyrightText: 2024 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
@ -44,4 +44,13 @@ SPDX-License-Identifier: AGPL-3.0-or-later
- group: root
- makedirs: True
"{{ slsdotpath }}-qubes-gui-resolution-helper":
file.managed:
- name: /usr/local/bin/qubes-gui-resolution
- source: salt://{{ slsdotpath }}/files/bin/qubes-gui-resolution
- mode: "0755"
- user: root
- group: root
- makedirs: True
{% endif -%}