From 63cf8e48c4cffb9a6ef661ae73699bbc7bad8e37 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 29 Nov 2015 10:26:50 -0500 Subject: [PATCH] Add swaybar subproject --- CMakeLists.txt | 1 + swaybar/CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++++++ swaybar/main.c | 20 ++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 swaybar/CMakeLists.txt create mode 100644 swaybar/main.c diff --git a/CMakeLists.txt b/CMakeLists.txt index fce820fc..1298a2ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") add_subdirectory(swaybg) add_subdirectory(swaymsg) add_subdirectory(swaygrab) +add_subdirectory(swaybar) find_package(XKBCommon REQUIRED) find_package(WLC REQUIRED) diff --git a/swaybar/CMakeLists.txt b/swaybar/CMakeLists.txt new file mode 100644 index 00000000..12dd40c6 --- /dev/null +++ b/swaybar/CMakeLists.txt @@ -0,0 +1,36 @@ +project(swaybar) + +find_package(Wayland REQUIRED) +find_package(Cairo REQUIRED) +find_package(Pango REQUIRED) + +include(Wayland) +set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../bin/) +WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell "${PROJECT_SOURCE_DIR}/../protocols/xdg-shell.xml" xdg-shell) +WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell "${PROJECT_SOURCE_DIR}/../protocols/desktop-shell.xml" desktop-shell) + +include_directories( + ${WAYLAND_CLIENT_INCLUDE_DIR} + ${CAIRO_INCLUDE_DIRS} + ${PANGO_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} +) + +FILE(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) +FILE(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) +FILE(GLOB wl_sources ${PROJECT_SOURCE_DIR}/../wayland/*.c) + +add_executable(swaybar + ${sources} + ${wl_sources} + ${common} + ${proto-xdg-shell} + ${proto-desktop-shell} +) + +TARGET_LINK_LIBRARIES(swaybar ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES} ${CAIRO_LIBRARIES} ${PANGO_LIBRARIES} m) + +install( + TARGETS swaybar + RUNTIME DESTINATION bin + COMPONENT runtime) diff --git a/swaybar/main.c b/swaybar/main.c new file mode 100644 index 00000000..49ba7a78 --- /dev/null +++ b/swaybar/main.c @@ -0,0 +1,20 @@ +#include +#include +#include "client/registry.h" +#include "client/window.h" +#include "log.h" + +struct registry *registry; +struct window *window; + +void sway_terminate(void) { + window_teardown(window); + registry_teardown(registry); + exit(EXIT_FAILURE); +} + +int main(int argc, char **argv) { + init_log(L_INFO); + sway_log(L_INFO, "Hello world!"); + return 0; +}