-
Notifications
You must be signed in to change notification settings - Fork 58
wayland/shortcuts-inhibit: add shortcuts inhibitor #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
wayland/shortcuts-inhibit: add shortcuts inhibitor #277
Conversation
|
This does not look helpful for creating keybinds and I can't think of much to use it for apart from making misguided lock screens that don't work properly. Can you explain exactly what you want to do with it and why having your compositor run qs ipc does not solve it? |
Specifically, I want to integrate a settings screen for configuring niri keybinds into my shell. Which is now possible with niris config include branch. It's not possible to have a keybind input field without it. (If I want to overwrite one that's already bound) |
rec_1759233568.mp4This is the type of input field I have in mind |
outfoxxed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone over the protocol and the implementation, and most of it is missing here. To merge this we'll need to be able to tell if the compositor takes away the inhibitor or it disappears due to focus loss.
Additionally, only one inhibitor object can be created at a time per surface or a protocol error will be raised and quickshell will crash, so merge them.
f484db0 to
21eb42f
Compare
|
I added an |
21eb42f to
a764cec
Compare
outfoxxed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
went through everything
| this->onWindowVisibilityChanged(); | ||
| } | ||
|
|
||
| emit this->windowChanged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like window and bBoundWindow should be pretty much unrelated. As window hasn't changed here, it shouldn't update. If the window is actually connected should be transparent to the window property.
| ShortcutsInhibitor* | ||
| ShortcutsInhibitManager::createShortcutsInhibitor(QtWaylandClient::QWaylandWindow* surface) { | ||
| auto* display = QtWaylandClient::QWaylandIntegration::instance()->display(); | ||
| auto* inputDevice = display->lastInputDevice(); | ||
| if (inputDevice == nullptr) inputDevice = display->defaultInputDevice(); | ||
|
|
||
| if (inputDevice == nullptr) { | ||
| qCCritical(logShortcutsInhibit) << "Could not create shortcuts inhibitor: No seat."; | ||
| return nullptr; | ||
| } | ||
|
|
||
| auto* wlSurface = surface->surface(); | ||
|
|
||
| if (this->inhibitors.contains(wlSurface)) { | ||
| auto* inhibitor = this->inhibitors.value(wlSurface); | ||
| this->refCounts[inhibitor]++; | ||
| qCDebug(logShortcutsInhibit) << "Reusing existing inhibitor" << inhibitor << "for surface" | ||
| << wlSurface << "- refcount:" << this->refCounts[inhibitor]; | ||
| return inhibitor; | ||
| } | ||
|
|
||
| auto* inhibitor = | ||
| new ShortcutsInhibitor(this->inhibit_shortcuts(wlSurface, inputDevice->object()), wlSurface); | ||
| this->inhibitors.insert(wlSurface, inhibitor); | ||
| this->refCounts.insert(inhibitor, 1); | ||
| qCDebug(logShortcutsInhibit) << "Created inhibitor" << inhibitor << "for surface" << wlSurface; | ||
| return inhibitor; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return an existing inhibitor if we have one that matches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is if it already exists for the surface
27b5ae9 to
a77f9b0
Compare
Implement keyboard-shortcuts-inhibit-unstable-v1
There's probably a few use cases for this in quickshell, but the one i'm interested in is getting an interface for creating keybinds. Without it it gets eaten by the compositor.
Usage is as follows: