Skip to content
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

How to change resolution and rotate the screen #285

Closed
samuelexferri opened this issue Oct 27, 2023 · 8 comments
Closed

How to change resolution and rotate the screen #285

samuelexferri opened this issue Oct 27, 2023 · 8 comments

Comments

@samuelexferri
Copy link

samuelexferri commented Oct 27, 2023

I'm on a minimal Debian installation (Only "SSH Server" and "Standard System Utilities" with no DE). I installed only the following packages:

apt install -y --no-install-recommends build-essential ca-certificates cage chromium curl dphys-swapfile fail2ban firmware-realtek gcc git gnupg iptables jq polkitd psmisc resolvconf systemd-timesyncd wireguard wlr-randr xwayland xorg zip

I try to use Cage 1.5.0 (From Debian Testing) with systemd in this way:

tee /etc/systemd/system/cage@.service <<EOF
# This is a system unit for launching Cage with auto-login as the
# user configured here. For this to work, wlroots must be built
# with systemd logind support.

[Unit]
Description=Cage Wayland compositor on %I
# Make sure we are started after logins are permitted. If Plymouth is
# used, we want to start when it is on its way out.
After=systemd-user-sessions.service
# Since we are part of the graphical session, make sure we are started
# before it is complete.
Before=graphical.target
# On systems without virtual consoles, do not start.
ConditionPathExists=/dev/tty0
# D-Bus is necessary for contacting logind, which is required.
Wants=dbus.socket systemd-logind.service
After=dbus.socket systemd-logind.service
# Replace any (a)getty that may have spawned, since we log in
# automatically.
Conflicts=getty@%i.service
After=getty@%i.service

[Service]
Type=simple
ExecStart=/usr/bin/cage -- /usr/bin/chromium --no-first-run --start-fullscreen --start-maximized --fast --fast-start --window-position=0,0 --window-size=1280,800 --no-sandbox --kiosk --incognito --disable --disable-pinch --disable-translate --disable-infobars --disable-suggestions-service --disable-save-password-bubble --disable-session-crashed-bubble --noerrdialogs --password-store=basic --disk-cache-dir=/dev/null --disk-cache-size=1 --overscroll-history-navigation=0 --enable-features=OverlayScrollbar --autoplay-policy=no-user-gesture-required --check-for-update-interval=315360000 "https://google.it/" # TODO: "http://0.0.0.0:8080/"
Restart=always
User=cage
# Log this user with utmp, letting it show up with commands 'w' and
# 'who'. This is needed since we replace (a)getty.
UtmpIdentifier=%I
UtmpMode=user
# A virtual terminal is needed.
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
# Fail to start if not controlling the virtual terminal.
StandardInput=tty-fail

# Set up a full (custom) user session for the user, required by Cage.
PAMName=cage

[Install]
WantedBy=graphical.target
# Alias=display-manager.service
DefaultInstance=tty7
EOF

tee /etc/pam.d/cage <<EOF
auth           required        pam_unix.so nullok
account        required        pam_unix.so
session        required        pam_unix.so
session        required        pam_systemd.so
EOF

systemctl daemon-reload
systemctl enable cage@tty1.service
systemctl start cage@tty1.service

systemctl set-default graphical.target # Set systemd's default target to the graphical target

When I boot up, I successfully have Cage running Chromium but the resolution is very big, I can't find a way to set the resolution to 1280x800 on my WTD touchscreen. There is no much documentation for kanshi and wlr-randr.

Thanks in advance

@joggee-fr
Copy link
Collaborator

Debian manpages give some hints on how to use wlr-randr. If some Wayland environment variable are well set (especially WAYLAND_DISPLAY), you can just use wlr-randr with no parameter to know which mode / resolution is currently used for your monitor. Then, it is quite easy to modify it looking at manpages.

@bhack
Copy link

bhack commented Nov 5, 2023

Is it supposed to be run with another service after the cage service?

@joggee-fr
Copy link
Collaborator

@bhack, wlr-randr is a utility you can use manually and I don't think it is supposed to be used as a service. It communicates with the Wayland compositor, here Cage, through a well-defined protocol wlr output management.

On the other side, kanshi is a daemon to manage your preferred configurations according to plugged monitors for example. But I am not a user of this tool (right now).

@bhack
Copy link

bhack commented Nov 6, 2023

Ok so if we want to autoconfigure at the boot we need to investigate that daemon.

@joggee-fr
Copy link
Collaborator

@samuelexferri, do you consider this issue resolved now?

@MayNiklas
Copy link

@samuelexferri I'm trying to solve the same issue.
Setting WAYLAND_DISPLAY="wayland-1 wlr-randr --output HDMI-A-1 --transform 90" does not work for me.
Can you maybe share your solution?

@joggee-fr
Copy link
Collaborator

joggee-fr commented Jan 19, 2024

@MayNiklas, don't you have a double quote issue in your command?

@MayNiklas
Copy link

@MayNiklas, don't you have a double quote issue in your command?

Sorry, this was a issue on my side when copying from my NixOS configuration.
I'm setting environment variables using the Nix language.

WAYLAND_DISPLAY = "wayland-1 ${pkgs.wlr-randr}/bin/wlr-randr --output HDMI-A-1 --transform 90";

is getting translated into the regular syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants