From eeefb3c61071ead6a1278c226e4e6090878b4963 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Thu, 19 May 2016 16:41:06 +0200 Subject: [PATCH] init(git): Base commit --- .exrc | 5 + .gitignore | 6 + .gitmodules | 8 + .ycm_extra_conf.py | 130 ++++ CMakeLists.txt | 145 ++++ LICENSE | 19 + README.md | 11 + cmake/modules/FindLibMPDClient.cmake | 31 + cmake/uninstall.cmake.in | 26 + config | 947 +++++++++++++++++++++++++++ contrib/dosini.vim | 11 + contrib/i3ipcpp | 1 + contrib/lemonbar-sm-git | 1 + examples/config.i3.edp1 | 60 ++ examples/config.i3.hdmi1 | 172 +++++ examples/config.test | 229 +++++++ examples/config.white | 870 ++++++++++++++++++++++++ examples/external_top | 187 ++++++ include/bar.hpp | 93 +++ include/config.hpp.cmake | 24 + include/drawtypes/animation.hpp | 41 ++ include/drawtypes/bar.hpp | 45 ++ include/drawtypes/icon.hpp | 41 ++ include/drawtypes/label.hpp | 33 + include/drawtypes/ramp.hpp | 34 + include/eventloop.hpp | 60 ++ include/exception.hpp | 20 + include/interfaces/alsa.hpp | 76 +++ include/interfaces/mpd.hpp | 183 ++++++ include/interfaces/net.hpp | 88 +++ include/lemonbuddy.hpp | 13 + include/modules/backlight.hpp | 35 + include/modules/base.hpp | 437 ++++++++++++ include/modules/battery.hpp | 67 ++ include/modules/bspwm.hpp | 81 +++ include/modules/counter.hpp | 22 + include/modules/cpu.hpp | 54 ++ include/modules/date.hpp | 35 + include/modules/i3.hpp | 85 +++ include/modules/memory.hpp | 35 + include/modules/menu.hpp | 47 ++ include/modules/mpd.hpp | 78 +++ include/modules/network.hpp | 68 ++ include/modules/script.hpp | 36 + include/modules/text.hpp | 20 + include/modules/torrent.hpp | 42 ++ include/modules/volume.hpp | 60 ++ include/registry.hpp | 57 ++ include/services/builder.hpp | 102 +++ include/services/command.hpp | 45 ++ include/services/inotify.hpp | 63 ++ include/services/logger.hpp | 69 ++ include/services/store.hpp | 36 + include/utils/cli.hpp | 44 ++ include/utils/concurrency.hpp | 115 ++++ include/utils/config.hpp | 152 +++++ include/utils/io.hpp | 80 +++ include/utils/math.hpp | 18 + include/utils/memory.hpp | 16 + include/utils/proc.hpp | 47 ++ include/utils/streams.hpp | 47 ++ include/utils/string.hpp | 37 ++ include/utils/timer.hpp | 10 + include/utils/xlib.hpp | 34 + scripts/lemonbuddy_wrapper.sh | 38 ++ scripts/torrents.sh | 48 ++ src/CMakeLists.txt | 57 ++ src/bar.cpp | 259 ++++++++ src/drawtypes/animation.cpp | 70 ++ src/drawtypes/bar.cpp | 113 ++++ src/drawtypes/icon.cpp | 40 ++ src/drawtypes/label.cpp | 46 ++ src/drawtypes/ramp.cpp | 42 ++ src/eventloop.cpp | 229 +++++++ src/interfaces/alsa.cpp | 183 ++++++ src/interfaces/mpd.cpp | 386 +++++++++++ src/interfaces/net.cpp | 167 +++++ src/lemonbuddy.cpp | 202 ++++++ src/modules/backlight.cpp | 63 ++ src/modules/base.cpp | 17 + src/modules/battery.cpp | 176 +++++ src/modules/bspwm.cpp | 223 +++++++ src/modules/counter.cpp | 33 + src/modules/cpu.cpp | 138 ++++ src/modules/date.cpp | 60 ++ src/modules/i3.cpp | 176 +++++ src/modules/memory.cpp | 94 +++ src/modules/menu.cpp | 125 ++++ src/modules/mpd.cpp | 303 +++++++++ src/modules/network.cpp | 195 ++++++ src/modules/script.cpp | 83 +++ src/modules/text.cpp | 42 ++ src/modules/torrent.cpp | 123 ++++ src/modules/volume.cpp | 230 +++++++ src/registry.cpp | 158 +++++ src/services/builder.cpp | 472 +++++++++++++ src/services/command.cpp | 155 +++++ src/services/inotify.cpp | 62 ++ src/services/logger.cpp | 70 ++ src/services/store.cpp | 65 ++ src/utils/cli.cpp | 126 ++++ src/utils/config.cpp | 57 ++ src/utils/io.cpp | 220 +++++++ src/utils/proc.cpp | 109 +++ src/utils/string.cpp | 110 ++++ src/utils/timer.cpp | 14 + src/utils/xlib.cpp | 101 +++ 107 files changed, 11464 insertions(+) create mode 100644 .exrc create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .ycm_extra_conf.py create mode 100644 CMakeLists.txt create mode 100644 LICENSE create mode 100644 README.md create mode 100644 cmake/modules/FindLibMPDClient.cmake create mode 100644 cmake/uninstall.cmake.in create mode 100644 config create mode 100644 contrib/dosini.vim create mode 160000 contrib/i3ipcpp create mode 160000 contrib/lemonbar-sm-git create mode 100644 examples/config.i3.edp1 create mode 100644 examples/config.i3.hdmi1 create mode 100644 examples/config.test create mode 100644 examples/config.white create mode 100644 examples/external_top create mode 100644 include/bar.hpp create mode 100644 include/config.hpp.cmake create mode 100644 include/drawtypes/animation.hpp create mode 100644 include/drawtypes/bar.hpp create mode 100644 include/drawtypes/icon.hpp create mode 100644 include/drawtypes/label.hpp create mode 100644 include/drawtypes/ramp.hpp create mode 100644 include/eventloop.hpp create mode 100644 include/exception.hpp create mode 100644 include/interfaces/alsa.hpp create mode 100644 include/interfaces/mpd.hpp create mode 100644 include/interfaces/net.hpp create mode 100644 include/lemonbuddy.hpp create mode 100644 include/modules/backlight.hpp create mode 100644 include/modules/base.hpp create mode 100644 include/modules/battery.hpp create mode 100644 include/modules/bspwm.hpp create mode 100644 include/modules/counter.hpp create mode 100644 include/modules/cpu.hpp create mode 100644 include/modules/date.hpp create mode 100644 include/modules/i3.hpp create mode 100644 include/modules/memory.hpp create mode 100644 include/modules/menu.hpp create mode 100644 include/modules/mpd.hpp create mode 100644 include/modules/network.hpp create mode 100644 include/modules/script.hpp create mode 100644 include/modules/text.hpp create mode 100644 include/modules/torrent.hpp create mode 100644 include/modules/volume.hpp create mode 100644 include/registry.hpp create mode 100644 include/services/builder.hpp create mode 100644 include/services/command.hpp create mode 100644 include/services/inotify.hpp create mode 100644 include/services/logger.hpp create mode 100644 include/services/store.hpp create mode 100644 include/utils/cli.hpp create mode 100644 include/utils/concurrency.hpp create mode 100644 include/utils/config.hpp create mode 100644 include/utils/io.hpp create mode 100644 include/utils/math.hpp create mode 100644 include/utils/memory.hpp create mode 100644 include/utils/proc.hpp create mode 100644 include/utils/streams.hpp create mode 100644 include/utils/string.hpp create mode 100644 include/utils/timer.hpp create mode 100644 include/utils/xlib.hpp create mode 100755 scripts/lemonbuddy_wrapper.sh create mode 100755 scripts/torrents.sh create mode 100644 src/CMakeLists.txt create mode 100644 src/bar.cpp create mode 100644 src/drawtypes/animation.cpp create mode 100644 src/drawtypes/bar.cpp create mode 100644 src/drawtypes/icon.cpp create mode 100644 src/drawtypes/label.cpp create mode 100644 src/drawtypes/ramp.cpp create mode 100644 src/eventloop.cpp create mode 100644 src/interfaces/alsa.cpp create mode 100644 src/interfaces/mpd.cpp create mode 100644 src/interfaces/net.cpp create mode 100644 src/lemonbuddy.cpp create mode 100644 src/modules/backlight.cpp create mode 100644 src/modules/base.cpp create mode 100644 src/modules/battery.cpp create mode 100644 src/modules/bspwm.cpp create mode 100644 src/modules/counter.cpp create mode 100644 src/modules/cpu.cpp create mode 100644 src/modules/date.cpp create mode 100644 src/modules/i3.cpp create mode 100644 src/modules/memory.cpp create mode 100644 src/modules/menu.cpp create mode 100644 src/modules/mpd.cpp create mode 100644 src/modules/network.cpp create mode 100644 src/modules/script.cpp create mode 100644 src/modules/text.cpp create mode 100644 src/modules/torrent.cpp create mode 100644 src/modules/volume.cpp create mode 100644 src/registry.cpp create mode 100644 src/services/builder.cpp create mode 100644 src/services/command.cpp create mode 100644 src/services/inotify.cpp create mode 100644 src/services/logger.cpp create mode 100644 src/services/store.cpp create mode 100644 src/utils/cli.cpp create mode 100644 src/utils/config.cpp create mode 100644 src/utils/io.cpp create mode 100644 src/utils/proc.cpp create mode 100644 src/utils/string.cpp create mode 100644 src/utils/timer.cpp create mode 100644 src/utils/xlib.cpp diff --git a/.exrc b/.exrc new file mode 100644 index 00000000..712d7b8a --- /dev/null +++ b/.exrc @@ -0,0 +1,5 @@ +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 g:alternateExtensions_cpp = 'hpp' +" let tag_path = expand("%:p:h") . "/tags" +set tags+=/home/jaagr/var/github/jaagr/lemonbuddy/tags diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..07d06bfc --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +build +tags +*.bak +*.pyc +*.tmp +include/config.hpp diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..0b1468a4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,8 @@ +[submodule "contrib/lemonbar-sm-git"] + path = contrib/lemonbar-sm-git + url = https://github.com/jaagr/bar + branch = master +[submodule "contrib/i3ipcpp"] + path = contrib/i3ipcpp + url = https://github.com/jaagr/i3ipcpp + branch = master diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py new file mode 100644 index 00000000..652b4bbe --- /dev/null +++ b/.ycm_extra_conf.py @@ -0,0 +1,130 @@ +# Here's the license text for this file: +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# For more information, please refer to + +import os +import ycm_core + +flags = [ +'-std=c++14', +'-Wall', +'-Wextra', +'-Wpedantic', +] + +compilation_database_folder = '' + +if os.path.exists( compilation_database_folder ): + database = ycm_core.CompilationDatabase( compilation_database_folder ) +else: + database = None + +SOURCE_EXTENSIONS = ['.cpp', '.cxx', '.cc', '.c', '.m', '.mm'] + +def DirectoryOfThisScript(): + return os.path.dirname( os.path.abspath( __file__ ) ) + +flags.append('-I'+ DirectoryOfThisScript() +'/src') +flags.append('-I'+ DirectoryOfThisScript() +'/include') +flags.append('-I'+ DirectoryOfThisScript() +'/contrib/i3ipcpp/include') + +def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): + if not working_directory: + return list( flags ) + new_flags = [] + make_next_absolute = False + path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] + for flag in flags: + new_flag = flag + + if make_next_absolute: + make_next_absolute = False + if not flag.startswith( '/' ): + new_flag = os.path.join( working_directory, flag ) + + for path_flag in path_flags: + if flag == path_flag: + make_next_absolute = True + break + + if flag.startswith( path_flag ): + path = flag[ len( path_flag ): ] + new_flag = path_flag + os.path.join( working_directory, path ) + break + + if new_flag: + new_flags.append( new_flag ) + return new_flags + +def IsHeaderFile( filename ): + extension = os.path.splitext( filename )[ 1 ] + return extension in [ '.h', '.hxx', '.hpp', '.hh' ] + +def GetCompilationInfoForFile( filename ): + # The compilation_commands.json file generated by CMake does not have entries + # for header files. So we do our best by asking the db for flags for a + # corresponding source file, if any. If one exists, the flags for that file + # should be good enough. + if IsHeaderFile( filename ): + basename = os.path.splitext( filename )[ 0 ] + for extension in SOURCE_EXTENSIONS: + replacement_file = basename + extension + if os.path.exists( replacement_file ): + compilation_info = database.GetCompilationInfoForFile( + replacement_file ) + if compilation_info.compiler_flags_: + return compilation_info + return None + return database.GetCompilationInfoForFile( filename ) + + +def FlagsForFile( filename, **kwargs ): + # if database: + # # Bear in mind that compilation_info.compiler_flags_ does NOT return a + # # python list, but a "list-like" StringVec object + # compilation_info = GetCompilationInfoForFile( filename ) + # if not compilation_info: + # return None + # + # final_flags = MakeRelativePathsInFlagsAbsolute( + # compilation_info.compiler_flags_, + # compilation_info.compiler_working_dir_ ) + # + # # NOTE: This is just for YouCompleteMe; it's highly likely that your project + # # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR + # # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT. + # try: + # final_flags.remove( '-stdlib=libc++' ) + # except ValueError: + # pass + # else: + relative_to = DirectoryOfThisScript() + final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) + + return { + 'flags': final_flags, + 'do_cache': True + } diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..6143155d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,145 @@ +# +# Build configuration +# +cmake_minimum_required(VERSION 3.0) + +set(CMAKE_CXX_COMPILER "/usr/bin/clang++") + +project(lemonbuddy VERSION 1.0.0) + +set(CMAKE_MODULE_PATH + "${CMAKE_MODULE_PATH}" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -Wpedantic -Wno-unused-parameter") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -DDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") + +# +# Internal values and switches +# +option(ENABLE_CCACHE "Enable ccache support" ON) +option(ENABLE_ALSA "Enable alsa support" ON) +option(ENABLE_MPD "Enable mpd support" ON) +option(ENABLE_I3 "Enable i3 support" OFF) + +message(STATUS "---------------------------") +message(STATUS " Enable ccache support ${ENABLE_CCACHE}") +message(STATUS " Enable mpd support ${ENABLE_MPD}") +message(STATUS " Enable alsa support ${ENABLE_ALSA}") +message(STATUS " Enable i3 support ${ENABLE_I3}") +message(STATUS "---------------------------") + +if(ENABLE_ALSA) + set(SETTING_ALSA_SOUNDCARD "default" + CACHE STRING "Name of the ALSA soundcard driver") +endif() + +if(ENABLE_MPD) + set(SETTING_MPD_HOST "127.0.0.1" + CACHE STRING "Address MPD is bound to") + set(SETTING_MPD_PASSWORD "" + CACHE STRING "Password required for authentication") + set(SETTING_MPD_PORT "6600" + CACHE STRING "Port MPD is bound to") +endif() + +set(SETTING_CONNECTION_TEST_IP "8.8.8.8" + CACHE STRING "Address to ping when testing network connection") +set(SETTING_PATH_BACKLIGHT_VAL "/sys/class/backlight/%card%/brightness" + CACHE STRING "Path to file containing the current backlight value") +set(SETTING_PATH_BACKLIGHT_MAX "/sys/class/backlight/%card%/max_brightness" + CACHE STRING "Path to file containing the maximum backlight value") +set(SETTING_PATH_BATTERY_WATCH "/sys/class/power_supply/%battery%/charge_now" + CACHE STRING "Path to attach inotify watch to") +set(SETTING_PATH_BATTERY_CAPACITY "/sys/class/power_supply/%battery%/capacity" + CACHE STRING "Path to file containing the current battery capacity") +set(SETTING_PATH_ADAPTER_STATUS "/sys/class/power_supply/%adapter%/online" + CACHE STRING "Path to file containing the current adapter status") +set(SETTING_BSPWM_SOCKET_PATH "/tmp/bspwm_0_0-socket" + CACHE STRING "Path to bspwm socket") +set(SETTING_BSPWM_STATUS_PREFIX "W" + CACHE STRING "Prefix prepended to the bspwm status line") +set(SETTING_PATH_CPU_INFO "/proc/stat" + CACHE STRING "Path to file containing cpu info") +set(SETTING_PATH_MEMORY_INFO "/proc/meminfo" + CACHE STRING "Path to file containing memory info") + +configure_file("${CMAKE_SOURCE_DIR}/include/config.hpp.cmake" "${CMAKE_SOURCE_DIR}/include/config.hpp" ESCAPE_QUOTES @ONLY) + +if(ENABLE_CCACHE) + find_program(CCACHE_FOUND "ccache") + if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "ccache") + else() + message(WARNING "ccache not found. Ignoring the flag...") + endif() +endif() + +# +# Locate and insert libs +# +find_package("Boost" REQUIRED) +#find_package("Boost" REQUIRED "regex") +find_package("Threads" REQUIRED) +find_package("X11" REQUIRED "X11_Xrandr" "X11_Xutil" "X11_Xlib") + +include_directories( + "${PROJECT_SOURCE_DIR}/include" + ${Boost_INCLUDE_DIRS} + ${X11_INCLUDE_DIR} + ${X11_Xrandr_INCLUDE_PATH}) + +link_directories( + ${Boost_LIBRARY_DIRS} + ${X11_LIBRARY_DIRS}) + +set(LINK_LIBS + ${Boost_LIBRARIES} + ${X11_LIBRARIES} + ${X11_Xrandr_LIB} + ${CMAKE_THREAD_LIBS_INIT}) + +if(ENABLE_ALSA) + find_package("ALSA" REQUIRED) + include_directories(${ALSA_INCLUDE_DIRS}) + link_directories(${ALSA_LIBRARY_DIRS}) + set(LINK_LIBS ${LINK_LIBS} ${ALSA_LIBRARIES}) +endif() + +if(ENABLE_MPD) + find_package("LibMPDClient" REQUIRED) + include_directories(${LIBMPDCLIENT_INCLUDE_DIRS}) + link_directories(${LIBMPDCLIENT_LIBRARY_DIRS}) + set(LINK_LIBS ${LINK_LIBS} ${LIBMPDCLIENT_LIBRARY}) +endif() + +# +# Install executable and wrapper +# +add_subdirectory("${PROJECT_SOURCE_DIR}/src") +add_executable(${PROJECT_NAME} ${SOURCE_FILES}) + +if(ENABLE_I3) + add_subdirectory("${PROJECT_SOURCE_DIR}/contrib/i3ipcpp" EXCLUDE_FROM_ALL) + include_directories(${SIGCPP_INCLUDE_DIRS} ${I3IPCpp_INCLUDE_DIRS}) + link_directories(${SIGCPP_LIBRARY_DIRS} ${I3IPCpp_LIBRARY_DIRS}) + set(LINK_LIBS "${LINK_LIBS};${I3IPCpp_LIBRARIES}") +endif() + +target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) + +install(TARGETS ${PROJECT_NAME} DESTINATION "bin") +install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/lemonbuddy_wrapper.sh" DESTINATION "bin") + +# +# Uninstall target +# +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake/uninstall.cmake" + IMMEDIATE @ONLY) + +add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} + -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/uninstall.cmake") diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..13e205a8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +The MIT License (MIT) +Copyright (c) 2016 Michael Carlberg + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..b240c581 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +Lemonbuddy +========== + +A fast and easy-to-use wrapper for [Lemonbar](https://github.com/LemonBoy/bar/), +helping you to style and organize your favorite status bar. + +### Todo + +- Write this README +- Create build script to make it easier to build the project for people who + aren't familiar with cmake diff --git a/cmake/modules/FindLibMPDClient.cmake b/cmake/modules/FindLibMPDClient.cmake new file mode 100644 index 00000000..24bb7d4f --- /dev/null +++ b/cmake/modules/FindLibMPDClient.cmake @@ -0,0 +1,31 @@ +# - Try to find LibMPDClient +# Once done, this will define +# +# LIBMPDCLIENT_FOUND - System has LibMPDClient +# LIBMPDCLIENT_INCLUDE_DIRS - The LibMPDClient include directories +# LIBMPDCLIENT_LIBRARIES - The libraries needed to use LibMPDClient +# LIBMPDCLIENT_DEFINITIONS - Compiler switches required for using LibMPDClient + +find_package(PkgConfig) +pkg_check_modules(PC_LIBMPDCLIENT QUIET libmpdclient) +set(LIBMPDCLIENT_DEFINITIONS ${PC_LIBMPDCLIENT_CFLAGS_OTHER}) + +find_path(LIBMPDCLIENT_INCLUDE_DIR + NAMES mpd/player.h + HINTS ${PC_LIBMPDCLIENT_INCLUDEDIR} ${PC_LIBMPDCLIENT_INCLUDE_DIRS} +) + +find_library(LIBMPDCLIENT_LIBRARY + NAMES mpdclient + HINTS ${PC_LIBMPDCLIENT_LIBDIR} ${PC_LIBMPDCLIENT_LIBRARY_DIRS} +) + +set(LIBMPDCLIENT_LIBRARIES ${LIBMPDCLIENT_LIBRARY}) +set(LIBMPDCLIENT_INCLUDE_DIRS ${LIBMPDCLIENT_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LibMPDClient DEFAULT_MSG + LIBMPDCLIENT_LIBRARY LIBMPDCLIENT_INCLUDE_DIR +) + +mark_as_advanced(LIBMPDCLIENT_LIBRARY LIBMPDCLIENT_INCLUDE_DIR) diff --git a/cmake/uninstall.cmake.in b/cmake/uninstall.cmake.in new file mode 100644 index 00000000..5e30cb44 --- /dev/null +++ b/cmake/uninstall.cmake.in @@ -0,0 +1,26 @@ +set(INSTALL_MANIFEST "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +if (NOT EXISTS ${INSTALL_MANIFEST}) + message(FATAL_ERROR + "Cannot find install manifest: + \"${INSTALL_MANIFEST}\"") +endif(NOT EXISTS ${INSTALL_MANIFEST}) + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +list(REVERSE files) + +foreach (file ${files}) + message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + if (EXISTS "$ENV{DESTDIR}${file}") + execute_process( + COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" + OUTPUT_VARIABLE rm_out + RESULT_VARIABLE rm_retval) + if(NOT ${rm_retval} EQUAL 0) + message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif (NOT ${rm_retval} EQUAL 0) + else (EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + endif (EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) diff --git a/config b/config new file mode 100644 index 00000000..9e8ed4d3 --- /dev/null +++ b/config @@ -0,0 +1,947 @@ +; +; Bar configurations +; --------------------------------------- +; +; Quote the value to keep spaces: +; key = " value" +; +; Values for the current bar can be accessed using: +; ${BAR.foreground} +; +; Other values can be referenced using: +; ${section.key} +; +; format:NAME = +; label:NAME[:(foreground|background|(under|over)line|font|padding)] = +; icon:NAME[:(foreground|background|(under|over)line|font|padding)] = +; ramp:NAME:[0-9]+[:(foreground|background|(under|over)line|font|padding)] = +; animation:NAME:[0-9]+[:(foreground|background|(under|over)line|font|padding)] = +; +; bar:NAME:width = +; bar:NAME:format = (tokens: %fill% %indicator% %empty%) +; bar:NAME:foreground:[0-9]+ = +; bar:NAME:indicator[:(foreground|background|(under|over)line|font|padding)] = +; bar:NAME:fill[:(foreground|background|(under|over)line|font|padding)] = +; bar:NAME:empty[:(foreground|background|(under|over)line|font|padding)] = +; +; These keys can be used to style the module container +; format:NAME:spacing = N (unit: whitespace) +; format:NAME:padding = N (unit: whitespace) +; format:NAME:margin = N (unit: whitespace) +; format:NAME:offset = N (unit: pixels) +; format:NAME:foreground = #hexcolor +; format:NAME:background = #hexcolor +; format:NAME:underline = #hexcolor +; format:NAME:overline = #hexcolor +; +; Module types: +; internal/backlight +; internal/battery +; internal/bspwm +; internal/cpu +; internal/date +; internal/memory +; internal/mpd +; internal/network +; internal/rtorrent +; internal/volume +; +; custom/text +; content +; click:(left|middle|right) +; scroll:(up|down) +; custom/script +; exec +; interval +; format +; click:(left|middle|right) +; scroll:(up|down) +; custom/menu +; format +; label:open +; label:close +; menu:LEVEL:n +; menu:LEVEL:n:exec +; + +[bar/top] +monitor = eDP-1 +width = 100% +height = 30 +clickareas = 35 + +background = #222222 +foreground = #eefafafa +linecolor = ${bar/top.background} + +;separator = | + +spacing = 3 +lineheight = 14 +;padding_left = 5 +;padding_right = 2 +module_margin_left = 3 +module_margin_right = 3 + +font:0 = NotoSans-Regular:size=8;0 +font:1 = MaterialIcons:size=10;0 +font:2 = Termsynu:size=8;-1 +font:3 = FontAwesome:size=10;0 + +; modules:left = powermenu mpd +; modules:right = backlight volume wireless-network wired-network battery date +modules:right = battery + +[bar/bottom] +monitor = eDP-1 +bottom = true +width = 100% +height = 27 +;clickareas = 25 + +background = #111111 +foreground = #ccffffff +linecolor = ${bar/bottom.background} + +spacing = 3 +lineheight = 2 +;padding_left = 0 +padding_right = 4 +module_margin_left = 0 +module_margin_right = 6 + +; font:idx = font:size=N;offsetY +font:0 = NotoSans-Regular:size=8;0 +font:1 = Unifont:size=6;-3 +;font:1 = Termsynu:size=8;-1 +font:2 = FontAwesome:size=8;-2 +font:3 = NotoSans-Regular:size=8;-1 +font:4 = MaterialIcons:size=10;-1 + +modules:left = bspwm +modules:right = rtorrent cpu memory +; modules:right = cpu memory + +[bar/external_bottom] +monitor = HDMI-1 +bottom = true +width = 100% +height = 27 +;clickareas = 25 + +background = #111111 +foreground = #ccffffff +linecolor = ${bar/external_bottom.background} + +spacing = 3 +lineheight = 2 +;padding_left = 0 +padding_right = 3 +module_margin_left = 0 +module_margin_right = 6 + +font:0 = NotoSans-Regular:size=8;0 +font:1 = Unifont:size=6;-3 +font:2 = FontAwesome:size=8;-2 +font:3 = NotoSans-Regular:size=8;-1 +font:4 = MaterialIcons:size=10;0 + +modules:left = bspwm +modules:right = clock + + +[module/backlight] +type = internal/backlight + +; Use the following command to list available cards: +; $ ls -1 /sys/class/backlight/ +card = intel_backlight + +; Available tags: +;