diff --git a/CMakeLists.txt b/CMakeLists.txt index d687cdd3..e3b50158 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,7 @@ endif() # Generate configuration file # -set(MODULES_LEFT "bspwm i3") +set(MODULES_LEFT "bspwm i3 dwm") set(MODULES_CENTER "mpd") set(MODULES_RIGHT "filesystem xbacklight alsa pulseaudio xkeyboard memory cpu wlan eth battery temperature date powermenu") @@ -98,6 +98,9 @@ endif() if(NOT ENABLE_I3) string(REPLACE " i3" "" MODULES_LEFT ${MODULES_LEFT}) endif() +if (NOT ENABLE_DWM) + string(REPLACE " dwm" "" MODULES_LEFT ${MODULES_LEFT}) +endif() if(NOT ENABLE_MPD) string(REPLACE "mpd" "" MODULES_CENTER ${MODULES_CENTER}) endif() diff --git a/build.sh b/build.sh index 50d1c0ed..d052d625 100755 --- a/build.sh +++ b/build.sh @@ -23,6 +23,8 @@ usage() { ${COLORS[GREEN]}${COLORS[BOLD]}Options:${COLORS[OFF]} ${COLORS[GREEN]}-3, --i3${COLORS[OFF]} Include support for internal/i3 (requires i3); disabled by default. + ${COLORS[GREEN]}-d, --dwm${COLORS[OFF]} + Include support for internal/dwm (requires dwm with IPC patch); disabled by default. ${COLORS[GREEN]}-a, --alsa${COLORS[OFF]} Include support for internal/alsa (requires alsalib); disabled by default. ${COLORS[GREEN]}-p, --pulseaudio${COLORS[OFF]} @@ -101,6 +103,7 @@ set_build_opts() { if [[ "$AUTO" == ON ]]; then [[ -z "$USE_GCC" ]] && USE_GCC="OFF" [[ -z "$ENABLE_I3" ]] && ENABLE_I3="OFF" + [[ -z "$ENABLE_DWM" ]] && ENABLE_DWM="OFF" [[ -z "$ENABLE_ALSA" ]] && ENABLE_ALSA="OFF" [[ -z "$ENABLE_PULSEAUDIO" ]] && ENABLE_PULSEAUDIO="OFF" [[ -z "$ENABLE_NETWORK" ]] && ENABLE_NETWORK="OFF" @@ -120,6 +123,11 @@ set_build_opts() { [[ "${p^^}" != "Y" ]] && ENABLE_I3="OFF" || ENABLE_I3="ON" fi + if [[ -z "$ENABLE_DWM" ]]; then + read -r -p "$(msg "Include support for \"internal/dwm\" (requires dwm) -------------- [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && ENABLE_DWM="OFF" || ENABLE_DWM="ON" + fi + if [[ -z "$ENABLE_ALSA" ]]; then read -r -p "$(msg "Include support for \"internal/alsa\" (requires alsalib) --------- [y/N]: ")" -n 1 p && echo [[ "${p^^}" != "Y" ]] && ENABLE_ALSA="OFF" || ENABLE_ALSA="ON" @@ -197,6 +205,7 @@ main() { -DENABLE_ALSA:BOOL="${ENABLE_ALSA}" \ -DENABLE_PULSEAUDIO:BOOL="${ENABLE_PULSEAUDIO}"\ -DENABLE_I3:BOOL="${ENABLE_I3}" \ + -DENABLE_DWM:BOOL="${ENABLE_DWM}" \ -DENABLE_MPD:BOOL="${ENABLE_MPD}" \ -DENABLE_NETWORK:BOOL="${ENABLE_NETWORK}" \ -DENABLE_CURL:BOOL="${ENABLE_CURL}" \ @@ -223,6 +232,8 @@ while [[ "$1" == -* ]]; do case "$1" in -3|--i3) ENABLE_I3=ON; shift ;; + -d|--dwm) + ENABLE_DWM=ON; shift ;; -a|--alsa) ENABLE_ALSA=ON; shift ;; -p|--pulseaudio) @@ -237,6 +248,7 @@ while [[ "$1" == -* ]]; do ENABLE_IPC_MSG=ON; shift ;; --all-features) ENABLE_I3=ON + ENABLE_DWM=ON ENABLE_ALSA=ON ENABLE_PULSEAUDIO=ON ENABLE_NETWORK=ON diff --git a/cmake/02-opts.cmake b/cmake/02-opts.cmake index 6aa7b7bf..e561e025 100644 --- a/cmake/02-opts.cmake +++ b/cmake/02-opts.cmake @@ -6,6 +6,7 @@ checklib(BUILD_DOC "binary" "${SPHINX_BUILD}") checklib(ENABLE_ALSA "pkg-config" alsa) checklib(ENABLE_CURL "pkg-config" libcurl) +checklib(ENABLE_DWM "binary" dwm) checklib(ENABLE_I3 "binary" i3) checklib(ENABLE_MPD "pkg-config" libmpdclient) checklib(WITH_LIBNL "pkg-config" libnl-genl-3.0) @@ -35,6 +36,7 @@ option(BUILD_DOC "Build documentation" ON) option(ENABLE_ALSA "Enable alsa support" ON) option(ENABLE_CURL "Enable curl support" ON) +option(ENABLE_DWM "Enable dwm support" ON) option(ENABLE_I3 "Enable i3 support" ON) option(ENABLE_MPD "Enable mpd support" ON) option(WITH_LIBNL "Use netlink interface for wireless" ON) @@ -62,6 +64,8 @@ set(SETTING_ALSA_SOUNDCARD "default" CACHE STRING "Name of the ALSA soundcard driver") set(SETTING_BSPWM_SOCKET_PATH "/tmp/bspwm_0_0-socket" CACHE STRING "Path to bspwm socket") +set(SETTING_DWM_SOCKET_PATH "/tmp/dwm.sock" + CACHE STRING "Path to dwm socket") set(SETTING_BSPWM_STATUS_PREFIX "W" CACHE STRING "Prefix prepended to the bspwm status line") set(SETTING_CONNECTION_TEST_IP "8.8.8.8" diff --git a/cmake/05-summary.cmake b/cmake/05-summary.cmake index ddcb2b09..adc6bb21 100644 --- a/cmake/05-summary.cmake +++ b/cmake/05-summary.cmake @@ -23,6 +23,7 @@ colored_option(" documentation" BUILD_DOC) message(STATUS " Module support:") colored_option(" alsa" ENABLE_ALSA) colored_option(" curl" ENABLE_CURL) +colored_option(" dwm" ENABLE_DWM) colored_option(" i3" ENABLE_I3) colored_option(" mpd" ENABLE_MPD) colored_option(" network (${WIRELESS_LIB})" ENABLE_NETWORK) diff --git a/include/settings.hpp.cmake b/include/settings.hpp.cmake index 2099ad5a..844a4af6 100644 --- a/include/settings.hpp.cmake +++ b/include/settings.hpp.cmake @@ -12,6 +12,7 @@ extern const char* const APP_VERSION; #cmakedefine01 ENABLE_NETWORK #cmakedefine01 WITH_LIBNL #cmakedefine01 ENABLE_I3 +#cmakedefine01 ENABLE_DWM #cmakedefine01 ENABLE_CURL #cmakedefine01 ENABLE_PULSEAUDIO @@ -60,6 +61,7 @@ extern const char* const ALSA_SOUNDCARD; extern const char* const BSPWM_SOCKET_PATH; extern const char* const BSPWM_STATUS_PREFIX; extern const char* const CONNECTION_TEST_IP; +extern const char* const DWM_SOCKET_PATH; extern const char* const PATH_ADAPTER; extern const char* const PATH_BACKLIGHT; extern const char* const PATH_BATTERY; diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index b74af3bc..29e5d54e 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -35,6 +35,14 @@ if(ENABLE_I3) list(APPEND libs ${I3IPCPP_LIBRARIES}) endif() +# }}} +# Library: dwmipcpp {{{ + +if(ENABLE_DWM) + add_subdirectory(dwmipcpp) + list(APPEND libs ${DWMIPCPP_LIBRARIES}) +endif() + # }}} set(libs ${libs} PARENT_SCOPE) diff --git a/src/settings.cpp.cmake b/src/settings.cpp.cmake index eadf3bb0..fd9f5185 100644 --- a/src/settings.cpp.cmake +++ b/src/settings.cpp.cmake @@ -12,6 +12,7 @@ const char* const ALSA_SOUNDCARD{"@SETTING_ALSA_SOUNDCARD@"}; const char* const BSPWM_SOCKET_PATH{"@SETTING_BSPWM_SOCKET_PATH@"}; const char* const BSPWM_STATUS_PREFIX{"@SETTING_BSPWM_STATUS_PREFIX@"}; const char* const CONNECTION_TEST_IP{"@SETTING_CONNECTION_TEST_IP@"}; +const char* const DWM_SOCKET_PATH{"@SETTING_DWM_SOCKET_PATH@"}; const char* const PATH_ADAPTER{"@SETTING_PATH_ADAPTER@"}; const char* const PATH_BACKLIGHT{"@SETTING_PATH_BACKLIGHT@"}; const char* const PATH_BATTERY{"@SETTING_PATH_BATTERY@"}; @@ -32,9 +33,10 @@ bool version_details(const std::vector& args) { // clang-format off void print_build_info(bool extended) { printf("%s %s\n\n", APP_NAME, APP_VERSION); - printf("Features: %calsa %ccurl %ci3 %cmpd %cnetwork(%s) %cpulseaudio %cxkeyboard\n", + printf("Features: %calsa %ccurl %cdwm %ci3 %cmpd %cnetwork(%s) %cpulseaudio %cxkeyboard\n", (ENABLE_ALSA ? '+' : '-'), (ENABLE_CURL ? '+' : '-'), + (ENABLE_DWM ? '+' : '-'), (ENABLE_I3 ? '+' : '-'), (ENABLE_MPD ? '+' : '-'), (ENABLE_NETWORK ? '+' : '-'),