aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2019-12-29 18:56:54 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2019-12-29 18:57:13 +0100
commitc270c172dd67e9ab74d13fcf572688bceb3c61d6 (patch)
tree201cbafaa0888929404bafcdbbde802a5b626113
parentoriented object is fine (diff)
downloadlowbat-gnu-c270c172dd67e9ab74d13fcf572688bceb3c61d6.tar.gz
lowbat-gnu-c270c172dd67e9ab74d13fcf572688bceb3c61d6.tar.bz2
lowbat-gnu-c270c172dd67e9ab74d13fcf572688bceb3c61d6.tar.xz
lowbat-gnu-c270c172dd67e9ab74d13fcf572688bceb3c61d6.tar.zst
lowbat-gnu-c270c172dd67e9ab74d13fcf572688bceb3c61d6.zip
espeak bug, searching
-rw-r--r--inc/jo_lowbat.hpp2
-rw-r--r--src/jo_lowbat.cpp13
-rw-r--r--src/main.cpp7
3 files changed, 14 insertions, 8 deletions
diff --git a/inc/jo_lowbat.hpp b/inc/jo_lowbat.hpp
index a2bd06e..7428c86 100644
--- a/inc/jo_lowbat.hpp
+++ b/inc/jo_lowbat.hpp
@@ -10,7 +10,7 @@ class Lowbat {
public:
uint8_t jo_testAcpi(void);
uint8_t jo_testNotifySend(void);
- void jo_testEspeak(void);
+ uint8_t jo_testEspeak(void);
int jo_fetchBatlvl(void);
int jo_fetchAcstat(void);
int jo_notify(void);
diff --git a/src/jo_lowbat.cpp b/src/jo_lowbat.cpp
index b6cc0d6..73a91b3 100644
--- a/src/jo_lowbat.cpp
+++ b/src/jo_lowbat.cpp
@@ -22,11 +22,11 @@ Lowbat::jo_testNotifySend(void) {
cout << "notify-send is not installed. Please install it in order to run lowbat" << endl;
return 1;
}
- cout << "notify-send is installed"
+ cout << "notify-send is installed" << endl;
return 0;
}
-void
+uint8_t
Lowbat::jo_testEspeak(void) {
if (system("which espeak > /dev/null 2>&1")) {
cout << "espeak is not installed. Please install it in order to run --say option" << endl;
@@ -47,11 +47,14 @@ Lowbat::jo_fetchBatlvl(void) {
int
Lowbat::jo_fetchAcstat(void) {
- const int ret = system("acpi | grep -q Discharging");
+ int ret;
+
+ cout << "Fetching acstat: "
+ ret = system("acpi | grep -q Discharging");
if (ret != 0)
- cout << ret << "acstat: Charging" << endl;
+ cout << "Charging" << endl;
else
- cout << "acstat: Discharging" << endl;
+ cout << "Discharging" << endl;
return ret;
}
diff --git a/src/main.cpp b/src/main.cpp
index 56ee872..d9f6874 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,5 +1,6 @@
#include <jo_lowbat.hpp>
#include <iostream>
+#include <cstring>
#include <cstdint>
#include <thread>
#include <chrono>
@@ -12,10 +13,12 @@ int main(int argc, const char *argv[]) {
uint8_t speaks;
speaks = 0;
- if (lowbat.jo_testAcpi())
+ if (lowbat.jo_testAcpi()) {
return 1;
- if (lowbat.jo_testNotifySend())
+ }
+ if (lowbat.jo_testNotifySend()) {
return 2;
+ }
if (argc > 2 && !strcmp(argv[1], "--say")) {
if (lowbat.jo_testEspeak()) {
lowbat.jo_setMsg(argv[2]);