Offset window from center
With origin=bottom-center I'm able to move notification upwards/downwards e.g. offset=0x123 but not leftward/rightward e.g. offset=123x0 — this is just ignored.
Also, it does seem that there's no way to provide negative integer values, e.g. offset=-123x0 or at least I'm not sure whether this format works, so it might be a good idea to change it to offset=(-123, 0) that's also consistent with width=(0,300).
Note: using origin=bottom-left or origin=bottom-right wouldn't cover my use case as setting offset here makes all notifications align to the left or right respectively instead of some central axis as I'd like.
Installation info
- Version:
v1.6.1-154-g660fdba - Install type:
package - Distro and version:
manjaro - WM:
sway
With
origin=bottom-centerI'm able to move notification upwards/downwards e.g.offset=0x123but not leftward/rightward e.g.offset=123x0— this is just ignored.
This is expected behavior. It's not easy to do this on wayland. Take a look at man 5 dunst for details.
Also, it does seem that there's no way to provide negative integer values, e.g.
offset=-123x0or at least I'm not sure whether this format works, so it might be a good idea to change it tooffset=(-123, 0)that's also consistent withwidth=(0,300).
Same thing here. It's also not easily possible on wayland and doesn't make sense if you're only offsetting from the edges.
This is what man page for dunst displays for me:
origin (default: top-right)
The origin of the notification window on the screen. It can then be moved with offset. Origin can be one of:
top-left
top-center
top-right
bottom-left
bottom-center
bottom-right
left-center
center
right-center
offset format: (horizontal, vertical)
Respectively the horizontal and vertical offset in pixels from the corner of the screen specified by origin. Both values should always be positive or zero.
Examples:
origin = top-right
offset = 10x300 # a margin of 10 pixels from the right and 300 pixels from the top
There's nothing said about Wayland, so I just assumed that it's bug or a missing functionality.
BTW, it seems that Sway allows relative moving of floating windows with for_window rules, I'll try that instead
Unfortunately, I cannot catch dunst window, it isn't displayed in swaymsg -t get_tree
Makes sense. We are using a "wlr layer shell" which isn't a real window. You cannot match you status bar either probably
I've added a "wontfix" label, since I don't think we will fix this any time soon. It will need a pretty hacky workaround.
Is it possible to get screen width in Wayland as well as width of your own window?
If yes then addition doesn't seems to be that hacky: for negative offset use bottom-left anchoring and for positive bottom-right and after that set relative margin that's equal to screen_width/2 - window_size/2 + offset
Yes it's possible, but currently we are using the wlr layer shell protcol's anchors to implement positioning. So we would need to do it completely diffently. Maybe the won't fix label isn't fitting, since it's something I would accept a PR for
It would be much better if it was built into the protocol though