Re: Third-party dock (C++): how to support AutoHide (Screen Edge) and Global Shortcuts ?

Viet Dang <[email protected]> Mon, 21 Oct 2024 18:20:17 +0100
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <CAO-rTSHTKFc5_UMhoW3V5Qz=qX7+gg2_C75XJRH3er=2bbP4Tw@mail.gmail.com>
--0000000000008699360624ffde80
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thanks Vlad, I'll give them a go.

On Mon, Oct 21, 2024 at 10:19=E2=80=AFAM Vlad Zahorodnii <vlad.zahorodnii@k=
de.org>
wrote:

> Hi,
>
> On 10/18/24 11:03 PM, Viet Dang wrote:
> > Hi,
> >
> > I'm working on some improvements of my third-party dock (written in
> > C++ here: https://github.com/dangvd/crystal-dock) and have some
> > questions about AutoHide (Screen Edge) and Global Shortcuts support in
> > KWin:
> > - AutoHide: I'd like to get my dock to have an AutoHide behaviour like
> > that of a Plasma panel. Is Screen Edge protocol
> > (https://wayland.app/protocols/kde-screen-edge-v1) the right one to
> > use? And if it is, what's the best way to get wl_surface object from
> > my main widget? (I already use layer-shell-qt for my main widget)
>
> You could use the QNativeInterface API to access the wl_surface object.
> See
>
> https://invent.kde.org/plasma/kwin/-/blob/3740a1b52adc1e5dcaa13320e28bf98=
8e9fb5aec/src/helpers/killer/killer.cpp#L298
> for an example how to do it.
>
> > - Global Shortcuts: how do I support global shortcuts for my dock
> > (e.g. Meta-1 to activate launcher 1 and so on). Is xdg-desktop-portal
> > (
> https://github.com/flatpak/xdg-desktop-portal/blob/main/data/org.freedesk=
top.portal.GlobalShortcuts.xml)
>
> > the right one to use?
>
> That, or if you know that the dock will run mostly in Plasma, you could
> use KGlobalAccel to save yourself some time.
>
> Regards,
> Vlad
>
>

--0000000000008699360624ffde80
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks Vlad, I&#39;ll give them a go.<br></div><br><div cl=
ass=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 21, 2=
024 at 10:19=E2=80=AFAM Vlad Zahorodnii &lt;<a href=3D"mailto:vlad.zahorodn=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid =
rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
On 10/18/24 11:03 PM, Viet Dang wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I&#39;m working on some improvements of my third-party dock (written i=
n <br>
&gt; C++ here: <a href=3D"https://github.com/dangvd/crystal-dock" rel=3D"no=
referrer" target=3D"_blank">https://github.com/dangvd/crystal-dock</a>) and=
 have some <br>
&gt; questions about AutoHide (Screen Edge) and Global Shortcuts support in=
 <br>
&gt; KWin:<br>
&gt; - AutoHide: I&#39;d like to get my dock to have an AutoHide behaviour =
like <br>
&gt; that of a Plasma panel. Is Screen Edge protocol <br>
&gt; (<a href=3D"https://wayland.app/protocols/kde-screen-edge-v1" rel=3D"n=
oreferrer" target=3D"_blank">https://wayland.app/protocols/kde-screen-edge-=
v1</a>) the right one to <br>
&gt; use? And if it is, what&#39;s the best way to get=C2=A0wl_surface obje=
ct from <br>
&gt; my main widget? (I already use layer-shell-qt for my main widget)<br>
<br>
You could use the QNativeInterface API to access the wl_surface object. <br=
>
See <br>
<a href=3D"https://invent.kde.org/plasma/kwin/-/blob/3740a1b52adc1e5dcaa133=
20e28bf988e9fb5aec/src/helpers/killer/killer.cpp#L298" rel=3D"noreferrer" t=
arget=3D"_blank">https://invent.kde.org/plasma/kwin/-/blob/3740a1b52adc1e5d=
caa13320e28bf988e9fb5aec/src/helpers/killer/killer.cpp#L298</a> <br>
for an example how to do it.<br>
<br>
&gt; - Global Shortcuts: how do I support global shortcuts for my dock <br>
&gt; (e.g. Meta-1 to activate launcher 1 and so on). Is xdg-desktop-portal =
<br>
&gt; (<a href=3D"https://github.com/flatpak/xdg-desktop-portal/blob/main/da=
ta/org.freedesktop.portal.GlobalShortcuts.xml" rel=3D"noreferrer" target=3D=
"_blank">https://github.com/flatpak/xdg-desktop-portal/blob/main/data/org.f=
reedesktop.portal.GlobalShortcuts.xml</a>) <br>
&gt; the right one to use?<br>
<br>
That, or if you know that the dock will run mostly in Plasma, you could <br=
>
use KGlobalAccel to save yourself some time.<br>
<br>
Regards,<br>
Vlad<br>
<br>
</blockquote></div>

--0000000000008699360624ffde80--