diff --git a/metadata/md5-cache/sys-power/poweralertd-0.3.0 b/metadata/md5-cache/sys-power/poweralertd-0.3.0-r1 similarity index 84% rename from metadata/md5-cache/sys-power/poweralertd-0.3.0 rename to metadata/md5-cache/sys-power/poweralertd-0.3.0-r1 index 8bba18a..e1bfc11 100644 --- a/metadata/md5-cache/sys-power/poweralertd-0.3.0 +++ b/metadata/md5-cache/sys-power/poweralertd-0.3.0-r1 @@ -12,5 +12,5 @@ RDEPEND=sys-power/upower elogind? ( sys-auth/elogind ) systemd? ( sys-apps/syste REQUIRED_USE=?? ( elogind systemd ) SLOT=0 SRC_URI=https://git.sr.ht/~kennylevinsen/poweralertd/archive/0.3.0.tar.gz -> poweralertd-0.3.0.tar.gz -_eclasses_=toolchain-funcs d3d42b22a610ce81c267b644bcec9b87 multilib b2a329026f2e404e9e371097dda47f96 flag-o-matic f14aba975c94ccaa9f357a27e3b17ffe multiprocessing 1e32df7deee68372153dca65f4a7c21f ninja-utils 2df4e452cea39a9ec8fb543ce059f8d6 python-utils-r1 2fee95c11e5f883024588d4837db6802 meson 99466844dd8d4fcfb07578a76f5a9922 -_md5_=1ecf50b520e6278b02789b501d020091 +_eclasses_=toolchain-funcs 14648d8795f7779e11e1bc7cf08b7536 multilib b2a329026f2e404e9e371097dda47f96 flag-o-matic f14aba975c94ccaa9f357a27e3b17ffe multiprocessing 1e32df7deee68372153dca65f4a7c21f ninja-utils 2df4e452cea39a9ec8fb543ce059f8d6 python-utils-r1 42c5abe4a656a4993a06a4fc61dbdd12 meson 99466844dd8d4fcfb07578a76f5a9922 +_md5_=f6051b97092e6a276fe3e6b7bc4e1a1b diff --git a/sys-power/poweralertd/files/poweralertd-0.3.0-43895-ignore-over-certain-level.patch b/sys-power/poweralertd/files/poweralertd-0.3.0-43895-ignore-over-certain-level.patch new file mode 100644 index 0000000..73277bd --- /dev/null +++ b/sys-power/poweralertd/files/poweralertd-0.3.0-43895-ignore-over-certain-level.patch @@ -0,0 +1,82 @@ +diff --git a/main.c b/main.c +index 99700e3..ec49327 100644 +--- a/main.c ++++ b/main.c +@@ -156,6 +156,7 @@ static const char usage[] = "usage: %s [options]\n" + " -v show the version number\n" + " -s ignore the events at startup\n" + " -i ignore this device type, can be use several times\n" ++" -o ignores events over specified battery percentage\n" + " -S only use the events coming from power supplies\n"; + + +@@ -163,6 +164,7 @@ int main(int argc, char *argv[]) { + int opt = 0; + int device_type = 0; + int ignore_types_mask = 0; ++ int ignore_over = 0; + bool ignore_initial = false; + bool ignore_non_power_supplies = false; + bool initialized = false; +@@ -173,7 +175,7 @@ int main(int argc, char *argv[]) { + return EXIT_FAILURE; + } + +- while ((opt = getopt(argc, argv, "hvsi:S")) != -1) { ++ while ((opt = getopt(argc, argv, "hvsi:o:S")) != -1) { + switch (opt) { + case 'i': + device_type = upower_device_type_int(optarg); +@@ -184,6 +186,9 @@ int main(int argc, char *argv[]) { + printf("Unrecognized device type: %s\n", optarg); + } + break; ++ case 'o': ++ ignore_over = atoi(optarg); ++ break; + case 's': + ignore_initial = true; + break; +@@ -241,23 +246,27 @@ int main(int argc, char *argv[]) { + goto next_device; + } + +- if (upower_device_has_battery(device)) { +- ret = send_state_update(user_bus, device); +- if (ret < 0) { +- fprintf(stderr, "could not send state update notification: %s\n", strerror(-ret)); +- goto finish; +- } +- ret = send_warning_update(user_bus, device); +- if (ret < 0) { +- fprintf(stderr, "could not send warning update notification: %s\n", strerror(-ret)); +- goto finish; ++ if (ignore_over == 0 || device->current.percentage < ignore_over) { ++ if (upower_device_has_battery(device)) { ++ ret = send_state_update(user_bus, device); ++ if (ret < 0) { ++ fprintf(stderr, "could not send state update notification: %s\n", strerror(-ret)); ++ goto finish; ++ } ++ ret = send_warning_update(user_bus, device); ++ if (ret < 0) { ++ fprintf(stderr, "could not send warning update notification: %s\n", strerror(-ret)); ++ goto finish; ++ } ++ } else { ++ ret = send_online_update(user_bus, device); ++ if (ret < 0) { ++ fprintf(stderr, "could not send online update notification: %s\n", strerror(-ret)); ++ goto finish; ++ } + } + } else { +- ret = send_online_update(user_bus, device); +- if (ret < 0) { +- fprintf(stderr, "could not send online update notification: %s\n", strerror(-ret)); +- goto finish; +- } ++ fprintf(stderr, "Ignored because -o: %i | percentage: %f\n", ignore_over, device->current.percentage); + } + next_device: + device->last = device->current; diff --git a/sys-power/poweralertd/poweralertd-0.3.0.ebuild b/sys-power/poweralertd/poweralertd-0.3.0-r1.ebuild similarity index 90% rename from sys-power/poweralertd/poweralertd-0.3.0.ebuild rename to sys-power/poweralertd/poweralertd-0.3.0-r1.ebuild index 9bf0337..82e2242 100644 --- a/sys-power/poweralertd/poweralertd-0.3.0.ebuild +++ b/sys-power/poweralertd/poweralertd-0.3.0-r1.ebuild @@ -26,6 +26,8 @@ DEPEND=" RDEPEND="${DEPEND}" BDEPEND="man? ( app-text/scdoc )" +PATCHES=( "${FILESDIR}/${P}-43895-ignore-over-certain-level.patch" ) + src_configure() { local emesonargs=( $(meson_feature man man-pages)