modfetch/modules/desktop.c

46 lines
830 B
C
Raw Normal View History

2024-02-10 00:04:36 +01:00
/* DESKTOP - desktop environment / window manager / compositor module for modfetch
*
* author: jacekpoz
* 09 Feb 2024
*/
2024-02-09 12:05:06 +01:00
#include "../mod.h"
#include <stdio.h>
#include <stdlib.h>
2024-02-11 17:50:10 +01:00
static const semver api_ver = {
.major = 0,
.minor = 1,
.patch = 0,
};
2024-02-10 14:11:26 +01:00
static const semver _version = {
.major = 0,
.minor = 1,
.patch = 0,
};
semver version(void) { return _version; }
2024-02-10 14:51:50 +01:00
const char *name(void) { return "desktop"; }
2024-02-09 12:05:06 +01:00
2024-02-11 17:50:10 +01:00
uint8_t init(char **config) {
if (!sveq(api_ver, API_VERSION)) {
return MFERR_APIVER;
}
2024-02-09 12:05:06 +01:00
(void)config;
2024-02-11 17:50:10 +01:00
return 0;
2024-02-09 12:05:06 +01:00
}
const char *get(void) {
char *ret;
if (asprintf(&ret, "Desktop: %s", getenv("XDG_CURRENT_DESKTOP")) < 0) {
fprintf(stderr, "error: failed formatting (this shouldn't happen)");
exit(EXIT_FAILURE);
}
return ret;
}