├── doc ├── _static │ ├── .gitignore │ └── default.png ├── .gitignore ├── README.md ├── index.rst ├── man │ └── polybar-msg.1.rst └── CMakeLists.txt ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── config.yml │ └── feature_request.md └── PULL_REQUEST_TEMPLATE.md ├── banner.png ├── src ├── events │ ├── signal_receiver.cpp │ └── signal_emitter.cpp ├── utils │ ├── factory.cpp │ ├── concurrency.cpp │ ├── env.cpp │ ├── io.cpp │ ├── action_router.cpp │ ├── actions.cpp │ ├── http.cpp │ └── i3.cpp ├── x11 │ ├── registry.cpp │ ├── xresources.cpp │ ├── extensions │ │ └── composite.cpp │ ├── cursor.cpp │ ├── icccm.cpp │ └── window.cpp ├── modules │ ├── counter.cpp │ ├── systray.cpp │ └── text.cpp ├── ipc │ ├── encoder.cpp │ └── util.cpp ├── drawtypes │ ├── iconset.cpp │ ├── animation.cpp │ └── ramp.cpp └── settings.cpp.cmake ├── tests ├── common │ └── test.hpp ├── unit_tests │ ├── drawtypes │ │ ├── iconset.cpp │ │ └── ramp.cpp │ ├── utils │ │ ├── scope.cpp │ │ ├── memory.cpp │ │ ├── env.cpp │ │ ├── process.cpp │ │ ├── command.cpp │ │ ├── action_router.cpp │ │ ├── file.cpp │ │ └── actions.cpp │ └── ipc │ │ ├── util.cpp │ │ └── encoder.cpp ├── CMakeLists.txt.in └── CMakeLists.txt ├── .gitignore ├── version.txt ├── contrib ├── bash │ ├── CMakeLists.txt │ └── polybar ├── zsh │ ├── CMakeLists.txt │ ├── _polybar_msg │ └── _polybar ├── vim │ ├── ftplugin │ │ ├── cpp.vim │ │ └── dosini.vim │ └── autoload │ │ └── ft │ │ └── cpphpp.vim ├── polybar.aur │ └── PKGBUILD └── polybar-git.aur │ └── PKGBUILD ├── .gitmodules ├── include ├── utils │ ├── functional.hpp │ ├── env.hpp │ ├── io.hpp │ ├── time.hpp │ ├── factory.hpp │ ├── http.hpp │ ├── mixins.hpp │ ├── concurrency.hpp │ ├── units.hpp │ ├── bspwm.hpp │ ├── process.hpp │ ├── scope.hpp │ ├── actions.hpp │ ├── inotify.hpp │ ├── i3.hpp │ ├── memory.hpp │ ├── socket.hpp │ ├── action_router.hpp │ └── color.hpp ├── cairo │ ├── fwd.hpp │ ├── types.hpp │ ├── utils.hpp │ └── surface.hpp ├── x11 │ ├── extensions │ │ ├── all.hpp │ │ ├── fwd.hpp │ │ ├── composite.hpp │ │ └── randr.hpp │ ├── registry.hpp │ ├── window.hpp │ ├── icccm.hpp │ ├── cursor.hpp │ ├── tray_client.hpp │ ├── ewmh.hpp │ ├── atoms.hpp │ ├── xresources.hpp │ └── xembed.hpp ├── ipc │ ├── encoder.hpp │ ├── util.hpp │ ├── decoder.hpp │ └── msg.hpp ├── modules │ ├── text.hpp │ ├── meta │ │ ├── static_module.hpp │ │ ├── event_handler.hpp │ │ ├── event_module.hpp │ │ └── timer_module.hpp │ ├── counter.hpp │ ├── systray.hpp │ ├── script.hpp │ ├── date.hpp │ ├── github.hpp │ ├── temperature.hpp │ ├── menu.hpp │ ├── xwindow.hpp │ ├── backlight.hpp │ ├── pulseaudio.hpp │ ├── cpu.hpp │ ├── ipc.hpp │ ├── memory.hpp │ ├── xbacklight.hpp │ ├── network.hpp │ ├── alsa.hpp │ ├── fs.hpp │ └── xkeyboard.hpp ├── CMakeLists.txt ├── drawtypes │ ├── iconset.hpp │ ├── layouticonset.hpp │ ├── ramp.hpp │ ├── progressbar.hpp │ └── animation.hpp ├── adapters │ ├── alsa │ │ ├── control.hpp │ │ ├── mixer.hpp │ │ └── generic.hpp │ ├── script_runner.hpp │ └── pulseaudio.hpp ├── events │ ├── signal_fwd.hpp │ └── signal_receiver.hpp ├── errors.hpp ├── common.hpp ├── tags │ ├── dispatch.hpp │ └── context.hpp ├── components │ ├── screen.hpp │ ├── renderer_interface.hpp │ ├── command_line.hpp │ └── builder.hpp ├── debug.hpp └── settings.hpp.cmake ├── .editorconfig ├── cmake ├── modules │ ├── FindLibUV.cmake │ ├── FindALSA.cmake │ ├── FindCURL.cmake │ ├── FindCairoFC.cmake │ ├── FindLibPulse.cmake │ ├── FindLibInotify.cmake │ ├── FindLibNlGenl3.cmake │ ├── FindLibMPDClient.cmake │ ├── FindLibiw.cmake │ └── FindXcb.cmake ├── templates │ └── uninstall.cmake.in ├── 02-opts.cmake ├── 01-core.cmake └── 04-targets.cmake ├── .clang-format ├── common ├── ci │ ├── summary.sh │ └── configure.sh ├── clang-format.sh └── clang-tidy.sh ├── .codecov.yml ├── lib └── CMakeLists.txt ├── LICENSE ├── SUPPORT.md ├── .clang-tidy ├── CMakeLists.txt └── .valgrind-suppressions /doc/_static/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: polybar 2 | open_collective: polybar 3 | -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/polybar/master/banner.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /doc/_static/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Debian/polybar/master/doc/_static/default.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /tags 3 | /compile_commands.json 4 | *.bak 5 | *.pyc 6 | *.swp 7 | *.tmp 8 | .tags 9 | *.user 10 | 11 | polybar-*.tar 12 | -------------------------------------------------------------------------------- /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 | 7 | POLYBAR_NS_END 8 | -------------------------------------------------------------------------------- /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.6.0 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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | #if WITH_XCOMPOSITE 9 | #include "x11/extensions/composite.hpp" 10 | #endif 11 | #if WITH_XKB 12 | #include "x11/extensions/xkb.hpp" 13 | #endif 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/utils/io.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common.hpp" 4 | 5 | POLYBAR_NS 6 | 7 | namespace io_util { 8 | void tail(int read_fd, const function& callback); 9 | 10 | bool poll(int fd, short int events, int timeout_ms = 0); 11 | bool poll_read(int fd, int timeout_ms = 0); 12 | } // namespace io_util 13 | 14 | POLYBAR_NS_END 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/ipc/encoder.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common.hpp" 4 | #include "errors.hpp" 5 | #include "ipc/msg.hpp" 6 | 7 | POLYBAR_NS 8 | 9 | namespace ipc { 10 | vector encode(const type_t type, const vector& data = {}); 11 | vector encode(const type_t type, const string& data); 12 | } // namespace ipc 13 | 14 | POLYBAR_NS_END 15 | -------------------------------------------------------------------------------- /cmake/modules/FindLibUV.cmake: -------------------------------------------------------------------------------- 1 | # This module defines 2 | # LibUV_FOUND 3 | # LibUV_INCLUDE_DIR 4 | # LibUV_INCLUDE_DIRS 5 | # LibUV_LIBRARY 6 | # LibUV_LIBRARIES 7 | # LibUV_VERSION 8 | 9 | find_package_impl("libuv" "LibUV" "uv.h") 10 | 11 | if(LibUV_FOUND AND NOT TARGET LibUV::LibUV) 12 | create_imported_target("LibUV::LibUV" "${LibUV_INCLUDE_DIR}" "${LibUV_LIBRARY}") 13 | endif() 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 | -------------------------------------------------------------------------------- /.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 | SpacesBeforeTrailingComments: 1 14 | --- 15 | -------------------------------------------------------------------------------- /include/ipc/util.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "common.hpp" 4 | 5 | POLYBAR_NS 6 | 7 | namespace ipc { 8 | string get_runtime_path(); 9 | string ensure_runtime_path(); 10 | string get_socket_path(const string& pid_string); 11 | string get_socket_path(int pid); 12 | string get_glob_socket_path(); 13 | int get_pid_from_socket(const string& path); 14 | } // namespace ipc 15 | 16 | POLYBAR_NS_END 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Generate settings.hpp 3 | # 4 | 5 | list(APPEND XPP_EXTENSION_LIST xpp::randr::extension) 6 | list(APPEND XPP_EXTENSION_LIST xpp::composite::extension) 7 | if(WITH_XKB) 8 | list(APPEND XPP_EXTENSION_LIST xpp::xkb::extension) 9 | endif() 10 | string(REPLACE ";" ", " XPP_EXTENSION_LIST "${XPP_EXTENSION_LIST}") 11 | 12 | configure_file( 13 | ${CMAKE_CURRENT_LIST_DIR}/settings.hpp.cmake 14 | ${CMAKE_BINARY_DIR}/generated-sources/settings.hpp 15 | ESCAPE_QUOTES) 16 | -------------------------------------------------------------------------------- /cmake/modules/FindALSA.cmake: -------------------------------------------------------------------------------- 1 | # This module defines an imported target `ALSA::ALSA` if alsa is found 2 | # 3 | # Defines the following Variables (see find_package_impl for more info): 4 | # ALSA_FOUND 5 | # ALSA_INCLUDE_DIR 6 | # ALSA_INCLUDE_DIRS 7 | # ALSA_LIBRARY 8 | # ALSA_LIBRARIES 9 | # ALSA_VERSION 10 | find_package_impl("alsa" "ALSA" "alsa/asoundlib.h") 11 | 12 | if(ALSA_FOUND AND NOT TARGET ALSA::ALSA) 13 | create_imported_target("ALSA::ALSA" "${ALSA_INCLUDE_DIR}" "${ALSA_LIBRARY}") 14 | endif() 15 | -------------------------------------------------------------------------------- /src/utils/concurrency.cpp: -------------------------------------------------------------------------------- 1 | #include "utils/concurrency.hpp" 2 | 3 | #include 4 | 5 | POLYBAR_NS 6 | 7 | namespace concurrency_util { 8 | size_t thread_id(const thread::id id) { 9 | static size_t idx{1_z}; 10 | static mutex_wrapper> ids; 11 | std::lock_guard lock(ids); 12 | if (ids.find(id) == ids.end()) { 13 | ids[id] = idx++; 14 | } 15 | return ids[id]; 16 | } 17 | } // namespace concurrency_util 18 | 19 | POLYBAR_NS_END 20 | -------------------------------------------------------------------------------- /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