diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d2853a..140cb2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,17 +51,17 @@ add_executable(f00bar particles/ramp.c particles/ramp.h particles/string.c particles/string.h - modules/alsa.c modules/alsa.h - modules/backlight.c modules/backlight.h - modules/battery.c modules/battery.h - modules/clock.c modules/clock.h - modules/i3.c modules/i3.h - modules/label.c modules/label.h - modules/mpd.c modules/mpd.h - modules/network.c modules/network.h - modules/removables.c modules/removables.h - modules/xkb.c modules/xkb.h - modules/xwindow.c modules/xwindow.h + modules/alsa/alsa.c modules/alsa/alsa.h + modules/backlight/backlight.c modules/backlight/backlight.h + modules/battery/battery.c modules/battery/battery.h + modules/clock/clock.c modules/clock/clock.h + modules/i3/i3.c modules/i3/i3.h + modules/label/label.c modules/label/label.h + modules/mpd/mpd.c modules/mpd/mpd.h + modules/network/network.c modules/network/network.h + modules/removables/removables.c modules/removables/removables.h + modules/xkb/xkb.c modules/xkb/xkb.h + modules/xwindow/xwindow.c modules/xwindow/xwindow.h ) target_compile_definitions(f00bar PRIVATE _GNU_SOURCE) diff --git a/config.c b/config.c index fcedfef..3bc9c1b 100644 --- a/config.c +++ b/config.c @@ -21,17 +21,17 @@ #include "particles/string.h" #include "module.h" -#include "modules/alsa.h" -#include "modules/backlight.h" -#include "modules/battery.h" -#include "modules/clock.h" -#include "modules/i3.h" -#include "modules/label.h" -#include "modules/mpd.h" -#include "modules/network.h" -#include "modules/removables.h" -#include "modules/xkb.h" -#include "modules/xwindow.h" +#include "modules/alsa/alsa.h" +#include "modules/backlight/backlight.h" +#include "modules/battery/battery.h" +#include "modules/clock/clock.h" +#include "modules/i3/i3.h" +#include "modules/label/label.h" +#include "modules/mpd/mpd.h" +#include "modules/network/network.h" +#include "modules/removables/removables.h" +#include "modules/xkb/xkb.h" +#include "modules/xwindow/xwindow.h" #include "config-verify.h" diff --git a/modules/alsa.c b/modules/alsa/alsa.c similarity index 99% rename from modules/alsa.c rename to modules/alsa/alsa.c index b67aabb..d4311ca 100644 --- a/modules/alsa.c +++ b/modules/alsa/alsa.c @@ -7,9 +7,9 @@ #define LOG_MODULE "alsa" #define LOG_ENABLE_DBG 0 -#include "../log.h" -#include "../bar.h" -#include "../tllist.h" +#include "../../log.h" +#include "../../bar.h" +#include "../../tllist.h" struct private { char *card; diff --git a/modules/alsa.h b/modules/alsa/alsa.h similarity index 66% rename from modules/alsa.h rename to modules/alsa/alsa.h index ec539e1..4c63775 100644 --- a/modules/alsa.h +++ b/modules/alsa/alsa.h @@ -1,7 +1,7 @@ #pragma once -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" struct module *module_alsa( const char *card, const char *mixer, struct particle *label); diff --git a/modules/backlight.c b/modules/backlight/backlight.c similarity index 99% rename from modules/backlight.c rename to modules/backlight/backlight.c index 7a3e08d..4c6a7bb 100644 --- a/modules/backlight.c +++ b/modules/backlight/backlight.c @@ -13,8 +13,8 @@ #include #define LOG_MODULE "battery" -#include "../log.h" -#include "../bar.h" +#include "../../log.h" +#include "../../bar.h" struct private { struct particle *label; diff --git a/modules/backlight.h b/modules/backlight/backlight.h similarity index 63% rename from modules/backlight.h rename to modules/backlight/backlight.h index f1e3a90..ab0b9b3 100644 --- a/modules/backlight.h +++ b/modules/backlight/backlight.h @@ -1,6 +1,6 @@ #pragma once -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" struct module *module_backlight(const char *device, struct particle *label); diff --git a/modules/battery.c b/modules/battery/battery.c similarity index 99% rename from modules/battery.c rename to modules/battery/battery.c index 43c2bee..2c3ba4f 100644 --- a/modules/battery.c +++ b/modules/battery/battery.c @@ -14,8 +14,8 @@ #include #define LOG_MODULE "battery" -#include "../log.h" -#include "../bar.h" +#include "../../log.h" +#include "../../bar.h" enum state { STATE_FULL, STATE_CHARGING, STATE_DISCHARGING }; diff --git a/modules/battery.h b/modules/battery/battery.h similarity index 68% rename from modules/battery.h rename to modules/battery/battery.h index 1d268ab..e025f3a 100644 --- a/modules/battery.h +++ b/modules/battery/battery.h @@ -1,7 +1,7 @@ #pragma once -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" struct module *module_battery( const char *battery, struct particle *label, int poll_interval_secs); diff --git a/modules/clock.c b/modules/clock/clock.c similarity index 98% rename from modules/clock.c rename to modules/clock/clock.c index a9f57e6..8b8e692 100644 --- a/modules/clock.c +++ b/modules/clock/clock.c @@ -6,7 +6,7 @@ #include -#include "../bar.h" +#include "../../bar.h" struct private { struct particle *label; diff --git a/modules/clock.h b/modules/clock/clock.h similarity index 69% rename from modules/clock.h rename to modules/clock/clock.h index 2af48db..06c02f4 100644 --- a/modules/clock.h +++ b/modules/clock/clock.h @@ -1,7 +1,7 @@ #pragma once -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" struct module *module_clock( struct particle *label, const char *date_format, const char *time_format); diff --git a/modules/i3.c b/modules/i3/i3.c similarity index 99% rename from modules/i3.c rename to modules/i3/i3.c index b910355..d55eb50 100644 --- a/modules/i3.c +++ b/modules/i3/i3.c @@ -19,10 +19,10 @@ #define LOG_MODULE "i3" #define LOG_ENABLE_DBG 0 -#include "../log.h" -#include "../bar.h" +#include "../../log.h" +#include "../../bar.h" -#include "../particles/dynlist.h" +#include "../../particles/dynlist.h" struct ws_content { char *name; diff --git a/modules/i3.h b/modules/i3/i3.h similarity index 83% rename from modules/i3.h rename to modules/i3/i3.h index d6be4e5..33b323b 100644 --- a/modules/i3.h +++ b/modules/i3/i3.h @@ -1,7 +1,7 @@ #pragma once -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" /* Maps workspace name to a content particle. */ struct i3_workspaces { diff --git a/modules/label.c b/modules/label/label.c similarity index 100% rename from modules/label.c rename to modules/label/label.c diff --git a/modules/label.h b/modules/label/label.h similarity index 55% rename from modules/label.h rename to modules/label/label.h index 7f04a10..07a875e 100644 --- a/modules/label.h +++ b/modules/label/label.h @@ -1,6 +1,6 @@ #pragma once -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" struct module *module_label(struct particle *label); diff --git a/modules/mpd.c b/modules/mpd/mpd.c similarity index 99% rename from modules/mpd.c rename to modules/mpd/mpd.c index 58583f6..13b3889 100644 --- a/modules/mpd.c +++ b/modules/mpd/mpd.c @@ -16,8 +16,8 @@ #define LOG_MODULE "mpd" #define LOG_ENABLE_DBG 0 -#include "../log.h" -#include "../bar.h" +#include "../../log.h" +#include "../../bar.h" enum state { STATE_OFFLINE = 1000, diff --git a/modules/mpd.h b/modules/mpd/mpd.h similarity index 69% rename from modules/mpd.h rename to modules/mpd/mpd.h index 3a69b7c..e1c5183 100644 --- a/modules/mpd.h +++ b/modules/mpd/mpd.h @@ -2,8 +2,8 @@ #include -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" struct module *module_mpd( const char *host, uint16_t port, struct particle *label); diff --git a/modules/network.c b/modules/network/network.c similarity index 98% rename from modules/network.c rename to modules/network/network.c index 9e747c1..e7da46d 100644 --- a/modules/network.c +++ b/modules/network/network.c @@ -16,10 +16,10 @@ #define LOG_MODULE "network" #define LOG_ENABLE_DBG 0 -#include "../log.h" -#include "../module.h" -#include "../bar.h" -#include "../tllist.h" +#include "../../log.h" +#include "../../module.h" +#include "../../bar.h" +#include "../../tllist.h" struct af_addr { int family; @@ -141,6 +141,8 @@ netlink_connect(void) .nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR, }; + LOG_WARN("nl_pid_value = 0x%08x", addr.nl_pid); + if (bind(sock, (const struct sockaddr *)&addr, sizeof(addr)) == -1) { LOG_ERRNO("failed to bind netlink socket"); close(sock); diff --git a/modules/network.h b/modules/network/network.h similarity index 62% rename from modules/network.h rename to modules/network/network.h index 6ec57bd..6c3fee7 100644 --- a/modules/network.h +++ b/modules/network/network.h @@ -1,6 +1,6 @@ #pragma once -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" struct module *module_network(const char *iface, struct particle *label); diff --git a/modules/removables.c b/modules/removables/removables.c similarity index 99% rename from modules/removables.c rename to modules/removables/removables.c index 263206f..eab132f 100644 --- a/modules/removables.c +++ b/modules/removables/removables.c @@ -16,10 +16,10 @@ #define LOG_MODULE "removables" #define LOG_ENABLE_DBG 0 -#include "../log.h" -#include "../bar.h" -#include "../tllist.h" -#include "../particles/dynlist.h" +#include "../../log.h" +#include "../../bar.h" +#include "../../tllist.h" +#include "../../particles/dynlist.h" typedef tll(char *) mount_point_list_t; diff --git a/modules/removables.h b/modules/removables/removables.h similarity index 68% rename from modules/removables.h rename to modules/removables/removables.h index ff94a18..9d780fc 100644 --- a/modules/removables.h +++ b/modules/removables/removables.h @@ -1,7 +1,7 @@ #pragma once -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" struct module *module_removables( struct particle *label, int left_spacing, int right_spacing); diff --git a/modules/xkb.c b/modules/xkb/xkb.c similarity index 99% rename from modules/xkb.c rename to modules/xkb/xkb.c index ca99058..48d1854 100644 --- a/modules/xkb.c +++ b/modules/xkb/xkb.c @@ -11,9 +11,9 @@ #include #define LOG_MODULE "xkb" -#include "../log.h" -#include "../bar.h" -#include "../xcb.h" +#include "../../log.h" +#include "../../bar.h" +#include "../../xcb.h" struct layout { char *name; diff --git a/modules/xkb.h b/modules/xkb/xkb.h similarity index 54% rename from modules/xkb.h rename to modules/xkb/xkb.h index d8ec03d..c23129b 100644 --- a/modules/xkb.h +++ b/modules/xkb/xkb.h @@ -1,5 +1,5 @@ #pragma once -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" struct module *module_xkb(struct particle *label); diff --git a/modules/xwindow.c b/modules/xwindow/xwindow.c similarity index 99% rename from modules/xwindow.c rename to modules/xwindow/xwindow.c index f699192..515c0a0 100644 --- a/modules/xwindow.c +++ b/modules/xwindow/xwindow.c @@ -15,9 +15,9 @@ #include #define LOG_MODULE "xkb" -#include "../log.h" -#include "../bar.h" -#include "../xcb.h" +#include "../../log.h" +#include "../../bar.h" +#include "../../xcb.h" struct private { /* Accessed from bar thread only */ diff --git a/modules/xwindow.h b/modules/xwindow/xwindow.h similarity index 56% rename from modules/xwindow.h rename to modules/xwindow/xwindow.h index e178ff8..cba35f2 100644 --- a/modules/xwindow.h +++ b/modules/xwindow/xwindow.h @@ -1,6 +1,6 @@ #pragma once -#include "../module.h" -#include "../particle.h" +#include "../../module.h" +#include "../../particle.h" struct module *module_xwindow(struct particle *label);