Skip to content

Commit

Permalink
Add documentation and tests for progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
fwsmit committed Nov 6, 2020
1 parent bfcf655 commit 26332f7
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 3 deletions.
43 changes: 40 additions & 3 deletions docs/dunst.pod
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,32 @@ the notification on the left border of the screen while a horizontal offset of

=back

=item B<no_progress_bar> (values: [true/false], default: false)

When an integer value is passed to dunst as a hint (see B<NOTIFY-SEND>), a
progress bar will be drawn at the bottom of the notification. This
behavior can be turned off by setting this setting to true.

=item B<progress_bar_height> (default: 10)

The height of the progress bar in pixel. This includes the frame. Make sure
this value is bigger than twice the frame width.

=item B<progress_bar_min_width> (default: 150)

The minimum width of the progress bar in pixels. The notification is rescaled
to fit the bar.

=item B<progress_bar_max_width> (default: 300)

The maximum width of the progress bar in pixels. The notification is resized
to fit the progress bar.

=item B<progress_bar_frame_width> (default: 1)

The frame width of the progress bar in pixels. This value should be smaller
than half of the progress bar height.

=item B<indicate_hidden> (values: [true/false], default: true)

If this is set to true, a notification indicating how many notifications are
Expand Down Expand Up @@ -561,8 +587,8 @@ Specifies the keyboard shortcut that opens the context menu.

The urgency sections work in a similar way to rules and can be used to specify
attributes for the different urgency levels of notifications (low, normal,
critical). Currently only the background, foreground, timeout, frame_color and
icon attributes can be modified.
critical). Currently only the background, foreground, hightlight, timeout,
frame_color and icon attributes can be modified.

The urgency sections are urgency_low, urgency_normal, urgency_critical for low,
normal and critical urgency respectively.
Expand Down Expand Up @@ -595,6 +621,12 @@ Defines the background color for low, normal and critical notifications respecti

See COLORS for the value format.

=item B<-lh/nh/ch color>

Defines the highlight color for low, normal and critical notifications respectively.

See COLORS for the value format.

=item B<-lfr/nfr/cfr color>

Defines the frame color for low, normal and critical notifications respectively.
Expand Down Expand Up @@ -725,7 +757,12 @@ The background color of the notification. See COLORS for possible values.

=item C<foreground>

The background color of the notification. See COLORS for possible values.
The foreground color of the notification. See COLORS for possible values.

=item C<highlight>

The highlight color of the notification. This color is used for coloring the
progress bar. See COLORS for possible values.

=item C<format>

Expand Down
10 changes: 10 additions & 0 deletions test/functional-tests/dunstrc.progress_bar
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[global]
font = Monospace 8
allow_markup = yes
format = "<b>%s</b>\n%b"
geometry = "0x5-30+20"
icon_position = left
progress_bar_min_width = 100
progress_bar_max_width = 200
progress_bar_frame_width = 5
progress_bar_height = 30
23 changes: 23 additions & 0 deletions test/functional-tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,35 @@ function geometry {
keypress
}

function progress_bar {
killall dunst
../../dunst -config dunstrc.default &
../../dunstify -h int:value:0 -a "dunst tester" -u c "Progress bar 0%: "
../../dunstify -h int:value:33 -a "dunst tester" -u c "Progress bar 33%: "
../../dunstify -h int:value:66 -a "dunst tester" -u c "Progress bar 66%: "
../../dunstify -h int:value:100 -a "dunst tester" -u c "Progress bar 100%: "
keypress
killall dunst
../../dunst -config dunstrc.default &
../../dunstify -h int:value:33 -a "dunst tester" -u l "Low priority: "
../../dunstify -h int:value:33 -a "dunst tester" -u n "Normal priority: "
../../dunstify -h int:value:33 -a "dunst tester" -u c "Critical priority: "
keypress
killall dunst
../../dunst -config dunstrc.progress_bar &
../../dunstify -h int:value:33 -a "dunst tester" -u n "The progress bar should not be the entire width"
../../dunstify -h int:value:33 -a "dunst tester" -u n "You might also notice height and frame size are changed"
../../dunstify -h int:value:33 -a "dunst tester" -u c "Short"
keypress
}

if [ -n "$1" ]; then
while [ -n "$1" ]; do
$1
shift
done
else
progress_bar
geometry
corners
show_age
Expand Down

0 comments on commit 26332f7

Please sign in to comment.