@@ -163,7 +163,7 @@ file.
|
||||
**-U \| \--unique**
|
||||
|
||||
: Conky won't start if another Conky process is already running. Implemented
|
||||
only for Linux, FreeBSD, NetBSD and Haiku.
|
||||
only for Linux, FreeBSD, NetBSD, OpenBSD and Haiku.
|
||||
|
||||
**-v \| -V \| \--version**
|
||||
|
||||
|
@@ -2112,9 +2112,9 @@ void set_current_config() {
|
||||
const char *getopt_string =
|
||||
"vVqdDSs:t:u:i:hc:p:"
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
||||
defined(__HAIKU__) || defined(__NetBSD__)
|
||||
defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
"U"
|
||||
#endif /* Linux || FreeBSD || Haiku || NetBSD */
|
||||
#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */
|
||||
#ifdef BUILD_X11
|
||||
"x:y:w:a:X:m:f:"
|
||||
#ifdef OWN_WINDOW
|
||||
@@ -2146,9 +2146,9 @@ const struct option longopts[] = {
|
||||
{"text", 1, nullptr, 't'}, {"interval", 1, nullptr, 'u'},
|
||||
{"pause", 1, nullptr, 'p'},
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
||||
defined(__HAIKU__) || defined(__NetBSD__)
|
||||
defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
{"unique", 0, nullptr, 'U'},
|
||||
#endif /* Linux || FreeBSDi || Haiku || NetBSD */
|
||||
#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */
|
||||
{nullptr, 0, nullptr, 0}
|
||||
};
|
||||
|
||||
|
@@ -444,3 +444,8 @@ void prepare_update() {}
|
||||
int get_entropy_avail(unsigned int *val) { return 1; }
|
||||
|
||||
int get_entropy_poolsize(unsigned int *val) { return 1; }
|
||||
|
||||
bool is_conky_already_running() {
|
||||
return bsdcommon::is_conky_already_running();
|
||||
}
|
||||
|
||||
|
@@ -30,4 +30,6 @@ typedef struct apm_power_info *apm_info_t;
|
||||
int get_entropy_avail(unsigned int *);
|
||||
int get_entropy_poolsize(unsigned int *);
|
||||
|
||||
bool is_conky_already_running();
|
||||
|
||||
#endif /*OPENBSD_H_*/
|
||||
|
16
src/main.cc
16
src/main.cc
@@ -56,6 +56,10 @@
|
||||
#include "data/os/netbsd.h"
|
||||
#endif /* NetBSD */
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#include "data/os/openbsd.h"
|
||||
#endif /* OpenBSD */
|
||||
|
||||
#if defined(__HAIKU__)
|
||||
#include "data/os/haiku.h"
|
||||
#endif /* Haiku */
|
||||
@@ -282,9 +286,9 @@ static void print_help(const char *prog_name) {
|
||||
" -p, --pause=SECS pause for SECS seconds at startup "
|
||||
"before doing anything\n"
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
||||
defined(__HAIKU__) || defined(__NetBSD__)
|
||||
defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
" -U, --unique only one conky process can be created\n"
|
||||
#endif /* Linux || FreeBSD || Haiku || NetBSD */
|
||||
#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */
|
||||
, prog_name);
|
||||
}
|
||||
|
||||
@@ -368,23 +372,23 @@ int main(int argc, char **argv) {
|
||||
break;
|
||||
#endif /* BUILD_X11 */
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
||||
defined(__HAIKU__) || defined(__NetBSD__)
|
||||
defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
case 'U':
|
||||
unique_process = true;
|
||||
break;
|
||||
#endif /* Linux || FreeBSD || Haiku || NetBSD */
|
||||
#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */
|
||||
case '?':
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
||||
defined(__HAIKU__) || defined(__NetBSD__)
|
||||
defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
if (unique_process && is_conky_already_running()) {
|
||||
NORM_ERR("already running");
|
||||
return 0;
|
||||
}
|
||||
#endif /* Linux || FreeBSD || Haiku */
|
||||
#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */
|
||||
|
||||
try {
|
||||
set_current_config();
|
||||
|
Reference in New Issue
Block a user