module/battery: use libudev to monitor for battery changes

This allows us to detect plug/unplug events immediately, instead of
having to wait for the next poll event.

Unfortunately, capacity changes do not appear to generate events :(
This commit is contained in:
Daniel Eklöf 2018-12-16 17:04:44 +01:00
parent 47b36bdd35
commit fa3c17aa4a
2 changed files with 44 additions and 7 deletions

View file

@ -15,6 +15,7 @@ pkg_check_modules(CAIRO REQUIRED cairo cairo-xcb) # Core
pkg_check_modules(YAML REQUIRED yaml-0.1) # Core (configuration)
pkg_check_modules(JSON REQUIRED json-c) # Module/i3
pkg_check_modules(UDEV REQUIRED libudev) # Module/battery
add_executable(f00bar
bar.c bar.h
@ -47,6 +48,7 @@ target_compile_options(f00bar PRIVATE
${CAIRO_CFLAGS_OTHER}
${YAML_CFLAGS_OTHER}
${JSON_CFLAGS_OTHER}
${UDEV_CFLAGS_OTHER}
)
target_include_directories(f00bar PRIVATE
@ -54,6 +56,7 @@ target_include_directories(f00bar PRIVATE
${CAIRO_INCLUDE_DIRS}
${YAML_INCLUDE_DIRS}
${JSON_INCLUDE_DIRS}
${UDEV_INCLUDE_DIRS}
)
target_link_libraries(f00bar
@ -62,4 +65,5 @@ target_link_libraries(f00bar
${CAIRO_LIBRARIES}
${YAML_LIBRARIES}
${JSON_LIBRARIES}
${UDEV_LIBRARIES}
)