├── doc ├── _static │ └── .gitignore ├── .gitignore ├── index.rst ├── README.md ├── man │ └── polybar.1.rst └── CMakeLists.txt ├── src ├── events │ ├── signal_receiver.cpp │ └── signal_emitter.cpp ├── utils │ ├── factory.cpp │ ├── env.cpp │ ├── concurrency.cpp │ ├── throttle.cpp │ ├── actions.cpp │ ├── http.cpp │ ├── i3.cpp │ ├── io.cpp │ └── inotify.cpp ├── x11 │ ├── registry.cpp │ ├── xresources.cpp │ ├── extensions │ │ └── composite.cpp │ ├── cursor.cpp │ ├── icccm.cpp │ └── window.cpp ├── modules │ ├── counter.cpp │ ├── systray.cpp │ └── text.cpp ├── drawtypes │ ├── iconset.cpp │ ├── animation.cpp │ └── ramp.cpp ├── components │ └── ipc.cpp └── settings.cpp.cmake ├── tests ├── common │ └── test.hpp ├── unit_tests │ ├── utils │ │ ├── file.cpp │ │ ├── scope.cpp │ │ ├── memory.cpp │ │ ├── process.cpp │ │ ├── command.cpp │ │ └── actions.cpp │ ├── drawtypes │ │ ├── iconset.cpp │ │ └── ramp.cpp │ └── components │ │ └── bar.cpp ├── CMakeLists.txt.in └── CMakeLists.txt ├── banner.png ├── dwm-module.png ├── .gitignore ├── version.txt ├── contrib ├── bash │ ├── CMakeLists.txt │ └── polybar ├── zsh │ ├── CMakeLists.txt │ ├── _polybar_msg │ └── _polybar ├── polybar-dwm-module.aur │ ├── polybar-dwm-module.install │ └── PKGBUILD └── vim │ ├── ftplugin │ ├── cpp.vim │ └── dosini.vim │ └── autoload │ └── ft │ └── cpphpp.vim ├── include ├── utils │ ├── functional.hpp │ ├── env.hpp │ ├── time.hpp │ ├── http.hpp │ ├── io.hpp │ ├── mixins.hpp │ ├── bspwm.hpp │ ├── process.hpp │ ├── actions.hpp │ ├── i3.hpp │ ├── inotify.hpp │ ├── factory.hpp │ ├── scope.hpp │ ├── memory.hpp │ ├── socket.hpp │ ├── concurrency.hpp │ ├── color.hpp │ └── throttle.hpp ├── cairo │ ├── fwd.hpp │ ├── types.hpp │ ├── utils.hpp │ └── surface.hpp ├── x11 │ ├── extensions │ │ ├── all.hpp │ │ ├── fwd.hpp │ │ ├── composite.hpp │ │ └── randr.hpp │ ├── registry.hpp │ ├── icccm.hpp │ ├── window.hpp │ ├── cursor.hpp │ ├── tray_client.hpp │ ├── xembed.hpp │ ├── ewmh.hpp │ ├── atoms.hpp │ └── xresources.hpp ├── modules │ ├── text.hpp │ ├── counter.hpp │ ├── meta │ │ ├── static_module.hpp │ │ ├── event_handler.hpp │ │ ├── event_module.hpp │ │ ├── timer_module.hpp │ │ └── inotify_module.hpp │ ├── systray.hpp │ ├── date.hpp │ ├── github.hpp │ ├── temperature.hpp │ ├── ipc.hpp │ ├── menu.hpp │ ├── script.hpp │ ├── backlight.hpp │ ├── xwindow.hpp │ ├── pulseaudio.hpp │ ├── cpu.hpp │ ├── xbacklight.hpp │ ├── memory.hpp │ ├── network.hpp │ ├── alsa.hpp │ ├── fs.hpp │ ├── xkeyboard.hpp │ ├── bspwm.hpp │ └── i3.hpp ├── drawtypes │ ├── iconset.hpp │ ├── ramp.hpp │ ├── progressbar.hpp │ ├── animation.hpp │ └── label.hpp ├── CMakeLists.txt ├── common.hpp ├── adapters │ ├── alsa │ │ ├── control.hpp │ │ ├── mixer.hpp │ │ └── generic.hpp │ └── pulseaudio.hpp ├── tags │ ├── dispatch.hpp │ └── types.hpp ├── errors.hpp ├── components │ ├── ipc.hpp │ ├── screen.hpp │ ├── taskqueue.hpp │ ├── command_line.hpp │ └── builder.hpp ├── events │ ├── types.hpp │ ├── signal_receiver.hpp │ └── signal_fwd.hpp ├── debug.hpp └── settings.hpp.cmake ├── .editorconfig ├── cmake ├── templates │ ├── userconfig.cmake.in │ └── uninstall.cmake.in ├── modules │ └── FindLibiw.cmake ├── 03-libs.cmake ├── 05-summary.cmake └── 04-targets.cmake ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature_request.md │ ├── build.md │ └── bug_report.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── ci.yml ├── .gitmodules ├── .clang-format ├── common ├── ci │ ├── summary.sh │ └── configure.sh ├── clang-format.sh └── clang-tidy.sh ├── .codecov.yml ├── lib └── CMakeLists.txt ├── LICENSE ├── SUPPORT.md ├── .clang-tidy └── .valgrind-suppressions /doc/_static/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /src/events/signal_receiver.cpp: -------------------------------------------------------------------------------- 1 | #include "events/signal_receiver.hpp" 2 | -------------------------------------------------------------------------------- /tests/common/test.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "gtest/gtest.h" 4 | -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mihirlad55/polybar-dwm-module/HEAD/banner.png -------------------------------------------------------------------------------- /dwm-module.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mihirlad55/polybar-dwm-module/HEAD/dwm-module.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /tags 3 | /compile_commands.json 4 | /config 5 | *.bak 6 | *.pyc 7 | *.swp 8 | *.tmp 9 | .tags 10 | 11 | polybar-*.tar 12 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | # Polybar version information 2 | # Update this on every release 3 | # This is used to create the version string if a git repo is not available 4 | 3.5.2 5 | -------------------------------------------------------------------------------- /contrib/bash/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Bash completion template 3 | # 4 | install(FILES polybar 5 | DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions 6 | COMPONENT tools) 7 | -------------------------------------------------------------------------------- /contrib/zsh/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Zsh completion template 3 | # 4 | install(FILES _polybar _polybar_msg 5 | DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions 6 | COMPONENT tools) 7 | -------------------------------------------------------------------------------- /src/utils/factory.cpp: -------------------------------------------------------------------------------- 1 | #include "utils/factory.hpp" 2 | 3 | POLYBAR_NS 4 | 5 | factory_util::detail::null_deleter factory_util::null_deleter{}; 6 | factory_util::detail::fd_deleter factory_util::fd_deleter{}; 7 | 8 | POLYBAR_NS_END 9 | -------------------------------------------------------------------------------- /include/utils/functional.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "common.hpp" 6 | 7 | POLYBAR_NS 8 | 9 | template 10 | using callback = function; 11 | 12 | POLYBAR_NS_END 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | insert_final_newline = true 5 | trim_trailing_whitespace = true 6 | indent_style = space 7 | indent_size = 2 8 | charset = utf-8 9 | 10 | [Makefile] 11 | indent_style = tab 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /include/utils/env.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common.hpp" 4 | 5 | POLYBAR_NS 6 | 7 | namespace env_util { 8 | bool has(const string& var); 9 | string get(const string& var, string fallback = ""); 10 | } 11 | 12 | POLYBAR_NS_END 13 | -------------------------------------------------------------------------------- /include/cairo/fwd.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common.hpp" 4 | 5 | POLYBAR_NS 6 | 7 | namespace cairo { 8 | class context; 9 | class surface; 10 | class xcb_surface; 11 | class font; 12 | class font_fc; 13 | } 14 | 15 | POLYBAR_NS_END 16 | -------------------------------------------------------------------------------- /include/x11/extensions/all.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "settings.hpp" 4 | 5 | #if WITH_XRANDR 6 | #include "x11/extensions/randr.hpp" 7 | #endif 8 | #include "x11/extensions/composite.hpp" 9 | #if WITH_XKB 10 | #include "x11/extensions/xkb.hpp" 11 | #endif 12 | -------------------------------------------------------------------------------- /cmake/templates/userconfig.cmake.in: -------------------------------------------------------------------------------- 1 | set(USER_CONFIG_HOME "$ENV{XDG_CONFIG_HOME}") 2 | if(NOT USER_CONFIG_HOME) 3 | set(USER_CONFIG_HOME "$ENV{HOME}/.config") 4 | endif() 5 | set(USER_CONFIG_HOME "${USER_CONFIG_HOME}/polybar") 6 | 7 | file(INSTALL "@CMAKE_SOURCE_DIR@/config" 8 | DESTINATION "${USER_CONFIG_HOME}") 9 | -------------------------------------------------------------------------------- /src/x11/registry.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "x11/connection.hpp" 4 | #include "x11/extensions/all.hpp" 5 | #include "x11/registry.hpp" 6 | 7 | POLYBAR_NS 8 | 9 | registry::registry(connection& conn) : xpp::event::registry(conn) {} 10 | 11 | POLYBAR_NS_END 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Polybar Gitter Room 4 | url: https://gitter.im/polybar/polybar 5 | about: Please ask and answer questions here. 6 | - name: Polybar subreddit 7 | url: https://www.reddit.com/r/polybar 8 | about: Please ask and answer questions here. 9 | -------------------------------------------------------------------------------- /contrib/polybar-dwm-module.aur/polybar-dwm-module.install: -------------------------------------------------------------------------------- 1 | post_install() { 2 | cat << EOF 3 | 4 | Get started with the example configuration: 5 | 6 | $ install -Dm644 /usr/share/doc/polybar/config \$HOME/.config/polybar/config 7 | $ polybar example 8 | 9 | For more information, see https://github.com/polybar/polybar/wiki 10 | 11 | EOF 12 | } 13 | -------------------------------------------------------------------------------- /contrib/vim/ftplugin/cpp.vim: -------------------------------------------------------------------------------- 1 | " Swap between source/header 2 | nnoremap af :call ft#cpphpp#Swap('edit') 3 | nnoremap as :call ft#cpphpp#Swap('new') 4 | nnoremap av :call ft#cpphpp#Swap('vnew') 5 | 6 | " Code formatting using clang-format 7 | set formatprg=/usr/bin/clang-format 8 | nmap :ClangFormat 9 | -------------------------------------------------------------------------------- /src/x11/xresources.cpp: -------------------------------------------------------------------------------- 1 | #include "x11/xresources.hpp" 2 | 3 | POLYBAR_NS 4 | 5 | template <> 6 | string xresource_manager::convert(string&& value) const { 7 | return forward(value); 8 | } 9 | 10 | template <> 11 | double xresource_manager::convert(string&& value) const { 12 | return std::strtod(value.c_str(), nullptr); 13 | } 14 | 15 | POLYBAR_NS_END 16 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/i3ipcpp"] 2 | path = lib/i3ipcpp 3 | url = https://github.com/polybar/i3ipcpp 4 | branch = master 5 | [submodule "lib/xpp"] 6 | path = lib/xpp 7 | url = https://github.com/polybar/xpp 8 | branch = master 9 | [submodule "lib/dwmipcpp"] 10 | path = lib/dwmipcpp 11 | url = https://github.com/mihirlad55/dwmipcpp 12 | branch = master 13 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | Standard: Cpp11 4 | BasedOnStyle: Google 5 | ColumnLimit: 120 6 | NamespaceIndentation: All 7 | AlignAfterOpenBracket: DontAlign 8 | AllowShortFunctionsOnASingleLine: Empty 9 | AllowShortIfStatementsOnASingleLine: false 10 | BreakConstructorInitializersBeforeComma: true 11 | DerivePointerAlignment: false 12 | PointerAlignment: Left 13 | --- 14 | -------------------------------------------------------------------------------- /include/x11/extensions/fwd.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "settings.hpp" 4 | 5 | namespace xpp { 6 | #if WITH_XRANDR 7 | namespace randr { 8 | class extension; 9 | } 10 | #endif 11 | #if WITH_XCOMPOSITE 12 | namespace composite { 13 | class extension; 14 | } 15 | #endif 16 | #if WITH_XKB 17 | namespace xkb { 18 | class extension; 19 | } 20 | #endif 21 | } 22 | -------------------------------------------------------------------------------- /src/events/signal_emitter.cpp: -------------------------------------------------------------------------------- 1 | #include "events/signal_emitter.hpp" 2 | #include "utils/factory.hpp" 3 | 4 | POLYBAR_NS 5 | 6 | signal_receivers_t g_signal_receivers; 7 | 8 | /** 9 | * Create instance 10 | */ 11 | signal_emitter::make_type signal_emitter::make() { 12 | return static_cast(*factory_util::singleton()); 13 | } 14 | 15 | POLYBAR_NS_END 16 | -------------------------------------------------------------------------------- /common/ci/summary.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | set -x 6 | 7 | "${CXX}" --version 8 | cmake --version 9 | 10 | set +x 11 | 12 | echo "PATH=${PATH}" 13 | echo "CXX=${CXX}" 14 | echo "CXXFLAGS=${CXXFLAGS}" 15 | echo "LDFLAGS=${LDFLAGS}" 16 | echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" 17 | echo "MAKEFLAGS=${MAKEFLAGS}" 18 | echo "POLYBAR_BUILD_TYPE=${POLYBAR_BUILD_TYPE}" 19 | echo "CMAKE_BUILD_TYPE=${BUILD_TYPE}" 20 | -------------------------------------------------------------------------------- /contrib/vim/ftplugin/dosini.vim: -------------------------------------------------------------------------------- 1 | " 2 | " Enables syntax folding for the configuration file. 3 | " Removes the need to clutter the file with fold markers. 4 | " 5 | " Put the file in $VIM/after/syntax/dosini.vim 6 | " 7 | syn region dosiniSection start="^\[" end="\(\n\+\[\)\@=" contains=dosiniLabel,dosiniHeader,dosiniComment keepend fold 8 | setlocal foldmethod=syntax 9 | 10 | " Uncomment to start with folds open 11 | "setlocal foldlevel=20 12 | -------------------------------------------------------------------------------- /include/x11/extensions/composite.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "settings.hpp" 4 | 5 | #if not WITH_XCOMPOSITE 6 | #error "X Composite extension is disabled..." 7 | #endif 8 | 9 | #include 10 | #include 11 | 12 | #include "common.hpp" 13 | 14 | POLYBAR_NS 15 | 16 | // fwd 17 | class connection; 18 | 19 | namespace composite_util { 20 | void query_extension(connection& conn); 21 | } 22 | 23 | POLYBAR_NS_END 24 | -------------------------------------------------------------------------------- /tests/unit_tests/utils/file.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "common/test.hpp" 5 | #include "utils/command.hpp" 6 | #include "utils/file.hpp" 7 | 8 | using namespace polybar; 9 | 10 | TEST(File, expand) { 11 | auto cmd = command_util::make_command("echo $HOME"); 12 | cmd->exec(); 13 | cmd->tail([](string home) { 14 | EXPECT_EQ(home + "/test", file_util::expand("~/test")); 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /common/clang-format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | main() { 4 | if [ $# -lt 1 ]; then 5 | echo "$0 DIR..." 1>&2 6 | exit 1 7 | fi 8 | 9 | # Search paths 10 | search="${*:-.}" 11 | 12 | echo "$0 in $search" 13 | 14 | # shellcheck disable=2086 15 | find $search -regex ".*.[c|h]pp" \ 16 | -exec printf "\\033[32;1m** \\033[0mFormatting %s\\n" {} \; \ 17 | -exec clang-format -style=file -i {} \; 18 | } 19 | 20 | main "$@" 21 | -------------------------------------------------------------------------------- /include/modules/text.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "modules/meta/static_module.hpp" 4 | 5 | POLYBAR_NS 6 | 7 | namespace modules { 8 | class text_module : public static_module { 9 | public: 10 | explicit text_module(const bar_settings&, string); 11 | 12 | void update() {} 13 | string get_format() const; 14 | string get_output(); 15 | 16 | static constexpr auto TYPE = "custom/text"; 17 | }; 18 | } // namespace modules 19 | 20 | POLYBAR_NS_END 21 | -------------------------------------------------------------------------------- /tests/unit_tests/drawtypes/iconset.cpp: -------------------------------------------------------------------------------- 1 | #include "drawtypes/iconset.hpp" 2 | 3 | #include "common/test.hpp" 4 | 5 | using namespace std; 6 | using namespace polybar; 7 | using namespace polybar::drawtypes; 8 | 9 | TEST(IconSet, fuzzyMatchExactMatchFirst) { 10 | iconset_t icons = make_shared(); 11 | 12 | icons->add("1", make_shared