4

Is it possible to rotate a single window in X11? I tried to use Xephyr but I run into bug 100458.

I use XMonad as WM if that helps.

  • I don't think there's a way in general. There was an experimental plugin/extension for Compiz a while ago that allowed for that, but I don't know its name or current state – Fox Mar 29 '17 at 23:11
3

I've searched around a bit and I'm surprised not to find a ready solution for this. A possibility could be to use KWin and write a "Kwin effect" for it: https://blog.martin-graesslin.com/blog/2009/07/how-to-write-a-kwin-effect/ . Also, a gnome shell extension is imaginable, but does not exist yet.

A workaround solution: Weston is the reference implementation of Wayland. It allows rotating windows with super-key + middle mouse button. As this works for Wayland clients only, you can run Xwayland in weston, run your X application on Xwayland, and rotate the Xwayland display. If your application supports Wayland (based on GTK3, QT5 or SDL, for example), this works in weston without Xwayland.

For X applications on Xwayland

weston
WAYLAND_DISPLAY=wayland-0 Xwayland :5
DISPLAY=:5 yourXapplication
DISPLAY=:5 x-window-manager  # additionally run a window manager for comfort

(On Gnome-Wayland you can run Xwayland directly without using weston, but I'm not aware of a Gnome-Wayland option to rotate a window).

For QT5 applications without Xwayland:

weston
WAYLAND_DISPLAY=wayland-0  QT_QPA_PLATFORM=wayland  yourQT5application

For GTK3 and SDL applications without Xwayland:

weston
WAYLAND_DISPLAY=wayland-0 yourGTK3application

(Note: You can specify a wayland socket/WAYLAND_DISPLAY with weston --socket=mywaylandsocket instead of assuming it will be wayland-0. You need to do this on Gnome-Wayland as it uses wayland-0 itself)

1

I'm adding a second answer using Weston, a bit different and more useable than my first one. Create a file ~/.config/weston.ini with this content:

[core]
modules=xwayland.so
shell=desktop-shell.so
idle-time=0
[shell]
background-color=0xff002244
locking=false
# panel-location=none    
[launcher]
icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
path=/usr/bin/weston-terminal
[launcher]
icon=/usr/share/icons/hicolor/48x48/apps/firefox.png
path=/usr/bin/firefox
[output]
name=X1
mode=600x800
transform=90
# wanna get mad? use: transform=flipped-270
scale=1

This weston.ini enables a rootless xwayland.so in weston. The [output] section with name=X1 defines weston's appearance as X client.

  • mode=600x800 sets the screen/window size.
  • transform=90 rotates the weston display.
  • scale=1 sets a scaling factor if needed.
  • the [launcher] sections can be used to create custom panel starters for your X applications.

See man weston.ini and /usr/share/doc/weston/examples/weston.ini for further informations and options.

(Instead of using the weston panel, you can disable it with panel-location=none, parse output of weston for xserver listening on display :1 and use DISPLAY=:1 yourXapp)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.