Conversation
Instead, we can use startup-x and startup-y properties
|
In case anyone is wondering what this is all about:
Example IPC script showing how this works in practice: import wayfire
s = wayfire.WayfireSocket()
# With pre-map events, Wayfire will delay mapping the view until we unblock it (or until transaction timeout happens)
s.watch(['view-pre-map'])
cnt = 0
while True:
ev = s.read_next_event()
# We get only view-pre-map events as those are the only events we subscribe to
view = ev['view']
if view['title'] == "simple-egl":
# set spin animation for weston-simple-egl only
s.set_view_property(view['id'], 'open-animation-type', 'spin')
else:
# rotate through different animations for each other view
cnt = (cnt + 1) % 3
if cnt == 0:
# Use default animation settings
pass
if cnt == 1:
# zoom animation for every third view, starting from the second view
s.set_view_property(view['id'], 'open-animation-type', 'zoom')
if cnt == 2:
# fire animation with a custom duration for every third view, starting from the third view
s.set_view_property(view['id'], 'open-animation-type', 'fire')
s.set_view_property(view['id'], 'open-animation-duration', '1s circle')
# Tell Wayfire we have finished setting up the view and it can be mapped now.
s.unblock_view_map(view['id'])Note: view-pre-map event is not subscribed by default when we do a |
how the custom property works? |
|
The properties are not visible over IPC, do you need that? I could add it but the issue is that properties can store any type of value, so you can't easily serialize them to json. |
|
Also it would be easy to add a query for a particular property (for example it is easy to query for a property with a name 'open-animation-type' and value type 'string'), if that is enough for your use-case. |
|
Ah, also @killown, properties is not the same as what you see in the json list. What you see in the json currently are fixed parts of the definition of a view, whereas properties are like random attached metadata, not part of the view as seen in the json description. |
My use case would be something like
if I understood well, your PR is not specifically about custom data yet xd |
In the C++ API, you can set a property as a combination of name and any value type. Just the issue is that if we expose this over IPC, we are limited to what JSON can provide.
Transferring icons over json can be quite inefficient, that would essentially be binary data which we pack directly into json as a string. It would also not make sense to broadcast the icon on every IPC query, as most clients wouldn't care about the icon. However I assume we can add a query like |
As we discussed earlier in matrix, no worries, I was just curious how the custom data from your PR works. All the IPC features Wayfire currently offers are more than enough! |
This PR adds a more streamlined way to attach custom data (integers, strings, etc.) to views under a given key - properties. They are meant to be used for setting metadata which is unrelated to the 'main' view state (geometry, minimized/tiled/fullscreen state, etc.), as well as custom properties that various plugins can use.
Planned properties for this first PR:
startup-xandstartup-yto replaceis_positionedin the view-mapped signal. This way Xwayland can indicate it has a custom position for the views and the place plugin should not move them. Similar could be set via IPC or any custom plugin.A way to set properties via window-rules or similar(will be IPC only for now, PRs welcome for window-rules properties)open-animation-type,open-animation-duration,close-animation,close-animation-durationfor theanimateplugin (fixes Per-window animations & effects / Window rules for animations & effects #1832)