From 4001b3c116267321909503d4067f20f010fc9f94 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Fri, 4 Aug 2017 13:33:31 +0200 Subject: [PATCH] Add patch for fancy dunst progressbars, fix libnotify for volumeicon --- satellites/dunst.sat | 4 ++ .../dunst/dunst-1.2.0-fancy-progressbar.patch | 56 +++++++++++++++++++ satellites/volumeicon.sat | 4 ++ 3 files changed, 64 insertions(+) create mode 100644 satellites/extrafiles/dunst/dunst-1.2.0-fancy-progressbar.patch diff --git a/satellites/dunst.sat b/satellites/dunst.sat index 88658cf..52ebeac 100644 --- a/satellites/dunst.sat +++ b/satellites/dunst.sat @@ -3,11 +3,15 @@ version=1.2.0 update_url="https://github.com/dunst-project/$name/releases" update_names="/archive/v$version.tar.gz" +define_option '!fancy-progressbar: Apply a patch that draws the progress value in a fancy way' + dlextract "https://github.com/dunst-project/dunst/archive/v$version/$name-$version.tar.gz" \ '425d5bb10a8b571c7494c5e60aaae7e1' +option fancy-progressbar extrafile "$name-$version-fancy-progressbar.patch" header_end cd "$name-$version" +option fancy-progressbar patch -p1 -i "../$name-$version-fancy-progressbar.patch" sed -i -e "s/\${PREFIX}\/bin/\${PREFIX}\/$(safe_sed "$dir_bindir")/" \ -e "s/\${PREFIX}\/share/\${PREFIX}\/$(safe_sed "$dir_datadir")/" Makefile diff --git a/satellites/extrafiles/dunst/dunst-1.2.0-fancy-progressbar.patch b/satellites/extrafiles/dunst/dunst-1.2.0-fancy-progressbar.patch new file mode 100644 index 0000000..a293118 --- /dev/null +++ b/satellites/extrafiles/dunst/dunst-1.2.0-fancy-progressbar.patch @@ -0,0 +1,56 @@ +diff --git a/src/x11/x.c b/src/x11/x.c +index 9f7ac20..3430892 100644 +--- a/src/x11/x.c ++++ b/src/x11/x.c +@@ -565,14 +565,22 @@ static dimension_t x_render_layout(cairo_t *c, colored_layout *cl, colored_layou + double bg_half_height = settings.notification_height/2.0; + int pango_offset = (int) floor(h/2.0); + ++ int progress_width = cl->n->progress > 0 ? bg_width * (cl->n->progress - 1) / 100 : bg_width; ++ + if (first) bg_height += settings.frame_width; + if (last) bg_height += settings.frame_width; + else bg_height += settings.separator_height; + + cairo_set_source_rgb(c, cl->frame.r, cl->frame.g, cl->frame.b); +- cairo_rectangle(c, bg_x, bg_y, bg_width, bg_height); ++ cairo_rectangle(c, bg_x, bg_y, progress_width, bg_height); + cairo_fill(c); + ++ if (progress_width != bg_width) { ++ cairo_set_source_rgb(c, cl->frame.r - 0.2, cl->frame.g - 0.2, cl->frame.b - 0.2); ++ cairo_rectangle(c, bg_x + progress_width, bg_y, bg_width - progress_width, bg_height); ++ cairo_fill(c); ++ } ++ + /* adding frame */ + bg_x += settings.frame_width; + if (first) { +@@ -582,13 +590,26 @@ static dimension_t x_render_layout(cairo_t *c, colored_layout *cl, colored_layou + if (!last) bg_height -= settings.separator_height; + } + bg_width -= 2 * settings.frame_width; ++ if (progress_width < settings.frame_width) { ++ progress_width = 0; ++ } else if (progress_width - settings.frame_width > bg_width) { ++ progress_width = bg_width; ++ } else { ++ progress_width -= settings.frame_width; ++ } + if (last) + bg_height -= settings.frame_width; + + cairo_set_source_rgb(c, cl->bg.r, cl->bg.g, cl->bg.b); +- cairo_rectangle(c, bg_x, bg_y, bg_width, bg_height); ++ cairo_rectangle(c, bg_x, bg_y, progress_width, bg_height); + cairo_fill(c); + ++ if (progress_width != bg_width) { ++ cairo_set_source_rgb(c, cl->bg.r - 0.2, cl->bg.g - 0.2, cl->bg.b - 0.2); ++ cairo_rectangle(c, bg_x + progress_width, bg_y, bg_width - progress_width, bg_height); ++ cairo_fill(c); ++ } ++ + bool use_padding = settings.notification_height <= (2 * settings.padding) + h; + if (use_padding) + dim.y += settings.padding; diff --git a/satellites/volumeicon.sat b/satellites/volumeicon.sat index 95d5b6d..4c9944d 100644 --- a/satellites/volumeicon.sat +++ b/satellites/volumeicon.sat @@ -16,7 +16,11 @@ fi header_end cd "$name-$version" + +# Fix compiling with libnotify sed -i -e 's/-DCOMPILEWITH_NOTIFY/ &/' ./configure.ac ./configure +# Remove SIGCHLD ignore that breaks libnotify +sed -i -e '/^\tsignal(SIGCHLD, SIG_IGN);$/d' src/volumeicon.c if option !gtk3; then patch -p2 -i ../gtk2.patch