This post was intended as an answer to this thread over at discourse.ubuntu.com, but as a new user (at least over there) I would have to throw out a lot of links & mentions. Since this might be interesting to ppl here as well, I’m posting the full version here and will put a link in the forum there. Admins: Feel free to move if needed.
@greyback As a follow-up to our IRC discussion, here are my findings with the current chromium-mir-kiosk snap when rotating the mir-kiosk screen via
miral-kiosk.display orientation property. My use-case is a smart mirror appliance which requires the display to be rotated 90° to Portrait mode. For the current version, I can assume a fixed resolution of 1080x1920 px.
- Ubuntu Core edge from 20181023 (tested on ubuntu-core-vm and Raspberry Pi 3B attached to HDMI display)
- Installed mir-kiosk (stable) and chromium-mir-kiosk (beta)
When the mir display is rotated to the left as described, the chromium window rotates as well – but the i3 WM does not seem to pick up on it. Thus, all fullscreen windows are still in landscape mode, where the right half of the window goes off the screen. The following screenshot illustrates the issue:
This is the default behavior with no additional configuration changes apart from the rotation.
As @greyback mentioned, it seems that the i3 window manager does not pick up the rotation and thinks it’s in landscape orientation.
To experiment with config files in the chromium snap without rebuilding the snap, I cloned the source, adapted line 17 of snapcraft.yaml it so that the i3 configuration is loaded from
cp $SNAP/etc/i3.config $SNAP_DATA/i3.config in
snap/hooks/install to have the file available in a writable location. This way, you can edit the config with
sudo editor /var/snap/chromium-mir-kiosk/current/i3.config and apply changes with
snap restart chromium-mir-kiosk.
First attempt is to resize the window manually after disabling the fullscreen command:
# in $SNAP_DATA/i3.config
#for_window [class="^chromium$"] fullscreen
for_window [class="^chromium$"] resize set 1080 1920
This didn’t work at first. Reason: chromium-mir-kiosk starts chromium with a kiosk Chrome extension loaded by default – once disabled with
snap set chromium-mir-kiosk disable kiosk=true, chromium is no longer in fullscreen mode and will thus be resized by i3.config commands. Unfortunately, this also means that you can see the i3 window title bar as well as the regular Chromium UI.
Adapting the snap’s
glue/chromium-browser.launcher with a startup flag --kiosk has the same effect; it seems that chromium in kiosk mode will always run fullscreen. To quickly test command line flags (list of available flags), you can also install chromium on your regular host OS and run it with
chromium-browser --your --flags --here.
Second attempt: Do not use kiosk mode (i. e. disable it through snap set) and start Chromium with the required dimensions instead. These are the changes I made to chromium-mir-kiosk snap source files:
# git diff for glue/chrome-browser.launcher
@@ -80,7 +80,100 @@ fi
-- ignore-gpu-blacklist --enable-native-gpu-memory-buffers \
-- class=chromium \
- -- profile-directory=Default $EXTRA_ARGS
+ --app="https://my-app.tld" \
+ -- profile-directory=Default $EXTRA_ARGS
# git diff for glue/i3.config
@@ -7,8 +7,7 @@
font pango:monospace 8
# make chromium always start in fullscreen (chromium-browser --class chromium)
-for_window [class="^chromium$] fullscreen
+for_window [class="^chromium$] floating enable, resize set 1080 1920, move position 0 0, border none
I also adapted
snap/hooks/install to set the defaults as required (
disablekiosk=true to prevent fullscreen behavior).
Configured this way, the complete browser window is rotated and visible on screen apart from a few pixels on the “top” of the window (i. e. left)
This is a hacky workaround, of course. It assumes a fixed resolution and discards all the benefits of kiosk mode. So to solve this in a clean way which can be committed for the general snap, I think one needs to figure out if the rotation / resolution is passed to i3 correctly, and if not, how to do it. Some questions for @greyback / @alan_g or anyone proficient with this stack:
- Where should I start to investigate whether Xwayland passes rotation/resolution information to i3 at all? (completely new to graphics stacks, so any hint is helpful)
- Related: How would I best debug this? Found the snap
graphics-debug-tools-bboozzoobut can’t get the bundled tools to work after connecting it to the x11-plug slot of chromium-mir-kiosk.
- I briefly tried to include x11-xserver-utils as a stage-package in my modified chromium-kiosk snap to test if xrandr commands (e. g.
xrandr -o left) bundled as a snap command would achieve proper rotation for the X window. This was something @ogra suggested in IRC. All attempts failed with “could not open display”, as
$DISPLAYdoes not seem to be set. I also tried to connect display-sounding interfaces from core to the snap, but to no avail. Am I doing it completely wrong, or is this a path worth pursuing?
Thank you in advance for all helpful answers!