Dunst: Add option to align icon/text vertically

Created on 18 Jan 2018  ยท  5Comments  ยท  Source: dunst-project/dunst

In it's current state (v1.3.0), dunst seems to vertically center the icon and text. I personally find this irritating and would prefer to align them to the top of the notification.

The following graphics demonstrate/clarify the idea with a) an icon smaller than the text and b) a much larger icon than the text.

Center alignment (current behaviour)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  |  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      first line   โ”‚  |  โ”‚ ####              โ”‚
โ”‚  #   second       โ”‚  |  โ”‚ ####  one line    โ”‚
โ”‚      third line   โ”‚  |  โ”‚ ####              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  |  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Top alignment
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  |  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  #   first line   โ”‚  |  โ”‚ ####  one line    โ”‚
โ”‚      second       โ”‚  |  โ”‚ ####              โ”‚
โ”‚      third line   โ”‚  |  โ”‚ ####              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  |  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Bottom alignment
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  |  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      first line   โ”‚  |  โ”‚ ####              โ”‚
โ”‚      second       โ”‚  |  โ”‚ ####              โ”‚
โ”‚  #   third line   โ”‚  |  โ”‚ ####  one line    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  |  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Would it be possible to implement such alignment? I would much appreciate it.

Feature graphics

Most helpful comment

Implemented with #684!

All 5 comments

Agreed, I can totally understand why people would be driven nuts by a limitation in the current release like this. For future readers who are looking for a solution to this problem, here's a workaround hack you can use. Basically, what you do is trick dunst into preserving the leading/trailing whitespace in your string by using a "pseudo" space character. This way, you can vertically top-align or bottom-align your notification text.

Before the hack:

notify-send "๐ŸŽต ~Now playing~ ๐ŸŽต" "$SONG_TITLE\n$ALBUM_NAME"

before

After the hack:

# NOTE!!! The "space" at the end is actually the Unicode symbol '\u3000'
notify-send "๐ŸŽต ~Now playing~ ๐ŸŽต" "$SONG_TITLE\n$ALBUM_NAME\n\n\nใ€€"

after

Good luck! Here's a video demo of it in action

Hi, is there any possibility this will be taken up any time soon ?
been really looking forward to this since a while..

Unfortunately, I do not have enough time to dedicate to proper dunst development other than bugfixing for the time being. However if anyone wants to step up to implement this I'd gladly accept a PR, and I'm obviously still active here if there are any questions.

Most of the positioning work is done in render_content so if anyone wants to implement it that's the place to start.

Most of the positioning work is done in render_content so if anyone wants to implement it that's the place to start.

Uh, this looks intriguing. I hacked at it shortly and it looks promising. Will try to have another shot at it on the weekend. Thanks for the pointer :)

Implemented with #684!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

existme picture existme  ยท  4Comments

k80w picture k80w  ยท  7Comments

progandy picture progandy  ยท  4Comments

adihrustic picture adihrustic  ยท  3Comments

catzybluphish picture catzybluphish  ยท  6Comments