From 81983e41cd28d808d57cc7624c9524abc3516faf Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Mon, 1 Mar 2021 21:22:57 +0000 Subject: [PATCH] Import polybar_3.5.5.orig.tar.gz [dgit import orig polybar_3.5.5.orig.tar.gz] --- .clang-format | 13 + .clang-tidy | 52 + .codecov.yml | 18 + .editorconfig | 12 + .github/ISSUE_TEMPLATE/bug_report.md | 61 + .github/ISSUE_TEMPLATE/build.md | 46 + .github/ISSUE_TEMPLATE/config.yml | 8 + .github/ISSUE_TEMPLATE/feature_request.md | 20 + .github/PULL_REQUEST_TEMPLATE.md | 26 + .github/workflows/ci.yml | 98 + .gitignore | 11 + .gitmodules | 8 + .valgrind-suppressions | 101 + .ycm_extra_conf.py | 126 + CHANGELOG.md | 29 + CMakeLists.txt | 167 + CONTRIBUTING.md | 123 + LICENSE | 19 + README.md | 159 + SUPPORT.md | 14 + banner.png | Bin 0 -> 12078 bytes build.sh | 273 ++ cmake/01-core.cmake | 93 + cmake/02-opts.cmake | 82 + cmake/03-libs.cmake | 30 + cmake/04-targets.cmake | 76 + cmake/05-summary.cmake | 49 + cmake/common/utils.cmake | 120 + cmake/modules/FindLibiw.cmake | 17 + cmake/templates/uninstall.cmake.in | 23 + cmake/templates/userconfig.cmake.in | 8 + common/ci/configure.sh | 46 + common/ci/summary.sh | 19 + common/clang-format.sh | 20 + common/clang-tidy.sh | 26 + common/release-archive.sh | 59 + config.cmake | 423 ++ contrib/bash/CMakeLists.txt | 6 + contrib/bash/polybar | 95 + contrib/polybar-git.aur/PKGBUILD | 42 + contrib/polybar-git.aur/polybar.install | 12 + contrib/polybar.aur/PKGBUILD | 34 + contrib/polybar.aur/polybar.install | 26 + contrib/rpm/polybar.spec | 71 + contrib/vim/autoload/ft/cpphpp.vim | 19 + contrib/vim/ftplugin/cpp.vim | 8 + contrib/vim/ftplugin/dosini.vim | 11 + contrib/zsh/CMakeLists.txt | 6 + contrib/zsh/_polybar | 45 + contrib/zsh/_polybar_msg | 32 + doc/.gitignore | 1 + doc/CMakeLists.txt | 69 + doc/README.md | 22 + doc/_static/.gitignore | 0 doc/conf.py | 248 ++ doc/dev/packaging.rst | 88 + doc/dev/release-workflow.rst | 193 + doc/index.rst | 43 + doc/man/polybar.1.rst | 84 + doc/man/polybar.5.rst | 156 + doc/user/actions.rst | 419 ++ include/CMakeLists.txt | 25 + include/adapters/alsa/control.hpp | 41 + include/adapters/alsa/generic.hpp | 65 + include/adapters/alsa/mixer.hpp | 50 + include/adapters/mpd.hpp | 183 + include/adapters/net.hpp | 184 + include/adapters/pulseaudio.hpp | 81 + include/cairo/context.hpp | 344 ++ include/cairo/font.hpp | 341 ++ include/cairo/fwd.hpp | 15 + include/cairo/surface.hpp | 76 + include/cairo/types.hpp | 69 + include/cairo/utils.hpp | 70 + include/common.hpp | 45 + include/components/bar.hpp | 134 + include/components/builder.hpp | 75 + include/components/command_line.hpp | 78 + include/components/config.hpp | 399 ++ include/components/config_parser.hpp | 247 ++ include/components/controller.hpp | 145 + include/components/ipc.hpp | 46 + include/components/logger.hpp | 160 + include/components/parser.hpp | 46 + include/components/renderer.hpp | 142 + include/components/screen.hpp | 54 + include/components/taskqueue.hpp | 62 + include/components/types.hpp | 245 ++ include/debug.hpp | 51 + include/drawtypes/animation.hpp | 47 + include/drawtypes/iconset.hpp | 26 + include/drawtypes/label.hpp | 86 + include/drawtypes/progressbar.hpp | 45 + include/drawtypes/ramp.hpp | 31 + include/errors.hpp | 36 + include/events/signal.hpp | 181 + include/events/signal_emitter.hpp | 107 + include/events/signal_fwd.hpp | 66 + include/events/signal_receiver.hpp | 52 + include/events/types.hpp | 59 + include/modules/alsa.hpp | 68 + include/modules/backlight.hpp | 56 + include/modules/battery.hpp | 113 + include/modules/bspwm.hpp | 97 + include/modules/counter.hpp | 24 + include/modules/cpu.hpp | 53 + include/modules/date.hpp | 49 + include/modules/fs.hpp | 73 + include/modules/github.hpp | 42 + include/modules/i3.hpp | 99 + include/modules/ipc.hpp | 46 + include/modules/memory.hpp | 47 + include/modules/menu.hpp | 50 + include/modules/meta/base.hpp | 190 + include/modules/meta/base.inl | 211 + include/modules/meta/event_handler.hpp | 33 + include/modules/meta/event_module.hpp | 45 + include/modules/meta/factory.hpp | 112 + include/modules/meta/inotify_module.hpp | 93 + include/modules/meta/static_module.hpp | 27 + include/modules/meta/timer_module.hpp | 77 + include/modules/mpd.hpp | 110 + include/modules/network.hpp | 60 + include/modules/pulseaudio.hpp | 57 + include/modules/script.hpp | 51 + include/modules/systray.hpp | 42 + include/modules/temperature.hpp | 46 + include/modules/text.hpp | 20 + include/modules/unsupported.hpp | 64 + include/modules/xbacklight.hpp | 60 + include/modules/xkeyboard.hpp | 70 + include/modules/xwindow.hpp | 54 + include/modules/xworkspaces.hpp | 116 + include/settings.hpp.cmake | 76 + include/utils/actions.hpp | 31 + include/utils/bspwm.hpp | 37 + include/utils/color.hpp | 66 + include/utils/command.hpp | 121 + include/utils/concurrency.hpp | 70 + include/utils/env.hpp | 12 + include/utils/factory.hpp | 45 + include/utils/file.hpp | 121 + include/utils/functional.hpp | 12 + include/utils/http.hpp | 30 + include/utils/i3.hpp | 34 + include/utils/inotify.hpp | 47 + include/utils/io.hpp | 27 + include/utils/math.hpp | 118 + include/utils/memory.hpp | 39 + include/utils/mixins.hpp | 35 + include/utils/process.hpp | 32 + include/utils/scope.hpp | 44 + include/utils/socket.hpp | 48 + include/utils/string.hpp | 104 + include/utils/throttle.hpp | 92 + include/utils/time.hpp | 23 + include/x11/atoms.hpp | 48 + include/x11/background_manager.hpp | 125 + include/x11/connection.hpp | 173 + include/x11/cursor.hpp | 27 + include/x11/ewmh.hpp | 47 + include/x11/extensions/all.hpp | 11 + include/x11/extensions/composite.hpp | 23 + include/x11/extensions/fwd.hpp | 21 + include/x11/extensions/randr.hpp | 68 + include/x11/extensions/xkb.hpp | 95 + include/x11/icccm.hpp | 18 + include/x11/registry.hpp | 25 + include/x11/tray_client.hpp | 48 + include/x11/tray_manager.hpp | 173 + include/x11/types.hpp | 84 + include/x11/window.hpp | 23 + include/x11/winspec.hpp | 180 + include/x11/xembed.hpp | 44 + include/x11/xresources.hpp | 64 + lib/CMakeLists.txt | 40 + .../moodycamel/blockingconcurrentqueue.h | 981 +++++ .../include/moodycamel/concurrentqueue.h | 3623 +++++++++++++++++ lib/i3ipcpp/.gitignore | 4 + lib/i3ipcpp/3rd/auss/LICENSE | 24 + lib/i3ipcpp/3rd/auss/README.md | 27 + lib/i3ipcpp/3rd/auss/include/auss.hpp | 47 + lib/i3ipcpp/CHANGELOG | 33 + lib/i3ipcpp/CMakeLists.txt | 65 + lib/i3ipcpp/Doxyfile | 2353 +++++++++++ lib/i3ipcpp/LICENSE | 22 + lib/i3ipcpp/README.md | 129 + lib/i3ipcpp/examples/CMakeLists.txt | 23 + lib/i3ipcpp/examples/bar-configs.cpp | 43 + lib/i3ipcpp/examples/events.cpp | 46 + lib/i3ipcpp/examples/workspaces.cpp | 64 + lib/i3ipcpp/include/i3ipc++/ipc-util.hpp | 169 + lib/i3ipcpp/include/i3ipc++/ipc.hpp | 377 ++ lib/i3ipcpp/include/i3ipc++/log.hpp | 97 + lib/i3ipcpp/src/ipc-util.cpp | 172 + lib/i3ipcpp/src/ipc.cpp | 630 +++ lib/i3ipcpp/test/test_ipc.hpp | 28 + lib/xpp/.gitignore | 7 + lib/xpp/CMakeLists.txt | 200 + lib/xpp/LICENSE | 8 + lib/xpp/README.md | 313 ++ lib/xpp/cmake/FindX11_XCB.cmake | 31 + lib/xpp/cmake/FindXCB.cmake | 254 ++ lib/xpp/generators/TODO | 53 + lib/xpp/generators/accessor.py | 126 + lib/xpp/generators/cpp_client.py | 3125 ++++++++++++++ lib/xpp/generators/cppcookie.py | 202 + lib/xpp/generators/cpperror.py | 221 + lib/xpp/generators/cppevent.py | 380 ++ lib/xpp/generators/cppreply.py | 138 + lib/xpp/generators/cpprequest.py | 197 + lib/xpp/generators/extensionclass.py | 45 + lib/xpp/generators/interfaceclass.py | 86 + lib/xpp/generators/objectclass.py | 69 + lib/xpp/generators/parameter.py | 269 ++ lib/xpp/generators/resource_classes.py | 81 + lib/xpp/generators/utils.py | 64 + lib/xpp/include/xpp/atom.hpp | 34 + lib/xpp/include/xpp/colormap.hpp | 77 + lib/xpp/include/xpp/connection.hpp | 157 + lib/xpp/include/xpp/core.hpp | 340 ++ lib/xpp/include/xpp/cursor.hpp | 142 + lib/xpp/include/xpp/drawable.hpp | 35 + lib/xpp/include/xpp/event.hpp | 210 + lib/xpp/include/xpp/flags.makefile | 40 + lib/xpp/include/xpp/font.hpp | 74 + lib/xpp/include/xpp/fontable.hpp | 35 + lib/xpp/include/xpp/gcontext.hpp | 114 + lib/xpp/include/xpp/generic.hpp | 15 + lib/xpp/include/xpp/generic/error.hpp | 96 + lib/xpp/include/xpp/generic/event.hpp | 45 + lib/xpp/include/xpp/generic/extension.hpp | 59 + lib/xpp/include/xpp/generic/factory.hpp | 92 + .../xpp/generic/input_iterator_adapter.hpp | 163 + .../include/xpp/generic/iterator_traits.hpp | 24 + .../include/xpp/generic/reply_iterator.hpp | 376 ++ lib/xpp/include/xpp/generic/request.hpp | 129 + lib/xpp/include/xpp/generic/resource.hpp | 142 + lib/xpp/include/xpp/generic/signature.hpp | 16 + lib/xpp/include/xpp/pixmap.hpp | 78 + lib/xpp/include/xpp/valueparam.hpp | 50 + lib/xpp/include/xpp/window.hpp | 91 + lib/xpp/include/xpp/xpp.hpp | 19 + lib/xpp/src/examples/Makefile | 14 + lib/xpp/src/examples/demo_01.cpp | 138 + lib/xpp/src/examples/demo_02.cpp | 229 ++ lib/xpp/src/tests/.gitignore | 2 + lib/xpp/src/tests/Makefile | 25 + lib/xpp/src/tests/README.md | 2 + lib/xpp/src/tests/callable.cpp | 83 + lib/xpp/src/tests/error_test.cpp | 497 +++ lib/xpp/src/tests/event.cpp | 125 + lib/xpp/src/tests/iterator.cpp | 155 + lib/xpp/src/tests/requests.cpp | 910 +++++ lib/xpp/src/tests/resource.cpp | 49 + lib/xpp/src/tests/sizeof.cpp | 767 ++++ lib/xpp/src/tests/template.cpp | 101 + lib/xpp/src/tests/test.cpp | 1255 ++++++ lib/xpp/src/tests/xlib-test.cpp | 33 + lib/xpp/src/tests/xlib.cpp | 30 + lib/xpp/src/tests/xproto.cpp | 870 ++++ lib/xpp/src/xpp.cpp | 1 + src/CMakeLists.txt | 102 + src/adapters/alsa/control.cpp | 121 + src/adapters/alsa/mixer.cpp | 232 ++ src/adapters/mpd.cpp | 494 +++ src/adapters/net.cpp | 320 ++ src/adapters/net_iw.cpp | 137 + src/adapters/net_nl.cpp | 231 ++ src/adapters/pulseaudio.cpp | 329 ++ src/cairo/utils.cpp | 176 + src/components/bar.cpp | 978 +++++ src/components/builder.cpp | 567 +++ src/components/command_line.cpp | 204 + src/components/config.cpp | 246 ++ src/components/config_parser.cpp | 295 ++ src/components/controller.cpp | 869 ++++ src/components/ipc.cpp | 85 + src/components/logger.cpp | 100 + src/components/parser.cpp | 323 ++ src/components/renderer.cpp | 896 ++++ src/components/screen.cpp | 147 + src/components/taskqueue.cpp | 110 + src/drawtypes/animation.cpp | 63 + src/drawtypes/iconset.cpp | 38 + src/drawtypes/label.cpp | 306 ++ src/drawtypes/progressbar.cpp | 138 + src/drawtypes/ramp.cpp | 66 + src/events/signal_emitter.cpp | 15 + src/events/signal_receiver.cpp | 1 + src/ipc.cpp | 134 + src/main.cpp | 169 + src/modules/alsa.cpp | 276 ++ src/modules/backlight.cpp | 144 + src/modules/battery.cpp | 372 ++ src/modules/bspwm.cpp | 504 +++ src/modules/counter.cpp | 30 + src/modules/cpu.cpp | 162 + src/modules/date.cpp | 96 + src/modules/fs.cpp | 185 + src/modules/github.cpp | 135 + src/modules/i3.cpp | 272 ++ src/modules/ipc.cpp | 130 + src/modules/memory.cpp | 148 + src/modules/menu.cpp | 158 + src/modules/meta/base.cpp | 172 + src/modules/mpd.cpp | 408 ++ src/modules/network.cpp | 193 + src/modules/pulseaudio.cpp | 171 + src/modules/script.cpp | 220 + src/modules/systray.cpp | 69 + src/modules/temperature.cpp | 108 + src/modules/text.cpp | 56 + src/modules/xbacklight.cpp | 177 + src/modules/xkeyboard.cpp | 290 ++ src/modules/xwindow.cpp | 143 + src/modules/xworkspaces.cpp | 405 ++ src/settings.cpp.cmake | 62 + src/utils/actions.cpp | 55 + src/utils/bspwm.cpp | 151 + src/utils/color.cpp | 180 + src/utils/command.cpp | 222 + src/utils/concurrency.cpp | 31 + src/utils/env.cpp | 22 + src/utils/factory.cpp | 8 + src/utils/file.cpp | 338 ++ src/utils/http.cpp | 59 + src/utils/i3.cpp | 83 + src/utils/inotify.cpp | 120 + src/utils/io.cpp | 96 + src/utils/process.cpp | 199 + src/utils/socket.cpp | 120 + src/utils/string.cpp | 317 ++ src/utils/throttle.cpp | 36 + src/x11/atoms.cpp | 82 + src/x11/background_manager.cpp | 205 + src/x11/connection.cpp | 246 ++ src/x11/cursor.cpp | 27 + src/x11/ewmh.cpp | 185 + src/x11/extensions/composite.cpp | 20 + src/x11/extensions/randr.cpp | 267 ++ src/x11/extensions/xkb.cpp | 217 + src/x11/icccm.cpp | 43 + src/x11/registry.cpp | 11 + src/x11/tray_client.cpp | 121 + src/x11/tray_manager.cpp | 1148 ++++++ src/x11/window.cpp | 70 + src/x11/winspec.cpp | 138 + src/x11/xembed.cpp | 101 + src/x11/xresources.cpp | 15 + tests/CMakeLists.txt | 70 + tests/CMakeLists.txt.in | 15 + tests/common/test.hpp | 3 + tests/unit_tests/components/bar.cpp | 48 + tests/unit_tests/components/command_line.cpp | 113 + tests/unit_tests/components/config_parser.cpp | 238 ++ tests/unit_tests/components/parser.cpp | 37 + tests/unit_tests/drawtypes/iconset.cpp | 18 + tests/unit_tests/drawtypes/label.cpp | 109 + tests/unit_tests/utils/actions.cpp | 51 + tests/unit_tests/utils/color.cpp | 125 + tests/unit_tests/utils/command.cpp | 57 + tests/unit_tests/utils/file.cpp | 16 + tests/unit_tests/utils/math.cpp | 85 + tests/unit_tests/utils/memory.cpp | 23 + tests/unit_tests/utils/process.cpp | 34 + tests/unit_tests/utils/scope.cpp | 19 + tests/unit_tests/utils/string.cpp | 150 + version.txt | 4 + 369 files changed, 55261 insertions(+) create mode 100644 .clang-format create mode 100644 .clang-tidy create mode 100644 .codecov.yml create mode 100644 .editorconfig create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/build.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .valgrind-suppressions create mode 100644 .ycm_extra_conf.py create mode 100644 CHANGELOG.md create mode 100644 CMakeLists.txt create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 SUPPORT.md create mode 100644 banner.png create mode 100755 build.sh create mode 100644 cmake/01-core.cmake create mode 100644 cmake/02-opts.cmake create mode 100644 cmake/03-libs.cmake create mode 100644 cmake/04-targets.cmake create mode 100644 cmake/05-summary.cmake create mode 100644 cmake/common/utils.cmake create mode 100644 cmake/modules/FindLibiw.cmake create mode 100644 cmake/templates/uninstall.cmake.in create mode 100644 cmake/templates/userconfig.cmake.in create mode 100755 common/ci/configure.sh create mode 100755 common/ci/summary.sh create mode 100755 common/clang-format.sh create mode 100755 common/clang-tidy.sh create mode 100755 common/release-archive.sh create mode 100644 config.cmake create mode 100644 contrib/bash/CMakeLists.txt create mode 100644 contrib/bash/polybar create mode 100644 contrib/polybar-git.aur/PKGBUILD create mode 100644 contrib/polybar-git.aur/polybar.install create mode 100644 contrib/polybar.aur/PKGBUILD create mode 100644 contrib/polybar.aur/polybar.install create mode 100644 contrib/rpm/polybar.spec create mode 100644 contrib/vim/autoload/ft/cpphpp.vim create mode 100644 contrib/vim/ftplugin/cpp.vim create mode 100644 contrib/vim/ftplugin/dosini.vim create mode 100644 contrib/zsh/CMakeLists.txt create mode 100644 contrib/zsh/_polybar create mode 100644 contrib/zsh/_polybar_msg create mode 100644 doc/.gitignore create mode 100644 doc/CMakeLists.txt create mode 100644 doc/README.md create mode 100644 doc/_static/.gitignore create mode 100644 doc/conf.py create mode 100644 doc/dev/packaging.rst create mode 100644 doc/dev/release-workflow.rst create mode 100644 doc/index.rst create mode 100644 doc/man/polybar.1.rst create mode 100644 doc/man/polybar.5.rst create mode 100644 doc/user/actions.rst create mode 100644 include/CMakeLists.txt create mode 100644 include/adapters/alsa/control.hpp create mode 100644 include/adapters/alsa/generic.hpp create mode 100644 include/adapters/alsa/mixer.hpp create mode 100644 include/adapters/mpd.hpp create mode 100644 include/adapters/net.hpp create mode 100644 include/adapters/pulseaudio.hpp create mode 100644 include/cairo/context.hpp create mode 100644 include/cairo/font.hpp create mode 100644 include/cairo/fwd.hpp create mode 100644 include/cairo/surface.hpp create mode 100644 include/cairo/types.hpp create mode 100644 include/cairo/utils.hpp create mode 100644 include/common.hpp create mode 100644 include/components/bar.hpp create mode 100644 include/components/builder.hpp create mode 100644 include/components/command_line.hpp create mode 100644 include/components/config.hpp create mode 100644 include/components/config_parser.hpp create mode 100644 include/components/controller.hpp create mode 100644 include/components/ipc.hpp create mode 100644 include/components/logger.hpp create mode 100644 include/components/parser.hpp create mode 100644 include/components/renderer.hpp create mode 100644 include/components/screen.hpp create mode 100644 include/components/taskqueue.hpp create mode 100644 include/components/types.hpp create mode 100644 include/debug.hpp create mode 100644 include/drawtypes/animation.hpp create mode 100644 include/drawtypes/iconset.hpp create mode 100644 include/drawtypes/label.hpp create mode 100644 include/drawtypes/progressbar.hpp create mode 100644 include/drawtypes/ramp.hpp create mode 100644 include/errors.hpp create mode 100644 include/events/signal.hpp create mode 100644 include/events/signal_emitter.hpp create mode 100644 include/events/signal_fwd.hpp create mode 100644 include/events/signal_receiver.hpp create mode 100644 include/events/types.hpp create mode 100644 include/modules/alsa.hpp create mode 100644 include/modules/backlight.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/fs.hpp create mode 100644 include/modules/github.hpp create mode 100644 include/modules/i3.hpp create mode 100644 include/modules/ipc.hpp create mode 100644 include/modules/memory.hpp create mode 100644 include/modules/menu.hpp create mode 100644 include/modules/meta/base.hpp create mode 100644 include/modules/meta/base.inl create mode 100644 include/modules/meta/event_handler.hpp create mode 100644 include/modules/meta/event_module.hpp create mode 100644 include/modules/meta/factory.hpp create mode 100644 include/modules/meta/inotify_module.hpp create mode 100644 include/modules/meta/static_module.hpp create mode 100644 include/modules/meta/timer_module.hpp create mode 100644 include/modules/mpd.hpp create mode 100644 include/modules/network.hpp create mode 100644 include/modules/pulseaudio.hpp create mode 100644 include/modules/script.hpp create mode 100644 include/modules/systray.hpp create mode 100644 include/modules/temperature.hpp create mode 100644 include/modules/text.hpp create mode 100644 include/modules/unsupported.hpp create mode 100644 include/modules/xbacklight.hpp create mode 100644 include/modules/xkeyboard.hpp create mode 100644 include/modules/xwindow.hpp create mode 100644 include/modules/xworkspaces.hpp create mode 100644 include/settings.hpp.cmake create mode 100644 include/utils/actions.hpp create mode 100644 include/utils/bspwm.hpp create mode 100644 include/utils/color.hpp create mode 100644 include/utils/command.hpp create mode 100644 include/utils/concurrency.hpp create mode 100644 include/utils/env.hpp create mode 100644 include/utils/factory.hpp create mode 100644 include/utils/file.hpp create mode 100644 include/utils/functional.hpp create mode 100644 include/utils/http.hpp create mode 100644 include/utils/i3.hpp create mode 100644 include/utils/inotify.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/mixins.hpp create mode 100644 include/utils/process.hpp create mode 100644 include/utils/scope.hpp create mode 100644 include/utils/socket.hpp create mode 100644 include/utils/string.hpp create mode 100644 include/utils/throttle.hpp create mode 100644 include/utils/time.hpp create mode 100644 include/x11/atoms.hpp create mode 100644 include/x11/background_manager.hpp create mode 100644 include/x11/connection.hpp create mode 100644 include/x11/cursor.hpp create mode 100644 include/x11/ewmh.hpp create mode 100644 include/x11/extensions/all.hpp create mode 100644 include/x11/extensions/composite.hpp create mode 100644 include/x11/extensions/fwd.hpp create mode 100644 include/x11/extensions/randr.hpp create mode 100644 include/x11/extensions/xkb.hpp create mode 100644 include/x11/icccm.hpp create mode 100644 include/x11/registry.hpp create mode 100644 include/x11/tray_client.hpp create mode 100644 include/x11/tray_manager.hpp create mode 100644 include/x11/types.hpp create mode 100644 include/x11/window.hpp create mode 100644 include/x11/winspec.hpp create mode 100644 include/x11/xembed.hpp create mode 100644 include/x11/xresources.hpp create mode 100644 lib/CMakeLists.txt create mode 100644 lib/concurrentqueue/include/moodycamel/blockingconcurrentqueue.h create mode 100644 lib/concurrentqueue/include/moodycamel/concurrentqueue.h create mode 100644 lib/i3ipcpp/.gitignore create mode 100644 lib/i3ipcpp/3rd/auss/LICENSE create mode 100644 lib/i3ipcpp/3rd/auss/README.md create mode 100644 lib/i3ipcpp/3rd/auss/include/auss.hpp create mode 100644 lib/i3ipcpp/CHANGELOG create mode 100644 lib/i3ipcpp/CMakeLists.txt create mode 100644 lib/i3ipcpp/Doxyfile create mode 100644 lib/i3ipcpp/LICENSE create mode 100644 lib/i3ipcpp/README.md create mode 100644 lib/i3ipcpp/examples/CMakeLists.txt create mode 100644 lib/i3ipcpp/examples/bar-configs.cpp create mode 100644 lib/i3ipcpp/examples/events.cpp create mode 100644 lib/i3ipcpp/examples/workspaces.cpp create mode 100644 lib/i3ipcpp/include/i3ipc++/ipc-util.hpp create mode 100644 lib/i3ipcpp/include/i3ipc++/ipc.hpp create mode 100644 lib/i3ipcpp/include/i3ipc++/log.hpp create mode 100644 lib/i3ipcpp/src/ipc-util.cpp create mode 100644 lib/i3ipcpp/src/ipc.cpp create mode 100644 lib/i3ipcpp/test/test_ipc.hpp create mode 100644 lib/xpp/.gitignore create mode 100644 lib/xpp/CMakeLists.txt create mode 100644 lib/xpp/LICENSE create mode 100644 lib/xpp/README.md create mode 100644 lib/xpp/cmake/FindX11_XCB.cmake create mode 100644 lib/xpp/cmake/FindXCB.cmake create mode 100644 lib/xpp/generators/TODO create mode 100644 lib/xpp/generators/accessor.py create mode 100644 lib/xpp/generators/cpp_client.py create mode 100644 lib/xpp/generators/cppcookie.py create mode 100644 lib/xpp/generators/cpperror.py create mode 100644 lib/xpp/generators/cppevent.py create mode 100644 lib/xpp/generators/cppreply.py create mode 100644 lib/xpp/generators/cpprequest.py create mode 100644 lib/xpp/generators/extensionclass.py create mode 100644 lib/xpp/generators/interfaceclass.py create mode 100644 lib/xpp/generators/objectclass.py create mode 100644 lib/xpp/generators/parameter.py create mode 100644 lib/xpp/generators/resource_classes.py create mode 100644 lib/xpp/generators/utils.py create mode 100644 lib/xpp/include/xpp/atom.hpp create mode 100644 lib/xpp/include/xpp/colormap.hpp create mode 100644 lib/xpp/include/xpp/connection.hpp create mode 100644 lib/xpp/include/xpp/core.hpp create mode 100644 lib/xpp/include/xpp/cursor.hpp create mode 100644 lib/xpp/include/xpp/drawable.hpp create mode 100644 lib/xpp/include/xpp/event.hpp create mode 100644 lib/xpp/include/xpp/flags.makefile create mode 100644 lib/xpp/include/xpp/font.hpp create mode 100644 lib/xpp/include/xpp/fontable.hpp create mode 100644 lib/xpp/include/xpp/gcontext.hpp create mode 100644 lib/xpp/include/xpp/generic.hpp create mode 100644 lib/xpp/include/xpp/generic/error.hpp create mode 100644 lib/xpp/include/xpp/generic/event.hpp create mode 100644 lib/xpp/include/xpp/generic/extension.hpp create mode 100644 lib/xpp/include/xpp/generic/factory.hpp create mode 100644 lib/xpp/include/xpp/generic/input_iterator_adapter.hpp create mode 100644 lib/xpp/include/xpp/generic/iterator_traits.hpp create mode 100644 lib/xpp/include/xpp/generic/reply_iterator.hpp create mode 100644 lib/xpp/include/xpp/generic/request.hpp create mode 100644 lib/xpp/include/xpp/generic/resource.hpp create mode 100644 lib/xpp/include/xpp/generic/signature.hpp create mode 100644 lib/xpp/include/xpp/pixmap.hpp create mode 100644 lib/xpp/include/xpp/valueparam.hpp create mode 100644 lib/xpp/include/xpp/window.hpp create mode 100644 lib/xpp/include/xpp/xpp.hpp create mode 100644 lib/xpp/src/examples/Makefile create mode 100644 lib/xpp/src/examples/demo_01.cpp create mode 100644 lib/xpp/src/examples/demo_02.cpp create mode 100644 lib/xpp/src/tests/.gitignore create mode 100644 lib/xpp/src/tests/Makefile create mode 100644 lib/xpp/src/tests/README.md create mode 100644 lib/xpp/src/tests/callable.cpp create mode 100644 lib/xpp/src/tests/error_test.cpp create mode 100644 lib/xpp/src/tests/event.cpp create mode 100644 lib/xpp/src/tests/iterator.cpp create mode 100644 lib/xpp/src/tests/requests.cpp create mode 100644 lib/xpp/src/tests/resource.cpp create mode 100644 lib/xpp/src/tests/sizeof.cpp create mode 100644 lib/xpp/src/tests/template.cpp create mode 100644 lib/xpp/src/tests/test.cpp create mode 100644 lib/xpp/src/tests/xlib-test.cpp create mode 100644 lib/xpp/src/tests/xlib.cpp create mode 100644 lib/xpp/src/tests/xproto.cpp create mode 100644 lib/xpp/src/xpp.cpp create mode 100644 src/CMakeLists.txt create mode 100644 src/adapters/alsa/control.cpp create mode 100644 src/adapters/alsa/mixer.cpp create mode 100644 src/adapters/mpd.cpp create mode 100644 src/adapters/net.cpp create mode 100644 src/adapters/net_iw.cpp create mode 100644 src/adapters/net_nl.cpp create mode 100644 src/adapters/pulseaudio.cpp create mode 100644 src/cairo/utils.cpp create mode 100644 src/components/bar.cpp create mode 100644 src/components/builder.cpp create mode 100644 src/components/command_line.cpp create mode 100644 src/components/config.cpp create mode 100644 src/components/config_parser.cpp create mode 100644 src/components/controller.cpp create mode 100644 src/components/ipc.cpp create mode 100644 src/components/logger.cpp create mode 100644 src/components/parser.cpp create mode 100644 src/components/renderer.cpp create mode 100644 src/components/screen.cpp create mode 100644 src/components/taskqueue.cpp create mode 100644 src/drawtypes/animation.cpp create mode 100644 src/drawtypes/iconset.cpp create mode 100644 src/drawtypes/label.cpp create mode 100644 src/drawtypes/progressbar.cpp create mode 100644 src/drawtypes/ramp.cpp create mode 100644 src/events/signal_emitter.cpp create mode 100644 src/events/signal_receiver.cpp create mode 100644 src/ipc.cpp create mode 100644 src/main.cpp create mode 100644 src/modules/alsa.cpp create mode 100644 src/modules/backlight.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/fs.cpp create mode 100644 src/modules/github.cpp create mode 100644 src/modules/i3.cpp create mode 100644 src/modules/ipc.cpp create mode 100644 src/modules/memory.cpp create mode 100644 src/modules/menu.cpp create mode 100644 src/modules/meta/base.cpp create mode 100644 src/modules/mpd.cpp create mode 100644 src/modules/network.cpp create mode 100644 src/modules/pulseaudio.cpp create mode 100644 src/modules/script.cpp create mode 100644 src/modules/systray.cpp create mode 100644 src/modules/temperature.cpp create mode 100644 src/modules/text.cpp create mode 100644 src/modules/xbacklight.cpp create mode 100644 src/modules/xkeyboard.cpp create mode 100644 src/modules/xwindow.cpp create mode 100644 src/modules/xworkspaces.cpp create mode 100644 src/settings.cpp.cmake create mode 100644 src/utils/actions.cpp create mode 100644 src/utils/bspwm.cpp create mode 100644 src/utils/color.cpp create mode 100644 src/utils/command.cpp create mode 100644 src/utils/concurrency.cpp create mode 100644 src/utils/env.cpp create mode 100644 src/utils/factory.cpp create mode 100644 src/utils/file.cpp create mode 100644 src/utils/http.cpp create mode 100644 src/utils/i3.cpp create mode 100644 src/utils/inotify.cpp create mode 100644 src/utils/io.cpp create mode 100644 src/utils/process.cpp create mode 100644 src/utils/socket.cpp create mode 100644 src/utils/string.cpp create mode 100644 src/utils/throttle.cpp create mode 100644 src/x11/atoms.cpp create mode 100644 src/x11/background_manager.cpp create mode 100644 src/x11/connection.cpp create mode 100644 src/x11/cursor.cpp create mode 100644 src/x11/ewmh.cpp create mode 100644 src/x11/extensions/composite.cpp create mode 100644 src/x11/extensions/randr.cpp create mode 100644 src/x11/extensions/xkb.cpp create mode 100644 src/x11/icccm.cpp create mode 100644 src/x11/registry.cpp create mode 100644 src/x11/tray_client.cpp create mode 100644 src/x11/tray_manager.cpp create mode 100644 src/x11/window.cpp create mode 100644 src/x11/winspec.cpp create mode 100644 src/x11/xembed.cpp create mode 100644 src/x11/xresources.cpp create mode 100644 tests/CMakeLists.txt create mode 100644 tests/CMakeLists.txt.in create mode 100644 tests/common/test.hpp create mode 100644 tests/unit_tests/components/bar.cpp create mode 100644 tests/unit_tests/components/command_line.cpp create mode 100644 tests/unit_tests/components/config_parser.cpp create mode 100644 tests/unit_tests/components/parser.cpp create mode 100644 tests/unit_tests/drawtypes/iconset.cpp create mode 100644 tests/unit_tests/drawtypes/label.cpp create mode 100644 tests/unit_tests/utils/actions.cpp create mode 100644 tests/unit_tests/utils/color.cpp create mode 100644 tests/unit_tests/utils/command.cpp create mode 100644 tests/unit_tests/utils/file.cpp create mode 100644 tests/unit_tests/utils/math.cpp create mode 100644 tests/unit_tests/utils/memory.cpp create mode 100644 tests/unit_tests/utils/process.cpp create mode 100644 tests/unit_tests/utils/scope.cpp create mode 100644 tests/unit_tests/utils/string.cpp create mode 100644 version.txt diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..3caddce --- /dev/null +++ b/.clang-format @@ -0,0 +1,13 @@ +--- +Language: Cpp +Standard: Cpp11 +BasedOnStyle: Google +ColumnLimit: 120 +NamespaceIndentation: All +AlignAfterOpenBracket: DontAlign +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: false +BreakConstructorInitializersBeforeComma: true +DerivePointerAlignment: false +PointerAlignment: Left +--- diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..a12c09f --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,52 @@ +--- +Checks: ' + -*, + performance-*, + readability-*, + clang-analyzer-alpha.core*, + clang-analyzer-alpha.security*, + clang-analyzer-alpha.unix.cstring*, + clang-analyzer-core.uninitialized*, + clang-analyzer-cplusplus.*, + clang-analyzer-nullability*, + clang-analyzer-unix*, + cppcoreguidelines*, + modernize-use-*, + modernize-*, + -modernize-raw-string-literal, + -modernize-use-bool-literals, + -modernize-use-trailing-return-type, + -readability-implicit-bool-cast, + -readability-else-after-return, + -readability-named-parameter, + -readability-implicit-bool-conversion, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-pro-bounds-array-to-pointer-decay, + -cppcoreguidelines-pro-type-vararg, + -cppcoreguidelines-pro-type-reinterpret-cast, + -cppcoreguidelines-pro-type-union-access, + -cppcoreguidelines-pro-type-cstyle-cast, + -cppcoreguidelines-pro-bounds-constant-array-index + ' + +CheckOptions: + - key: modernize-loop-convert.NamingStyle + value: lower_case + - key: readability-identifier-naming.GlobalConstantPrefix + value: 'g_' + - key: readability-identifier-naming.ClassCase + value: lower_case + - key: readability-identifier-naming.ClassConstantCase + value: UPPER_CASE + - key: readability-identifier-naming.ClassMethodCase + value: lower_case + - key: readability-identifier-naming.MemberCase + value: lower_case + - key: readability-identifier-naming.ProtectedMemberPrefix + value: 'm_' + - key: readability-identifier-naming.PrivateMemberPrefix + value: 'm_' +HeaderFilterRegex: '' +WarningsAsErrors: '' +AnalyzeTemporaryDtors: false +... diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..cb44c86 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,18 @@ +coverage: + status: + project: + default: + # Coverage can drop by 0.1% without failing the status + threshold: 0.1 + patch: + default: + # Patches don't need test coverage + # TODO remove once we have proper testing infrastructure and documentation + target: 0 + +ignore: + - "tests/*" + - "lib/*" + +comment: + require_changes: true diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..57c08e6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 +charset = utf-8 + +[Makefile] +indent_style = tab +indent_size = 2 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..2442129 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,61 @@ +--- +name: Bug Report +about: Create a report for something that misbehaves + +--- + +## Checklist + + + +* [ ] I have read the appropriate section in the [contributing + guidelines](https://github.com/polybar/polybar/blob/master/CONTRIBUTING.md) +* [ ] I believe this issue is a problem with polybar itself and not a misconfiguration on my part. +* [ ] I have searched for other open and closed [issues](https://github.com/polybar/polybar/issues?q=is%3Aissue) that + may have already reported this problem. +* [ ] I have checked the [known issues](https://github.com/polybar/polybar/wiki/Known-Issues) page for this problem. + +## Describe the bug + + +**Expected behavior:** + + + +**Actual behavior:** + + + +**Was it working before?** +* Did you also experience this bug in an earlier version of polybar (yes/no/don't know)? +* If no, what was the last version where this worked correctly? + +## To Reproduce + + + +```dosini + +``` + + +## Polybar Log + +``` + +``` + +## Screenshots + + +## Environment: +* WM: +* Distro: +* Output of `polybar -vvv`: + +``` + +``` + +## Additional context + diff --git a/.github/ISSUE_TEMPLATE/build.md b/.github/ISSUE_TEMPLATE/build.md new file mode 100644 index 0000000..9e0c86a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/build.md @@ -0,0 +1,46 @@ +--- +name: Build Issues +about: Report issues while building polybar from source + +--- + +## Checklist + + + +* [ ] I have followed every step on the [compiling wiki page](https://github.com/polybar/polybar/wiki/Compiling) and + installed all necessary dependencies. +* [ ] My problem is not described on the [known issues page](https://github.com/polybar/polybar/wiki/Known-Issues) +* [ ] I have searched for other open and closed [issues](https://github.com/polybar/polybar/issues?q=is%3Aissue) that + may have already reported this problem. +* [ ] I was able to reproduce this build issue in a clean build + +## Build Process + +**How did you build polybar?** + + + +* [ ] From a release archive (Which version?) +* [ ] By cloning this repository (What is the of `git describe --tags`?) +* [ ] Some other way (How?) + + + + +## Build Log + +``` + +``` + +## Environment: +* Distro (with Version): + +## Additional context + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..6a1549a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Polybar Gitter Room + url: https://gitter.im/polybar/polybar + about: Please ask and answer questions here. + - name: Polybar subreddit + url: https://www.reddit.com/r/polybar + about: Please ask and answer questions here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..0092b9f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +## Is your feature request related to a problem? Please describe. + + +## Why does polybar need this feature? + + +## Describe the solution you'd like + + +## Describe alternatives you've considered + + +## Additional context + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..442cf05 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## What type of PR is this? (check all applicable) + +* [ ] Refactor +* [ ] Feature +* [ ] Bug Fix +* [ ] Optimization +* [ ] Documentation Update +* [ ] Other: *Replace this with a description of the type of this PR* + +## Description + + +## Related Issues & Documents + + +## Documentation (check all applicable) + +* [ ] This PR requires changes to the Wiki documentation (describe the changes) +* [ ] This PR requires changes to the documentation inside the git repo (please add them to the PR). +* [ ] Does not require documentation changes diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9974676 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,98 @@ +name: CI +on: + workflow_dispatch: + inputs: + ref: + description: 'ref' + required: false + push: + pull_request: + +jobs: + docs: + runs-on: ubuntu-20.04 + env: + COLOR: "ON" + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.ref }} + - name: Install Dependencies + run: sudo apt-get install -y python3-sphinx + - name: Build Documentation + run: | + mkdir -p doc/build + cd doc/build + cmake .. + make doc + + build: + runs-on: ubuntu-20.04 + strategy: + matrix: + cxx: [g++, clang++] + polybar_build_type: ["full"] + build_type: ["Release"] + include: + - cxx: g++ + polybar_build_type: "tests" + build_type: "Coverage" + - cxx: g++ + polybar_build_type: "minimal" + build_type: "Release" + env: + CXX: ${{ matrix.cxx }} + BUILD_TYPE: ${{ matrix.build_type }} + POLYBAR_BUILD_TYPE: ${{ matrix.polybar_build_type }} + POLYBAR_DIR: ${{ github.workspace }} + BUILD_DIR: "${{ github.workspace}}/build" + MAKEFLAGS: "-j4" + COLOR: "ON" + steps: + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + libxcb-composite0-dev \ + libxcb-ewmh-dev \ + libxcb-icccm4-dev \ + libxcb-image0-dev \ + libxcb-randr0-dev \ + libxcb-util0-dev \ + libxcb1-dev \ + libcairo2-dev \ + python3-xcbgen \ + xcb-proto + + if [ "$POLYBAR_BUILD_TYPE" != "minimal" ]; then + sudo apt-get install -y \ + libxcb-xkb-dev \ + libxcb-cursor-dev \ + libxcb-xrm-dev \ + i3-wm \ + libcurl4-openssl-dev \ + libjsoncpp-dev \ + libasound2-dev \ + libpulse-dev \ + libiw-dev \ + libmpdclient-dev + fi + - uses: actions/checkout@v2 + with: + submodules: true + ref: ${{ github.event.inputs.ref }} + - name: Summary + run: ./common/ci/summary.sh + - name: Configure + run: ./common/ci/configure.sh + - name: Build + run: | + cd $BUILD_DIR + make + - name: Tests + if: ${{ matrix.polybar_build_type == 'tests' }} + run: | + cd $BUILD_DIR + make check + cd $POLYBAR_DIR + bash <(curl -s https://codecov.io/bash) -F unittests -a "-ap" -Z diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f6db60c --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/build +/tags +/compile_commands.json +/config +*.bak +*.pyc +*.swp +*.tmp +.tags + +polybar-*.tar diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4b6f7f5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,8 @@ +[submodule "lib/i3ipcpp"] + path = lib/i3ipcpp + url = https://github.com/polybar/i3ipcpp + branch = master +[submodule "lib/xpp"] + path = lib/xpp + url = https://github.com/polybar/xpp + branch = master diff --git a/.valgrind-suppressions b/.valgrind-suppressions new file mode 100644 index 0000000..6d33fd4 --- /dev/null +++ b/.valgrind-suppressions @@ -0,0 +1,101 @@ +{ + xft/fontconfig + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:FcPatternCreate + fun:FcFontRenderPrepare + fun:FcFontMatch + fun:XftFontMatch + fun:XftFontOpenName + ... + ... + ... + ... + ... + ... +} +{ + xft/fontconfig + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/lib/libfontconfig.so.* + obj:/usr/lib/libfontconfig.so.* + fun:FcPatternAddDouble + obj:/usr/lib/libXft.so.* + obj:/usr/lib/libXft.so.* + obj:/usr/lib/libXft.so.* + obj:/usr/lib/libXft.so.* + fun:XftDefaultHasRender + fun:XftDefaultSubstitute + fun:XftFontMatch + fun:XftFontOpenName +} +{ + xft/fontconfig + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:XftFontCheckGlyph + fun:XftGlyphRender + fun:XftDrawGlyphs + fun:XftDrawString16 + ... + ... + ... + ... + ... + ... + ... +} +{ + xft/fontconfig + Memcheck:Leak + match-leak-kinds: definite + fun:realloc + obj:/usr/lib/libfontconfig.so.* + obj:/usr/lib/libfontconfig.so.* + fun:FcFontRenderPrepare + fun:FcFontMatch + fun:XftFontMatch + fun:XftFontOpenName + ... + ... + ... + ... + ... +} +{ + xresource manager + Memcheck:Leak + match-leak-kinds: definite + fun:realloc + obj:/usr/lib/libX11.so.* + obj:/usr/lib/libX11.so.* + obj:/usr/lib/libX11.so.* + fun:_XlcCreateLC + fun:_XlcDefaultLoader + fun:_XOpenLC + fun:_XrmInitParseInfo + obj:/usr/lib/libX11.so.* + fun:XrmGetStringDatabase + ... + ... +} +{ + xft conditional jump + Memcheck:Cond + obj:/usr/lib/libfreetype.so.* + obj:/usr/lib/libfreetype.so.* + fun:FT_Outline_Decompose + obj:/usr/lib/libfreetype.so.* + obj:/usr/lib/libfreetype.so.* + obj:/usr/lib/libfreetype.so.* + obj:/usr/lib/libfreetype.so.* + obj:/usr/lib/libfreetype.so.* + fun:XftFontLoadGlyphs + fun:XftGlyphExtents + ... + ... +} diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py new file mode 100644 index 0000000..4942991 --- /dev/null +++ b/.ycm_extra_conf.py @@ -0,0 +1,126 @@ +import os +import ycm_core + +# Default flags +flags = [ + '-std=c++14', + '-Wall', + '-Wextra', + + # Relative paths are corrected by MakeRelativePathsInFlagsAbsolute + '-Isrc', + '-Iinclude', + '-Ilib/concurrentqueue/include', + '-Ilib/i3ipcpp/include', + '-Ilib/xpp/include', + '-Itests', + + '-I/usr/include', + '-I/usr/include/freetype2', + ] + +# Base directory of the project, parent directory of all source files +project_dir = os.path.dirname(os.path.abspath(__file__)) + +# This assumes that everyone coding for this project builds inside the 'build' +# directory +compilation_database_folder = project_dir + "/build" + +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'] + +# Converts all relative paths in the given flag list to absolute paths with +# working_directory as the base directory +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', ".inl"] + +# Tries to query the compilation database for flags +# For header files it tries to use the flags for a corresponding source file +def GetCompilationInfoForFile(filename): + if not database: + return None + + # The compilation_commands.json file generated by CMake does not have entries + # for header files. We try to use the compile flags used for the corresponding + # source file. + # + # For this try to replace the file extension with an extension that + # corresponds to a source and we also try to replace the 'include' folder in + # the path with 'src' + if IsHeaderFile(filename) : + basename = os.path.splitext(filename)[0] + + # Absolute path of the include and source directories + include_dir = project_dir + "/include" + src_dir = project_dir + "/src" + + # Absolute path without file extension, with the 'include' folder replaced + # with 'src' in the path + src_basename = None + # If the header file is inside the include dir, try to search in the src dir + if basename.startswith(include_dir): + # file path relative to include dir + rel_path_include = os.path.relpath(basename, include_dir) + src_basename = os.path.join(src_dir, rel_path_include) + + for extension in SOURCE_EXTENSIONS: + # A list of all possible replacement files to be searched + replacement_files = [basename + extension] + + if src_basename: + replacement_files.append(src_basename + extension) + + for replacement_file in replacement_files: + if os.path.exists(replacement_file): + comp_info = database.GetCompilationInfoForFile(replacement_file) + if comp_info.compiler_flags_: + return comp_info + return database.GetCompilationInfoForFile(filename) + +def FlagsForFile(filename, **kwargs): + compilation_info = GetCompilationInfoForFile(filename) + if compilation_info and compilation_info.compiler_flags_: + # Bear in mind that compilation_info.compiler_flags_ does NOT return a + # python list, but a "list-like" StringVec object + final_flags = MakeRelativePathsInFlagsAbsolute( + [x for x in compilation_info.compiler_flags_ if x != "-Werror"], + compilation_info.compiler_working_dir_) + else: + # We use default flags if GetCompilationInfoForFile can't find any flags + relative_to = project_dir + final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to) + + return {'flags': final_flags, 'do_cache': True} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..44988bd --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,29 @@ +# Changelog + +All notable changes to this project will be documented in this file. +Each release should have the following subsections, if entries exist, in the +given order: `Breaking`, `Build`, `Deprecated`, `Removed`, `Added`, `Changed`, +`Fixed`, `Security`. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] +## [3.5.5] - 2021-03-01 +### Build +- Support older python sphinx versions again ([`#2356`](https://github.com/polybar/polybar/issues/2356)) + +## [3.5.4] - 2021-01-07 +### Fixed +- Wrong text displayed if module text ends with `}` ([`#2331`](https://github.com/polybar/polybar/issues/2331)) + +## [3.5.3] - 2020-12-23 +### Build +- Don't use `git` when building documentation ([`#2309`](https://github.com/polybar/polybar/issues/2309)) +### Fixed +- Empty color values are no longer treated as invalid and no longer produce an error. + +[Unreleased]: https://github.com/polybar/polybar/compare/3.5.5...HEAD +[3.5.5]: https://github.com/polybar/polybar/releases/tag/3.5.5 +[3.5.4]: https://github.com/polybar/polybar/releases/tag/3.5.4 +[3.5.3]: https://github.com/polybar/polybar/releases/tag/3.5.3 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d687cdd --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,167 @@ +# +# Build configuration +# +cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) + +# Enable ccache by default and as early as possible because project() performs +# checks on the compiler +option(ENABLE_CCACHE "Enable ccache support" ON) +if(ENABLE_CCACHE) + message(STATUS "Trying to enable ccache") + find_program(BIN_CCACHE ccache) + + string(ASCII 27 esc) + if(NOT BIN_CCACHE) + message(STATUS "${esc}[33mCouldn't locate ccache, disabling ccache...${esc}[0m") + else() + # Enable only if the binary is found + message(STATUS "${esc}[32mUsing compiler cache ${BIN_CCACHE}${esc}[0m") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${BIN_CCACHE}) + endif() +endif() + +project(polybar CXX) + +# Extract version information from version.txt. The first line that looks like +# a version string is used, so the file supports comments +file(STRINGS version.txt version_txt REGEX "^[0-9]+\\.[0-9]+\\.[0-9]+.*$" LIMIT_COUNT 1) + +# If we are in a git repo we can get the version information from git describe +execute_process(COMMAND git describe --tags --dirty=-dev + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + RESULT_VARIABLE git_result + OUTPUT_VARIABLE git_describe + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) + +if(git_result EQUAL "0") + set(APP_VERSION "${git_describe}") +else() + message(STATUS "Could not detect version with git, falling back to built-in version information.") + set(APP_VERSION "${version_txt}") +endif() + +set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/cmake + ${PROJECT_SOURCE_DIR}/cmake/common + ${PROJECT_SOURCE_DIR}/cmake/modules) + +include(GNUInstallDirs) +include(utils) +include(01-core) +include(02-opts) +include(03-libs) +include(04-targets) +include(05-summary) + +if(BUILD_DOC) + add_subdirectory(doc) +endif() +add_subdirectory(contrib/bash) +add_subdirectory(contrib/zsh) +add_subdirectory(include) +add_subdirectory(lib) +add_subdirectory(src bin) + +# We need to enable testing in the root folder so that 'ctest' and 'make test' +# can be run in the build directory +if(BUILD_TESTS) + enable_testing() + add_subdirectory(tests) +endif() + + +# +# Generate configuration file +# + +set(MODULES_LEFT "bspwm i3") +set(MODULES_CENTER "mpd") +set(MODULES_RIGHT "filesystem xbacklight alsa pulseaudio xkeyboard memory cpu wlan eth battery temperature date powermenu") + +set(FONT_FIXED "fixed:pixelsize=10") +set(FONT_UNIFONT "unifont:fontformat=truetype") +set(FONT_SIJI "siji:pixelsize=10") + +queryfont(FONT_FIXED ${FONT_FIXED} FIELDS family pixelsize) +queryfont(FONT_UNIFONT ${FONT_UNIFONT} FIELDS family fontformat) +queryfont(FONT_SIJI ${FONT_SIJI} FIELDS family pixelsize) + +# Strip disabled modules {{{ + +if(NOT ENABLE_PULSEAUDIO) + string(REPLACE " pulseaudio" "" MODULES_RIGHT ${MODULES_RIGHT}) +endif() +if(NOT ENABLE_ALSA) + string(REPLACE " alsa" "" MODULES_RIGHT ${MODULES_RIGHT}) +endif() +if(NOT ENABLE_I3) + string(REPLACE " i3" "" MODULES_LEFT ${MODULES_LEFT}) +endif() +if(NOT ENABLE_MPD) + string(REPLACE "mpd" "" MODULES_CENTER ${MODULES_CENTER}) +endif() +if(NOT ENABLE_NETWORK) + string(REPLACE " wlan eth" "" MODULES_RIGHT ${MODULES_RIGHT}) +endif() +if(NOT WITH_XRANDR) + string(REPLACE "xbacklight " "backlight-acpi " MODULES_RIGHT ${MODULES_RIGHT}) +endif() +if(NOT WITH_XKB) + string(REPLACE "xkeyboard " "" MODULES_RIGHT ${MODULES_RIGHT}) +endif() + +# }}} +# Get battery/adapter name {{{ + +string(REGEX REPLACE /%battery%.* "" PATH_BAT ${SETTING_PATH_BATTERY}) +string(REGEX REPLACE /%adapter%.* "" PATH_ADP ${SETTING_PATH_ADAPTER}) +file(GLOB BAT_LIST RELATIVE ${PATH_BAT} ${PATH_ADP}/B*) +file(GLOB ADP_LIST RELATIVE ${PATH_ADP} ${PATH_ADP}/A*) +if(BAT_LIST) + list(GET BAT_LIST 0 BATTERY) +else() + set(BATTERY BAT0) +endif() +if(ADP_LIST) + list(GET ADP_LIST 0 ADAPTER) +else() + set(ADAPTER ADP1) +endif() + +# }}} +# Get network interfaces {{{ + +if(ENABLE_NETWORK) + file(GLOB IFLIST RELATIVE /sys/class/net /sys/class/net/*) + foreach(INTERFACE ${IFLIST}) + if(NOT ${INTERFACE} STREQUAL "lo") + file(GLOB IS_WIRELESS /sys/class/net/${INTERFACE}/wireless) + if(IS_WIRELESS) + set(INTERFACE_WLAN ${INTERFACE}) + else() + set(INTERFACE_ETH ${INTERFACE}) + endif() + endif() + endforeach() + if(NOT INTERFACE_ETH) + set(INTERFACE_ETH net0) + endif() + if(NOT INTERFACE_WLAN) + set(INTERFACE_WLAN net1) + endif() +endif() + +# }}} +# Configure and install {{{ + +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/config.cmake + ${CMAKE_CURRENT_LIST_DIR}/config + ESCAPE_QUOTES @ONLY) + +install(FILES config + DESTINATION ${CMAKE_INSTALL_DOCDIR} + COMPONENT config) + +# }}} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..90c8672 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,123 @@ +# Contributing + +First of all, thank you very much for considering contributing to polybar. You +are awesome! :tada: + +**Table of Contents:** +* [Bug Reports](#bug-reports) +* [Pull Requests](#pull-requests) + + [Testing](#testing) + + [Documentation](#documentation) + + [Style](#style) + +## Bug Reports + +Bugs should be reported at the polybar issue tracker, using the [bug report +template](https://github.com/polybar/polybar/issues/new?template=bug_report.md). +Make sure you fill out all the required sections. + +Before opening a bug report, please search our [issue +tracker](https://github.com/polybar/polybar/issues?q=is%3Aissue) and [known +issues page](https://github.com/polybar/polybar/wiki/Known-Issues) for your +problem to avoid duplicates. + +If your issue has already been reported but is already marked as fixed and the +version of polybar you are using includes this supposed fix, feel free to open a +new issue. + +You should also go through our [debugging +guide](https://github.com/polybar/polybar/wiki/Debugging-your-Config) to confirm +what you are experiencing is indeed a polybar bug and not an issue with your +configuration. +This will also help you narrow down the issue which, in turn, will help us +resolve it, if it turns out to be a bug in polybar. + +If this bug was not present in a previous version of polybar and you know how +to, doing a `git bisect` and providing us with the commit ID that introduced the +issue would be immensely helpful. + +## Pull Requests + +If you want to start contributing to polybar, a good place to start are issues +labeled with +[help wanted](https://github.com/polybar/polybar/labels/help%20wanted) +or +[good first issue](https://github.com/polybar/polybar/labels/good%20first%20issue). + +Except for small changes, PRs should always address an already open and accepted +issue. +Otherwise you run the risk of spending time implementing something and then the +PR being rejected because the feature you implemented was not actually something +we want in polybar. + +Issues with any of the following labels are generally safe to start working on, +unless someone else has already claimed them: + +* [bug](https://github.com/polybar/polybar/labels/bug) +* [confirmed](https://github.com/polybar/polybar/labels/confirmed) +* [good first issue](https://github.com/polybar/polybar/labels/good%20first%20issue) +* [help wanted](https://github.com/polybar/polybar/labels/help%20wanted) + +For anything else, it's a good idea to first comment under the issue to ask +whether it is something that can/should be worked on right now. +This is especially true for issues labeled with `feature` (and none of the +labels listed above), here a feature may depend on some other things being +implemented first or it may need to be split into many smaller features, because +it is too big otherwise. +In particular, this means that you should not open a feature request and +immediately start working on that feature, unless you are very sure it will be +accepted or accept the risk of it being rejected. + +Things like documentation changes or refactorings, don't necessarily need an +issue associated with them. +These changes are less likely to be rejected since they don't change the +behavior of polybar. +Nevertheless, for bigger changes or when in doubt, open an issue and ask whether +such changes would be desirable. + +To claim an issue, comment under it to let others know that you are working on +it. + +Feel free to ask for feedback about your changes at any time. +Especially when implementing features, this can be very useful because it allows +us to make sure you are going in the direction we had envisioned for that +feature and you don't lose time on something that ultimately has to be +rewritten. +In that case, a [draft PR](https://github.blog/2019-02-14-introducing-draft-pull-requests/) +is a useful tool. + +When creating a PR, please fill out the PR template. + +### Testing + +Your PR must pass all existing tests. +If possible, you should also add tests for the things you write. +However, this is not always possible, for example when working on modules. +But at least isolated components should be tested. + +See the [testing page](https://github.com/polybar/polybar/wiki/Testing) on the +wiki for more information. +Also don't hesitate to ask for help, testing isn't that mature in polybar yet +and some things may be harder/impossible to test right now. + +### Documentation + +Right now, documentation for polybar lives in two places: The GitHub wiki and +the git repo itself. + +Ultimately, most of the documentation is supposed to live in the repo itself. + +For now, if your PR requires documentation changes in the repo, those changes +need to be in the PR as well. + +Changes on the wiki should not be made right away because the wiki should +reflect the currently released version and not the development version. +In that case, outline the documentation changes that need to be made (for +example, which new config options are available). +If your PR would introduce a lot of new documentation on the wiki, let us know +and we can decide if we want to put some of the documentation directly into the +repo. + +### Style + +Please read our [style guide](https://github.com/polybar/polybar/wiki/Style-Guide). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..13e205a --- /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 0000000..a1a67b7 --- /dev/null +++ b/README.md @@ -0,0 +1,159 @@ +

+ Polybar +

+ +

+A fast and easy-to-use tool for creating status bars. +

+ +

+ + + + + + + +

+ +**Polybar** aims to help users build beautiful and highly customizable status bars +for their desktop environment, without the need of having a black belt in shell scripting. +Here are a few screenshots showing you what it can look like: + +[![sample screenshot](https://i.imgur.com/xvlw9iHt.png)](https://i.imgur.com/xvlw9iH.png) +[![sample screenshot](https://i.imgur.com/cYQOuRrt.png)](https://i.imgur.com/cYQOuRr.png) +[![sample screenshot](https://i.imgur.com/A6spiZZt.png)](https://i.imgur.com/A6spiZZ.png) +[![sample screenshot](https://i.imgur.com/TY5a5r9t.png)](https://i.imgur.com/TY5a5r9.png) + +You can find polybar configs for these example images (and other configs) [here](https://github.com/jaagr/dots/tree/master/.local/etc/themer/themes). + +## Table of Contents + +* [Introduction](#introduction) +* [Getting Help](#getting-help) +* [Contributing](#contributing) +* [Getting started](#getting-started) + * [Installation](#installation) + * [Configuration](#configuration) + * [Running](#running) +* [Community](#community) +* [Contributors](#contributors) +* [License](#license) + + +## Introduction + +The main purpose of **Polybar** is to help users create awesome status bars. +It has built-in functionality to display information about the most commonly used services. +Some of the services included so far: + +- Systray icons +- Window title +- Playback controls and status display for [MPD](https://www.musicpd.org/) using [libmpdclient](https://www.musicpd.org/libs/libmpdclient/) +- [ALSA](https://www.alsa-project.org/main/index.php/Main_Page) and [PulseAudio](https://www.freedesktop.org/wiki/Software/PulseAudio/) volume controls +- Workspace and desktop panel for [bspwm](https://github.com/baskerville/bspwm) and [i3](https://github.com/i3/i3) +- Workspace module for [EWMH compliant](https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#idm140130320786080) window managers +- Keyboard layout and indicator status +- CPU and memory load indicator +- Battery display +- Network connection details +- Backlight level +- Date and time label +- Time-based shell script execution +- Command output tailing +- User-defined menu tree +- Inter-process messaging +- And more... + +[See the wiki for more details](https://github.com/polybar/polybar/wiki). + +## Getting Help + +If you find yourself stuck, have a look at our [Support](SUPPORT.md) page for resources where you can find help. + +## Contributing + +Read our [contributing guidelines](CONTRIBUTING.md) for how to get started with contributing to polybar. + +## Getting started + + + Packaging status + + +Polybar was already packaged for the distros listed below. +If you can't find your distro here, you will have to [build from source](https://github.com/polybar/polybar/wiki/Compiling). + +If you are using **Debian** (unstable or testing), you can install [polybar](https://tracker.debian.org/pkg/polybar) using `sudo apt install polybar`. +If you are using **Debian** (buster/stable), you need to enable [backports](https://wiki.debian.org/Backports) and then install using `sudo apt -t buster-backports install polybar`. + +If you are using **Arch Linux**, you can install the AUR package [polybar-git](https://aur.archlinux.org/packages/polybar-git/) to get the latest version, or +[polybar](https://aur.archlinux.org/packages/polybar/) for the latest stable release. + +If you are using **Void Linux**, you can install [polybar](https://github.com/void-linux/void-packages/blob/master/srcpkgs/polybar/template) using `xbps-install -S polybar`. + +If you are using **NixOS**, polybar is available in both the stable and unstable channels and can be installed with the command `nix-env -iA nixos.polybar`. + +If you are using **Slackware**, polybar is available from the [SlackBuilds](https://slackbuilds.org/repository/14.2/desktop/polybar/) repository. + +If you are using **Source Mage GNU/Linux**, polybar spell is available in test grimoire and can be installed via `cast polybar`. + +If you are using **openSUSE**, polybar is available from [OBS](https://build.opensuse.org/package/show/X11:Utilities/polybar/) repository. Package is available for openSUSE Leap 15.1, openSUSE Leap 15.2 and Tumbleweed. + +If you are using **FreeBSD**, [polybar](https://svnweb.freebsd.org/ports/head/x11/polybar/) can be installed using `pkg install polybar`. Make sure you are using the `latest` package branch. + +If you are using **Gentoo**, both release and git-master versions are available in the [main](https://packages.gentoo.org/packages/x11-misc/polybar) repository. + +If you are using **Fedora**, you can install [polybar](https://src.fedoraproject.org/rpms/polybar) using `sudo dnf install polybar`. + +### Installation + +The [compiling page](https://github.com/polybar/polybar/wiki/Compiling) on the +wiki describes all steps necessary to build and install polybar. + +### Configuration + +Details on how to setup and configure the bar and each module have been moved to [the wiki](https://github.com/polybar/polybar/wiki/Configuration). + +#### Install the example configuration +Run the following inside the build directory: +~~~ sh +$ make userconfig +~~~ +Or you can copy the example config from `/usr/share/doc/polybar/config` or ` /usr/local/share/doc/polybar/config` (depending on your install parameters) + +#### Launch the example bar + ~~~ sh + $ polybar example + ~~~ + +### Running + +[See the wiki for details on how to run polybar](https://github.com/polybar/polybar/wiki). + +## Community +Want to get in touch? + +* Join our Gitter room at [gitter.im/polybar/polybar](https://gitter.im/polybar/polybar) +* We have our own subreddit at [r/polybar](https://www.reddit.com/r/polybar). +* Chat with us in the `#polybar` IRC channel on the `chat.freenode.net` server. + +## Contributors + +### Owner +* Michael Carlberg [**@jaagr**](https://github.com/jaagr/) + +### Maintainers +* [**@NBonaparte**](https://github.com/NBonaparte) +* Chase Geigle [**@skystrife**](https://github.com/skystrife) +* Patrick Ziegler [**@patrick96**](https://github.com/patrick96) + +### Logo Design by +* [**@Tobaloidee**](https://github.com/Tobaloidee) + + +### [All Contributors](https://github.com/polybar/polybar/graphs/contributors) + +## License + +Polybar is licensed under the MIT license. [See LICENSE for more information](https://github.com/polybar/polybar/blob/master/LICENSE). diff --git a/SUPPORT.md b/SUPPORT.md new file mode 100644 index 0000000..c4e7c0c --- /dev/null +++ b/SUPPORT.md @@ -0,0 +1,14 @@ +Getting Help +============ + +If you need help or troubleshooting tips or just have a question: + +* If applicable, go through our [debugging guide](https://github.com/polybar/polybar/wiki/Debugging-your-Config). +* Read the [Known Issues page](https://github.com/polybar/polybar/wiki/Known-Issues), maybe others had the same issue before. +* Read the [Wiki page](https://github.com/polybar/polybar/wiki) for the thing you have problems with. +* Join our Gitter room at [gitter.im/polybar/polybar](https://gitter.im/polybar/polybar) +* Ask in our reddit community at [r/polybar](https://www.reddit.com/r/polybar) +* Join the official IRC channel `#polybar` on the `chat.freenode.net` network. If you don't get an answer try asking on [Gitter](https://gitter.im/polybar/polybar). +* Ask on [Unix & Linux StackExchange](https://unix.stackexchange.com/). Though not all questions may be suited over there, make sure you're [on topic](https://unix.stackexchange.com/help/on-topic). + +Please **do not** use the github issue tracker to ask for help or if you have a question, it is meant for bug reports and feature requests. Issues will be closed and you will be referred to the above resources. diff --git a/banner.png b/banner.png new file mode 100644 index 0000000000000000000000000000000000000000..6fb984f1df484ead45e3b6d0a755e46057927cdf GIT binary patch literal 12078 zcmc(lWmuF=ALwTnmM%$YPy}g^Mq&XG>24$?1!)1PrAtCl>6UisQfeuclu&A=ML`VcnoudNgSeC5h_vJ}%kc#hpegp;vAbnv>9;P+VZ+3$?r zdn>j_ZsOsJ{h}rjM!8;7(adv?f(+JQ5sM%+qV9-*DN5c`_eiGdS822iY2qrmIoEdS zrXj_kk+wUOc|3HO^COL;FUz$rczUa4>|`&m0IG)|(1LKmVI_bn_y7CFJ%x}rnmKK2 z?^4?A12umPw$5ac9vpbd+|eXnN5d!XuNn9RIk_B;-XC+A8i4&rVJ+Pd5$S%7=P?&I zAnol)i&m+EVjLNl+{WUyFY0a0zna%Q{$nOQl;F+ks-)8VR%L5>O8ZZt)nBIaHs16% z<>nK~oeu`c|CJiD$hCdcrzqsOf4wOp@=#U0DMF>a0~RA5c$7)vjFmo{Ei$m-p|eN;&A22>9JB7 z|H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A{1~BTxo&1aIhp~ z_|2LCCDq4f=;2L1tR>V313#MZ<6>w8#sR5JfMgxrXbXIYf^;#rCpw7HB$Rub2?oNc zcAR%weiovLV-!D?Vq&ug$ijB1PCpGidfu2|bE@zm@f!GE$1jA|L+OMVlh4{S&kOCI z-{}{o&BQoP@3$8C2!i$jBz#CjIvc7{$RWh6hcXEX+U-##3B05_{(f!k^U?3RaOC`r z#7U}wjD_bIU?SKCvSF>>M>E+S|G^XrUJjYQ&j*{eo8 zxL#fl5|L(@lee+zkRGmZs3$#`H#tTJ?6iD-OQs$Y!IOz81mCp8;Y6LoKjq)Tu(^b literal 0 HcmV?d00001 diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..50d1c0e --- /dev/null +++ b/build.sh @@ -0,0 +1,273 @@ +#!/usr/bin/env bash + +readonly SELF=${0##*/} +declare -rA COLORS=( + [RED]=$'\033[0;31m' + [GREEN]=$'\033[0;32m' + [BLUE]=$'\033[0;34m' + [PURPLE]=$'\033[0;35m' + [CYAN]=$'\033[0;36m' + [WHITE]=$'\033[0;37m' + [YELLOW]=$'\033[0;33m' + [BOLD]=$'\033[1m' + [OFF]=$'\033[0m' +) + +usage() { + echo " + Builds and installs polybar. + + ${COLORS[GREEN]}${COLORS[BOLD]}Usage:${COLORS[OFF]} + ${COLORS[CYAN]}${SELF}${COLORS[OFF]} [options] + + ${COLORS[GREEN]}${COLORS[BOLD]}Options:${COLORS[OFF]} + ${COLORS[GREEN]}-3, --i3${COLORS[OFF]} + Include support for internal/i3 (requires i3); disabled by default. + ${COLORS[GREEN]}-a, --alsa${COLORS[OFF]} + Include support for internal/alsa (requires alsalib); disabled by default. + ${COLORS[GREEN]}-p, --pulseaudio${COLORS[OFF]} + Include support for internal/pulseaudio (requires libpulse); disabled by default. + ${COLORS[GREEN]}-n, --network${COLORS[OFF]} + Include support for internal/network (requires libnl/libiw); disabled by default. + ${COLORS[GREEN]}-m, --mpd${COLORS[OFF]} + Include support for internal/mpd (requires libmpdclient); disabled by default. + ${COLORS[GREEN]}-c, --curl${COLORS[OFF]} + Include support for internal/github (requires libcurl); disabled by default. + ${COLORS[GREEN]}-i, --ipc${COLORS[OFF]} + Build polybar-msg used to send ipc messages; disabled by default. + ${COLORS[GREEN]}--all-features${COLORS[OFF]} + Enable all abovementioned features; + equal to -3 -a -p -n -m -c -i + ${COLORS[GREEN]}-g, --gcc${COLORS[OFF]} + Use GCC even if Clang is installed; disabled by default. + ${COLORS[GREEN]}-j, --jobs${COLORS[OFF]} + Use make -j to use make jobs with $(nproc) jobs; disabled by default. + ${COLORS[GREEN]}-f${COLORS[OFF]} + Remove existing build dir; disabled by default. + ${COLORS[GREEN]}-I, --no-install${COLORS[OFF]} + Do not execute 'sudo make install'; enabled by default. + ${COLORS[GREEN]}-C, --install-config${COLORS[OFF]} + Install example configuration; disabled by default. + ${COLORS[GREEN]}-A, --auto${COLORS[OFF]} + Automatic, non-interactive installation; disabled by default. + When set, script defaults options not explicitly set. + ${COLORS[GREEN]}-h, --help${COLORS[OFF]} + Displays this help. +" +} + +msg_err() { + echo -e "${COLORS[RED]}${COLORS[BOLD]}** ${COLORS[OFF]}$*\n" + exit 1 +} + +msg() { + echo -e "${COLORS[GREEN]}${COLORS[BOLD]}** ${COLORS[OFF]}$*\n" +} + +install() { + local p + + if [[ "$AUTO" == ON ]]; then + [[ -z "$INSTALL" ]] && INSTALL="ON" + [[ -z "$INSTALL_CONF" ]] && INSTALL_CONF="OFF" + fi + + if [[ -z "$INSTALL" ]]; then + read -r -p "$(msg "Execute 'sudo make install'? [Y/n] ")" -n 1 p && echo + [[ "${p^^}" != "N" ]] && INSTALL="ON" || INSTALL="OFF" + fi + + if [[ -z "$INSTALL_CONF" ]]; then + read -r -p "$(msg "Install example configuration? [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && INSTALL_CONF="OFF" || INSTALL_CONF="ON" + fi + + + if [[ "$INSTALL" == ON ]]; then + sudo make install || msg_err "Failed to install executables..." + fi + + if [[ "$INSTALL_CONF" == ON ]]; then + make userconfig || msg_err "Failed to install user configuration..." + fi +} + +set_build_opts() { + local p + + msg "Setting build options" + + if [[ "$AUTO" == ON ]]; then + [[ -z "$USE_GCC" ]] && USE_GCC="OFF" + [[ -z "$ENABLE_I3" ]] && ENABLE_I3="OFF" + [[ -z "$ENABLE_ALSA" ]] && ENABLE_ALSA="OFF" + [[ -z "$ENABLE_PULSEAUDIO" ]] && ENABLE_PULSEAUDIO="OFF" + [[ -z "$ENABLE_NETWORK" ]] && ENABLE_NETWORK="OFF" + [[ -z "$ENABLE_MPD" ]] && ENABLE_MPD="OFF" + [[ -z "$ENABLE_CURL" ]] && ENABLE_CURL="OFF" + [[ -z "$ENABLE_IPC_MSG" ]] && ENABLE_IPC_MSG="OFF" + [[ -z "$JOB_COUNT" ]] && JOB_COUNT=1 + fi + + if [[ -z "$USE_GCC" ]]; then + read -r -p "$(msg "Use GCC even if Clang is installed ----------------------------- [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && USE_GCC="OFF" || USE_GCC="ON" + fi + + if [[ -z "$ENABLE_I3" ]]; then + read -r -p "$(msg "Include support for \"internal/i3\" (requires i3) ---------------- [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && ENABLE_I3="OFF" || ENABLE_I3="ON" + fi + + if [[ -z "$ENABLE_ALSA" ]]; then + read -r -p "$(msg "Include support for \"internal/alsa\" (requires alsalib) --------- [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && ENABLE_ALSA="OFF" || ENABLE_ALSA="ON" + fi + + if [[ -z "$ENABLE_PULSEAUDIO" ]]; then + read -r -p "$(msg "Include support for \"internal/pulseaudio\" (requires libpulse) -- [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && ENABLE_PULSEAUDIO="OFF" || ENABLE_PULSEAUDIO="ON" + fi + + if [[ -z "$ENABLE_NETWORK" ]]; then + read -r -p "$(msg "Include support for \"internal/network\" (requires libnl/libiw) -- [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && ENABLE_NETWORK="OFF" || ENABLE_NETWORK="ON" + fi + + if [[ -z "$ENABLE_MPD" ]]; then + read -r -p "$(msg "Include support for \"internal/mpd\" (requires libmpdclient) ----- [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && ENABLE_MPD="OFF" || ENABLE_MPD="ON" + fi + + if [[ -z "$ENABLE_CURL" ]]; then + read -r -p "$(msg "Include support for \"internal/github\" (requires libcurl) ------- [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && ENABLE_CURL="OFF" || ENABLE_CURL="ON" + fi + + if [[ -z "$ENABLE_IPC_MSG" ]]; then + read -r -p "$(msg "Build \"polybar-msg\" used to send ipc messages ------------------ [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && ENABLE_IPC_MSG="OFF" || ENABLE_IPC_MSG="ON" + fi + + if [[ -z "$JOB_COUNT" ]]; then + read -r -p "$(msg "Parallelize the build using make -j$(nproc) --------------------------- [y/N]: ")" -n 1 p && echo + [[ "${p^^}" != "Y" ]] && JOB_COUNT=1 || JOB_COUNT=$(nproc) + fi + + + CXX="c++" + + if [[ "$USE_GCC" == OFF ]]; then + if command -v clang++ >/dev/null; then + msg "Using compiler: clang++/clang" + CXX="clang++" + elif command -v g++ >/dev/null; then + msg "Using compiler: g++/gcc" + CXX="g++" + fi + else + CXX="g++" + fi +} + +main() { + [[ -d ./.git ]] && { + msg "Fetching submodules" + git submodule update --init --recursive || msg_err "Failed to clone submodules" + } + + [[ -d ./build ]] && { + if [[ "$REMOVE_BUILD_DIR" == ON ]]; then + msg "Removing existing build dir (-f)" + rm -rf ./build >/dev/null || msg_err "Failed to remove existing build dir" + else + msg "A build dir already exists (pass -f to replace)" + fi + } + + mkdir -p ./build || msg_err "Failed to create build dir" + cd ./build || msg_err "Failed to enter build dir" + + set_build_opts + + msg "Executing cmake command" + cmake \ + -DCMAKE_CXX_COMPILER="${CXX}" \ + -DENABLE_ALSA:BOOL="${ENABLE_ALSA}" \ + -DENABLE_PULSEAUDIO:BOOL="${ENABLE_PULSEAUDIO}"\ + -DENABLE_I3:BOOL="${ENABLE_I3}" \ + -DENABLE_MPD:BOOL="${ENABLE_MPD}" \ + -DENABLE_NETWORK:BOOL="${ENABLE_NETWORK}" \ + -DENABLE_CURL:BOOL="${ENABLE_CURL}" \ + -DBUILD_IPC_MSG:BOOL="${ENABLE_IPC_MSG}" \ + .. || msg_err "Failed to generate build... read output to get a hint of what went wrong" + + msg "Building project" + if [ -z ${JOB_COUNT} ]; then + make || msg_err "Failed to build project" + else + make -j$JOB_COUNT || msg_err "Failed to build project" + fi + install + msg "Build complete!" + + exit 0 +} + + +################# +###### Entry +################# +while [[ "$1" == -* ]]; do + case "$1" in + -3|--i3) + ENABLE_I3=ON; shift ;; + -a|--alsa) + ENABLE_ALSA=ON; shift ;; + -p|--pulseaudio) + ENABLE_PULSEAUDIO=ON; shift ;; + -n|--network) + ENABLE_NETWORK=ON; shift ;; + -m|--mpd) + ENABLE_MPD=ON; shift ;; + -c|--curl) + ENABLE_CURL=ON; shift ;; + -i|--ipc) + ENABLE_IPC_MSG=ON; shift ;; + --all-features) + ENABLE_I3=ON + ENABLE_ALSA=ON + ENABLE_PULSEAUDIO=ON + ENABLE_NETWORK=ON + ENABLE_MPD=ON + ENABLE_CURL=ON + ENABLE_IPC_MSG=ON + shift ;; + + -g|--gcc) + USE_GCC=ON; shift ;; + -j|--jobs) + JOB_COUNT=$(nproc); shift ;; + -f) + REMOVE_BUILD_DIR=ON; shift ;; + -I|--no-install) + INSTALL=OFF; shift ;; + -C|--install-config) + INSTALL_CONF=ON; shift ;; + -A|--auto) + AUTO=ON; shift ;; + -h|--help) + usage + exit 0 + ;; + --) shift; break ;; + *) + usage + [[ "$1" =~ ^-[0-9a-zA-Z]{2,}$ ]] && msg_err "don't combine options: ie do [-c -i] instead of [-ci]" || msg_err "unknown option [$1]" + ;; + esac +done + +main + diff --git a/cmake/01-core.cmake b/cmake/01-core.cmake new file mode 100644 index 0000000..282a559 --- /dev/null +++ b/cmake/01-core.cmake @@ -0,0 +1,93 @@ +# +# Core setup +# + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(THREADS_PREFER_PTHREAD_FLAG ON) + +# Export compile commands used for custom targets +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Set default build type if not specified +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") + message_colored(STATUS "No build type specified; using ${CMAKE_BUILD_TYPE}" 33) +endif() +string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER) + +# Compiler flags +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic") + +if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + # Need dprintf() for FreeBSD 11.1 and older + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WITH_DPRINTF") + # libinotify uses c99 extension, so suppress this error + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c99-extensions") + # Ensures that libraries from dependencies in LOCALBASE are used + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib") +endif() + +if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=parentheses-equality") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-zero-length-array") +endif() + +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g2") + +if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -fdata-sections -ffunction-sections") + set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -Wl,--gc-sections,--icf=safe") +endif() + +# Check compiler +if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.4.0") + message_colored(FATAL_ERROR "Compiler not supported (Requires clang-3.4+ or gcc-5.1+)" 31) + else() + message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" 32) + endif() +elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.1.0") + message_colored(FATAL_ERROR "Compiler not supported (Requires clang-3.4+ or gcc-5.1+)" 31) + else() + message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" 32) + endif() +else() + message_colored(WARNING "Using unsupported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION} !" 31) +endif() + +# Set compiler and linker flags for preferred C++ library +if(CXXLIB_CLANG) + message_colored(STATUS "Linking against libc++" 32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++ -lc++abi") +elseif(CXXLIB_GCC) + message_colored(STATUS "Linking against libstdc++" 32) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++") +endif() + +# Custom build type ; SANITIZE +SET(CMAKE_CXX_FLAGS_SANITIZE "-O0 -g -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls" + CACHE STRING "Flags used by the C++ compiler during sanitize builds." FORCE) +SET(CMAKE_EXE_LINKER_FLAGS_SANITIZE "" + CACHE STRING "Flags used for linking binaries during sanitize builds." FORCE) +SET(CMAKE_SHARED_LINKER_FLAGS_SANITIZE "" + CACHE STRING "Flags used by the shared libraries linker during sanitize builds." FORCE) +MARK_AS_ADVANCED( + CMAKE_CXX_FLAGS_SANITIZE + CMAKE_EXE_LINKER_FLAGS_SANITIZE + CMAKE_SHARED_LINKER_FLAGS_SANITIZE) + +# Custom build type ; Coverage +SET(CMAKE_CXX_FLAGS_COVERAGE + "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_COVERAGE} --coverage") +SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE + "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${CMAKE_EXE_LINKER_FLAGS_COVERAGE}") +SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE + "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${CMAKE_SHARED_LINKER_FLAGS_COVERAGE}") diff --git a/cmake/02-opts.cmake b/cmake/02-opts.cmake new file mode 100644 index 0000000..6aa7b7b --- /dev/null +++ b/cmake/02-opts.cmake @@ -0,0 +1,82 @@ +# +# Build options +# +set(SPHINX_BUILD "sphinx-build" CACHE STRING "Name/Path of the sphinx-build executable to use.") +checklib(BUILD_DOC "binary" "${SPHINX_BUILD}") + +checklib(ENABLE_ALSA "pkg-config" alsa) +checklib(ENABLE_CURL "pkg-config" libcurl) +checklib(ENABLE_I3 "binary" i3) +checklib(ENABLE_MPD "pkg-config" libmpdclient) +checklib(WITH_LIBNL "pkg-config" libnl-genl-3.0) +if(WITH_LIBNL) + checklib(ENABLE_NETWORK "pkg-config" libnl-genl-3.0) + set(WIRELESS_LIB "libnl") +else() + checklib(ENABLE_NETWORK "cmake" Libiw) + set(WIRELESS_LIB "wireless-tools") +endif() +checklib(ENABLE_PULSEAUDIO "pkg-config" libpulse) +checklib(WITH_XKB "pkg-config" xcb-xkb) +checklib(WITH_XRM "pkg-config" xcb-xrm) +checklib(WITH_XRANDR_MONITORS "pkg-config" "xcb-randr>=1.12") +checklib(WITH_XCURSOR "pkg-config" "xcb-cursor") + +if(NOT DEFINED ENABLE_CCACHE AND CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG) + set(ENABLE_CCACHE ON) +endif() + +option(CXXLIB_CLANG "Link against libc++" OFF) +option(CXXLIB_GCC "Link against stdlibc++" OFF) + +option(BUILD_IPC_MSG "Build ipc messager" ON) +option(BUILD_TESTS "Build testsuite" OFF) +option(BUILD_DOC "Build documentation" ON) + +option(ENABLE_ALSA "Enable alsa support" ON) +option(ENABLE_CURL "Enable curl support" ON) +option(ENABLE_I3 "Enable i3 support" ON) +option(ENABLE_MPD "Enable mpd support" ON) +option(WITH_LIBNL "Use netlink interface for wireless" ON) +option(ENABLE_NETWORK "Enable network support" ON) +option(ENABLE_XKEYBOARD "Enable xkeyboard support" ON) +option(ENABLE_PULSEAUDIO "Enable PulseAudio support" ON) + +option(WITH_XRANDR "xcb-randr support" ON) +option(WITH_XRANDR_MONITORS "xcb-randr monitor support" ON) +option(WITH_XCOMPOSITE "xcb-composite support" ON) +option(WITH_XKB "xcb-xkb support" ON) +option(WITH_XRM "xcb-xrm support" ON) +option(WITH_XCURSOR "xcb-cursor support" ON) + +option(DEBUG_LOGGER "Trace logging" ON) + +if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG) + option(DEBUG_LOGGER_VERBOSE "Trace logging (verbose)" OFF) + option(DEBUG_HINTS "Debug clickable areas" OFF) + option(DEBUG_WHITESPACE "Debug whitespace" OFF) + option(DEBUG_FONTCONFIG "Debug fontconfig" OFF) +endif() + +set(SETTING_ALSA_SOUNDCARD "default" + CACHE STRING "Name of the ALSA soundcard driver") +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_CONNECTION_TEST_IP "8.8.8.8" + CACHE STRING "Address to ping when testing network connection") +set(SETTING_PATH_ADAPTER "/sys/class/power_supply/%adapter%" + CACHE STRING "Path to adapter") +set(SETTING_PATH_BACKLIGHT "/sys/class/backlight/%card%" + CACHE STRING "Path to backlight sysfs folder") +set(SETTING_PATH_BATTERY "/sys/class/power_supply/%battery%" + CACHE STRING "Path to battery") +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") +set(SETTING_PATH_MESSAGING_FIFO "/tmp/polybar_mqueue.%pid%" + CACHE STRING "Path to file containing the current temperature") +set(SETTING_PATH_TEMPERATURE_INFO "/sys/class/thermal/thermal_zone%zone%/temp" + CACHE STRING "Path to file containing the current temperature") diff --git a/cmake/03-libs.cmake b/cmake/03-libs.cmake new file mode 100644 index 0000000..1d620e9 --- /dev/null +++ b/cmake/03-libs.cmake @@ -0,0 +1,30 @@ +# +# Check libraries +# + +find_package(Threads REQUIRED) +list(APPEND libs ${CMAKE_THREAD_LIBS_INIT}) + +querylib(TRUE "pkg-config" cairo-fc libs dirs) + +querylib(ENABLE_ALSA "pkg-config" alsa libs dirs) +querylib(ENABLE_CURL "pkg-config" libcurl libs dirs) +querylib(ENABLE_MPD "pkg-config" libmpdclient libs dirs) +if(WITH_LIBNL) + querylib(ENABLE_NETWORK "pkg-config" libnl-genl-3.0 libs dirs) +else() + querylib(ENABLE_NETWORK "cmake" Libiw libs dirs) +endif() +querylib(ENABLE_PULSEAUDIO "pkg-config" libpulse libs dirs) + +querylib(WITH_XCOMPOSITE "pkg-config" xcb-composite libs dirs) +querylib(WITH_XKB "pkg-config" xcb-xkb libs dirs) +querylib(WITH_XRANDR "pkg-config" xcb-randr libs dirs) +querylib(WITH_XRANDR_MONITORS "pkg-config" "xcb-randr>=1.12" libs dirs) +querylib(WITH_XRM "pkg-config" xcb-xrm libs dirs) +querylib(WITH_XCURSOR "pkg-config" xcb-cursor libs dirs) + +# FreeBSD Support +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + querylib(TRUE "pkg-config" libinotify libs dirs) +endif() diff --git a/cmake/04-targets.cmake b/cmake/04-targets.cmake new file mode 100644 index 0000000..b1d6c3b --- /dev/null +++ b/cmake/04-targets.cmake @@ -0,0 +1,76 @@ +# +# Custom targets +# + +# Target: userconfig {{{ + +configure_file( + ${PROJECT_SOURCE_DIR}/cmake/templates/userconfig.cmake.in + ${PROJECT_BINARY_DIR}/cmake/userconfig.cmake + ESCAPE_QUOTES @ONLY) + +add_custom_target(userconfig + DEPENDS ${PROJECT_NAME} + COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/cmake/userconfig.cmake) + +# }}} +# Target: uninstall {{{ + +configure_file( + ${PROJECT_SOURCE_DIR}/cmake/templates/uninstall.cmake.in + ${PROJECT_BINARY_DIR}/cmake/uninstall.cmake + ESCAPE_QUOTES @ONLY) + +add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/cmake/uninstall.cmake) + +# }}} + +# folders where the clang tools should operate +set(CLANG_SEARCH_PATHS ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/tests) + +# Target: codeformat (clang-format) {{{ + +add_custom_target(codeformat) +add_custom_command(TARGET codeformat + COMMAND ${PROJECT_SOURCE_DIR}/common/clang-format.sh ${CLANG_SEARCH_PATHS}) + +# }}} +# Target: codecheck (clang-tidy) {{{ + +add_custom_target(codecheck) +add_custom_command(TARGET codecheck + COMMAND ${PROJECT_SOURCE_DIR}/common/clang-tidy.sh + ${PROJECT_BINARY_DIR} ${CLANG_SEARCH_PATHS}) + +# }}} +# Target: codecheck-fix (clang-tidy + clang-format) {{{ + +add_custom_target(codecheck-fix) +add_custom_command(TARGET codecheck-fix + COMMAND ${PROJECT_SOURCE_DIR}/common/clang-tidy.sh + ${PROJECT_BINARY_DIR} -fix ${CLANG_SEARCH_PATHS}) + +# }}} + +# Target: memcheck (valgrind) {{{ + +add_custom_target(memcheck) +add_custom_command(TARGET memcheck + COMMAND valgrind + --leak-check=summary + --suppressions=${PROJECT_SOURCE_DIR}/.valgrind-suppressions + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME} + example --config=${PROJECT_SOURCE_DIR}/doc/config) + +add_custom_target(memcheck-full) +add_custom_command(TARGET memcheck-full + COMMAND valgrind + --leak-check=full + --track-origins=yes + --track-fds=yes + --suppressions=${PROJECT_SOURCE_DIR}/.valgrind-suppressions + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME} + example --config=${PROJECT_SOURCE_DIR}/doc/config) + +# }}} diff --git a/cmake/05-summary.cmake b/cmake/05-summary.cmake new file mode 100644 index 0000000..ddcb2b0 --- /dev/null +++ b/cmake/05-summary.cmake @@ -0,0 +1,49 @@ +# +# Output build summary +# + +message(STATUS " Build:") +message_colored(STATUS " Version: ${APP_VERSION}" "32;1") +message_colored(STATUS " Type: ${CMAKE_BUILD_TYPE}" "37;2") +message_colored(STATUS " CXX: ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}" "37;2") +message_colored(STATUS " LD: ${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}" "37;2") + +message(STATUS " Install Paths:") +message_colored(STATUS " PREFIX: ${CMAKE_INSTALL_PREFIX}" "32") +message_colored(STATUS " BINDIR: ${CMAKE_INSTALL_FULL_BINDIR}" "32") +message_colored(STATUS " DATADIR: ${CMAKE_INSTALL_FULL_DATADIR}" "32") +message_colored(STATUS " DOCDIR: ${CMAKE_INSTALL_FULL_DOCDIR}" "32") +message_colored(STATUS " MANDIR: ${CMAKE_INSTALL_FULL_MANDIR}" "32") + +message(STATUS " Targets:") +colored_option(" polybar-msg" BUILD_IPC_MSG) +colored_option(" testsuite" BUILD_TESTS) +colored_option(" documentation" BUILD_DOC) + +message(STATUS " Module support:") +colored_option(" alsa" ENABLE_ALSA) +colored_option(" curl" ENABLE_CURL) +colored_option(" i3" ENABLE_I3) +colored_option(" mpd" ENABLE_MPD) +colored_option(" network (${WIRELESS_LIB})" ENABLE_NETWORK) +colored_option(" pulseaudio" ENABLE_PULSEAUDIO) +colored_option(" xkeyboard" WITH_XKB) + +message(STATUS " X extensions:") +colored_option(" xcb-randr" WITH_XRANDR) +colored_option(" xcb-randr (monitor support)" WITH_XRANDR_MONITORS) +colored_option(" xcb-composite" WITH_XCOMPOSITE) +colored_option(" xcb-xkb" WITH_XKB) +colored_option(" xcb-xrm" WITH_XRM) +colored_option(" xcb-cursor" WITH_XCURSOR) + +message(STATUS " Log options:") +colored_option(" Trace logging" DEBUG_LOGGER) + +if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG) + message(STATUS " Debug options:") + colored_option(" Trace logging (verbose)" DEBUG_LOGGER_VERBOSE) + colored_option(" Draw clickable areas" DEBUG_HINTS) + colored_option(" Print fc-match details" DEBUG_FONTCONFIG) + colored_option(" Enable window shading" DEBUG_SHADED) +endif() diff --git a/cmake/common/utils.cmake b/cmake/common/utils.cmake new file mode 100644 index 0000000..bc3cb7a --- /dev/null +++ b/cmake/common/utils.cmake @@ -0,0 +1,120 @@ +# +# Collection of cmake utility functions +# + +# message_colored {{{ + +function(message_colored message_level text color) + string(ASCII 27 esc) + message(${message_level} "${esc}[${color}m${text}${esc}[0m") +endfunction() + +# }}} +# colored_option {{{ + +function(colored_option text flag) + # Append version of option, if ${flag}_VERSION is set + set(version ${${flag}_VERSION}) + + if(NOT "${version}" STREQUAL "") + set(text "${text} (${version})") + endif() + + if(${flag}) + message_colored(STATUS "[X]${text}" "32;1") + else() + message_colored(STATUS "[ ]${text}" "37;2") + endif() +endfunction() + +# }}} + +# queryfont {{{ + +function(queryfont output_variable fontname) + set(multi_value_args FIELDS) + cmake_parse_arguments(ARG "" "" "${multi_value_args}" ${ARGN}) + + find_program(BIN_FCLIST fc-list) + if(NOT BIN_FCLIST) + message_colored(WARNING "Failed to locate `fc-list`" "33;1") + return() + endif() + + string(REPLACE ";" " " FIELDS "${ARG_FIELDS}") + if(NOT FIELDS) + set(FIELDS family) + endif() + + execute_process( + COMMAND sh -c "${BIN_FCLIST} : ${FIELDS}" + RESULT_VARIABLE status + OUTPUT_VARIABLE output + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + STRING(REGEX REPLACE ";" "\\\\;" output "${output}") + STRING(REGEX REPLACE "\n" ";" output "${output}") + STRING(TOLOWER "${output}" output) + + foreach(match LISTS ${output}) + if(${match} MATCHES ".*${fontname}.*$") + list(APPEND matches ${match}) + endif() + endforeach() + + if(matches) + list(GET matches 0 fst_match) + set(${output_variable} "${fst_match}" PARENT_SCOPE) + message(STATUS "Found font: ${fst_match}") + else() + message_colored(STATUS "Font not found: ${fontname}" "33;1") + endif() +endfunction() + +# }}} +# querylib {{{ + +function(querylib flag type pkg out_library out_include_dirs) + if(${flag}) + if(${type} STREQUAL "cmake") + find_package(${pkg} REQUIRED) + string(TOUPPER ${pkg} pkg_upper) + list(APPEND ${out_library} ${${pkg_upper}_LIBRARY}) + list(APPEND ${out_include_dirs} ${${pkg_upper}_INCLUDE_DIR}) + elseif(${type} STREQUAL "pkg-config") + find_package(PkgConfig REQUIRED) + pkg_check_modules(PKG_${flag} REQUIRED ${pkg}) + + # Set packet version so that it can be used in the summary + set(${flag}_VERSION ${PKG_${flag}_VERSION} PARENT_SCOPE) + list(APPEND ${out_library} ${PKG_${flag}_LIBRARIES}) + list(APPEND ${out_include_dirs} ${PKG_${flag}_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "Invalid lookup type '${type}'") + endif() + set(${out_library} ${${out_library}} PARENT_SCOPE) + set(${out_include_dirs} ${${out_include_dirs}} PARENT_SCOPE) + endif() +endfunction() + +# }}} +# checklib {{{ + +function(checklib flag type pkg) + if(NOT DEFINED ${flag}) + if(${type} STREQUAL "cmake") + find_package(${pkg} QUIET) + set(${flag} ${${pkg}_FOUND} CACHE BOOL "") + elseif(${type} STREQUAL "pkg-config") + find_package(PkgConfig REQUIRED) + pkg_check_modules(PKG_${flag} QUIET ${pkg}) + set(${flag} ${PKG_${flag}_FOUND} CACHE BOOL "") + elseif(${type} STREQUAL "binary") + find_program(BIN_${flag} ${pkg}) + set(${flag} ${BIN_${flag}} CACHE BOOL "") + else() + message(FATAL_ERROR "Invalid lookup type '${type}'") + endif() + endif() +endfunction() + +# }}} diff --git a/cmake/modules/FindLibiw.cmake b/cmake/modules/FindLibiw.cmake new file mode 100644 index 0000000..c69b941 --- /dev/null +++ b/cmake/modules/FindLibiw.cmake @@ -0,0 +1,17 @@ +# This module defines +# LIBIW_FOUND - whether the libiw library was found +# LIBIW_LIBRARIES - the libiw library +# LIBIW_INCLUDE_DIR - the include path of the libiw library + +find_library(LIBIW_LIBRARY iw) + +if(LIBIW_LIBRARY) + set(LIBIW_LIBRARIES ${LIBIW_LIBRARY}) +endif(LIBIW_LIBRARY) + +find_path(LIBIW_INCLUDE_DIR NAMES iwlib.h) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libiw DEFAULT_MSG LIBIW_LIBRARY LIBIW_INCLUDE_DIR) + +mark_as_advanced(LIBIW_INCLUDE_DIR LIBIW_LIBRARY) diff --git a/cmake/templates/uninstall.cmake.in b/cmake/templates/uninstall.cmake.in new file mode 100644 index 0000000..79e6e89 --- /dev/null +++ b/cmake/templates/uninstall.cmake.in @@ -0,0 +1,23 @@ +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() + +file(READ ${INSTALL_MANIFEST} 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() + else() + message(STATUS "File $ENV{DESTDIR}${file} does not exist") + endif() +endforeach() diff --git a/cmake/templates/userconfig.cmake.in b/cmake/templates/userconfig.cmake.in new file mode 100644 index 0000000..9d05c60 --- /dev/null +++ b/cmake/templates/userconfig.cmake.in @@ -0,0 +1,8 @@ +set(USER_CONFIG_HOME "$ENV{XDG_CONFIG_HOME}") +if(NOT USER_CONFIG_HOME) + set(USER_CONFIG_HOME "$ENV{HOME}/.config") +endif() +set(USER_CONFIG_HOME "${USER_CONFIG_HOME}/polybar") + +file(INSTALL "@CMAKE_SOURCE_DIR@/config" + DESTINATION "${USER_CONFIG_HOME}") diff --git a/common/ci/configure.sh b/common/ci/configure.sh new file mode 100755 index 0000000..9071874 --- /dev/null +++ b/common/ci/configure.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +set -eo pipefail + +if [ -d "$BUILD_DIR" ]; then + rm -Rf "$BUILD_DIR" +fi + +mkdir -p "${BUILD_DIR}" +cd "${BUILD_DIR}" + +if [ "$POLYBAR_BUILD_TYPE" != "minimal" ]; then + ENABLE_PULSEAUDIO=ON + ENABLE_NETWORK=ON + ENABLE_MPD=ON + ENABLE_CURL=ON + ENABLE_ALSA=ON + ENABLE_I3=ON + WITH_XRM=ON + WITH_XKB=ON + WITH_XRANDR_MONITORS=ON + WITH_XCURSOR=ON +fi + +if [ "$POLYBAR_BUILD_TYPE" = "tests" ]; then + BUILD_TESTS=ON +fi + +cmake \ + -DCMAKE_CXX_COMPILER="${CXX}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS} -Werror" \ + -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \ + -DBUILD_TESTS:BOOL="${BUILD_TESTS:-OFF}" \ + -DBUILD_DOC:BOOL="${BUILD_DOC:-OFF}" \ + -DWITH_XRANDR=ON \ + -DENABLE_PULSEAUDIO="${ENABLE_PULSEAUDIO:-OFF}" \ + -DENABLE_NETWORK="${ENABLE_NETWORK:-OFF}" \ + -DENABLE_MPD="${ENABLE_MPD:-OFF}" \ + -DENABLE_CURL="${ENABLE_CURL:-OFF}" \ + -DENABLE_ALSA="${ENABLE_ALSA:-OFF}" \ + -DENABLE_I3="${ENABLE_I3:-OFF}" \ + -DWITH_XRM="${WITH_XRM:-OFF}" \ + -DWITH_XKB="${WITH_XKB:-OFF}" \ + -DWITH_XRANDR_MONITORS="${WITH_XRANDR_MONITORS:-OFF}" \ + -DWITH_XCURSOR="${WITH_XCURSOR:-OFF}" \ + .. diff --git a/common/ci/summary.sh b/common/ci/summary.sh new file mode 100755 index 0000000..a6bfcf8 --- /dev/null +++ b/common/ci/summary.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -eo pipefail + +set -x + +"${CXX}" --version +cmake --version + +set +x + +echo "PATH=${PATH}" +echo "CXX=${CXX}" +echo "CXXFLAGS=${CXXFLAGS}" +echo "LDFLAGS=${LDFLAGS}" +echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" +echo "MAKEFLAGS=${MAKEFLAGS}" +echo "POLYBAR_BUILD_TYPE=${POLYBAR_BUILD_TYPE}" +echo "CMAKE_BUILD_TYPE=${BUILD_TYPE}" diff --git a/common/clang-format.sh b/common/clang-format.sh new file mode 100755 index 0000000..0a912c8 --- /dev/null +++ b/common/clang-format.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +main() { + if [ $# -lt 1 ]; then + echo "$0 DIR..." 1>&2 + exit 1 + fi + + # Search paths + search="${*:-.}" + + echo "$0 in $search" + + # shellcheck disable=2086 + find $search -regex ".*.[c|h]pp" \ + -exec printf "\\033[32;1m** \\033[0mFormatting %s\\n" {} \; \ + -exec clang-format -style=file -i {} \; +} + +main "$@" diff --git a/common/clang-tidy.sh b/common/clang-tidy.sh new file mode 100755 index 0000000..f0de51f --- /dev/null +++ b/common/clang-tidy.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +main() { + if [ $# -lt 2 ]; then + echo "$0 build_path [-fix] DIR..." 1>&2 + exit 1 + fi + + args="-p $1"; shift + + if [ "$1" = "-fix" ]; then + args="${args} -fix"; shift + fi + + # Search paths + search="${*:-.}" + + echo "$0 in $search" + + # shellcheck disable=2086 + find $search -iname "*.cpp" \ + -exec printf "\\033[32;1m** \\033[0mProcessing %s\\n" {} \; \ + -exec clang-tidy $args {} \; +} + +main "$@" diff --git a/common/release-archive.sh b/common/release-archive.sh new file mode 100755 index 0000000..222dc57 --- /dev/null +++ b/common/release-archive.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +set -euo pipefail + +git_url="https://github.com/polybar/polybar.git" +wd="$(realpath .)" + +usage() { + cat </dev/null + +find . -type d -name ".git" -exec rm -rf {} \+ + +cd "$tmp_dir" +tar cf "$archive" "polybar" +sha256sum "$archive" diff --git a/config.cmake b/config.cmake new file mode 100644 index 0000000..004bbdb --- /dev/null +++ b/config.cmake @@ -0,0 +1,423 @@ +;========================================================== +; +; +; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ +; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ +; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ +; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ +; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ +; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ +; +; +; To learn more about how to configure Polybar +; go to https://github.com/polybar/polybar +; +; The README contains a lot of information +; +;========================================================== + +[colors] +;background = ${xrdb:color0:#222} +background = #222 +background-alt = #444 +;foreground = ${xrdb:color7:#222} +foreground = #dfdfdf +foreground-alt = #555 +primary = #ffb52a +secondary = #e60053 +alert = #bd2c40 + +[bar/example] +;monitor = ${env:MONITOR:HDMI-1} +width = 100% +height = 27 +;offset-x = 1% +;offset-y = 1% +radius = 6.0 +fixed-center = false + +background = ${colors.background} +foreground = ${colors.foreground} + +line-size = 3 +line-color = #f00 + +border-size = 4 +border-color = #00000000 + +padding-left = 0 +padding-right = 2 + +module-margin-left = 1 +module-margin-right = 2 + +font-0 = @FONT_FIXED@;1 +font-1 = @FONT_UNIFONT@:size=8:antialias=false;0 +font-2 = @FONT_SIJI@;1 + +modules-left = @MODULES_LEFT@ +modules-center = @MODULES_CENTER@ +modules-right = @MODULES_RIGHT@ + +tray-position = right +tray-padding = 2 +;tray-background = #0063ff + +;wm-restack = bspwm +;wm-restack = i3 + +;override-redirect = true + +;scroll-up = bspwm-desknext +;scroll-down = bspwm-deskprev + +;scroll-up = i3wm-wsnext +;scroll-down = i3wm-wsprev + +cursor-click = pointer +cursor-scroll = ns-resize + +[module/xwindow] +type = internal/xwindow +label = %title:0:30:...% + +[module/xkeyboard] +type = internal/xkeyboard +blacklist-0 = num lock + +format-prefix = " " +format-prefix-foreground = ${colors.foreground-alt} +format-prefix-underline = ${colors.secondary} + +label-layout = %layout% +label-layout-underline = ${colors.secondary} + +label-indicator-padding = 2 +label-indicator-margin = 1 +label-indicator-background = ${colors.secondary} +label-indicator-underline = ${colors.secondary} + +[module/filesystem] +type = internal/fs +interval = 25 + +mount-0 = / + +label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%% +label-unmounted = %mountpoint% not mounted +label-unmounted-foreground = ${colors.foreground-alt} + +[module/bspwm] +type = internal/bspwm + +label-focused = %index% +label-focused-background = ${colors.background-alt} +label-focused-underline= ${colors.primary} +label-focused-padding = 2 + +label-occupied = %index% +label-occupied-padding = 2 + +label-urgent = %index%! +label-urgent-background = ${colors.alert} +label-urgent-padding = 2 + +label-empty = %index% +label-empty-foreground = ${colors.foreground-alt} +label-empty-padding = 2 + +; Separator in between workspaces +; label-separator = | + +[module/i3] +type = internal/i3 +format = +index-sort = true +wrapping-scroll = false + +; Only show workspaces on the same output as the bar +;pin-workspaces = true + +label-mode-padding = 2 +label-mode-foreground = #000 +label-mode-background = ${colors.primary} + +; focused = Active workspace on focused monitor +label-focused = %index% +label-focused-background = ${colors.background-alt} +label-focused-underline= ${colors.primary} +label-focused-padding = 2 + +; unfocused = Inactive workspace on any monitor +label-unfocused = %index% +label-unfocused-padding = 2 + +; visible = Active workspace on unfocused monitor +label-visible = %index% +label-visible-background = ${self.label-focused-background} +label-visible-underline = ${self.label-focused-underline} +label-visible-padding = ${self.label-focused-padding} + +; urgent = Workspace with urgency hint set +label-urgent = %index% +label-urgent-background = ${colors.alert} +label-urgent-padding = 2 + +; Separator in between workspaces +; label-separator = | + + +[module/mpd] +type = internal/mpd +format-online = + +icon-prev =  +icon-stop =  +icon-play =  +icon-pause =  +icon-next =  + +label-song-maxlen = 25 +label-song-ellipsis = true + +[module/xbacklight] +type = internal/xbacklight + +format =