Ulauncher / Ulauncher

Feature rich application Launcher for Linux
https://ulauncher.io
Other
3.57k stars 190 forks source link

Wayland positioning via margins #1400

Open friday opened 1 month ago

friday commented 1 month ago

Description

I considered that we might be able to solve the Wayland positioning issues by drawing the window over the whole screen, but with a transparent background, and drawing a non-transparent window in the window, but it seems I was over-thinking and @hedgieinsocks found a workaround much easier than that:

Since xwayland caused black box flashing for me (https://github.com/Ulauncher/Ulauncher/issues/1399), I've tackled the issue by editing CSS for the custom theme I use. This way I can now force the ulauncher window to appear wherever I please on wayland.

1) in ulauncher prefs set the window width to max of your display (in my case 1920) 2) edit margin values under .app (in my case 160px 640px 180px 640px;)

I'm using ulauncher-theme-libadwaita theme so that's the line to edit https://github.com/leodr/ulauncher-theme-libadwaita/blob/59ba686189726ba0cbb59c0a60287e48378f7eec/theme.css#L40 https://github.com/Ulauncher/Ulauncher/issues/205#issuecomment-2196228549

I don't have much time to work on or test Ulauncher on other platforms atm, so creating this issue to remember it or get help from volunteers (@hedgieinsocks maybe). I'm interested in the following:

  1. Does it work in Gnome wayland? We already have a working solution with Wayland Layer shell, which all other Major DEs support (also see the general Wayland compatibility).
  2. Can we calculate the margin to use dynamically in the ulauncher window class
  3. Can we support dragging the window by changing the margin?

And thank you hedgieinsocks! :pray:

Communication guidelines

Ulauncher v6

hedgieinsocks commented 3 weeks ago

env: fedora gnome wayland display: 1920x1200 window width in ulauncher prefs: 1920 custom margins in theme's css:

.app {
  margin: 10em 40em 15em 40em;
}

https://github.com/Ulauncher/Ulauncher/assets/26518927/b03c91b6-f2ab-4124-9933-947a30767312

So this answers to question 1 and perhaps to question 3 (it does not drag upwards).

And according to https://docs.gtk.org/gtk3/css-properties.html margin is of datatype length so we cannot use percentage in the css files. So no easy fix there. One would definitely need to hack around the window codebase, which imho is a bit questionable approach. And I don't see other complaints about splashing on xwayland. So xwayland still looks like a go.

friday commented 3 weeks ago

Thank you for testing more. I meant that we could calculate the fixed margins using information about the monitor, and for 3 I meant dynamically changing the margins to move the window. I didn't think it would work without making changed in the Ulauncher logic. I'm very surprised it does (kinda).