<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Hacking in PrettyOSD positioning on KDE Wayland]]></title><description><![CDATA[<p dir="auto">I've been using strawberry on KDE for a few years now.<br />
From the start I've loved the "pretty OSD" style of notifications. They're just so much better than native ones.<br />
They work great under X11, but ever since I've moved to Wayland, the rough edges of that display protocol were apparent every time the OSD appeared... the OSD would always spawn in the middle of the screen, which is just sad.</p>
<p dir="auto">Now while I understand that this is a shortcoming of the Wayland protocols, that probably won't be resolved anytime soon (even though it should) and that the strawberry project can do nothing to resolve the issue for every Wayland user out there... this doesn't stop individual users (like myself) from hacking in solutions for their own use cases.<br />
So KDE has this neat feature called "window rules". It basically allows me to create sets rules for specific windows, provided that there's a way to select the desired window. These rules may include forcing a specific positioning of a window, which would be quite helpful in this case.</p>
<p dir="auto">There's only one issue. I couldn't find a way to distinguish the main strawberry player window from the OSD "window". Having the whole player be stuck to the top right corner of my screen wouldn't be ideal.<br />
That's why I've been running a patched version of strawberry for the past few months. One with literally just a one line patch that simply sets the title of the OSD window to "PrettyOSD". This makes it possible to match the OSD window by its new title.</p>
<p dir="auto">Now while this is a change that I made only to enable a DE-specific hack, I think it's quite a sensible change to make outside of this hack context.<br />
I'll attach the patch I use below as a reference, but keep in mind that I've got almost no C++ experience and this might be the worst way to implement my general idea. I didn't use any AI "help" though, if that makes anyone more confident about the quality of that hacky patch.</p>
<pre><code class="language-diff">diff --git a/src/osd/osdpretty.cpp b/src/osd/osdpretty.cpp
index c89a8504..00cd24c7 100644
--- a/src/osd/osdpretty.cpp
+++ b/src/osd/osdpretty.cpp
@@ -100,6 +100,7 @@ OSDPretty::OSDPretty(Mode mode, QWidget *parent)
   Qt::WindowFlags flags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint;
 
   setWindowFlags(flags);
+  setWindowTitle(QString::fromUtf8("PrettyOSD", -1));
   setAttribute(Qt::WA_TranslucentBackground, true);
   setAttribute(Qt::WA_X11NetWmWindowTypeNotification, true);
   setAttribute(Qt::WA_ShowWithoutActivating, true);
</code></pre>
]]></description><link>https://forum.strawberrymusicplayer.org/topic/5731/hacking-in-prettyosd-positioning-on-kde-wayland</link><generator>RSS for Node</generator><lastBuildDate>Sun, 14 Jun 2026 19:06:53 GMT</lastBuildDate><atom:link href="https://forum.strawberrymusicplayer.org/topic/5731.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 28 Jan 2025 17:27:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hacking in PrettyOSD positioning on KDE Wayland on Fri, 31 Jan 2025 16:15:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://forum.strawberrymusicplayer.org/uid/3264">@mini_bomba</a></p>
<p dir="auto">I've disabled the OSD Pretty if running on wayland, if you still want to enable it, you can change this line here <a href="https://github.com/strawberrymusicplayer/strawberry/blob/3fd29c6dcce235b5efcad28a14a9cb172311638a/src/osd/osdbase.cpp#L477" rel="nofollow ugc">https://github.com/strawberrymusicplayer/strawberry/blob/3fd29c6dcce235b5efcad28a14a9cb172311638a/src/osd/osdbase.cpp#L477</a> to <code>return true;</code></p>
]]></description><link>https://forum.strawberrymusicplayer.org/post/8442</link><guid isPermaLink="true">https://forum.strawberrymusicplayer.org/post/8442</guid><dc:creator><![CDATA[jonas]]></dc:creator><pubDate>Fri, 31 Jan 2025 16:15:58 GMT</pubDate></item><item><title><![CDATA[Reply to Hacking in PrettyOSD positioning on KDE Wayland on Thu, 30 Jan 2025 18:32:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://forum.strawberrymusicplayer.org/uid/1">@jonas</a><br />
I expected there to be a much simpler way to create a literal QString, but as I've said, I've got almost no C++ (let alone Qt) experience. That's one reason why I created a forum post rather than a pull request on the repo. Thanks for the insight though.</p>
<p dir="auto">As for wayland on nvidia: I myself also use an nvidia system and wayland on nvidia has been stable for some time now on the latest drivers. I wouldn't have been using it otherwise.</p>
<p dir="auto">I haven't done any extensive or exhaustive research, but I'm pretty sure there isn't a real way to position windows programmatically on wayland yet. There simply isn't a protocol in the suite to support this. And if there was, you'd expect the framework to implement it. I wouldn't have settled on this hack if I saw a viable way to properly implement this.<br />
I've also just tried forcing strawberry to run through xwayland (by setting <code>QT_QPA_PLATFORM=xcb</code>) and the pretty OSD appears to just<code>™</code> work<code>™</code> there without any hacks needed</p>
]]></description><link>https://forum.strawberrymusicplayer.org/post/8439</link><guid isPermaLink="true">https://forum.strawberrymusicplayer.org/post/8439</guid><dc:creator><![CDATA[mini_bomba]]></dc:creator><pubDate>Thu, 30 Jan 2025 18:32:51 GMT</pubDate></item><item><title><![CDATA[Reply to Hacking in PrettyOSD positioning on KDE Wayland on Tue, 28 Jan 2025 21:29:55 GMT]]></title><description><![CDATA[<p dir="auto"><code>QWidget::move</code> doesn't have any affect under Wayland when dragging the widget, but it works if I remove <code>Qt::FramelessWindowHint</code> and drag by the window title. Setting <code>Qt::Popup</code> I can drag the widget itself, but that makes it a modal window, and it's pretty flaky.</p>
]]></description><link>https://forum.strawberrymusicplayer.org/post/8437</link><guid isPermaLink="true">https://forum.strawberrymusicplayer.org/post/8437</guid><dc:creator><![CDATA[jonas]]></dc:creator><pubDate>Tue, 28 Jan 2025 21:29:55 GMT</pubDate></item><item><title><![CDATA[Reply to Hacking in PrettyOSD positioning on KDE Wayland on Tue, 28 Jan 2025 20:44:26 GMT]]></title><description><![CDATA[<p dir="auto">Adding <code>Qt::Popup</code> to window flags has some affect, I'm able to position the window on some parts of the screen, but it's still very buggy. I use nvidia, so wayland is buggy in general. Maybe you can try.</p>
]]></description><link>https://forum.strawberrymusicplayer.org/post/8436</link><guid isPermaLink="true">https://forum.strawberrymusicplayer.org/post/8436</guid><dc:creator><![CDATA[jonas]]></dc:creator><pubDate>Tue, 28 Jan 2025 20:44:26 GMT</pubDate></item><item><title><![CDATA[Reply to Hacking in PrettyOSD positioning on KDE Wayland on Tue, 28 Jan 2025 19:22:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://forum.strawberrymusicplayer.org/uid/3264">@mini_bomba</a></p>
<p dir="auto">I use the OSD pretty too, but I use X11 on all my machines. But I've noticed that the OSD pretty window can not be positioned under Wayland, have only looked into it briefly a while ago.<br />
Setting the title shouldn't cause any issues as far as I know, so that can be done.<br />
Using <code>QString::fromUtf8</code> isn't necessary there, <code>QStringLiteral()</code> (and can be simplified to <code>u""_s</code>) should be used there instead to avoid string conversions at runtime since the function takes <code>QString</code>.</p>
]]></description><link>https://forum.strawberrymusicplayer.org/post/8435</link><guid isPermaLink="true">https://forum.strawberrymusicplayer.org/post/8435</guid><dc:creator><![CDATA[jonas]]></dc:creator><pubDate>Tue, 28 Jan 2025 19:22:39 GMT</pubDate></item></channel></rss>