dunst icon indicating copy to clipboard operation
dunst copied to clipboard

Offset window from center

Open I60R opened this issue 4 years ago • 8 comments

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

I60R avatar Oct 17 '21 09:10 I60R

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.

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=-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).

Same thing here. It's also not easily possible on wayland and doesn't make sense if you're only offsetting from the edges.

fwsmit avatar Oct 17 '21 09:10 fwsmit

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

I60R avatar Oct 17 '21 09:10 I60R

Unfortunately, I cannot catch dunst window, it isn't displayed in swaymsg -t get_tree

I60R avatar Oct 17 '21 10:10 I60R

Makes sense. We are using a "wlr layer shell" which isn't a real window. You cannot match you status bar either probably

fwsmit avatar Oct 17 '21 14:10 fwsmit

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.

fwsmit avatar Oct 17 '21 16:10 fwsmit

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

I60R avatar Oct 17 '21 17:10 I60R

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

fwsmit avatar Oct 17 '21 17:10 fwsmit

It would be much better if it was built into the protocol though

fwsmit avatar Oct 17 '21 17:10 fwsmit