can i popup a menu to center of screen #272
-
I would like to make a power menu. i hope it can popup a menu to center of screen, when i click on it's icon. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
The proper answer in wayland is "no". An application can't control placement of it's windows. I may be possible to use some heuristics for a layer shell application to control location of it's xdg popup, but it would be hacky and won't work for all configurations (with potentially very messy results when it doesn't work). |
Beta Was this translation helpful? Give feedback.
-
The question is also what #!/usr/bin/env python3
import gi
gi.require_version("Gtk", "3.0")
gi.require_version('GtkLayerShell', '0.1')
from gi.repository import Gtk, GtkLayerShell
if __name__ == '__main__':
win = Gtk.Window()
GtkLayerShell.init_for_window(win)
GtkLayerShell.set_layer(win, GtkLayerShell.Layer.TOP)
win.set_size_request(640, 480)
win.show()
Gtk.main() This uses the fact that the wlr-layershell protocol states that layershell surfaces without anchors are centered. |
Beta Was this translation helpful? Give feedback.
-
Gtk menu is an xdg popup which is positioned relative to the patent
window. An unanchored layer shell window typically is placed in the center
of the screen, but there is no guarantee it will be. The placement is up
to a compositor.
…On Mon, 9 Dec 2024, 20:41 Consolatis, ***@***.***> wrote:
The question is also what menu refers to. If you mean something like a
context menu then no as explained above. If you mean a bigger surface with
buttons and the like that might be possible. See this python snippet:
#!/usr/bin/env python3
import gigi.require_version("Gtk", "3.0")gi.require_version('GtkLayerShell', '0.1')from gi.repository import Gtk, GtkLayerShell
if __name__ == '__main__':
win = Gtk.Window()
GtkLayerShell.init_for_window(win)
GtkLayerShell.set_layer(win, GtkLayerShell.Layer.TOP)
win.set_size_request(640, 480)
win.show()
Gtk.main()
—
Reply to this email directly, view it on GitHub
<#272 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASHPFFGMA25NS6GQCMIDZ7D2EX6AHAVCNFSM6AAAAABTFZ3TO2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNJRGI4DSNI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Indeed, you're right. From the protocol: "... or in the center if none is
specified." (In respect to the anchors).
…On Mon, 9 Dec 2024, 21:56 Consolatis, ***@***.***> wrote:
I'd say if a compositor places a layershell surface without anchors
anywhere but the center its a bug in the compositor. At least from how I
understand the protocol.
—
Reply to this email directly, view it on GitHub
<#272 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASHPFFHAYARSUVOF223XRVD2EYGZFAVCNFSM6AAAAABTFZ3TO2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNJRGM3DEMQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
That shouldn't be too difficult, The anchors are currently set via bar size
and bar direction settings. In theory we could add a setting to unanchor a
bar. (this is how the switcher works) Then you could create a bar in the
middle of the screen and populate then with widgets of your choice.
…On Tue, Dec 10, 2024 at 3:19 AM knm100 ***@***.***> wrote:
I mean a bigger surface with buttons like the dialog of lxqt-leave. thank
you!
—
Reply to this email directly, view it on GitHub
<#272 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASHPFFEEMCCJMFKSKWXGQF32EZMUHAVCNFSM6AAAAABTFZ3TO2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNJRGUZTQNI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
The question is also what
menu
refers to. If you mean something like a context menu then no as explained above. If you mean a bigger surface with buttons and the like that might be possible. See this python snippet:This uses the fact that the wlr-layershell protocol states that layershell surfaces without anchors are centered.