core/popupwindow: add grabFocus
Some checks failed
Build / Nix (push) Has been cancelled
Build / Nix-1 (push) Has been cancelled
Build / Nix-2 (push) Has been cancelled
Build / Nix-3 (push) Has been cancelled
Build / Nix-4 (push) Has been cancelled
Build / Nix-5 (push) Has been cancelled
Build / Nix-6 (push) Has been cancelled
Build / Nix-7 (push) Has been cancelled
Build / Nix-8 (push) Has been cancelled
Build / Nix-9 (push) Has been cancelled
Build / Nix-10 (push) Has been cancelled
Build / Nix-11 (push) Has been cancelled
Build / Nix-12 (push) Has been cancelled
Build / Nix-13 (push) Has been cancelled
Build / Nix-14 (push) Has been cancelled
Build / Nix-15 (push) Has been cancelled
Build / Nix-16 (push) Has been cancelled
Build / Nix-17 (push) Has been cancelled
Build / Nix-18 (push) Has been cancelled
Build / Nix-19 (push) Has been cancelled
Build / Nix-20 (push) Has been cancelled
Build / Nix-21 (push) Has been cancelled
Build / Nix-22 (push) Has been cancelled
Build / Nix-23 (push) Has been cancelled
Build / Nix-24 (push) Has been cancelled
Build / Nix-25 (push) Has been cancelled
Build / Nix-26 (push) Has been cancelled
Build / Nix-27 (push) Has been cancelled
Build / Nix-28 (push) Has been cancelled
Build / Nix-29 (push) Has been cancelled
Build / Nix-30 (push) Has been cancelled
Build / Nix-31 (push) Has been cancelled
Build / Archlinux (push) Has been cancelled
Lint / Lint (push) Has been cancelled

Allows standard wayland focus grabs on non hyprland compositors.
This commit is contained in:
outfoxxed 2026-01-13 01:24:20 -08:00
parent de1bfe028d
commit dca652366a
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
3 changed files with 16 additions and 1 deletions

View file

@ -21,6 +21,7 @@ set shell id.
- Pipewire service now reconnects if pipewire dies or a protocol error occurs.
- Added pipewire audio peak detection.
- Added initial support for network management.
- Added support for grabbing focus from popup windows.
## Other Changes

View file

@ -59,7 +59,7 @@ void ProxyPopupWindow::completeWindow() {
}
this->window->setTransientParent(bw);
this->window->setFlag(Qt::ToolTip);
this->window->setFlag(this->bWantsGrab ? Qt::Popup : Qt::ToolTip);
this->mAnchor.markDirty();
PopupPositioner::instance()->reposition(&this->mAnchor, this->window);

View file

@ -76,6 +76,15 @@ class ProxyPopupWindow: public ProxyWindowBase {
///
/// The popup will not be shown until @@anchor is valid, regardless of this property.
QSDOC_PROPERTY_OVERRIDE(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged);
/// If true, the popup window will be dismissed and @@visible will change to false
/// if the user clicks outside of the popup or it is otherwise closed.
///
/// > [!WARNING] Changes to this property while the window is open will only take
/// > effect after the window is hidden and shown again.
///
/// > [!NOTE] Under Hyprland, @@Quickshell.Hyprland.HyprlandFocusGrab provides more advanced
/// > functionality such as detecting clicks outside without closing the popup.
Q_PROPERTY(bool grabFocus READ default WRITE default NOTIFY grabFocusChanged BINDABLE bindableGrabFocus);
/// The screen that the window currently occupies.
///
/// This may be modified to move the window to the given screen.
@ -103,12 +112,15 @@ public:
[[nodiscard]] qint32 relativeY() const;
void setRelativeY(qint32 y);
[[nodiscard]] QBindable<bool> bindableGrabFocus() { return &this->bWantsGrab; }
[[nodiscard]] PopupAnchor* anchor();
signals:
void parentWindowChanged();
void relativeXChanged();
void relativeYChanged();
void grabFocusChanged();
private slots:
void onParentWindowChanged();
@ -131,4 +143,6 @@ private:
bTargetVisible,
&ProxyPopupWindow::targetVisibleChanged
);
Q_OBJECT_BINDABLE_PROPERTY(ProxyPopupWindow, bool, bWantsGrab);
};