diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..ffd7221a --- /dev/null +++ b/.clang-format @@ -0,0 +1,13 @@ +--- +Language: Cpp +Standard: Cpp11 +BasedOnStyle: Google +ColumnLimit: 100 +NamespaceIndentation: All +AlignAfterOpenBracket: DontAlign +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: false +BreakConstructorInitializersBeforeComma: true +DerivePointerAlignment: false +PointerAlignment: Left +--- diff --git a/.exrc b/.exrc index 712d7b8a..203a52a6 100644 --- a/.exrc +++ b/.exrc @@ -1,5 +1,24 @@ -let &path.="include,src," -let g:alternateSearchPath = 'sfr:../src,sfr:../../src/modules,sfr:../../src/utils,sfr:../../src/interfaces,sfr:../../src/services,sfr:../../src/drawtypes,sfr:../include,sfr:../../include/modules,sfr:../../include/interfaces,sfr:../../include/utils,sfr:../../include/services,sfr:../../include/drawtypes,' +let &path.='include,src,' +let g:alternateSearchPath = '' + \ . 'sfr:../src' + \ . ',sfr:../../src/adapters' + \ . ',sfr:../../src/components' + \ . ',sfr:../../src/drawtypes' + \ . ',sfr:../../src/interfaces' + \ . ',sfr:../../src/modules' + \ . ',sfr:../../src/services' + \ . ',sfr:../../src/utils' + \ . ',sfr:../../src/x11' + \ . ',sfr:../include' + \ . ',sfr:../../include/adapters' + \ . ',sfr:../../include/components' + \ . ',sfr:../../include/drawtypes' + \ . ',sfr:../../include/interfaces' + \ . ',sfr:../../include/modules' + \ . ',sfr:../../include/services' + \ . ',sfr:../../include/utils' + \ . ',sfr:../../include/x11' + let g:alternateExtensions_cpp = 'hpp' -" let tag_path = expand("%:p:h") . "/tags" -set tags+=/home/jaagr/var/github/jaagr/lemonbuddy/tags +let tag_path='/home/jaagr/.local/src/c++/lemonbuddy/.tags' +set tags+=/home/jaagr/.local/src/c++/lemonbuddy/.tags diff --git a/.gitignore b/.gitignore index 07d06bfc..bc90ec12 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ -build +build*/ tags *.bak *.pyc *.tmp include/config.hpp +.tags diff --git a/.gitmodules b/.gitmodules index 8ad8b7df..e3479a8c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,3 @@ -[submodule "contrib/lemonbar-sm-git"] - path = contrib/lemonbar-sm-git - url = https://github.com/jaagr/bar - branch = v1.1 [submodule "lib/i3ipcpp"] path = lib/i3ipcpp url = https://github.com/jaagr/i3ipcpp diff --git a/.travis.yml b/.travis.yml index c5a87450..d7e64f25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,36 +1,98 @@ sudo: required dist: trusty - language: cpp + compiler: - clang - gcc -cache: ccache + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.8 + packages: + - gcc-5 + - g++-5 + - clang-3.8 env: global: - - LLVM_VERSION=3.8.0 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - BUILD_TYPE="Release" + - LLVM_VERSION="3.8.1" + - LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz" + - LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz" + - LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz" + - CMAKE_URL="https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz" + +cache: + directories: + - ${TRAVIS_BUILD_DIR}/deps/cmake + - ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.1/install before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - export PATH=$HOME/clang-$LLVM_VERSION/bin:$PATH - - export PYTHONPATH="/usr/lib/python2.7/dist-packages:$PYTHONPATH" - sudo apt-add-repository -y "ppa:george-edison55/george-edison" - - sudo sed -i "s/trusty/wily/g" /etc/apt/sources.list - sudo apt-get -qq update - - sudo apt-get install -y cmake cmake-data libxcb1-dev python-xcbgen xcb-proto libboost-dev libiw-dev libasound2-dev libmpdclient-dev + + # Install packages : core + #--------------------------------------------------------------------------x + - sudo apt-get install -y cmake cmake-data libcppunit-dev libboost-dev libfreetype6-dev + + # Install packages : xcb + #--------------------------------------------------------------------------x + - sudo apt-get install -y libxcb1-dev libxcb-util0-dev libxcb-randr0-dev libxcb-ewmh-dev libxcb-icccm4-dev xcb-proto python-xcbgen + + # Install packages : optional + #--------------------------------------------------------------------------x + - sudo apt-get install -y libiw-dev libasound2-dev libmpdclient-dev libjsoncpp-dev + +install: + # Install dependencies in ${TRAVIS_BUILD_DIR}/deps + #--------------------------------------------------------------------------x + - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" + - LLVM_ROOT="${DEPS_DIR}/llvm-${LLVM_VERSION}" + + # Update python path to make sure we find the xcbgen module + #--------------------------------------------------------------------------x + - export PYTHONPATH="/usr/lib/python2.7/dist-packages:${PYTHONPATH}" + + # Install a later version of cmake + #--------------------------------------------------------------------------x + - | + mkdir -p "${DEPS_DIR}" && cd "${DEPS_DIR}" + if [[ -z "$(ls -A ${DEPS_DIR}/cmake/bin 2>/dev/null)" ]]; then + mkdir -p cmake && travis_retry wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C cmake + fi + - export PATH="${DEPS_DIR}/cmake/bin:${PATH}" + + # Install LLVM libc++ + #--------------------------------------------------------------------------x + - | + if [[ "${CXX}" == "clang++" ]] && [[ -z "$(ls -A ${LLVM_ROOT}/install/include 2>/dev/null)" ]]; then + mkdir -p "${LLVM_ROOT}" "${LLVM_ROOT}/build" "${LLVM_ROOT}/projects/libcxx" "${LLVM_ROOT}/projects/libcxxabi" + travis_retry wget --quiet -O - "${LLVM_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}" + travis_retry wget --quiet -O - "${LIBCXX_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxx" + travis_retry wget --quiet -O - "${LIBCXXABI_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxxabi" + (cd "${LLVM_ROOT}/build" && cmake .. -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_C_COMPILER="${CC}" -DCMAKE_INSTALL_PREFIX="${LLVM_ROOT}/install" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}") + (cd "${LLVM_ROOT}/build/projects/libcxx" && make install) + (cd "${LLVM_ROOT}/build/projects/libcxxabi" && make install) + export CXXFLAGS="${CXXFLAGS} -I ${LLVM_ROOT}/install/include/c++/v1" + export LDFLAGS="${LDFLAGS} -L ${LLVM_ROOT}/install/lib -lc++ -lc++abi" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_ROOT}/install/lib" + fi + + # Set compiler's + #--------------------------------------------------------------------------x + - if [[ "${CXX}" == "clang++" ]]; then export CXX="clang++-3.8" CC="clang-3.8" CXXFLAGS="${CXXFLAGS} -Qunused-arguments"; fi + - if [[ "${CXX}" == "g++" ]]; then export CXX="g++-5" CC="gcc-5"; fi before_script: - - if [ "$CXX" = "clang++" ]; then export CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" CXXFLAGS="-Qunused-arguments"; fi + - eval "${CXX} --version" + - eval "${CC} --version" - cmake --version - - eval "$CXX --version" - - eval "$CC --version" - - mkdir build - - cd build - - cmake -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_CXX_FLAGS="$CXXFLAGS" .. + - mkdir -p "${TRAVIS_BUILD_DIR}/build" + - cd "${TRAVIS_BUILD_DIR}/build" + - cmake -DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DENABLE_CCACHE=OFF .. script: make diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py index 12a1e8aa..1255cadf 100644 --- a/.ycm_extra_conf.py +++ b/.ycm_extra_conf.py @@ -48,8 +48,21 @@ def DirectoryOfThisScript(): flags.append('-I'+ DirectoryOfThisScript() +'/src') flags.append('-I'+ DirectoryOfThisScript() +'/include') +flags.append('-I'+ DirectoryOfThisScript() +'/lib/gsl') +flags.append('-I'+ DirectoryOfThisScript() +'/lib/cpp_freetype/include') flags.append('-I'+ DirectoryOfThisScript() +'/lib/i3ipcpp/include') flags.append('-I'+ DirectoryOfThisScript() +'/lib/xpp/include') +flags.append('-I'+ DirectoryOfThisScript() +'/lib/lemonbar/include') +flags.append('-I'+ DirectoryOfThisScript() +'/lib/fastdelegate/include') +flags.append('-I'+ DirectoryOfThisScript() +'/lib/boost/include') +flags.append('-I'+ DirectoryOfThisScript() +'/tests') +flags.append('-I/usr/include/freetype2') +flags.append('-I/usr/include/pango-1.0') +flags.append('-I/usr/include/cairomm-1.0') +flags.append('-I/usr/include/pangomm-1.4') +flags.append('-I/usr/include/glibmm-2.4') +flags.append('-I/usr/lib/cairomm-1.0/include') +flags.append('-I/usr/include') def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): if not working_directory: diff --git a/CMakeLists.txt b/CMakeLists.txt index ac791f4f..f73816cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,35 +2,45 @@ # Build configuration # cmake_minimum_required(VERSION 3.1 FATAL_ERROR) -project(lemonbuddy C CXX) +project(lemonbuddy CXX) -# Include the local cmake modules -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/modules) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wno-unused-parameter -Wno-unused-local-typedefs") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -O0 -g2") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") + +set(CMAKE_C_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +SET(CMAKE_EXPORT_COMPILE_COMMANDS ON) if(NOT CMAKE_BUILD_TYPE) message(STATUS "No build type specified; using Release") set(CMAKE_BUILD_TYPE "Release") endif() -string(ASCII 27 ESC) +include(cmake/utils.cmake) +include(cmake/clang-cpp-tools.cmake) -# -# Project settings -# +# Figure out default option values {{{ -# Make the default options based on available libs find_package(ALSA QUIET) find_package(Libiw QUIET) find_package(LibMPDClient QUIET) find_program(CCACHE_BINARY ccache) +find_program(I3_BINARY i3) if(CCACHE_BINARY) set(CCACHE_FOUND ON) endif() -find_program(I3_BINARY i3) if(I3_BINARY) set(I3_FOUND ON) endif() +# }}} +# Project settings {{{ + option(ENABLE_CCACHE "Enable ccache support" ${CCACHE_FOUND}) option(ENABLE_ALSA "Enable alsa support" ${ALSA_FOUND}) option(ENABLE_I3 "Enable i3 support" ${I3_FOUND}) @@ -61,123 +71,116 @@ set(SETTING_PATH_MEMORY_INFO "/proc/meminfo" CACHE STRING "Path to file containing memory info") if(ENABLE_CCACHE) - find_program(CCACHE_BINARY ccache REQUIRED) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache") set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache") endif() -# -# Locate and insert libs -# -find_package("Boost" REQUIRED) -find_package("Threads" REQUIRED) +# }}} +# Locate dependencies {{{ -set(PROJECT_INCL_DIRS "${PROJECT_SOURCE_DIR}/include" - ${BOOST_INCLUDE_DIR}) -set(PROJECT_LINK_LIBS - ${BOOST_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT}) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Boost REQUIRED) +find_package(Threads REQUIRED) +find_package(Freetype REQUIRED Freetype2) +find_package(PkgConfig) +find_package(X11 REQUIRED COMPONENTS Xft) +find_package(X11_XCB REQUIRED) -if(ENABLE_I3) - add_subdirectory("${PROJECT_SOURCE_DIR}/lib/i3ipcpp" EXCLUDE_FROM_ALL) - set(PROJECT_INCL_DIRS - ${PROJECT_INCL_DIRS} - ${SIGCPP_INCLUDE_DIRS} - ${I3IPCPP_INCLUDE_DIRS}) - set(PROJECT_LINK_LIBS - ${PROJECT_LINK_LIBS} - ${I3IPCPP_LIBRARIES}) -endif() +pkg_check_modules(FONTCONFIG REQUIRED fontconfig) + +link_libraries(${X11_Xft_LIB}) +link_libraries(${X11_XCB_LIB}) +link_libraries(${BOOST_LIBRARIES}) +link_libraries(${CMAKE_THREAD_LIBS_INIT}) +link_libraries(${X11_LIBRARIES}) +link_libraries(${FREETYPE_LIBRARIES}) +link_libraries(${FONTCONFIG_LIBRARIES}) +link_libraries() + +include_directories( + ${BOOST_INCLUDE_DIR} + ${FONTCONFIG_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/include + ${PROJECT_SOURCE_DIR}/lib/boost/include + ${PROJECT_SOURCE_DIR}/lib/fastdelegate/include) + +set(XCB_PROTOS xproto randr) +add_subdirectory(${PROJECT_SOURCE_DIR}/lib/xpp) +link_libraries(${XPP_LIBRARIES}) if(ENABLE_ALSA) find_package(ALSA REQUIRED) - set(PROJECT_INCL_DIRS ${PROJECT_INCL_DIRS} ${ALSA_INCLUDE_DIR}) - set(PROJECT_LINK_LIBS ${PROJECT_LINK_LIBS} ${ALSA_LIBRARY}) + link_libraries(${ALSA_LIBRARY}) endif() - if(ENABLE_MPD) find_package(LibMPDClient REQUIRED) - set(PROJECT_INCL_DIRS ${PROJECT_INCL_DIRS} ${LIBMPDCLIENT_INCLUDE_DIR}) - set(PROJECT_LINK_LIBS ${PROJECT_LINK_LIBS} ${LIBMPDCLIENT_LIBRARY}) + link_libraries(${LIBMPDCLIENT_LIBRARIES}) endif() - if(ENABLE_NETWORK) find_package(Libiw REQUIRED) - set(PROJECT_INCL_DIRS ${PROJECT_INCL_DIRS} ${LIBIW_INCLUDE_DIR}) - set(PROJECT_LINK_LIBS ${PROJECT_LINK_LIBS} ${LIBIW_LIBRARY}) + link_libraries(${LIBIW_LIBRARY}) +endif() +if(ENABLE_I3) + add_subdirectory(${PROJECT_SOURCE_DIR}/lib/i3ipcpp EXCLUDE_FROM_ALL) + include_directories(${I3IPCPP_INCLUDE_DIRS}) + link_libraries(${I3IPCPP_LIBRARIES}) endif() -# -# Load the xpp library -# -set(XCB_PROTOS xproto randr) -add_subdirectory("${PROJECT_SOURCE_DIR}/lib/xpp") -set(PROJECT_INCL_DIRS ${PROJECT_INCL_DIRS} ${XPP_INCLUDE_DIRS}) -set(PROJECT_LINK_LIBS ${PROJECT_LINK_LIBS} ${XPP_LIBRARIES}) +# }}} +# Build source tree {{{ + +add_subdirectory(${PROJECT_SOURCE_DIR}/man) +add_subdirectory(${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/bin) +add_subdirectory(${PROJECT_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples) +add_subdirectory(${PROJECT_SOURCE_DIR}/tests ${PROJECT_BINARY_DIR}/tests EXCLUDE_FROM_ALL) + +# }}} +# Build summary {{{ -# -# Install executable and wrapper -# message(STATUS "---------------------------") message(STATUS " Build type: ${CMAKE_BUILD_TYPE}") message(STATUS " Compiler C: ${CMAKE_C_COMPILER}") message(STATUS " Compiler C++: ${CMAKE_CXX_COMPILER}") +message(STATUS " Compiler flags: ${CMAKE_CXX_FLAGS}") + +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + message(STATUS " + debug flags:: ${CMAKE_CXX_FLAGS_DEBUG}") +elseif(CMAKE_BUILD_TYPE STREQUAL "Release") + message(STATUS " + release flags:: ${CMAKE_CXX_FLAGS_RELEASE}") +elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") + message(STATUS " + minsizerel flags:: ${CMAKE_CXX_FLAGS_MINSIZEREL}") +elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") + message(STATUS " + relwithdebinfo flags:: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +endif() message(STATUS "---------------------------") + message(STATUS " Enable ccache support ${ENABLE_CCACHE}") message(STATUS " Enable alsa support ${ENABLE_ALSA}") message(STATUS " Enable i3 support ${ENABLE_I3}") message(STATUS " Enable mpd support ${ENABLE_MPD}") message(STATUS " Enable network support ${ENABLE_NETWORK}") + +if(DISABLE_MODULES) + message(STATUS " Disable modules ON") +endif() +if(DISABLE_TRAY) + message(STATUS " Disable systray ON") +endif() +if(DISABLE_DRAW) + message(STATUS " Disable drawing ON") +endif() + message(STATUS "---------------------------") -add_subdirectory("${PROJECT_SOURCE_DIR}/man") -add_subdirectory("${PROJECT_SOURCE_DIR}/src" EXCLUDE_FROM_ALL) -link_directories(${PROJECT_LINK_DIRS}) -include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${PROJECT_INCL_DIRS}) -link_libraries(${PROJECT_LINK_LIBS}) +# }}} +# Uninstall target {{{ -add_executable(${PROJECT_NAME} ${FILES} - "examples/config" - "examples/config.bspwm" - "examples/config.i3") - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) - -target_compile_options(${PROJECT_NAME} PRIVATE - -Wall -Wextra -Wpedantic -Wno-unused-parameter - $<$:-g3 -DDEBUG> - $<$:-O3 -Wno-unused-variable>) - -target_link_libraries(${PROJECT_NAME} ${PROJECT_LINK_LIBS}) - -configure_file("${CMAKE_SOURCE_DIR}/include/config.hpp.cmake" "${CMAKE_SOURCE_DIR}/include/config.hpp" ESCAPE_QUOTES @ONLY) - -install(TARGETS ${PROJECT_NAME} - DESTINATION "bin" - COMPONENT "binaries") -install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/lemonbuddy_wrapper" - DESTINATION "bin" COMPONENT "binaries") -install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/lemonbuddy_terminate" - DESTINATION "bin" COMPONENT "binaries") - -install(FILES "examples/config" - DESTINATION "share/examples/${PROJECT_NAME}" - COMPONENT "config") -install(FILES "examples/config.bspwm" - DESTINATION "share/examples/${PROJECT_NAME}" - COMPONENT "config") -install(FILES "examples/config.i3" - DESTINATION "share/examples/${PROJECT_NAME}" - COMPONENT "config") - -# -# Uninstall target -# configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake/uninstall.cmake" + ${PROJECT_SOURCE_DIR}/cmake/uninstall.cmake.in + ${PROJECT_BINARY_DIR}/cmake/uninstall.cmake IMMEDIATE @ONLY) add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} - -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/uninstall.cmake") + -P ${PROJECT_BINARY_DIR}/cmake/uninstall.cmake) + +# }}} diff --git a/README.md b/README.md index e34164a8..a84b1707 100644 --- a/README.md +++ b/README.md @@ -98,25 +98,25 @@ available for more people. ### Dependencies -A C++ compiler with C++14 support. For example [`clang`](http://clang.llvm.org/get_started.html). +A compiler with c++14 support. For example [`clang`](http://clang.llvm.org/get_started.html). -- lemonbar with xft support _(personally I use [this fork](https://github.com/osense/bar))_ - cmake - boost - libxcb - xcb-proto +- freetype2 Optional dependencies for module support: - wireless_tools (required for `internal/network` support) - alsa-lib (required for `internal/volume` support) - libmpdclient (required for `internal/mpd` support) -- jsoncpp, libsigc++ (required for `internal/i3` support) +- jsoncpp (required for `internal/i3` support) ~~~ sh -$ pacman -S cmake boost libxcb xcb-proto wireless_tools alsa-lib libmpdclient jsoncpp libsigc++ -$ xbps-install cmake boost-devel libxcb-devel alsa-lib-devel i3-devel libmpdclient-devel jsoncpp-devel libsigc++-devel wireless_tools-devel -$ apt-get install cmake libxcb1-dev xcb-proto python-xcbgen libboost-dev libiw-dev libasound2-dev libmpdclient-dev libjsoncpp-dev libsigc++-dev +$ pacman -S cmake boost libxcb xcb-proto wireless_tools alsa-lib libmpdclient jsoncpp +$ xbps-install cmake boost-devel libxcb-devel alsa-lib-devel i3-devel libmpdclient-devel jsoncpp-devel freetype-devel wireless_tools-devel +$ apt-get install cmake libxcb1-dev xcb-proto python-xcbgen libboost-dev libiw-dev libasound2-dev libmpdclient-dev libjsoncpp-dev libfreetype6-dev ~~~ @@ -125,10 +125,10 @@ $ apt-get install cmake libxcb1-dev xcb-proto python-xcbgen libboost-dev libiw-d Please [report any problems](https://github.com/jaagr/lemonbuddy/issues/new) you run into when building the project. It helps alot. ~~~ sh - $ git clone --branch 1.4.6 --recursive https://github.com/jaagr/lemonbuddy + $ git clone --branch 2.0.0 --recursive https://github.com/jaagr/lemonbuddy $ mkdir lemonbuddy/build $ cd lemonbuddy/build - $ cmake .. + $ cmake -DCMAKE_BUILD_TYPE=Release .. $ sudo make install ~~~ @@ -150,43 +150,26 @@ The following code will get you started: # Launch the bar # (where "example" is the name of the bar as defined by [bar/NAME] in the config) - $ lemonbuddy_wrapper example + $ lemonbuddy example ~~~ -> **NOTE:** If you are running i3 or bspwm and you don't see the workspace icons -> it probably depends on the font. Install `font-awesome` and relaunch the bar. -> ...or replace the icons in the config. - -**It is recommended** to always use `lemonbuddy_wrapper` when launching the bars. - -`lemonbuddy_wrapper` is just a simple shell script that takes care -of redirecting the in-/output streams between `lemonbuddy` and `lemonbar`. - -If you handle the in-/output stream redirection's manually, the internal command -handlers (e.g. mpd or volume controls) might stop working. It won't change the -output of the bar but you will miss out on the internal API calls, which is one -of the main advantages of using the application. - -The `lemonbuddy_wrapper` will be deprecated once `lemonbar` is integrated -into the project. +> **NOTE:** In case the bar output looks odd, it's probably because you're +> missing he fonts defined in the config. Update the config or install the +> missing fonts. ## Launching the bar in your wm's bootstrap routine -When using the wrapper to start the bar in in your wm's autostart routine, make sure to include -a kill directive before launching the bar. This is done to make sure that any previously spawned -processes gets terminated before before we launch the new ones. - Create an executable file containing the startup logic, for example `$HOME/.config/lemonbuddy/launch.sh`: ~~~ sh #!/usr/bin/env sh # Terminate already running bar instances - lemonbuddy_terminate noconfirm + killall -q lemonbuddy # Launch bar1 and bar2 - lemonbuddy_wrapper bar1 & - lemonbuddy_wrapper bar2 & + lemonbuddy bar1 & + lemonbuddy bar2 & echo "Bars launched..." ~~~ @@ -203,7 +186,7 @@ If you are using **bspwm**, add the following line to `bspwmrc`: If you are using **i3**, add the following line to your configuration: ~~~ sh - exec_always $HOME/.config/lemonbuddy/launch.sh + exec_always --no-startup-id $HOME/.config/lemonbuddy/launch.sh ~~~ @@ -219,10 +202,10 @@ the resulting output might not be award-winning. ### Fonts When working with unicode symbols, remember that fonts render the symbols differently. Changing font -can drastically improve the quality of your bar. One must-have font -is [Unifont](http://unifoundry.com/unifont.html), which has great unicode coverage. +can drastically improve the quality of your bar. [Unifont](http://unifoundry.com/unifont.html) has great unicode coverage, which makes +it really useful. -Also try different icon fonts, such as [Font Awesome](http://fontawesome.io/icons/) and [Material Icons](https://design.google.com/icons/). +Also try different icon fonts, such as [Font Awesome](http://fontawesome.io/icons), [Material Icons](https://design.google.com/icons) and my personal favorite: [Siji](https://github.com/stark/siji). *TODO: Describe usage in configuration...* @@ -323,11 +306,11 @@ The configuration syntax is based on the `ini` file format. ### Application settings ~~~ ini [settings] - ; Limit the amount of events sent to lemonbar within a set timeframe: + ; Limit the amount of update events within a set timeframe: ; - "Allow updates within of time" ; Default values: - throttle_limit = 5 - throttle_ms = 50 + throttle_limit = 3 + throttle_ms = 60 ~~~ @@ -335,6 +318,7 @@ The configuration syntax is based on the `ini` file format. ~~~ ini [bar/example] ; Use the following command to list available outputs: + ; If unspecified, the application will pick the first one it finds. ; $ xrandr -q | grep " connected" | cut -d ' ' -f1 monitor = HDMI1 @@ -343,14 +327,16 @@ The configuration syntax is based on the `ini` file format. height = 30 ; Offset value defined in pixels - offset_x = 0 - offset_y = 0 + offset-x = 0 + offset-y = 0 ; Put the bar at the bottom of the screen bottom = true ; Weather to force docking mode or not - dock = false + ; If you are using i3wm it's recommended to use the default value + ; Default: false + dock = true ; This value is used as a multiplier when adding spaces between elements spacing = 3 @@ -359,17 +345,30 @@ The configuration syntax is based on the `ini` file format. lineheight = 14 ; Colors - background = #222222 + background = #ee222222 foreground = #eefafafa linecolor = ${bar/example.background} - ; Amount of spaces to add at the start/end of the whole bar - padding_left = 5 - padding_right = 2 + ; Borders + ; Size to be used for all borders + border-size = 2 + ; Color to be used for all borders + border-color = #ff9900 + ; Per-border values + ;border-top = 1 + ;border-top-color = #ff9900 + ;border-bottom = 2 + ;border-bottom-color = #5d00ff + ;border-left = 3 + ;border-right-color = #ff0059 + + ; Number of spaces to add at the beginning/end of the bar + padding-left = 5 + padding-right = 2 ; Amount of spaces to add before/after each module - module_margin_left = 3 - module_margin_right = 3 + module-margin-left = 3 + module-margin-right = 3 ; Fonts are defined using: ; font-0 = NotoSans-Regular:size=8;0 @@ -380,13 +379,9 @@ The configuration syntax is based on the `ini` file format. ; The separator will be inserted between the output of each module separator = | - ; This value is used by Lemonbar and it specifies the clickable - ; areas available -> %{A:action:}...%{A} - clickareas = 30 - ; Value to be used to set the WM_NAME atom ; This defaults to "lemonbuddy-[BAR]_[MONITOR]" - wm_name = mybar + wm-name = mybar ; Locale used to localize module output (for example date) ;locale = sv_SE.UTF-8 @@ -395,6 +390,26 @@ The configuration syntax is based on the `ini` file format. modules-left = cpu ram modules-center = label modules-right = clock + + ; Position of the tray container + ; If undefined, tray support will be disabled + ; + ; Available positions: + ; left + ; right + tray-position = right + + ; Restack the bar window and put it above the + ; selected window manager's root + ; + ; Fixes the issue where the bar is being drawn + ; on top of fullscreen window's + ; + ; Currently supported WM's: + ; bspwm + ; i3 + ; Default: none + wm-restack = bspwm ~~~ ### Modules @@ -441,7 +456,7 @@ The configuration syntax is based on the `ini` file format. type = internal/battery ; This is useful in case the battery never reports 100% charge - full_at = 99 + full-at = 99 ; Use the following command to list batteries and adapters: ; $ ls -1 /sys/class/power_supply/ @@ -450,7 +465,7 @@ The configuration syntax is based on the `ini` file format. ; Seconds between reading battery capacity. ; If set to 0, polling will be disabled. - ;poll_interval = 3 + ;poll-interval = 3 ~~~ ##### Extra formatting (example) @@ -499,7 +514,8 @@ The configuration syntax is based on the `ini` file format. animation-charging-2 =  animation-charging-3 =  animation-charging-4 =  - animation-charging-framerate_ms = 750 + ; Framerate in milliseconds + animation-charging-framerate = 750 ~~~ @@ -514,13 +530,13 @@ To specify a custom path to the bspwm socket, you can set the environment variab ##### Extra formatting (example) ~~~ ini - ; workspace_icon-[0-9]+ = label;icon - workspace_icon-0 = code;♚ - workspace_icon-1 = office;♛ - workspace_icon-2 = graphics;♜ - workspace_icon-3 = mail;♝ - workspace_icon-4 = web;♞ - workspace_icon-default = ♟ + ; ws-icon-[0-9]+ = label;icon + ws-icon-0 = code;♚ + ws-icon-1 = office;♛ + ws-icon-2 = graphics;♜ + ws-icon-3 = mail;♝ + ws-icon-4 = web;♞ + ws-icon-default = ♟ ; Available tags: ; (default) - gets replaced with @@ -598,21 +614,21 @@ To specify a custom path to the bspwm socket, you can set the environment variab ;