aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraxtloss <axtlos@getcryst.al>2024-05-28 20:01:57 +0200
committeraxtloss <axtlos@getcryst.al>2024-05-28 20:01:57 +0200
commitff0328765c04614701bbfe793bb228cd63f1b2fc (patch)
treeeaec361a71a2cb4d09e178e9574c260f5da58417
parent85e5469362db3c3fb89f7dc3fbe1eb1431fb2fcc (diff)
downloadautodarkmode-ff0328765c04614701bbfe793bb228cd63f1b2fc.tar.gz
autodarkmode-ff0328765c04614701bbfe793bb228cd63f1b2fc.tar.bz2
add readme and fix some warnings
-rw-r--r--README.md34
-rw-r--r--src/configuration.c2
-rw-r--r--src/extString.c6
-rw-r--r--src/extString.h6
4 files changed, 40 insertions, 8 deletions
diff --git a/README.md b/README.md
index bc2ee88..a2a5395 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,35 @@
# autodarkmode
-A description of this project.
+A simple tool to switch between dark and light mode.
+
+It executes a command on switch and nothing else.
+Location is either specified by the user or
+
+# Building
+```
+meson setup _build
+cd build
+meson compile
+```
+the resulting binary `src/autodarkmode` can then be moved to any directory in PATH.
+
+# Configuration
+```ini
+[main]
+; can be 'manual' or 'gclue'
+locationtype = "manual"
+
+[manual]
+; set latitude and longitude in case that locationtype is set to manual
+latitude = -10.0
+longitude = -5.0
+
+[light]
+; command to execute for light mode
+cmd = "notify-send 'a'"
+
+[dark]
+; command to execute for dark mode
+cmd = "notify-send 'b'"
+```
+autodarkmode expects to find this configuration in `$XDG_CONFIG_HOME/autodarkmode/config.ini`, in the case that XDG_CONFIG_HOME is empty, it will use `~/.config/autodarkmode/config.ini`
diff --git a/src/configuration.c b/src/configuration.c
index 6196e26..7d978f6 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -63,7 +63,7 @@ config_get_location_type(dictionary *d)
if (d == NULL)
return GCLUE;
- char *loctype = iniparser_getstring (d, "main:locationtype", "gclue");
+ const char *loctype = iniparser_getstring (d, "main:locationtype", "gclue");
if (strcmp(strlwr(loctype), "gclue") == 0) {
return GCLUE;
diff --git a/src/extString.c b/src/extString.c
index b32b380..e7ebeaa 100644
--- a/src/extString.c
+++ b/src/extString.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <ctype.h>
-char *strlwr(char *s)
+const char *strlwr(const char *s)
{
unsigned char *p = (unsigned char *)s;
@@ -33,7 +33,7 @@ char *strlwr(char *s)
return s;
}
-char *trim(char *s)
+char *trim(const char *s)
{
char *result = strdup(s);
char *end;
@@ -51,7 +51,7 @@ char *trim(char *s)
return result;
}
-char *replaceStr(char *s, char *old, char *replace) {
+char *replaceStr(const char *s, const char *old, const char *replace) {
char* result;
int i, cnt = 0;
size_t newSize = strlen(replace);
diff --git a/src/extString.h b/src/extString.h
index 66149f1..d621792 100644
--- a/src/extString.h
+++ b/src/extString.h
@@ -1,3 +1,3 @@
-char *strlwr(char *s);
-char *trim(char *s);
-char *replaceStr(char *s, char *old, char *replace);
+const char *strlwr(const char *s);
+char *trim(const char *s);
+char *replaceStr(const char *s, const char *old, const char *replace);