Arch Linux und KDE – Bashscript für automatisches Skaleren?
Hi,
wisst ihr wie man mit einem Befehl die Bildschirmskalierung ändern kann? Ich nutzen KDE.
Ich habe paar Sachen probiert, jedoch ohne Erfolg.
Danke im Voraus.
3 Antworten
Schau mal hier:
https://github.com/HoleProfed/Kwin-display-scailing
Da sind zwei (beispielhafte) Skripte, die Wayland-Scaling über kscreen-doctor erledigen. Das wird wohl der Weg unter Wayland sein. Wenn ich das mal mit --help aufrufe, kommt u.a.:
Set scale (note: fractional scaling is only supported on wayland)
$ kscreen-doctor output.HDMI-2.scale.2
Viel Spaß beim Ausprobieren.
Du kannst mit xrandr (siehe Arch Wiki) die Auflösungen ermitteln und anschließend dem jeweiligen Monitor eine neue Einstellung zuweist.
# Variablen mit deinen Werten
DISPLAY_NAME="HDMI-1"
RESOLUTION="1920x1080"
REFRESH_RATE="60"
# Gewünschte Einstellung mit xrandr festlegen
xrandr --output $DISPLAY_NAME --mode $RESOLUTION --rate $REFRESH_RATE
Speichere es z.B. in deinem Benutzerordner ab, mach dein Bash-Script ausführbar (chmod +x scriptName.sh) und lade es es bei Bedarf. Du musst „HDMI-1” durch deinen Monitor ersetzen und jetzt bloß so aus dem Arch Wiki übernommen habe.
Ich habe nie KDE benutzt mit arch aber für anderer wms xrandr war einfach zu erstellen, z.B.
#!/bin/bash
# Function to list available resolutions
list_resolutions() {
echo "Available resolutions:"
xrandr | grep -A 20 "connected" | grep -v "connected" | grep "+" | awk '{print NR":", $1}'
}
# Function to set resolution
set_resolution() {
local resolution=$1
echo "Setting resolution to $resolution"
xrandr --output $(xrandr | grep " connected" | cut -d " " -f1) --mode $resolution
}
# Main menu
show_menu() {
echo "Screen Resolution Switcher"
echo "-------------------------"
echo "1. List available resolutions"
echo "2. Set custom resolution"
echo "3. Set to 1920x1080"
echo "4. Set to 1280x720"
echo "5. Exit"
echo -n "Enter your choice: "
read choice
case $choice in
1) list_resolutions ;;
2)
echo -n "Enter resolution (e.g., 1920x1080): "
read res
set_resolution $res
;;
3) set_resolution 1920x1080 ;;
4) set_resolution 1280x720 ;;
5) exit 0 ;;
*) echo "Invalid choice" ;;
esac
}
# Main loop
while true; do
show_menu
echo ""
done