dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.42k stars 338 forks source link

Notification Content Area Width miscalculated when frame_width is greater than 0 #1241

Open jesusofsuburbs opened 6 months ago

jesusofsuburbs commented 6 months ago

Issue description

The drawn notification is wider than the geometry size specified by width, but only if the frame_width > 0 (this is without incorporating the frame thickness into the total width). The notification content (i.e. everything within the frame) is expanded by the width of the frame.

So if e.g. 'width' is set to 360 and 'frame_width' to 1, the effective width will be 361 pixels (unexpected), with an additional 2 pixels of width added by the border (1 on each side) around it (expected). So rather than being 362 pixels in width in total, it's 363 wide. This seems to scale along with the frame_thickness, i.e. with 'width' set to 360 and 'frame_width' to 4 the effective notification content becomes 364 pixels in width (unexpected), with an additional 8 pixels of width added by the border (4 on each side) around it (expected). This makes the notification 372 pixels wide, rather than 360.

If I set the 'frame_width' to 0, the notification displays at its actual width (i.e. 360 pixels wide).

Installation info

Minimal dunstrc (default one suffices) ```ini [global] monitor = 0 follow = none width = 300 height = 300 origin = top-right offset = 10x50 scale = 0 notification_limit = 20 progress_bar = true progress_bar_height = 10 progress_bar_frame_width = 1 progress_bar_min_width = 150 progress_bar_max_width = 300 progress_bar_corner_radius = 0 icon_corner_radius = 0 indicate_hidden = yes transparency = 0 separator_height = 2 padding = 8 horizontal_padding = 8 text_icon_padding = 0 frame_width = 3 frame_color = "#aaaaaa" gap_size = 0 separator_color = frame sort = yes font = Monospace 8 line_height = 0 format = "%s\n%b" alignment = left vertical_alignment = center show_age_threshold = 60 ellipsize = middle ignore_newline = no stack_duplicates = true hide_duplicate_count = false show_indicators = yes enable_recursive_icon_lookup = true icon_theme = Adwaita icon_position = left min_icon_size = 32 max_icon_size = 128 icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ sticky_history = yes history_length = 20 dmenu = /usr/bin/dmenu -p dunst: browser = /usr/bin/xdg-open always_run_script = true title = Dunst class = Dunst corner_radius = 0 ignore_dbusclose = false force_xwayland = false force_xinerama = false [experimental] per_monitor_dpi = false ```

Screenshot

Screenshot This was taken using the default dunstrc. Its width therein is set to 300 pixels, with a frame_width of 3 pixels. The area contained within the frame has a width of 303, rather than 300 pixels.

bynect commented 3 months ago

This makes the notification 372 pixels wide, rather than 360

Did you mean 368 total?

I am trying to investigate this. Are you taking the pixel values from the dunst logging or externally with some measuring tool?