Examples and some fixies

This commit is contained in:
Sergey Naumov
2015-12-30 21:05:00 +03:00
parent e8a1a9777c
commit 1a9aacd5a2
3 changed files with 57 additions and 6 deletions

17
examples/CMakeLists.txt Normal file
View File

@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.0)
project(i3ipc++-examples)
include_directories(
${I3IPCpp_INCLUDE_DIRS}
)
link_directories(
${I3IPCpp_LIBRARY_DIRS}
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -DDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
add_executable(workspaces workspaces.cpp)
target_link_libraries(workspaces ${I3IPCpp_LIBRARIES})

22
examples/workspaces.cpp Normal file
View File

@@ -0,0 +1,22 @@
#include <iostream>
#include <i3ipc++/ipc.hpp>
int main() {
i3ipc::I3Connection conn;
for (auto& w : conn.get_workspaces()) {
std::cout << '#' << std::hex << w.num << std::dec
<< "\n\tName: " << w.name
<< "\n\tVisible: " << w.visible
<< "\n\tFocused: " << w.focused
<< "\n\tUrgent: " << w.urgent
<< "\n\tRect: "
<< "\n\t\tX: " << w.rect.x
<< "\n\t\tY: " << w.rect.y
<< "\n\t\tWidth: " << w.rect.width
<< "\n\t\tHeight: " << w.rect.height
<< "\n\tOutput: " << w.output
<< std::endl;
}
return 0;
}