Showing preview only (1,454K chars total). Download the full file or copy to clipboard to get everything.
Repository: Alexays/Waybar
Branch: master
Commit: ab7bfdb29735
Files: 362
Total size: 1.3 MB
Directory structure:
gitextract_s9ytwrgg/
├── .clang-format
├── .clang-tidy
├── .editorconfig
├── .envrc
├── .github/
│ ├── FUNDING.yml
│ ├── labeler.yml
│ └── workflows/
│ ├── clang-format.yml
│ ├── clang-tidy.yml.bak
│ ├── docker.yml
│ ├── freebsd.yml
│ ├── labeler.yml
│ ├── linux.yml
│ ├── nix-tests.yml
│ └── nix-update-flake-lock.yml
├── .gitignore
├── .gitmodules
├── Dockerfiles/
│ ├── alpine
│ ├── archlinux
│ ├── debian
│ ├── fedora
│ ├── gentoo
│ └── opensuse
├── LICENSE
├── Makefile
├── README.md
├── asan.supp
├── default.nix
├── flake.nix
├── include/
│ ├── AAppIconLabel.hpp
│ ├── AIconLabel.hpp
│ ├── ALabel.hpp
│ ├── AModule.hpp
│ ├── ASlider.hpp
│ ├── IModule.hpp
│ ├── bar.hpp
│ ├── client.hpp
│ ├── config.hpp
│ ├── factory.hpp
│ ├── group.hpp
│ ├── modules/
│ │ ├── backlight.hpp
│ │ ├── backlight_slider.hpp
│ │ ├── battery.hpp
│ │ ├── bluetooth.hpp
│ │ ├── cava/
│ │ │ ├── cavaGLSL.hpp
│ │ │ ├── cavaRaw.hpp
│ │ │ ├── cava_backend.hpp
│ │ │ └── cava_frontend.hpp
│ │ ├── cffi.hpp
│ │ ├── clock.hpp
│ │ ├── cpu.hpp
│ │ ├── cpu_frequency.hpp
│ │ ├── cpu_usage.hpp
│ │ ├── custom.hpp
│ │ ├── disk.hpp
│ │ ├── dwl/
│ │ │ ├── tags.hpp
│ │ │ └── window.hpp
│ │ ├── ext/
│ │ │ ├── workspace_manager.hpp
│ │ │ └── workspace_manager_binding.hpp
│ │ ├── gamemode.hpp
│ │ ├── gps.hpp
│ │ ├── hyprland/
│ │ │ ├── backend.hpp
│ │ │ ├── language.hpp
│ │ │ ├── submap.hpp
│ │ │ ├── window.hpp
│ │ │ ├── windowcount.hpp
│ │ │ ├── windowcreationpayload.hpp
│ │ │ ├── workspace.hpp
│ │ │ └── workspaces.hpp
│ │ ├── idle_inhibitor.hpp
│ │ ├── image.hpp
│ │ ├── inhibitor.hpp
│ │ ├── jack.hpp
│ │ ├── keyboard_state.hpp
│ │ ├── load.hpp
│ │ ├── memory.hpp
│ │ ├── mpd/
│ │ │ ├── mpd.hpp
│ │ │ ├── state.hpp
│ │ │ └── state.inl.hpp
│ │ ├── mpris/
│ │ │ └── mpris.hpp
│ │ ├── network.hpp
│ │ ├── niri/
│ │ │ ├── backend.hpp
│ │ │ ├── language.hpp
│ │ │ ├── window.hpp
│ │ │ └── workspaces.hpp
│ │ ├── power_profiles_daemon.hpp
│ │ ├── privacy/
│ │ │ ├── privacy.hpp
│ │ │ └── privacy_item.hpp
│ │ ├── pulseaudio.hpp
│ │ ├── pulseaudio_slider.hpp
│ │ ├── river/
│ │ │ ├── layout.hpp
│ │ │ ├── mode.hpp
│ │ │ ├── tags.hpp
│ │ │ └── window.hpp
│ │ ├── simpleclock.hpp
│ │ ├── sndio.hpp
│ │ ├── sni/
│ │ │ ├── host.hpp
│ │ │ ├── icon_manager.hpp
│ │ │ ├── item.hpp
│ │ │ ├── tray.hpp
│ │ │ └── watcher.hpp
│ │ ├── sway/
│ │ │ ├── bar.hpp
│ │ │ ├── ipc/
│ │ │ │ ├── client.hpp
│ │ │ │ └── ipc.hpp
│ │ │ ├── language.hpp
│ │ │ ├── mode.hpp
│ │ │ ├── scratchpad.hpp
│ │ │ ├── window.hpp
│ │ │ └── workspaces.hpp
│ │ ├── systemd_failed_units.hpp
│ │ ├── temperature.hpp
│ │ ├── upower.hpp
│ │ ├── user.hpp
│ │ ├── wayfire/
│ │ │ ├── backend.hpp
│ │ │ ├── window.hpp
│ │ │ └── workspaces.hpp
│ │ ├── wireplumber.hpp
│ │ └── wlr/
│ │ └── taskbar.hpp
│ └── util/
│ ├── SafeSignal.hpp
│ ├── audio_backend.hpp
│ ├── backend_common.hpp
│ ├── backlight_backend.hpp
│ ├── clara.hpp
│ ├── command.hpp
│ ├── css_reload_helper.hpp
│ ├── date.hpp
│ ├── enum.hpp
│ ├── format.hpp
│ ├── gtk_icon.hpp
│ ├── icon_loader.hpp
│ ├── json.hpp
│ ├── kill_signal.hpp
│ ├── pipewire/
│ │ ├── pipewire_backend.hpp
│ │ └── privacy_node_info.hpp
│ ├── portal.hpp
│ ├── prepare_for_sleep.h
│ ├── regex_collection.hpp
│ ├── rewrite_string.hpp
│ ├── rfkill.hpp
│ ├── sanitize_str.hpp
│ ├── scope_guard.hpp
│ ├── scoped_fd.hpp
│ ├── sleeper_thread.hpp
│ ├── string.hpp
│ ├── udev_deleter.hpp
│ └── ustring_clen.hpp
├── man/
│ ├── waybar-backlight-slider.5.scd
│ ├── waybar-backlight.5.scd
│ ├── waybar-battery.5.scd
│ ├── waybar-bluetooth.5.scd
│ ├── waybar-cava.5.scd
│ ├── waybar-cffi.5.scd
│ ├── waybar-clock.5.scd
│ ├── waybar-cpu.5.scd
│ ├── waybar-custom.5.scd
│ ├── waybar-disk.5.scd
│ ├── waybar-dwl-tags.5.scd
│ ├── waybar-dwl-window.5.scd
│ ├── waybar-ext-workspaces.5.scd
│ ├── waybar-gamemode.5.scd
│ ├── waybar-gps.5.scd
│ ├── waybar-hyprland-language.5.scd
│ ├── waybar-hyprland-submap.5.scd
│ ├── waybar-hyprland-window.5.scd
│ ├── waybar-hyprland-windowcount.5.scd
│ ├── waybar-hyprland-workspaces.5.scd
│ ├── waybar-idle-inhibitor.5.scd
│ ├── waybar-image.5.scd
│ ├── waybar-inhibitor.5.scd
│ ├── waybar-jack.5.scd
│ ├── waybar-keyboard-state.5.scd
│ ├── waybar-memory.5.scd
│ ├── waybar-menu.5.scd
│ ├── waybar-mpd.5.scd
│ ├── waybar-mpris.5.scd
│ ├── waybar-network.5.scd
│ ├── waybar-niri-language.5.scd
│ ├── waybar-niri-window.5.scd
│ ├── waybar-niri-workspaces.5.scd
│ ├── waybar-power-profiles-daemon.5.scd
│ ├── waybar-privacy.5.scd
│ ├── waybar-pulseaudio-slider.5.scd
│ ├── waybar-pulseaudio.5.scd
│ ├── waybar-river-layout.5.scd
│ ├── waybar-river-mode.5.scd
│ ├── waybar-river-tags.5.scd
│ ├── waybar-river-window.5.scd
│ ├── waybar-sndio.5.scd
│ ├── waybar-states.5.scd
│ ├── waybar-styles.5.scd.in
│ ├── waybar-sway-language.5.scd
│ ├── waybar-sway-mode.5.scd
│ ├── waybar-sway-scratchpad.5.scd
│ ├── waybar-sway-window.5.scd
│ ├── waybar-sway-workspaces.5.scd
│ ├── waybar-systemd-failed-units.5.scd
│ ├── waybar-temperature.5.scd
│ ├── waybar-tray.5.scd
│ ├── waybar-upower.5.scd
│ ├── waybar-wayfire-window.5.scd
│ ├── waybar-wayfire-workspaces.5.scd
│ ├── waybar-wireplumber.5.scd
│ ├── waybar-wlr-taskbar.5.scd
│ └── waybar.5.scd.in
├── meson.build
├── meson_options.txt
├── nix/
│ └── default.nix
├── protocol/
│ ├── dbus-menu.xml
│ ├── dbus-status-notifier-item.xml
│ ├── dbus-status-notifier-watcher.xml
│ ├── dwl-ipc-unstable-v2.xml
│ ├── meson.build
│ ├── river-control-unstable-v1.xml
│ ├── river-status-unstable-v1.xml
│ └── wlr-foreign-toplevel-management-unstable-v1.xml
├── resources/
│ ├── config.jsonc
│ ├── custom_modules/
│ │ ├── cffi_example/
│ │ │ ├── .gitignore
│ │ │ ├── README.md
│ │ │ ├── main.c
│ │ │ ├── meson.build
│ │ │ └── waybar_cffi_module.h
│ │ ├── mediaplayer.py
│ │ └── power_menu.xml
│ ├── icons/
│ │ ├── meson.build
│ │ └── waybar_icons.gresource.xml
│ ├── style.css
│ └── waybar.service.in
├── src/
│ ├── AAppIconLabel.cpp
│ ├── AIconLabel.cpp
│ ├── ALabel.cpp
│ ├── AModule.cpp
│ ├── ASlider.cpp
│ ├── bar.cpp
│ ├── client.cpp
│ ├── config.cpp
│ ├── factory.cpp
│ ├── group.cpp
│ ├── main.cpp
│ ├── modules/
│ │ ├── backlight.cpp
│ │ ├── backlight_slider.cpp
│ │ ├── battery.cpp
│ │ ├── bluetooth.cpp
│ │ ├── cava/
│ │ │ ├── cavaGLSL.cpp
│ │ │ ├── cavaRaw.cpp
│ │ │ └── cava_backend.cpp
│ │ ├── cffi.cpp
│ │ ├── clock.cpp
│ │ ├── cpu.cpp
│ │ ├── cpu_frequency/
│ │ │ ├── bsd.cpp
│ │ │ ├── common.cpp
│ │ │ └── linux.cpp
│ │ ├── cpu_usage/
│ │ │ ├── bsd.cpp
│ │ │ ├── common.cpp
│ │ │ └── linux.cpp
│ │ ├── custom.cpp
│ │ ├── disk.cpp
│ │ ├── dwl/
│ │ │ ├── tags.cpp
│ │ │ └── window.cpp
│ │ ├── ext/
│ │ │ ├── workspace_manager.cpp
│ │ │ └── workspace_manager_binding.cpp
│ │ ├── gamemode.cpp
│ │ ├── gps.cpp
│ │ ├── hyprland/
│ │ │ ├── backend.cpp
│ │ │ ├── language.cpp
│ │ │ ├── submap.cpp
│ │ │ ├── window.cpp
│ │ │ ├── windowcount.cpp
│ │ │ ├── windowcreationpayload.cpp
│ │ │ ├── workspace.cpp
│ │ │ └── workspaces.cpp
│ │ ├── idle_inhibitor.cpp
│ │ ├── image.cpp
│ │ ├── inhibitor.cpp
│ │ ├── jack.cpp
│ │ ├── keyboard_state.cpp
│ │ ├── load.cpp
│ │ ├── memory/
│ │ │ ├── bsd.cpp
│ │ │ ├── common.cpp
│ │ │ └── linux.cpp
│ │ ├── mpd/
│ │ │ ├── mpd.cpp
│ │ │ └── state.cpp
│ │ ├── mpris/
│ │ │ └── mpris.cpp
│ │ ├── network.cpp
│ │ ├── niri/
│ │ │ ├── backend.cpp
│ │ │ ├── language.cpp
│ │ │ ├── window.cpp
│ │ │ └── workspaces.cpp
│ │ ├── power_profiles_daemon.cpp
│ │ ├── privacy/
│ │ │ ├── privacy.cpp
│ │ │ └── privacy_item.cpp
│ │ ├── pulseaudio.cpp
│ │ ├── pulseaudio_slider.cpp
│ │ ├── river/
│ │ │ ├── layout.cpp
│ │ │ ├── mode.cpp
│ │ │ ├── tags.cpp
│ │ │ └── window.cpp
│ │ ├── simpleclock.cpp
│ │ ├── sndio.cpp
│ │ ├── sni/
│ │ │ ├── host.cpp
│ │ │ ├── item.cpp
│ │ │ ├── tray.cpp
│ │ │ └── watcher.cpp
│ │ ├── sway/
│ │ │ ├── bar.cpp
│ │ │ ├── ipc/
│ │ │ │ └── client.cpp
│ │ │ ├── language.cpp
│ │ │ ├── mode.cpp
│ │ │ ├── scratchpad.cpp
│ │ │ ├── window.cpp
│ │ │ └── workspaces.cpp
│ │ ├── systemd_failed_units.cpp
│ │ ├── temperature.cpp
│ │ ├── upower.cpp
│ │ ├── user.cpp
│ │ ├── wayfire/
│ │ │ ├── backend.cpp
│ │ │ ├── window.cpp
│ │ │ └── workspaces.cpp
│ │ ├── wireplumber.cpp
│ │ └── wlr/
│ │ └── taskbar.cpp
│ └── util/
│ ├── audio_backend.cpp
│ ├── backlight_backend.cpp
│ ├── css_reload_helper.cpp
│ ├── enum.cpp
│ ├── gtk_icon.cpp
│ ├── icon_loader.cpp
│ ├── pipewire/
│ │ ├── pipewire_backend.cpp
│ │ └── privacy_node_info.cpp
│ ├── portal.cpp
│ ├── prepare_for_sleep.cpp
│ ├── regex_collection.cpp
│ ├── rewrite_string.cpp
│ ├── rfkill.cpp
│ ├── sanitize_str.cpp
│ └── ustring_clen.cpp
├── test/
│ ├── config/
│ │ ├── hyprland-workspaces.json
│ │ ├── include-1.json
│ │ ├── include-2.json
│ │ ├── include-multi-0.json
│ │ ├── include-multi-1.json
│ │ ├── include-multi-2.json
│ │ ├── include-multi-3-0.json
│ │ ├── include-multi-3.json
│ │ ├── include-multi.json
│ │ ├── include-relative-path.json
│ │ ├── include-wildcard.json
│ │ ├── include.json
│ │ ├── modules/
│ │ │ ├── cpu.jsonc
│ │ │ └── memory.jsonc
│ │ ├── multi.json
│ │ └── simple.json
│ ├── config.cpp
│ ├── hyprland/
│ │ ├── backend.cpp
│ │ └── meson.build
│ ├── main.cpp
│ ├── meson.build
│ └── utils/
│ ├── JsonParser.cpp
│ ├── SafeSignal.cpp
│ ├── command.cpp
│ ├── css_reload_helper.cpp
│ ├── date.cpp
│ ├── fixtures/
│ │ └── GlibTestsFixture.hpp
│ ├── meson.build
│ └── sleeper_thread.cpp
└── tsan.supp
================================================
FILE CONTENTS
================================================
================================================
FILE: .clang-format
================================================
---
BasedOnStyle: Google
AlignConsecutiveDeclarations: false
ColumnLimit: 100
...
================================================
FILE: .clang-tidy
================================================
Checks: >
-*,
bugprone-*
misc-*,
modernize-*,
performance-*,
portability-*,
readability-*,
-fuchsia-trailing-return,
-readability-magic-numbers,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-readability-braces-around-statements,
-readability-redundant-access-specifiers,
-readability-redundant-member-init,
-readability-redundant-string-init,
-readability-identifier-length
# CheckOptions:
# - { key: readability-identifier-naming.NamespaceCase, value: lower_case }
# - { key: readability-identifier-naming.ClassCase, value: CamelCase }
# - { key: readability-identifier-naming.StructCase, value: CamelCase }
# - { key: readability-identifier-naming.FunctionCase, value: camelBack }
# - { key: readability-identifier-naming.VariableCase, value: camelBack }
# - { key: readability-identifier-naming.PrivateMemberCase, value: camelBack }
# - { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
# - { key: readability-identifier-naming.EnumCase, value: CamelCase }
# - { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE }
# - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
# - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE }
================================================
FILE: .editorconfig
================================================
# EditorConfig configuration for Waybar
# http://EditorConfig.org
# Top-most EditorConfig file
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
[*.{build,css}]
indent_style = space
indent_size = 4
[*.{hpp,cpp}]
indent_style = space
indent_size = 2
================================================
FILE: .envrc
================================================
use flake
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: Alexays
custom: https://paypal.me/ARouillard
================================================
FILE: .github/labeler.yml
================================================
bug:
- "(crash|bug|error|coredump|freeze|segfault|issue|problem)"
enhancement:
- "(feature|enhancement|improvement|request|suggestion)"
hyprland:
- "(hyprland)"
network:
- "(network|wifi|ethernet)"
bluetooth:
- "(bluetooth|bluez)"
sway:
- "(sway)"
cpu:
- "(cpu)"
memory:
- "(memory|ram)"
disk:
- "(disk|storage)"
battery:
- "(upower|battery)"
sni:
- "(sni|tray)"
dwl:
- "(dwl)"
custom:
- "(custom|module|extension|plugin|script)"
mpd:
- "(mpd|music)"
audio:
- "(pulseaudio|alsa|jack|audio|pirewire|wireplumber)"
temperature:
- "(temperature|thermal|hwmon)"
clock:
- "(clock|time|date)"
gamemode:
- "(gamemode|game|gaming)"
inhibitor:
- "(inhibitor|idle|lock|suspend|hibernate|logout)"
cava:
- "(cava|audio-visualizer)"
backlight:
- "(backlight|brightness)"
keyboard:
- "(keyboard|keymap|layout|shortcut)"
================================================
FILE: .github/workflows/clang-format.yml
================================================
name: clang-format
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-format-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: RafikFarhad/clang-format-github-action@v6
name: clang-format
with:
sources: "src/**/*.hpp,src/**/*.cpp"
style: "file"
================================================
FILE: .github/workflows/clang-tidy.yml.bak
================================================
name: clang-tidy
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-tidy-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
container:
image: alexays/waybar:debian
steps:
- uses: actions/checkout@v6
- name: configure
run: |
meson -Dcpp_std=c++20 build # necessary to generate compile_commands.json
ninja -C build # necessary to find certain .h files (xdg, wayland, etc.)
- uses: actions/setup-python@v5
with:
python-version: '3.10' # to be kept in sync with cpp-linter-action
update-environment: true # the python dist installed by the action needs LD_LIBRARY_PATH to work
- uses: cpp-linter/cpp-linter-action@v2.9.1
name: clang-tidy
id: clang-tidy-check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PIP_NO_CACHE_DIR: false
with:
style: "" # empty string => don't do clang-format checks here, we do them in clang-format.yml
files-changed-only: true # only check files that have changed
lines-changed-only: true # only check lines that have changed
tidy-checks: "" # empty string => use the .clang-tidy file
version: "17" # clang-tools version
database: "build" # path to the compile_commands.json file
- name: Check if clang-tidy failed on any files
if: steps.clang-tidy-check.outputs.checks-failed > 0
run: echo "Some files failed the linting checks!" && exit 1
================================================
FILE: .github/workflows/docker.yml
================================================
name: Build and Push Docker Image
on:
workflow_dispatch:
schedule:
# run monthly
- cron: '0 0 1 * *'
jobs:
build-and-push:
runs-on: ubuntu-latest
if: github.event_name != 'schedule' || github.repository == 'Alexays/Waybar'
strategy:
fail-fast: false # don't fail the other jobs if one of the images fails to build
matrix:
os: [ 'alpine', 'archlinux', 'debian', 'fedora', 'gentoo', 'opensuse' ]
steps:
- name: Checkout repository
- uses: actions/checkout@v6
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfiles/${{ matrix.os }}
push: true
tags: alexays/waybar:${{ matrix.os }}
================================================
FILE: .github/workflows/freebsd.yml
================================================
name: freebsd
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-freebsd-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
# Run actions in a FreeBSD VM on the ubuntu runner
# https://github.com/actions/runner/issues/385 - for FreeBSD runner support
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Test in FreeBSD VM
uses: cross-platform-actions/action@v0.28.0
timeout-minutes: 180
env:
CPPFLAGS: '-isystem/usr/local/include'
LDFLAGS: '-L/usr/local/lib'
with:
operating_system: freebsd
version: "14.2"
environment_variables: CPPFLAGS LDFLAGS
sync_files: runner-to-vm
run: |
sudo pkg install -y git # subprojects/date
sudo pkg install -y catch evdev-proto gtk-layer-shell gtkmm30 jsoncpp \
libdbusmenu libevdev libfmt libmpdclient libudev-devd meson \
pkgconf pipewire pulseaudio scdoc sndio spdlog wayland-protocols upower \
libinotify
meson setup build -Dman-pages=enabled
ninja -C build
meson test -C build --no-rebuild --print-errorlogs --suite waybar
================================================
FILE: .github/workflows/labeler.yml
================================================
name: "Issue Labeler"
on:
issues:
types: [opened, edited]
permissions:
issues: write
contents: read
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: github/issue-labeler@v3.4
with:
configuration-path: .github/labeler.yml
enable-versioned-regex: 0
include-title: 1
repo-token: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .github/workflows/linux.yml
================================================
name: linux
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
distro:
- alpine
- archlinux
- debian
- fedora
- opensuse
- gentoo
cpp_std: [c++20]
runs-on: ubuntu-latest
container:
image: alexays/waybar:${{ matrix.distro }}
steps:
- uses: actions/checkout@v6
- name: configure
run: meson setup -Dman-pages=enabled -Dcpp_std=${{matrix.cpp_std}} build
- name: build
run: ninja -C build
- name: test
run: make test
================================================
FILE: .github/workflows/nix-tests.yml
================================================
name: "Nix-Tests"
on:
pull_request:
push:
concurrency:
group: ${{ github.workflow }}-nix-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
nix-flake-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- run: nix flake show
- run: nix flake check --print-build-logs
- run: nix build --print-build-logs
================================================
FILE: .github/workflows/nix-update-flake-lock.yml
================================================
name: update-flake-lock
on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 1 * *' # Run monthly
push:
paths:
- 'flake.nix'
jobs:
lockfile:
runs-on: ubuntu-latest
if: github.event_name != 'schedule' || github.repository == 'Alexays/Waybar'
steps:
- name: Checkout repository
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v28
================================================
FILE: .gitignore
================================================
.DS_Store
*~
vgcore.*
/.vscode
/.idea
/.cache
*.swp
packagecache
/subprojects/**/
/subprojects/.wraplock
/build*
/dist
/meson.egg-info
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
/.direnv/
# Nix
result
result-*
.ccls-cache
_codeql_detected_source_root
heaptrack*
================================================
FILE: .gitmodules
================================================
[submodule "package/archlinux"]
path = package/archlinux
url = https://aur.archlinux.org/waybar-git.git
================================================
FILE: Dockerfiles/alpine
================================================
# vim: ft=Dockerfile
FROM alpine:latest
RUN apk add --no-cache git meson alpine-sdk libinput-dev wayland-dev wayland-protocols mesa-dev libxkbcommon-dev eudev-dev pixman-dev gtkmm3-dev jsoncpp-dev pugixml-dev libnl3-dev pulseaudio-dev libmpdclient-dev sndio-dev scdoc libxkbcommon tzdata playerctl-dev
================================================
FILE: Dockerfiles/archlinux
================================================
# vim: ft=Dockerfile
FROM archlinux:base-devel
RUN pacman -Syu --noconfirm && \
pacman -S --noconfirm git meson base-devel libinput wayland wayland-protocols glib2-devel pixman libxkbcommon mesa gtkmm3 jsoncpp pugixml scdoc libpulse libdbusmenu-gtk3 libmpdclient gobject-introspection libxkbcommon playerctl iniparser fftw && \
sed -Ei 's/#(en_(US|GB)\.UTF)/\1/' /etc/locale.gen && locale-gen
================================================
FILE: Dockerfiles/debian
================================================
# vim: ft=Dockerfile
FROM debian:sid-slim
RUN apt update && \
apt install --no-install-recommends --no-install-suggests -y \
build-essential \
catch2 \
cmake \
git \
gobject-introspection \
libdbusmenu-gtk3-dev \
libegl1-mesa-dev \
libfmt-dev \
libgbm-dev \
libgirepository1.0-dev \
libgles2-mesa-dev \
libgtk-layer-shell-dev \
libgtkmm-3.0-dev \
libhowardhinnant-date-dev \
libiniparser-dev \
libinput-dev \
libjack-jackd2-dev \
libjsoncpp-dev \
libmpdclient-dev \
libnl-3-dev \
libnl-genl-3-dev \
libpixman-1-dev \
libplayerctl-dev \
libpugixml-dev \
libpulse-dev \
libsndio-dev \
libspdlog-dev \
libudev-dev \
libupower-glib-dev \
libwayland-dev \
libwireplumber-0.5-dev \
libxkbcommon-dev \
libxkbregistry-dev \
locales \
meson \
ninja-build \
pkg-config \
python3-pip \
python3-venv \
scdoc \
sudo \
wayland-protocols \
&& apt clean
================================================
FILE: Dockerfiles/fedora
================================================
# vim: ft=Dockerfile
FROM fedora:latest
RUN dnf install -y @c-development \
git-core glibc-langpack-en meson scdoc \
'pkgconfig(catch2)' \
'pkgconfig(date)' \
'pkgconfig(dbusmenu-gtk3-0.4)' \
'pkgconfig(fmt)' \
'pkgconfig(gdk-pixbuf-2.0)' \
'pkgconfig(gio-unix-2.0)' \
'pkgconfig(gtk-layer-shell-0)' \
'pkgconfig(gtkmm-3.0)' \
'pkgconfig(jack)' \
'pkgconfig(jsoncpp)' \
'pkgconfig(libevdev)' \
'pkgconfig(libinput)' \
'pkgconfig(libmpdclient)' \
'pkgconfig(libnl-3.0)' \
'pkgconfig(libnl-genl-3.0)' \
'pkgconfig(libpulse)' \
'pkgconfig(libudev)' \
'pkgconfig(playerctl)' \
'pkgconfig(pugixml)' \
'pkgconfig(sigc++-2.0)' \
'pkgconfig(spdlog)' \
'pkgconfig(upower-glib)' \
'pkgconfig(wayland-client)' \
'pkgconfig(wayland-cursor)' \
'pkgconfig(wayland-protocols)' \
'pkgconfig(wireplumber-0.5)' \
'pkgconfig(xkbregistry)' && \
dnf clean all -y
================================================
FILE: Dockerfiles/gentoo
================================================
# vim: ft=Dockerfile
FROM gentoo/stage3:latest
RUN export FEATURES="-ipc-sandbox -network-sandbox -pid-sandbox -sandbox -usersandbox" && \
emerge --sync && \
eselect news read --quiet new 1>/dev/null 2>&1 && \
emerge --verbose --update --deep --with-bdeps=y --backtrack=30 --newuse @world && \
USE="wayland gtk3 gtk -doc X pulseaudio minimal" emerge dev-vcs/git dev-libs/wayland dev-libs/wayland-protocols dev-cpp/gtkmm:3.0 x11-libs/libxkbcommon \
x11-libs/gtk+:3 dev-libs/libdbusmenu dev-libs/libnl sys-power/upower media-libs/libpulse dev-libs/libevdev media-libs/libmpdclient \
media-sound/sndio gui-libs/gtk-layer-shell app-text/scdoc media-sound/playerctl dev-libs/iniparser sci-libs/fftw
================================================
FILE: Dockerfiles/opensuse
================================================
# vim: ft=Dockerfile
FROM opensuse/tumbleweed:latest
RUN zypper -n up && \
zypper addrepo https://download.opensuse.org/repositories/X11:Wayland/openSUSE_Tumbleweed/X11:Wayland.repo | echo 'a' && \
zypper -n refresh && \
zypper -n install -t pattern devel_C_C++ && \
zypper -n install git meson clang libinput10 libinput-devel pugixml-devel libwayland-client0 libwayland-cursor0 wayland-protocols-devel wayland-devel Mesa-libEGL-devel Mesa-libGLESv2-devel libgbm-devel libxkbcommon-devel libudev-devel libpixman-1-0-devel gtkmm3-devel jsoncpp-devel libxkbregistry-devel scdoc playerctl-devel python3-packaging
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2025 Alex
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.
================================================
FILE: Makefile
================================================
.PHONY: build build-debug run clean default install
default: build
build:
meson setup build
ninja -C build
build-debug:
meson setup build --buildtype=debug
ninja -C build
install: build
ninja -C build install
run: build
./build/waybar
debug-run: build-debug
./build/waybar --log-level debug
test:
meson test -C build --verbose --suite waybar
.PHONY: test
test-detailed:
meson test -C build --verbose --print-errorlogs --test-args='--reporter console -s'
.PHONY: test-detailed
clean:
rm -rf build
================================================
FILE: README.md
================================================
# Waybar [](LICENSE) [](https://paypal.me/ARouillard)<br>
> Highly customizable Wayland bar for Sway and Wlroots based compositors.<br>
> Available in [all major distributions](https://github.com/Alexays/Waybar/wiki/Installation)<br>
> *Waybar [examples](https://github.com/Alexays/Waybar/wiki/Examples)*
#### Current features
- Sway (Workspaces, Binding mode, Focused window name)
- River (Mapping mode, Tags, Focused window name)
- Hyprland (Window Icons, Workspaces, Focused window name)
- Niri (Workspaces, Focused window name, Language)
- DWL (Tags, Focused window name) [requires dwl ipc patch](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/ipc)
- Tray [#21](https://github.com/Alexays/Waybar/issues/21)
- Local time
- Battery
- UPower
- Power profiles daemon
- Network
- Bluetooth
- Pulseaudio
- Privacy Info
- Wireplumber
- Disk
- Memory
- Cpu load average
- Temperature
- MPD
- Custom scripts
- Custom image
- Multiple output configuration
- And many more customizations
#### Configuration and Styling
[See the wiki for more details](https://github.com/Alexays/Waybar/wiki).
### Installation
Waybar is available from a number of Linux distributions:
[](https://repology.org/project/waybar/versions)
An Ubuntu PPA with more recent versions is available
[here](https://launchpad.net/~nschloe/+archive/ubuntu/waybar).
#### Building from source
```bash
$ git clone https://github.com/Alexays/Waybar
$ cd Waybar
$ meson setup build
$ ninja -C build
$ ./build/waybar
# If you want to install it
$ ninja -C build install
$ waybar
```
**Dependencies**
```
gtkmm3
jsoncpp
libsigc++
fmt
wayland
chrono-date
spdlog
libgtk-3-dev [gtk-layer-shell]
gobject-introspection [gtk-layer-shell]
libgirepository1.0-dev [gtk-layer-shell]
libpulse [Pulseaudio module]
libnl [Network module]
libappindicator-gtk3 [Tray module]
libdbusmenu-gtk3 [Tray module]
libmpdclient [MPD module]
libsndio [sndio module]
libevdev [KeyboardState module]
xkbregistry
upower [UPower battery module]
```
**Build dependencies**
```
cmake
meson
scdoc
wayland-protocols
```
On Ubuntu, you can install all the relevant dependencies using this command (tested with 19.10 and 20.04):
```
sudo apt install \
clang-tidy \
gobject-introspection \
libdbusmenu-gtk3-dev \
libevdev-dev \
libfmt-dev \
libgirepository1.0-dev \
libgtk-3-dev \
libgtkmm-3.0-dev \
libinput-dev \
libjsoncpp-dev \
libmpdclient-dev \
libnl-3-dev \
libnl-genl-3-dev \
libpulse-dev \
libsigc++-2.0-dev \
libspdlog-dev \
libwayland-dev \
scdoc \
upower \
libxkbregistry-dev
```
On Arch, you can use this command:
```
pacman -S --asdeps \
gtkmm3 \
jsoncpp \
libsigc++ \
fmt \
wayland \
chrono-date \
spdlog \
gtk3 \
gobject-introspection \
libgirepository \
libpulse \
libnl \
libappindicator-gtk3 \
libdbusmenu-gtk3 \
libmpdclient \
sndio \
libevdev \
libxkbcommon \
upower \
meson \
cmake \
scdoc \
wayland-protocols \
glib2-devel
```
Contributions welcome!<br>
Have fun :)<br>
The style guidelines are [Google's](https://google.github.io/styleguide/cppguide.html)
> [!CAUTION]
> Distributions of Waybar are only released on the [official GitHub page](https://github.com/Alexays/Waybar).<br/>
> Waybar does **not** have an official website. Do not trust any sites that claim to be official.
## License
Waybar is licensed under the MIT license. [See LICENSE for more information](https://github.com/Alexays/Waybar/blob/master/LICENSE).
================================================
FILE: asan.supp
================================================
# Suppress common address sanitizer issues in dependencies, these are often non-fixable or not an issue.
# Use it like this (when in repo root): ASAN_OPTIONS="suppressions=./asan.supp" ./build/waybar
leak:libpangoft2-1.0.so.0
leak:libgtk-3.so.0
leak:libfontconfig.so.1
================================================
FILE: default.nix
================================================
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
) { src = ./.; }).defaultNix
================================================
FILE: flake.nix
================================================
{
description = "Highly customizable Wayland bar for Sway and Wlroots based compositors";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs =
{ self, nixpkgs, ... }:
let
inherit (nixpkgs) lib;
genSystems =
func:
lib.genAttrs
[
"x86_64-linux"
"aarch64-linux"
]
(
system:
func (
import nixpkgs {
inherit system;
overlays = with self.overlays; [
waybar
];
}
)
);
mkDate =
longDate:
(lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in
{
devShells = genSystems (pkgs: {
default = pkgs.mkShell {
name = "waybar-shell";
# inherit attributes from upstream nixpkgs derivation
inherit (pkgs.waybar)
buildInputs
depsBuildBuild
depsBuildBuildPropagated
depsBuildTarget
depsBuildTargetPropagated
depsHostHost
depsHostHostPropagated
depsTargetTarget
depsTargetTargetPropagated
propagatedBuildInputs
propagatedNativeBuildInputs
strictDeps
;
# overrides for local development
nativeBuildInputs =
pkgs.waybar.nativeBuildInputs
++ (with pkgs; [
nixfmt
clang-tools
gdb
]);
};
});
formatter = genSystems (
pkgs:
pkgs.treefmt.withConfig {
settings = {
formatter = {
clang-format = {
options = [ "-i" ];
command = lib.getExe' pkgs.clang-tools "clang-format";
excludes = [ ];
includes = [
"*.c"
"*.cpp"
"*.h"
"*.hpp"
];
};
nixfmt = {
command = lib.getExe pkgs.nixfmt;
includes = [ "*.nix" ];
};
};
tree-root-file = ".git/index";
};
}
);
overlays = {
default = self.overlays.waybar;
waybar = final: prev: {
waybar = final.callPackage ./nix/default.nix {
waybar = prev.waybar;
# take the first "version: '...'" from meson.build
version =
(builtins.head (
builtins.split "'" (
builtins.elemAt (builtins.split " version: '" (builtins.readFile ./meson.build)) 2
)
))
+ "+date="
+ (mkDate (self.lastModifiedDate or "19700101"))
+ "_"
+ (self.shortRev or "dirty");
};
};
};
packages = genSystems (pkgs: {
default = self.packages.${pkgs.stdenv.hostPlatform.system}.waybar;
inherit (pkgs) waybar;
});
};
}
================================================
FILE: include/AAppIconLabel.hpp
================================================
#pragma once
#include <gtkmm/box.h>
#include <gtkmm/image.h>
#include "AIconLabel.hpp"
namespace waybar {
class AAppIconLabel : public AIconLabel {
public:
AAppIconLabel(const Json::Value& config, const std::string& name, const std::string& id,
const std::string& format, uint16_t interval = 0, bool ellipsize = false,
bool enable_click = false, bool enable_scroll = false);
virtual ~AAppIconLabel() = default;
auto update() -> void override;
protected:
void updateAppIconName(const std::string& app_identifier,
const std::string& alternative_app_identifier);
void updateAppIcon();
unsigned app_icon_size_{24};
bool update_app_icon_{true};
std::string app_icon_name_;
};
} // namespace waybar
================================================
FILE: include/AIconLabel.hpp
================================================
#pragma once
#include <gtkmm/box.h>
#include <gtkmm/image.h>
#include "ALabel.hpp"
namespace waybar {
class AIconLabel : public ALabel {
public:
AIconLabel(const Json::Value& config, const std::string& name, const std::string& id,
const std::string& format, uint16_t interval = 0, bool ellipsize = false,
bool enable_click = false, bool enable_scroll = false);
virtual ~AIconLabel() = default;
auto update() -> void override;
protected:
Gtk::Image image_;
Gtk::Box box_;
bool iconEnabled() const;
};
} // namespace waybar
================================================
FILE: include/ALabel.hpp
================================================
#pragma once
#include <glibmm/markup.h>
#include <gtkmm/label.h>
#include <json/json.h>
#include "AModule.hpp"
namespace waybar {
class ALabel : public AModule {
public:
ALabel(const Json::Value&, const std::string&, const std::string&, const std::string& format,
uint16_t interval = 0, bool ellipsize = false, bool enable_click = false,
bool enable_scroll = false);
virtual ~ALabel() = default;
auto update() -> void override;
virtual std::string getIcon(uint16_t, const std::string& alt = "", uint16_t max = 0);
virtual std::string getIcon(uint16_t, const std::vector<std::string>& alts, uint16_t max = 0);
protected:
Gtk::Label label_;
std::string format_;
const std::chrono::milliseconds interval_;
bool alt_ = false;
std::string default_format_;
bool handleToggle(GdkEventButton* const& e) override;
virtual std::string getState(uint8_t value, bool lesser = false);
std::map<std::string, GtkMenuItem*> submenus_;
std::map<std::string, std::string> menuActionsMap_;
static void handleGtkMenuEvent(GtkMenuItem* menuitem, gpointer data);
};
} // namespace waybar
================================================
FILE: include/AModule.hpp
================================================
#pragma once
#include <glibmm/dispatcher.h>
#include <glibmm/markup.h>
#include <gtkmm.h>
#include <gtkmm/eventbox.h>
#include <json/json.h>
#include "IModule.hpp"
namespace waybar {
class AModule : public IModule {
public:
static constexpr const char* MODULE_CLASS = "module";
~AModule() override;
auto update() -> void override;
virtual auto refresh(int shouldRefresh) -> void {};
operator Gtk::Widget&() override;
auto doAction(const std::string& name) -> void override;
/// Emitting on this dispatcher triggers a update() call
Glib::Dispatcher dp;
bool expandEnabled() const;
protected:
// Don't need to make an object directly
// Derived classes are able to use it
AModule(const Json::Value&, const std::string&, const std::string&, bool enable_click = false,
bool enable_scroll = false);
enum SCROLL_DIR { NONE, UP, DOWN, LEFT, RIGHT };
SCROLL_DIR getScrollDir(GdkEventScroll* e);
bool tooltipEnabled() const;
std::vector<int> pid_children_;
const std::string name_;
const Json::Value& config_;
Gtk::EventBox event_box_;
virtual void setCursor(Gdk::CursorType const& c);
virtual bool handleToggle(GdkEventButton* const& ev);
virtual bool handleMouseEnter(GdkEventCrossing* const& ev);
virtual bool handleMouseLeave(GdkEventCrossing* const& ev);
virtual bool handleScroll(GdkEventScroll*);
virtual bool handleRelease(GdkEventButton* const& ev);
GObject* menu_ = nullptr;
private:
bool handleUserEvent(GdkEventButton* const& ev);
const bool isTooltip;
const bool isExpand;
bool hasUserEvents_;
gdouble distance_scrolled_y_;
gdouble distance_scrolled_x_;
std::map<std::string, std::string> eventActionMap_;
static const inline std::map<std::pair<uint, GdkEventType>, std::string> eventMap_{
{std::make_pair(1, GdkEventType::GDK_BUTTON_PRESS), "on-click"},
{std::make_pair(1, GdkEventType::GDK_BUTTON_RELEASE), "on-click-release"},
{std::make_pair(1, GdkEventType::GDK_2BUTTON_PRESS), "on-double-click"},
{std::make_pair(1, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click"},
{std::make_pair(2, GdkEventType::GDK_BUTTON_PRESS), "on-click-middle"},
{std::make_pair(2, GdkEventType::GDK_BUTTON_RELEASE), "on-click-middle-release"},
{std::make_pair(2, GdkEventType::GDK_2BUTTON_PRESS), "on-double-click-middle"},
{std::make_pair(2, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click-middle"},
{std::make_pair(3, GdkEventType::GDK_BUTTON_PRESS), "on-click-right"},
{std::make_pair(3, GdkEventType::GDK_BUTTON_RELEASE), "on-click-right-release"},
{std::make_pair(3, GdkEventType::GDK_2BUTTON_PRESS), "on-double-click-right"},
{std::make_pair(3, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click-right"},
{std::make_pair(8, GdkEventType::GDK_BUTTON_PRESS), "on-click-backward"},
{std::make_pair(8, GdkEventType::GDK_BUTTON_RELEASE), "on-click-backward-release"},
{std::make_pair(8, GdkEventType::GDK_2BUTTON_PRESS), "on-double-click-backward"},
{std::make_pair(8, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click-backward"},
{std::make_pair(9, GdkEventType::GDK_BUTTON_PRESS), "on-click-forward"},
{std::make_pair(9, GdkEventType::GDK_BUTTON_RELEASE), "on-click-forward-release"},
{std::make_pair(9, GdkEventType::GDK_2BUTTON_PRESS), "on-double-click-forward"},
{std::make_pair(9, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click-forward"}};
};
} // namespace waybar
================================================
FILE: include/ASlider.hpp
================================================
#pragma once
#include "AModule.hpp"
#include "gtkmm/scale.h"
namespace waybar {
class ASlider : public AModule {
public:
ASlider(const Json::Value& config, const std::string& name, const std::string& id);
virtual void onValueChanged();
protected:
bool vertical_ = false;
int min_ = 0, max_ = 100, curr_ = 50;
Gtk::Scale scale_;
};
} // namespace waybar
================================================
FILE: include/IModule.hpp
================================================
#pragma once
#include <gtkmm/widget.h>
namespace waybar {
class IModule {
public:
virtual ~IModule() = default;
virtual auto update() -> void = 0;
virtual operator Gtk::Widget&() = 0;
virtual auto doAction(const std::string& name) -> void = 0;
};
} // namespace waybar
================================================
FILE: include/bar.hpp
================================================
#pragma once
#include <gdkmm/monitor.h>
#include <glibmm/refptr.h>
#include <gtkmm/box.h>
#include <gtkmm/cssprovider.h>
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <json/json.h>
#include <memory>
#include <optional>
#include <vector>
#include "AModule.hpp"
#include "group.hpp"
#include "util/kill_signal.hpp"
#include "xdg-output-unstable-v1-client-protocol.h"
namespace waybar {
class Factory;
struct waybar_output {
Glib::RefPtr<Gdk::Monitor> monitor;
std::string name;
std::string identifier;
std::unique_ptr<struct zxdg_output_v1, decltype(&zxdg_output_v1_destroy)> xdg_output = {
nullptr, &zxdg_output_v1_destroy};
};
enum class bar_layer : uint8_t {
BOTTOM,
TOP,
OVERLAY,
};
struct bar_margins {
int top = 0;
int right = 0;
int bottom = 0;
int left = 0;
};
struct bar_mode {
bar_layer layer;
bool exclusive;
bool passthrough;
bool visible;
};
#ifdef HAVE_SWAY
namespace modules::sway {
class BarIpcClient;
}
#endif // HAVE_SWAY
class Bar : public sigc::trackable {
public:
using bar_mode_map = std::map<std::string, struct bar_mode>;
static const bar_mode_map PRESET_MODES;
static const std::string MODE_DEFAULT;
static const std::string MODE_INVISIBLE;
Bar(struct waybar_output* w_output, const Json::Value&);
Bar(const Bar&) = delete;
~Bar();
void setMode(const std::string& mode);
void setVisible(bool value);
void toggle();
void show();
void hide();
void handleSignal(int);
util::KillSignalAction getOnSigusr1Action();
util::KillSignalAction getOnSigusr2Action();
struct waybar_output* output;
Json::Value config;
struct wl_surface* surface;
bool visible = true;
Gtk::Window window;
Gtk::Orientation orientation = Gtk::ORIENTATION_HORIZONTAL;
Gtk::PositionType position = Gtk::POS_TOP;
int x_global;
int y_global;
#ifdef HAVE_SWAY
std::string bar_id;
#endif
private:
void onMap(GdkEventAny*);
auto setupWidgets() -> void;
void getModules(const Factory&, const std::string&, waybar::Group*);
void setupAltFormatKeyForModule(const std::string& module_name);
void setupAltFormatKeyForModuleList(const char* module_list_name);
void setMode(const bar_mode&);
void setPassThrough(bool passthrough);
void setPosition(Gtk::PositionType position);
void onConfigure(GdkEventConfigure* ev);
void configureGlobalOffset(int width, int height);
void onOutputGeometryChanged();
/* Copy initial set of modes to allow customization */
bar_mode_map configured_modes = PRESET_MODES;
std::string last_mode_{MODE_DEFAULT};
struct bar_margins margins_;
uint32_t width_, height_;
bool passthrough_;
Gtk::Box left_;
Gtk::Box center_;
Gtk::Box right_;
Gtk::Box box_;
std::vector<std::shared_ptr<waybar::AModule>> modules_left_;
std::vector<std::shared_ptr<waybar::AModule>> modules_center_;
std::vector<std::shared_ptr<waybar::AModule>> modules_right_;
#ifdef HAVE_SWAY
using BarIpcClient = modules::sway::BarIpcClient;
std::unique_ptr<BarIpcClient> _ipc_client;
#endif
std::vector<std::shared_ptr<waybar::AModule>> modules_all_;
waybar::util::KillSignalAction onSigusr1 = util::SIGNALACTION_DEFAULT_SIGUSR1;
waybar::util::KillSignalAction onSigusr2 = util::SIGNALACTION_DEFAULT_SIGUSR2;
};
} // namespace waybar
================================================
FILE: include/client.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <gdk/gdk.h>
#include <gdk/gdkwayland.h>
#include <wayland-client.h>
#include "bar.hpp"
#include "config.hpp"
#include "util/css_reload_helper.hpp"
#include "util/portal.hpp"
struct zwp_idle_inhibitor_v1;
struct zwp_idle_inhibit_manager_v1;
namespace waybar {
class Client {
public:
static Client* inst();
int main(int argc, char* argv[]);
void reset();
Glib::RefPtr<Gtk::Application> gtk_app;
Glib::RefPtr<Gdk::Display> gdk_display;
struct wl_display* wl_display = nullptr;
struct wl_registry* registry = nullptr;
struct zxdg_output_manager_v1* xdg_output_manager = nullptr;
struct zwp_idle_inhibit_manager_v1* idle_inhibit_manager = nullptr;
std::vector<std::unique_ptr<Bar>> bars;
Config config;
std::string bar_id;
private:
Client() = default;
const std::string getStyle(const std::string& style, std::optional<Appearance> appearance);
void bindInterfaces();
void handleOutput(struct waybar_output& output);
auto setupCss(const std::string& css_file) -> void;
struct waybar_output& getOutput(void*);
std::vector<Json::Value> getOutputConfigs(struct waybar_output& output);
static void handleGlobal(void* data, struct wl_registry* registry, uint32_t name,
const char* interface, uint32_t version);
static void handleGlobalRemove(void* data, struct wl_registry* registry, uint32_t name);
static void handleOutputDone(void*, struct zxdg_output_v1*);
static void handleOutputName(void*, struct zxdg_output_v1*, const char*);
static void handleOutputDescription(void*, struct zxdg_output_v1*, const char*);
void handleMonitorAdded(Glib::RefPtr<Gdk::Monitor> monitor);
void handleMonitorRemoved(Glib::RefPtr<Gdk::Monitor> monitor);
void handleDeferredMonitorRemoval(Glib::RefPtr<Gdk::Monitor> monitor);
Glib::RefPtr<Gtk::StyleContext> style_context_;
Glib::RefPtr<Gtk::CssProvider> css_provider_;
std::unique_ptr<Portal> portal;
std::list<struct waybar_output> outputs_;
std::unique_ptr<CssReloadHelper> m_cssReloadHelper;
std::string m_cssFile;
sigc::connection monitor_added_connection_;
sigc::connection monitor_removed_connection_;
};
} // namespace waybar
================================================
FILE: include/config.hpp
================================================
#pragma once
#include <json/json.h>
#include <optional>
#include <string>
#ifndef SYSCONFDIR
#define SYSCONFDIR "/etc"
#endif
namespace waybar {
class Config {
public:
static const std::vector<std::string> CONFIG_DIRS;
static const char* CONFIG_PATH_ENV;
/* Try to find any of provided names in the supported set of config directories */
static std::optional<std::string> findConfigPath(
const std::vector<std::string>& names, const std::vector<std::string>& dirs = CONFIG_DIRS);
static std::vector<std::string> tryExpandPath(const std::string& base,
const std::string& filename);
Config() = default;
void load(const std::string& config);
Json::Value& getConfig() { return config_; }
std::vector<Json::Value> getOutputConfigs(const std::string& name, const std::string& identifier);
private:
void setupConfig(Json::Value& dst, const std::string& config_file, int depth);
void resolveConfigIncludes(Json::Value& config, int depth);
void mergeConfig(Json::Value& a_config_, Json::Value& b_config_);
static std::vector<std::string> findIncludePath(
const std::string& name, const std::vector<std::string>& dirs = CONFIG_DIRS);
std::string config_file_;
Json::Value config_;
};
} // namespace waybar
================================================
FILE: include/factory.hpp
================================================
#pragma once
#include <json/json.h>
#include <AModule.hpp>
namespace waybar {
class Bar;
class Factory {
public:
Factory(const Bar& bar, const Json::Value& config);
AModule* makeModule(const std::string& name, const std::string& pos) const;
private:
const Bar& bar_;
const Json::Value& config_;
};
} // namespace waybar
================================================
FILE: include/group.hpp
================================================
#pragma once
#include <gtkmm/box.h>
#include <gtkmm/widget.h>
#include <json/json.h>
#include "AModule.hpp"
#include "gtkmm/revealer.h"
namespace waybar {
class Group : public AModule {
public:
Group(const std::string&, const std::string&, const Json::Value&, bool);
~Group() override = default;
auto update() -> void override;
operator Gtk::Widget&() override;
virtual Gtk::Box& getBox();
void addWidget(Gtk::Widget& widget);
protected:
Gtk::Box box;
Gtk::Box revealer_box;
Gtk::Revealer revealer;
bool is_first_widget = true;
bool is_drawer = false;
bool click_to_reveal = false;
std::string add_class_to_drawer_children;
bool handleMouseEnter(GdkEventCrossing* const& ev) override;
bool handleMouseLeave(GdkEventCrossing* const& ev) override;
bool handleToggle(GdkEventButton* const& ev) override;
bool handleScroll(GdkEventScroll* e) override;
void show_group();
void hide_group();
};
} // namespace waybar
================================================
FILE: include/modules/backlight.hpp
================================================
#pragma once
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "ALabel.hpp"
#include "util/backlight_backend.hpp"
#include "util/json.hpp"
struct udev;
struct udev_device;
namespace waybar::modules {
class Backlight : public ALabel {
public:
Backlight(const std::string&, const Json::Value&);
virtual ~Backlight() = default;
auto update() -> void override;
bool handleScroll(GdkEventScroll* e) override;
const std::string preferred_device_;
std::string previous_format_;
util::BacklightBackend backend;
};
} // namespace waybar::modules
================================================
FILE: include/modules/backlight_slider.hpp
================================================
#pragma once
#include <chrono>
#include "ASlider.hpp"
#include "util/backlight_backend.hpp"
namespace waybar::modules {
class BacklightSlider : public ASlider {
public:
BacklightSlider(const std::string&, const Json::Value&);
virtual ~BacklightSlider() = default;
void update() override;
void onValueChanged() override;
private:
std::chrono::milliseconds interval_;
std::string preferred_device_;
util::BacklightBackend backend;
};
} // namespace waybar::modules
================================================
FILE: include/modules/battery.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <filesystem>
#if defined(__linux__)
#include <sys/inotify.h>
#endif
#include <poll.h>
#include <algorithm>
#include <fstream>
#include <string>
#include <vector>
#include "ALabel.hpp"
#include "bar.hpp"
#include "util/sleeper_thread.hpp"
#include "util/udev_deleter.hpp"
namespace waybar::modules {
namespace fs = std::filesystem;
class Battery : public ALabel {
public:
Battery(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Battery();
auto update() -> void override;
private:
static inline const fs::path data_dir_ = "/sys/class/power_supply/";
void refreshBatteries();
void worker();
const std::string getAdapterStatus(uint8_t capacity) const;
std::tuple<uint8_t, float, std::string, float, uint16_t, float> getInfos();
const std::string formatTimeRemaining(float hoursRemaining);
void setBarClass(std::string&);
void processEvents(std::string& state, std::string& status, uint8_t capacity);
std::map<fs::path, int> batteries_;
std::unique_ptr<udev, util::UdevDeleter> udev_;
std::array<pollfd, 1> poll_fds_;
std::unique_ptr<udev_monitor, util::UdevMonitorDeleter> mon_;
fs::path adapter_;
int battery_watch_fd_;
std::mutex battery_list_mutex_;
std::string old_status_;
std::string last_event_;
bool warnFirstTime_{true};
bool weightedAverage_{true};
const Bar& bar_;
util::SleeperThread thread_;
util::SleeperThread thread_battery_update_;
util::SleeperThread thread_timer_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/bluetooth.hpp
================================================
#pragma once
#include "ALabel.hpp"
#ifdef WANT_RFKILL
#include "util/rfkill.hpp"
#endif
#include <gio/gio.h>
#include <optional>
#include <string>
#include <vector>
namespace waybar::modules {
class Bluetooth : public ALabel {
struct ControllerInfo {
std::string path;
std::string address;
std::string address_type;
// std::string name; // just use alias instead
std::string alias;
bool powered;
bool discoverable;
bool pairable;
bool discovering;
};
// NOTE: there are some properties that not all devices provide
struct DeviceInfo {
std::string path;
std::string paired_controller;
std::string address;
std::string address_type;
// std::optional<std::string> name; // just use alias instead
std::string alias;
std::optional<std::string> icon;
bool paired;
bool trusted;
bool blocked;
bool connected;
bool services_resolved;
// NOTE: experimental feature in bluez
std::optional<unsigned char> battery_percentage;
};
public:
Bluetooth(const std::string&, const Json::Value&);
virtual ~Bluetooth() = default;
auto update() -> void override;
private:
static auto onObjectAdded(GDBusObjectManager*, GDBusObject*, gpointer) -> void;
static auto onObjectRemoved(GDBusObjectManager*, GDBusObject*, gpointer) -> void;
static auto onInterfaceAddedOrRemoved(GDBusObjectManager*, GDBusObject*, GDBusInterface*,
gpointer) -> void;
static auto onInterfaceProxyPropertiesChanged(GDBusObjectManagerClient*, GDBusObjectProxy*,
GDBusProxy*, GVariant*, const gchar* const*,
gpointer) -> void;
auto getDeviceBatteryPercentage(GDBusObject*) -> std::optional<unsigned char>;
auto getDeviceProperties(GDBusObject*, DeviceInfo&) -> bool;
auto getControllerProperties(GDBusObject*, ControllerInfo&) -> bool;
// Returns std::nullopt if no controller could be found
auto findCurController() -> std::optional<ControllerInfo>;
auto findConnectedDevices(const std::string&, std::vector<DeviceInfo>&) -> void;
#ifdef WANT_RFKILL
util::Rfkill rfkill_;
#endif
const std::unique_ptr<GDBusObjectManager, void (*)(GDBusObjectManager*)> manager_;
std::string state_;
std::optional<ControllerInfo> cur_controller_;
std::vector<DeviceInfo> connected_devices_;
DeviceInfo cur_focussed_device_;
std::string device_enumerate_;
std::vector<std::string> device_preference_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/cava/cavaGLSL.hpp
================================================
#pragma once
#include <epoxy/gl.h>
#include "AModule.hpp"
#include "cava_backend.hpp"
namespace waybar::modules::cava {
class CavaGLSL final : public AModule, public Gtk::GLArea {
public:
CavaGLSL(const std::string&, const Json::Value&);
~CavaGLSL() = default;
private:
std::shared_ptr<CavaBackend> backend_;
struct ::cava::config_params prm_;
int frame_counter{0};
bool silence_{false};
bool hide_on_silence_{false};
// Cava method
auto onUpdate(const ::cava::audio_raw& input) -> void;
auto onSilence() -> void;
// Member variable to store the shared pointer
std::shared_ptr<::cava::audio_raw> m_data_;
GLuint shaderProgram_;
// OpenGL variables
GLuint fbo_;
GLuint texture_;
GLint uniform_bars_;
GLint uniform_previous_bars_;
GLint uniform_bars_count_;
GLint uniform_time_;
// Methods
void onRealize();
bool onRender(const Glib::RefPtr<Gdk::GLContext>& context);
void initShaders();
void initSurface();
void initGLSL();
GLuint loadShader(const std::string& fileName, GLenum type);
};
} // namespace waybar::modules::cava
================================================
FILE: include/modules/cava/cavaRaw.hpp
================================================
#pragma once
#include "ALabel.hpp"
#include "cava_backend.hpp"
namespace waybar::modules::cava {
class Cava final : public ALabel, public sigc::trackable {
public:
Cava(const std::string&, const Json::Value&);
~Cava() = default;
auto doAction(const std::string& name) -> void override;
private:
std::shared_ptr<CavaBackend> backend_;
// Text to display
Glib::ustring label_text_{""};
bool silence_{false};
bool hide_on_silence_{false};
std::string format_silent_{""};
int ascii_range_{0};
// Cava method
void pause_resume();
auto onUpdate(const std::string& input) -> void;
auto onSilence() -> void;
// ModuleActionMap
static inline std::map<const std::string, void (waybar::modules::cava::Cava::* const)()>
actionMap_{{"mode", &waybar::modules::cava::Cava::pause_resume}};
};
} // namespace waybar::modules::cava
================================================
FILE: include/modules/cava/cava_backend.hpp
================================================
#pragma once
#include <json/json.h>
#include <sigc++/sigc++.h>
#include "util/sleeper_thread.hpp"
namespace cava {
extern "C" {
// Need sdl_glsl output feature to be enabled on libcava
#ifndef SDL_GLSL
#define SDL_GLSL
#endif
#include <cava/common.h>
#ifdef SDL_GLSL
#undef SDL_GLSL
#endif
}
} // namespace cava
namespace waybar::modules::cava {
using namespace std::literals::chrono_literals;
class CavaBackend final {
public:
static std::shared_ptr<CavaBackend> inst(const Json::Value& config);
virtual ~CavaBackend();
// Methods
int getAsciiRange();
void doPauseResume();
void Update();
const struct ::cava::config_params* getPrm();
std::chrono::milliseconds getFrameTimeMilsec();
// Signal accessor
using type_signal_update = sigc::signal<void(const std::string&)>;
type_signal_update signal_update();
using type_signal_audio_raw_update = sigc::signal<void(const ::cava::audio_raw&)>;
type_signal_audio_raw_update signal_audio_raw_update();
using type_signal_silence = sigc::signal<void()>;
type_signal_silence signal_silence();
private:
CavaBackend(const Json::Value& config);
util::SleeperThread read_thread_;
util::SleeperThread out_thread_;
// Cava API to read audio source
::cava::ptr input_source_{NULL};
struct ::cava::error_s error_{}; // cava errors
struct ::cava::config_params prm_{}; // cava parameters
struct ::cava::audio_raw audio_raw_{}; // cava handled raw audio data(is based on audio_data)
struct ::cava::audio_data audio_data_{}; // cava audio data
struct ::cava::cava_plan* plan_{NULL}; //{new cava_plan{}};
std::chrono::seconds fetch_input_delay_{4};
// Delay to handle audio source
std::chrono::milliseconds frame_time_milsec_{1s};
const Json::Value& config_;
int re_paint_{0};
bool silence_{false};
bool silence_prev_{false};
std::chrono::seconds suspend_silence_delay_{0};
int sleep_counter_{0};
std::string output_{};
// Methods
void invoke();
void execute();
bool isSilence();
void doUpdate(bool force = false);
void loadConfig();
void freeBackend();
// Signal
type_signal_update m_signal_update_;
type_signal_audio_raw_update m_signal_audio_raw_;
type_signal_silence m_signal_silence_;
};
} // namespace waybar::modules::cava
================================================
FILE: include/modules/cava/cava_frontend.hpp
================================================
#pragma once
#ifdef HAVE_LIBCAVA
#include "cavaRaw.hpp"
#include "cava_backend.hpp"
#ifdef HAVE_LIBCAVAGLSL
#include "cavaGLSL.hpp"
#endif
#endif
namespace waybar::modules::cava {
AModule* getModule(const std::string& id, const Json::Value& config) {
#ifdef HAVE_LIBCAVA
const std::shared_ptr<CavaBackend> backend_{waybar::modules::cava::CavaBackend::inst(config)};
switch (backend_->getPrm()->output) {
#ifdef HAVE_LIBCAVAGLSL
case ::cava::output_method::OUTPUT_SDL_GLSL:
return new waybar::modules::cava::CavaGLSL(id, config);
#endif
default:
return new waybar::modules::cava::Cava(id, config);
}
#else
throw std::runtime_error("Unknown module");
#endif
};
} // namespace waybar::modules::cava
================================================
FILE: include/modules/cffi.hpp
================================================
#pragma once
#include <string>
#include "AModule.hpp"
#include "util/command.hpp"
#include "util/json.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
namespace ffi {
extern "C" {
typedef struct wbcffi_module wbcffi_module;
typedef struct {
wbcffi_module* obj;
const char* waybar_version;
GtkContainer* (*get_root_widget)(wbcffi_module*);
void (*queue_update)(wbcffi_module*);
} wbcffi_init_info;
struct wbcffi_config_entry {
const char* key;
const char* value;
};
}
} // namespace ffi
class CFFI : public AModule {
public:
CFFI(const std::string&, const std::string&, const Json::Value&);
virtual ~CFFI();
virtual auto refresh(int signal) -> void override;
virtual auto doAction(const std::string& name) -> void override;
virtual auto update() -> void override;
private:
///
void* cffi_instance_ = nullptr;
typedef void*(InitFn)(const ffi::wbcffi_init_info* init_info,
const ffi::wbcffi_config_entry* config_entries, size_t config_entries_len);
typedef void(DenitFn)(void* instance);
typedef void(RefreshFn)(void* instance, int signal);
typedef void(DoActionFn)(void* instance, const char* name);
typedef void(UpdateFn)(void* instance);
// FFI hooks
struct {
std::function<InitFn> init = nullptr;
std::function<DenitFn> deinit = nullptr;
std::function<RefreshFn> refresh = [](void*, int) {};
std::function<DoActionFn> doAction = [](void*, const char*) {};
std::function<UpdateFn> update = [](void*) {};
} hooks_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/clock.hpp
================================================
#pragma once
#include "ALabel.hpp"
#include "util/date.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
const std::string kCldPlaceholder{"calendar"};
const std::string kTZPlaceholder{"tz_list"};
const std::string kOrdPlaceholder{"ordinal_date"};
enum class CldMode { MONTH, YEAR };
enum class WS { LEFT, RIGHT, HIDDEN };
class Clock final : public ALabel {
public:
Clock(const std::string&, const Json::Value&);
virtual ~Clock() = default;
auto update() -> void override;
auto doAction(const std::string&) -> void override;
private:
const std::locale m_locale_;
// tooltip
const std::string m_tlpFmt_;
std::string m_tlpText_{""}; // tooltip text to print
const Glib::RefPtr<Gtk::Label> m_tooltip_; // tooltip as a separate Gtk::Label
bool query_tlp_cb(int, int, bool, const Glib::RefPtr<Gtk::Tooltip>& tooltip);
// Calendar
const bool cldInTooltip_; // calendar in tooltip
/*
0 - calendar.format.months
1 - calendar.format.weekdays
2 - calendar.format.days
3 - calendar.format.today
4 - calendar.format.weeks
5 - tooltip-format
*/
std::map<int, std::string const> fmtMap_;
uint cldMonCols_{3}; // calendar count month columns
int cldWnLen_{3}; // calendar week number length
const int cldMonColLen_{20}; // calendar month column length
WS cldWPos_{WS::HIDDEN}; // calendar week side to print
date::months cldCurrShift_{0}; // calendar months shift
int cldShift_{1}; // calendar months shift factor
date::year_month_day cldYearShift_; // calendar Year mode. Cached ymd
std::string cldYearCached_; // calendar Year mode. Cached calendar
date::year_month cldMonShift_; // calendar Month mode. Cached ym
std::string cldMonCached_; // calendar Month mode. Cached calendar
date::day cldBaseDay_{0}; // calendar Cached day. Is used when today is changing(midnight)
std::string cldText_{""}; // calendar text to print
bool iso8601Calendar_{false}; // whether the calendar is in ISO8601
CldMode cldMode_{CldMode::MONTH};
auto get_calendar(const date::year_month_day& today, const date::year_month_day& ymd,
const date::time_zone* tz) -> const std::string;
// get local time zone
auto local_zone() -> const date::time_zone*;
// time zoned time in tooltip
const bool tzInTooltip_; // if need to print time zones text
std::vector<const date::time_zone*> tzList_; // time zones list
int tzCurrIdx_; // current time zone index for tzList_
std::string tzText_{""}; // time zones text to print
std::string tzTooltipFormat_{""}; // optional timezone tooltip format
util::SleeperThread thread_;
// ordinal date in tooltip
const bool ordInTooltip_;
std::string ordText_{""};
auto get_ordinal_date(const date::year_month_day& today) -> std::string;
auto getTZtext(date::sys_seconds now) -> std::string;
auto first_day_of_week() -> date::weekday;
// Module actions
void cldModeSwitch();
void cldShift_up();
void cldShift_down();
void cldShift_reset();
void tz_up();
void tz_down();
// Module Action Map
static inline std::map<const std::string, void (waybar::modules::Clock::* const)()> actionMap_{
{"mode", &waybar::modules::Clock::cldModeSwitch},
{"shift_up", &waybar::modules::Clock::cldShift_up},
{"shift_down", &waybar::modules::Clock::cldShift_down},
{"shift_reset", &waybar::modules::Clock::cldShift_reset},
{"tz_up", &waybar::modules::Clock::tz_up},
{"tz_down", &waybar::modules::Clock::tz_down}};
};
} // namespace waybar::modules
================================================
FILE: include/modules/cpu.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <cstdint>
#include <fstream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Cpu : public ALabel {
public:
Cpu(const std::string&, const Json::Value&);
virtual ~Cpu() = default;
auto update() -> void override;
private:
std::vector<std::tuple<size_t, size_t>> prev_times_;
util::SleeperThread thread_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/cpu_frequency.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <cstdint>
#include <fstream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class CpuFrequency : public ALabel {
public:
CpuFrequency(const std::string&, const Json::Value&);
virtual ~CpuFrequency() = default;
auto update() -> void override;
// This is a static member because it is also used by the cpu module.
static std::tuple<float, float, float> getCpuFrequency();
private:
static std::vector<float> parseCpuFrequencies();
util::SleeperThread thread_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/cpu_usage.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <cstdint>
#include <fstream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class CpuUsage : public ALabel {
public:
CpuUsage(const std::string&, const Json::Value&);
virtual ~CpuUsage() = default;
auto update() -> void override;
// This is a static member because it is also used by the cpu module.
static std::tuple<std::vector<uint16_t>, std::string> getCpuUsage(
std::vector<std::tuple<size_t, size_t>>&);
private:
static std::vector<std::tuple<size_t, size_t>> parseCpuinfo();
std::vector<std::tuple<size_t, size_t>> prev_times_;
util::SleeperThread thread_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/custom.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <csignal>
#include <string>
#include "ALabel.hpp"
#include "util/command.hpp"
#include "util/json.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Custom : public ALabel {
public:
Custom(const std::string&, const std::string&, const Json::Value&, const std::string&);
virtual ~Custom();
auto update() -> void override;
void refresh(int /*signal*/) override;
private:
void delayWorker();
void continuousWorker();
void waitingWorker();
void parseOutputRaw();
void parseOutputJson();
void handleEvent();
bool handleScroll(GdkEventScroll* e) override;
bool handleToggle(GdkEventButton* const& e) override;
const std::string name_;
const std::string output_name_;
std::string text_;
std::string id_;
std::string alt_;
std::string tooltip_;
std::string last_tooltip_markup_;
const bool tooltip_format_enabled_;
std::vector<std::string> class_;
int percentage_;
FILE* fp_;
int pid_;
util::command::res output_;
util::JsonParser parser_;
util::SleeperThread thread_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/disk.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <sys/statvfs.h>
#include <fstream>
#include "ALabel.hpp"
#include "util/format.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Disk : public ALabel {
public:
Disk(const std::string&, const Json::Value&);
virtual ~Disk() = default;
auto update() -> void override;
private:
util::SleeperThread thread_;
std::string path_;
std::string unit_;
float calc_specific_divisor(const std::string& divisor);
};
} // namespace waybar::modules
================================================
FILE: include/modules/dwl/tags.hpp
================================================
#pragma once
#include <gtkmm/button.h>
#include <wayland-client.h>
#include "AModule.hpp"
#include "bar.hpp"
#include "dwl-ipc-unstable-v2-client-protocol.h"
#include "xdg-output-unstable-v1-client-protocol.h"
namespace waybar::modules::dwl {
class Tags : public waybar::AModule {
public:
Tags(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Tags();
// Handlers for wayland events
void handle_view_tags(uint32_t tag, uint32_t state, uint32_t clients, uint32_t focused);
void handle_primary_clicked(uint32_t tag);
bool handle_button_press(GdkEventButton* event_button, uint32_t tag);
struct zdwl_ipc_manager_v2* status_manager_;
struct wl_seat* seat_;
private:
const waybar::Bar& bar_;
Gtk::Box box_;
std::vector<Gtk::Button> buttons_;
struct zdwl_ipc_output_v2* output_status_;
};
} /* namespace waybar::modules::dwl */
================================================
FILE: include/modules/dwl/window.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <string>
#include "AAppIconLabel.hpp"
#include "bar.hpp"
#include "dwl-ipc-unstable-v2-client-protocol.h"
#include "util/json.hpp"
namespace waybar::modules::dwl {
class Window : public AAppIconLabel, public sigc::trackable {
public:
Window(const std::string&, const waybar::Bar&, const Json::Value&);
~Window();
void handle_layout(const uint32_t layout);
void handle_title(const char* title);
void handle_appid(const char* ppid);
void handle_layout_symbol(const char* layout_symbol);
void handle_frame();
struct zdwl_ipc_manager_v2* status_manager_;
private:
const Bar& bar_;
std::string title_;
std::string appid_;
std::string layout_symbol_;
uint32_t layout_;
struct zdwl_ipc_output_v2* output_status_;
};
} // namespace waybar::modules::dwl
================================================
FILE: include/modules/ext/workspace_manager.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <gtkmm/button.h>
#include <gtkmm/image.h>
#include <gtkmm/label.h>
#include <map>
#include <memory>
#include <vector>
#include "AModule.hpp"
#include "bar.hpp"
#include "ext-workspace-v1-client-protocol.h"
namespace waybar::modules::ext {
class WorkspaceGroup;
class Workspace;
class WorkspaceManager final : public AModule {
public:
WorkspaceManager(const std::string& id, const waybar::Bar& bar, const Json::Value& config);
~WorkspaceManager() override;
void register_manager(wl_registry* registry, uint32_t name, uint32_t version);
void remove_workspace_group(uint32_t id);
void remove_workspace(uint32_t id);
void set_needs_sorting() { needs_sorting_ = true; }
// wl events
void handle_workspace_group(ext_workspace_group_handle_v1* handle);
void handle_workspace(ext_workspace_handle_v1* handle);
void handle_done();
void handle_finished();
// wl requests
void commit() const;
private:
void update() override;
bool has_button(const Gtk::Button* button);
void sort_workspaces();
void clear_buttons();
void update_buttons();
static uint32_t group_global_id;
static uint32_t workspace_global_id;
uint32_t workspace_name = 0;
bool sort_by_id_ = false;
bool sort_by_name_ = true;
bool sort_by_coordinates_ = false;
bool all_outputs_ = false;
const waybar::Bar& bar_;
Gtk::Box box_;
ext_workspace_manager_v1* ext_manager_ = nullptr;
std::vector<std::unique_ptr<WorkspaceGroup>> groups_;
std::vector<std::unique_ptr<Workspace>> workspaces_;
bool needs_sorting_ = false;
};
class WorkspaceGroup {
public:
WorkspaceGroup(WorkspaceManager& manager, ext_workspace_group_handle_v1* handle, uint32_t id);
~WorkspaceGroup();
u_int32_t id() const { return id_; }
bool has_output(const wl_output* output);
bool has_workspace(const ext_workspace_handle_v1* workspace);
// wl events
void handle_capabilities(uint32_t capabilities);
void handle_output_enter(wl_output* output);
void handle_output_leave(wl_output* output);
void handle_workspace_enter(ext_workspace_handle_v1* handle);
void handle_workspace_leave(ext_workspace_handle_v1* handle);
void handle_removed();
private:
WorkspaceManager& workspaces_manager_;
ext_workspace_group_handle_v1* ext_handle_;
uint32_t id_;
std::vector<wl_output*> outputs_;
std::vector<ext_workspace_handle_v1*> workspaces_;
};
class Workspace {
public:
Workspace(const Json::Value& config, WorkspaceManager& manager, ext_workspace_handle_v1* handle,
uint32_t id, const std::string& name);
~Workspace();
ext_workspace_handle_v1* handle() const { return ext_handle_; }
u_int32_t id() const { return id_; }
std::string& workspace_id() { return workspace_id_; }
std::string& name() { return name_; }
std::vector<u_int32_t>& coordinates() { return coordinates_; }
Gtk::Button& button() { return button_; }
void update();
// wl events
void handle_id(const std::string& id);
void handle_name(const std::string& name);
void handle_coordinates(const std::vector<uint32_t>& coordinates);
void handle_state(uint32_t state);
void handle_capabilities(uint32_t capabilities);
void handle_removed();
// gdk events
bool handle_clicked(const GdkEventButton* button) const;
private:
bool has_state(uint32_t state) const { return (state_ & state) == state; }
std::string icon();
WorkspaceManager& workspace_manager_;
ext_workspace_handle_v1* ext_handle_ = nullptr;
uint32_t id_;
uint32_t state_ = 0;
std::string workspace_id_;
std::string name_;
std::vector<uint32_t> coordinates_;
bool active_only_ = false;
bool ignore_hidden_ = true;
std::string format_;
bool with_icon_ = false;
static std::map<std::string, std::string> icon_map_;
std::string on_click_action_;
std::string on_click_middle_action_;
std::string on_click_right_action_;
Gtk::Button button_;
Gtk::Box content_;
Gtk::Label label_;
};
} // namespace waybar::modules::ext
================================================
FILE: include/modules/ext/workspace_manager_binding.hpp
================================================
#include "ext-workspace-v1-client-protocol.h"
namespace waybar::modules::ext {
void add_registry_listener(void* data);
void add_workspace_listener(ext_workspace_handle_v1* workspace_handle, void* data);
void add_workspace_group_listener(ext_workspace_group_handle_v1* workspace_group_handle,
void* data);
ext_workspace_manager_v1* workspace_manager_bind(wl_registry* registry, uint32_t name,
uint32_t version, void* data);
} // namespace waybar::modules::ext
================================================
FILE: include/modules/gamemode.hpp
================================================
#pragma once
#include <iostream>
#include <map>
#include <string>
#include "ALabel.hpp"
#include "giomm/dbusconnection.h"
#include "giomm/dbusproxy.h"
#include "glibconfig.h"
#include "gtkmm/box.h"
#include "gtkmm/image.h"
#include "gtkmm/label.h"
#include "gtkmm/overlay.h"
namespace waybar::modules {
class Gamemode : public AModule {
public:
Gamemode(const std::string&, const Json::Value&);
virtual ~Gamemode();
auto update() -> void override;
private:
const std::string DEFAULT_ICON_NAME = "input-gaming-symbolic";
const std::string DEFAULT_FORMAT = "{glyph}";
const std::string DEFAULT_FORMAT_ALT = "{glyph} {count}";
const std::string DEFAULT_TOOLTIP_FORMAT = "Games running: {count}";
const std::string DEFAULT_GLYPH = "";
void appear(const Glib::RefPtr<Gio::DBus::Connection>& connection, const Glib::ustring& name,
const Glib::ustring& name_owner);
void disappear(const Glib::RefPtr<Gio::DBus::Connection>& connection, const Glib::ustring& name);
void prepareForSleep_cb(const Glib::RefPtr<Gio::DBus::Connection>& connection,
const Glib::ustring& sender_name, const Glib::ustring& object_path,
const Glib::ustring& interface_name, const Glib::ustring& signal_name,
const Glib::VariantContainerBase& parameters);
void notify_cb(const Glib::ustring& sender_name, const Glib::ustring& signal_name,
const Glib::VariantContainerBase& arguments);
void getData();
bool handleToggle(GdkEventButton* const&) override;
// Config
std::string format = DEFAULT_FORMAT;
std::string format_alt = DEFAULT_FORMAT_ALT;
std::string tooltip_format = DEFAULT_TOOLTIP_FORMAT;
std::string glyph = DEFAULT_GLYPH;
bool tooltip = true;
bool hideNotRunning = true;
bool useIcon = true;
uint iconSize = 20;
uint iconSpacing = 4;
std::string iconName = DEFAULT_ICON_NAME;
Gtk::Box box_;
Gtk::Image icon_;
Gtk::Label label_;
const std::string dbus_name = "com.feralinteractive.GameMode";
const std::string dbus_obj_path = "/com/feralinteractive/GameMode";
const std::string dbus_interface = "org.freedesktop.DBus.Properties";
const std::string dbus_get_interface = "com.feralinteractive.GameMode";
uint gameCount = 0;
std::string lastStatus;
bool showAltText = false;
guint login1_id;
Glib::RefPtr<Gio::DBus::Proxy> gamemode_proxy;
Glib::RefPtr<Gio::DBus::Connection> system_connection;
bool gamemodeRunning;
guint gamemodeWatcher_id;
};
} // namespace waybar::modules
================================================
FILE: include/modules/gps.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <sys/statvfs.h>
#ifdef WANT_RFKILL
#include "util/rfkill.hpp"
#endif
#include <gps.h>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Gps : public ALabel {
public:
Gps(const std::string&, const Json::Value&);
virtual ~Gps();
auto update() -> void override;
private:
#ifdef WANT_RFKILL
util::Rfkill rfkill_;
#endif
const std::string getFixModeName() const;
const std::string getFixModeString() const;
const std::string getFixStatusString() const;
util::SleeperThread thread_, gps_thread_;
gps_data_t gps_data_;
std::string state_;
bool hideDisconnected = true;
bool hideNoFix = false;
};
} // namespace waybar::modules
================================================
FILE: include/modules/hyprland/backend.hpp
================================================
#pragma once
#include <atomic>
#include <filesystem>
#include <list>
#include <mutex>
#include <string>
#include <thread>
#include <utility>
#include "util/json.hpp"
namespace waybar::modules::hyprland {
class EventHandler {
public:
virtual void onEvent(const std::string& ev) = 0;
virtual ~EventHandler() = default;
};
/// If you want to use the Hyprland IPC, simply use IPC::inst() to get the singleton instance.
/// Do not create multiple instances.
class IPC {
protected:
IPC(); // use IPC::inst() instead.
public:
~IPC();
static IPC& inst();
void registerForIPC(const std::string& ev, EventHandler* ev_handler);
void unregisterForIPC(EventHandler* handler);
static std::string getSocket1Reply(const std::string& rq);
Json::Value getSocket1JsonReply(const std::string& rq);
static std::filesystem::path getSocketFolder(const char* instanceSig);
protected:
static std::filesystem::path socketFolder_;
private:
void socketListener();
void parseIPC(const std::string&);
std::thread ipcThread_;
std::mutex callbackMutex_;
std::mutex socketMutex_;
util::JsonParser parser_;
std::list<std::pair<std::string, EventHandler*>> callbacks_;
int socketfd_ = -1; // the hyprland socket file descriptor
pid_t socketOwnerPid_ = -1;
std::atomic<bool> running_ = true; // the ipcThread will stop running when this is false
};
}; // namespace waybar::modules::hyprland
================================================
FILE: include/modules/hyprland/language.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <string>
#include "ALabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "util/json.hpp"
namespace waybar::modules::hyprland {
class Language : public waybar::ALabel, public EventHandler {
public:
Language(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Language();
auto update() -> void override;
private:
void onEvent(const std::string&) override;
void initLanguage();
struct Layout {
std::string full_name;
std::string short_name;
std::string variant;
std::string short_description;
};
static auto getLayout(const std::string&) -> Layout;
std::mutex mutex_;
const Bar& bar_;
util::JsonParser parser_;
Layout layout_;
IPC& m_ipc;
};
} // namespace waybar::modules::hyprland
================================================
FILE: include/modules/hyprland/submap.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <string>
#include "ALabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "util/json.hpp"
namespace waybar::modules::hyprland {
class Submap : public waybar::ALabel, public EventHandler {
public:
Submap(const std::string&, const waybar::Bar&, const Json::Value&);
~Submap() override;
auto update() -> void override;
private:
auto parseConfig(const Json::Value&) -> void;
void onEvent(const std::string& ev) override;
std::mutex mutex_;
const Bar& bar_;
util::JsonParser parser_;
std::string submap_;
std::string prev_submap_;
bool always_on_ = false;
std::string default_submap_ = "Default";
IPC& m_ipc;
};
} // namespace waybar::modules::hyprland
================================================
FILE: include/modules/hyprland/window.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <string>
#include "AAppIconLabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "util/json.hpp"
namespace waybar::modules::hyprland {
class Window : public waybar::AAppIconLabel, public EventHandler {
public:
Window(const std::string&, const waybar::Bar&, const Json::Value&);
~Window() override;
auto update() -> void override;
private:
struct Workspace {
int id = 0;
int windows = 0;
std::string last_window;
std::string last_window_title;
static auto parse(const Json::Value& value) -> Workspace;
};
struct WindowData {
bool floating = false;
int monitor = -1;
std::string class_name;
std::string initial_class_name;
std::string title;
std::string initial_title;
bool fullscreen = false;
bool grouped = false;
static auto parse(const Json::Value&) -> WindowData;
};
static auto getActiveWorkspace(const std::string&) -> Workspace;
static auto getActiveWorkspace() -> Workspace;
void onEvent(const std::string& ev) override;
void queryActiveWorkspace();
void setClass(const std::string&, bool enable);
bool separateOutputs_ = false;
std::mutex mutex_;
const Bar& bar_;
util::JsonParser parser_;
WindowData windowData_;
Workspace workspace_;
std::string soloClass_;
std::string lastSoloClass_;
bool solo_ = false;
bool allFloating_ = false;
bool swallowing_ = false;
bool fullscreen_ = false;
bool focused_ = false;
IPC& m_ipc;
};
} // namespace waybar::modules::hyprland
================================================
FILE: include/modules/hyprland/windowcount.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <string>
#include "AAppIconLabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
namespace waybar::modules::hyprland {
class WindowCount : public waybar::AAppIconLabel, public EventHandler {
public:
WindowCount(const std::string&, const waybar::Bar&, const Json::Value&);
~WindowCount() override;
auto update() -> void override;
private:
struct Workspace {
int id;
int windows;
bool hasfullscreen;
static auto parse(const Json::Value& value) -> Workspace;
};
auto getActiveWorkspace(const std::string&) -> Workspace;
auto getActiveWorkspace() -> Workspace;
void onEvent(const std::string& ev) override;
void queryActiveWorkspace();
void setClass(const std::string&, bool enable);
bool separateOutputs_;
std::mutex mutex_;
const Bar& bar_;
Workspace workspace_;
IPC& m_ipc;
};
} // namespace waybar::modules::hyprland
================================================
FILE: include/modules/hyprland/windowcreationpayload.hpp
================================================
#pragma once
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <json/value.h>
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <regex>
#include <string>
#include <variant>
#include <vector>
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "util/enum.hpp"
#include "util/regex_collection.hpp"
using WindowAddress = std::string;
namespace waybar::modules::hyprland {
class Workspaces;
struct WindowRepr {
std::string address;
std::string window_class;
std::string window_title;
std::string repr_rewrite;
bool isActive = false;
public:
bool empty() const { return address.empty(); }
void setActive(bool value) { isActive = value; }
};
class WindowCreationPayload {
public:
WindowCreationPayload(const std::string& workspace_name, WindowAddress window_address,
WindowRepr window_repr);
WindowCreationPayload(const std::string& workspace_name, WindowAddress window_address,
const std::string& window_class, const std::string& window_title,
bool is_active);
WindowCreationPayload(Json::Value const& client_data);
int incrementTimeSpentUncreated();
bool isEmpty(Workspaces& workspace_manager);
bool reprIsReady() const { return std::holds_alternative<Repr>(m_window); }
WindowRepr repr(Workspaces& workspace_manager);
void setActive(bool value) { m_isActive = value; }
std::string getWorkspaceName() const { return m_workspaceName; }
WindowAddress getAddress() const { return m_windowAddress; }
void moveToWorkspace(std::string& new_workspace_name);
private:
void clearAddr();
void clearWorkspaceName();
using Repr = WindowRepr;
using ClassAndTitle = std::pair<std::string, std::string>;
std::variant<Repr, ClassAndTitle> m_window;
WindowAddress m_windowAddress;
std::string m_workspaceName;
bool m_isActive = false;
int m_timeSpentUncreated = 0;
};
} // namespace waybar::modules::hyprland
================================================
FILE: include/modules/hyprland/workspace.hpp
================================================
#pragma once
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <json/value.h>
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <regex>
#include <string>
#include <variant>
#include <vector>
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "modules/hyprland/windowcreationpayload.hpp"
#include "util/enum.hpp"
#include "util/regex_collection.hpp"
using WindowAddress = std::string;
namespace waybar::modules::hyprland {
class Workspaces;
class Workspace {
public:
explicit Workspace(const Json::Value& workspace_data, Workspaces& workspace_manager,
const Json::Value& clients_data = Json::Value::nullRef);
std::string& selectIcon(std::map<std::string, std::string>& icons_map);
Gtk::Button& button() { return m_button; };
int id() const { return m_id; };
std::string name() const { return m_name; };
std::string output() const { return m_output; };
bool isActive() const { return m_isActive; };
bool isSpecial() const { return m_isSpecial; };
bool isPersistent() const { return m_isPersistentRule || m_isPersistentConfig; };
bool isPersistentConfig() const { return m_isPersistentConfig; };
bool isPersistentRule() const { return m_isPersistentRule; };
bool isVisible() const { return m_isVisible; };
bool isUrgent() const { return m_isUrgent; };
bool handleClicked(GdkEventButton* bt) const;
void setActive(bool value = true) { m_isActive = value; };
void setPersistentRule(bool value = true) { m_isPersistentRule = value; };
void setPersistentConfig(bool value = true) { m_isPersistentConfig = value; };
void setUrgent(bool value = true) { m_isUrgent = value; };
void setVisible(bool value = true) { m_isVisible = value; };
void setWindows(uint value) { m_windows = value; };
void setName(std::string const& value) { m_name = value; };
void setOutput(std::string const& value) { m_output = value; };
bool containsWindow(WindowAddress const& addr) const {
return std::ranges::any_of(m_windowMap,
[&addr](const auto& window) { return window.address == addr; });
};
void insertWindow(WindowCreationPayload create_window_payload);
void initializeWindowMap(const Json::Value& clients_data);
void setActiveWindow(WindowAddress const& addr);
bool onWindowOpened(WindowCreationPayload const& create_window_payload);
std::optional<WindowRepr> closeWindow(WindowAddress const& addr);
void update(const std::string& workspace_icon);
private:
Workspaces& m_workspaceManager;
int m_id;
std::string m_name;
std::string m_output;
uint m_windows;
bool m_isActive = false;
bool m_isSpecial = false;
bool m_isPersistentRule = false; // represents the persistent state in hyprland
bool m_isPersistentConfig = false; // represents the persistent state in the Waybar config
bool m_isUrgent = false;
bool m_isVisible = false;
std::vector<WindowRepr> m_windowMap;
Gtk::Button m_button;
Gtk::Box m_content;
Gtk::Label m_labelBefore;
Gtk::Label m_labelAfter;
bool isEmpty() const;
void updateTaskbar(const std::string& workspace_icon);
bool handleClick(const GdkEventButton* event_button, WindowAddress const& addr) const;
bool shouldSkipWindow(const WindowRepr& window_repr) const;
IPC& m_ipc;
};
} // namespace waybar::modules::hyprland
================================================
FILE: include/modules/hyprland/workspaces.hpp
================================================
#pragma once
#include <gtkmm/button.h>
#include <gtkmm/enums.h>
#include <gtkmm/label.h>
#include <json/value.h>
#include <sigc++/connection.h>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <regex>
#include <string>
#include <vector>
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "modules/hyprland/windowcreationpayload.hpp"
#include "modules/hyprland/workspace.hpp"
#include "util/enum.hpp"
#include "util/icon_loader.hpp"
#include "util/regex_collection.hpp"
using WindowAddress = std::string;
namespace waybar::modules::hyprland {
class Workspaces;
class Workspaces : public AModule, public EventHandler {
public:
Workspaces(const std::string&, const waybar::Bar&, const Json::Value&);
~Workspaces() override;
void update() override;
void init();
auto allOutputs() const -> bool { return m_allOutputs; }
auto showSpecial() const -> bool { return m_showSpecial; }
auto activeOnly() const -> bool { return m_activeOnly; }
auto specialVisibleOnly() const -> bool { return m_specialVisibleOnly; }
auto persistentOnly() const -> bool { return m_persistentOnly; }
auto moveToMonitor() const -> bool { return m_moveToMonitor; }
auto enableTaskbar() const -> bool { return m_enableTaskbar; }
auto taskbarWithIcon() const -> bool { return m_taskbarWithIcon; }
auto barScroll() const -> bool { return m_barScroll; }
auto getBarOutput() const -> std::string { return m_bar.output->name; }
auto formatBefore() const -> std::string { return m_formatBefore; }
auto formatAfter() const -> std::string { return m_formatAfter; }
auto taskbarFormatBefore() const -> std::string { return m_taskbarFormatBefore; }
auto taskbarFormatAfter() const -> std::string { return m_taskbarFormatAfter; }
auto taskbarIconSize() const -> int { return m_taskbarIconSize; }
auto taskbarOrientation() const -> Gtk::Orientation { return m_taskbarOrientation; }
auto taskbarReverseDirection() const -> bool { return m_taskbarReverseDirection; }
auto onClickWindow() const -> std::string { return m_onClickWindow; }
auto getIgnoredWindows() const -> std::vector<std::regex> { return m_ignoreWindows; }
enum class ActiveWindowPosition { NONE, FIRST, LAST };
auto activeWindowPosition() const -> ActiveWindowPosition { return m_activeWindowPosition; }
std::string getRewrite(const std::string& window_class, const std::string& window_title);
std::string& getWindowSeparator() { return m_formatWindowSeparator; }
bool isWorkspaceIgnored(std::string const& workspace_name);
bool windowRewriteConfigUsesTitle() const { return m_anyWindowRewriteRuleUsesTitle; }
const IconLoader& iconLoader() const { return m_iconLoader; }
private:
void onEvent(const std::string& e) override;
void updateWindowCount();
void sortSpecialCentered();
void sortWorkspaces();
void createWorkspace(Json::Value const& workspace_data,
Json::Value const& clients_data = Json::Value::nullRef);
static Json::Value createMonitorWorkspaceData(std::string const& name,
std::string const& monitor);
void removeWorkspace(std::string const& workspaceString);
void setUrgentWorkspace(std::string const& windowaddress);
// Config
void parseConfig(const Json::Value& config);
auto populateIconsMap(const Json::Value& formatIcons) -> void;
static auto populateBoolConfig(const Json::Value& config, const std::string& key, bool& member)
-> void;
auto populateSortByConfig(const Json::Value& config) -> void;
auto populateIgnoreWorkspacesConfig(const Json::Value& config) -> void;
auto populateFormatWindowSeparatorConfig(const Json::Value& config) -> void;
auto populateWindowRewriteConfig(const Json::Value& config) -> void;
auto populateWorkspaceTaskbarConfig(const Json::Value& config) -> void;
void registerIpc();
// workspace events
void onWorkspaceActivated(std::string const& payload);
void onSpecialWorkspaceActivated(std::string const& payload);
void onWorkspaceDestroyed(std::string const& payload);
void onWorkspaceCreated(std::string const& payload,
Json::Value const& clientsData = Json::Value::nullRef);
void onWorkspaceMoved(std::string const& payload);
void onWorkspaceRenamed(std::string const& payload);
static std::optional<int> parseWorkspaceId(std::string const& workspaceIdStr);
// monitor events
void onMonitorFocused(std::string const& payload);
// window events
void onWindowOpened(std::string const& payload);
void onWindowClosed(std::string const& addr);
void onWindowMoved(std::string const& payload);
void onWindowTitleEvent(std::string const& payload);
void onActiveWindowChanged(WindowAddress const& payload);
void onConfigReloaded();
int windowRewritePriorityFunction(std::string const& window_rule);
// event payload management
template <typename... Args>
static std::string makePayload(Args const&... args);
static std::pair<std::string, std::string> splitDoublePayload(std::string const& payload);
static std::tuple<std::string, std::string, std::string> splitTriplePayload(
std::string const& payload);
// scroll events
bool handleScroll(GdkEventScroll* e) override;
// Update methods
void doUpdate();
void removeWorkspacesToRemove();
void createWorkspacesToCreate();
static std::vector<int> getVisibleWorkspaces();
void updateWorkspaceStates();
bool updateWindowsToCreate();
void extendOrphans(int workspaceId, Json::Value const& clientsJson);
void registerOrphanWindow(WindowCreationPayload create_window_payload);
void initializeWorkspaces();
void setCurrentMonitorId();
void loadPersistentWorkspacesFromConfig(Json::Value const& clientsJson);
void loadPersistentWorkspacesFromWorkspaceRules(const Json::Value& clientsJson);
bool m_allOutputs = false;
bool m_showSpecial = false;
bool m_activeOnly = false;
bool m_specialVisibleOnly = false;
bool m_persistentOnly = false;
bool m_moveToMonitor = false;
bool m_barScroll = false;
Json::Value m_persistentWorkspaceConfig;
// Map for windows stored in workspaces not present in the current bar.
// This happens when the user has multiple monitors (hence, multiple bars)
// and doesn't share windows across bars (a.k.a `all-outputs` = false)
std::map<WindowAddress, WindowRepr, std::less<>> m_orphanWindowMap;
enum class SortMethod { ID, NAME, NUMBER, SPECIAL_CENTERED, DEFAULT };
util::EnumParser<SortMethod> m_enumParser;
SortMethod m_sortBy = SortMethod::DEFAULT;
std::map<std::string, SortMethod> m_sortMap = {{"ID", SortMethod::ID},
{"NAME", SortMethod::NAME},
{"NUMBER", SortMethod::NUMBER},
{"SPECIAL-CENTERED", SortMethod::SPECIAL_CENTERED},
{"DEFAULT", SortMethod::DEFAULT}};
std::string m_formatBefore;
std::string m_formatAfter;
std::map<std::string, std::string> m_iconsMap;
util::RegexCollection m_windowRewriteRules;
bool m_anyWindowRewriteRuleUsesTitle = false;
std::string m_formatWindowSeparator;
bool m_withIcon;
uint64_t m_monitorId;
int m_activeWorkspaceId;
std::string m_activeSpecialWorkspaceName;
std::vector<std::unique_ptr<Workspace>> m_workspaces;
std::vector<std::pair<Json::Value, Json::Value>> m_workspacesToCreate;
std::vector<std::string> m_workspacesToRemove;
std::vector<WindowCreationPayload> m_windowsToCreate;
IconLoader m_iconLoader;
bool m_enableTaskbar = false;
bool m_updateActiveWindow = false;
bool m_taskbarWithIcon = false;
bool m_taskbarWithTitle = false;
std::string m_taskbarFormatBefore;
std::string m_taskbarFormatAfter;
int m_taskbarIconSize = 16;
Gtk::Orientation m_taskbarOrientation = Gtk::ORIENTATION_HORIZONTAL;
bool m_taskbarReverseDirection = false;
util::EnumParser<ActiveWindowPosition> m_activeWindowEnumParser;
ActiveWindowPosition m_activeWindowPosition = ActiveWindowPosition::NONE;
std::map<std::string, ActiveWindowPosition> m_activeWindowPositionMap = {
{"NONE", ActiveWindowPosition::NONE},
{"FIRST", ActiveWindowPosition::FIRST},
{"LAST", ActiveWindowPosition::LAST},
};
std::string m_onClickWindow;
std::string m_currentActiveWindowAddress;
std::vector<std::regex> m_ignoreWorkspaces;
std::vector<std::regex> m_ignoreWindows;
std::mutex m_mutex;
const Bar& m_bar;
Gtk::Box m_box;
sigc::connection m_scrollEventConnection_;
IPC& m_ipc;
};
} // namespace waybar::modules::hyprland
================================================
FILE: include/modules/idle_inhibitor.hpp
================================================
#pragma once
#include <fmt/format.h>
#include "ALabel.hpp"
#include "bar.hpp"
#include "client.hpp"
namespace waybar::modules {
class IdleInhibitor : public ALabel {
sigc::connection timeout_;
public:
IdleInhibitor(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~IdleInhibitor();
auto update() -> void override;
static std::list<waybar::AModule*> modules;
static bool status;
private:
bool handleToggle(GdkEventButton* const& e) override;
void toggleStatus();
const Bar& bar_;
struct zwp_idle_inhibitor_v1* idle_inhibitor_;
int pid_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/image.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <gtkmm/image.h>
#include <csignal>
#include <string>
#include "ALabel.hpp"
#include "gtkmm/box.h"
#include "util/command.hpp"
#include "util/json.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Image : public AModule {
public:
Image(const std::string&, const Json::Value&);
virtual ~Image() = default;
auto update() -> void override;
void refresh(int /*signal*/) override;
private:
void delayWorker();
void handleEvent();
void parseOutputRaw();
Gtk::Box box_;
Gtk::Image image_;
std::string path_;
std::string tooltip_;
int size_;
std::chrono::milliseconds interval_;
util::command::res output_;
util::SleeperThread thread_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/inhibitor.hpp
================================================
#pragma once
#include <gio/gio.h>
#include <memory>
#include "ALabel.hpp"
#include "bar.hpp"
namespace waybar::modules {
class Inhibitor : public ALabel {
public:
Inhibitor(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Inhibitor();
auto update() -> void override;
auto activated() -> bool;
private:
auto handleToggle(::GdkEventButton* const& e) -> bool override;
const std::unique_ptr<::GDBusConnection, void (*)(::GDBusConnection*)> dbus_;
const std::string inhibitors_;
int handle_ = -1;
};
} // namespace waybar::modules
================================================
FILE: include/modules/jack.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <jack/jack.h>
#include <jack/thread.h>
#include <fstream>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class JACK : public ALabel {
public:
JACK(const std::string&, const Json::Value&);
virtual ~JACK() = default;
auto update() -> void override;
int bufSize(jack_nframes_t size);
int sampleRate(jack_nframes_t rate);
int xrun();
void shutdown();
private:
std::string JACKState();
jack_client_t* client_;
jack_nframes_t bufsize_;
jack_nframes_t samplerate_;
unsigned int xruns_;
float load_;
bool running_;
std::mutex mutex_;
std::string state_;
util::SleeperThread thread_;
};
} // namespace waybar::modules
int bufSizeCallback(jack_nframes_t size, void* obj);
int sampleRateCallback(jack_nframes_t rate, void* obj);
int xrunCallback(void* obj);
void shutdownCallback(void* obj);
================================================
FILE: include/modules/keyboard_state.hpp
================================================
#pragma once
#include <fmt/chrono.h>
#include <gtkmm/label.h>
#include <mutex>
#include <set>
#include <unordered_map>
#include "AModule.hpp"
#include "bar.hpp"
#include "util/sleeper_thread.hpp"
extern "C" {
#include <libevdev/libevdev.h>
#include <libinput.h>
}
namespace waybar::modules {
class KeyboardState : public AModule {
public:
KeyboardState(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~KeyboardState();
auto update() -> void override;
private:
auto tryAddDevice(const std::string&) -> void;
Gtk::Box box_;
Gtk::Label numlock_label_;
Gtk::Label capslock_label_;
Gtk::Label scrolllock_label_;
std::string numlock_format_;
std::string capslock_format_;
std::string scrolllock_format_;
const std::chrono::seconds interval_;
std::string icon_locked_;
std::string icon_unlocked_;
std::string devices_path_;
struct libinput* libinput_;
std::unordered_map<std::string, struct libinput_device*> libinput_devices_;
std::mutex devices_mutex_; // protects libinput_devices_
std::set<int> binding_keys;
util::SleeperThread libinput_thread_, hotplug_thread_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/load.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <cstdint>
#include <fstream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Load : public ALabel {
public:
Load(const std::string&, const Json::Value&);
virtual ~Load() = default;
auto update() -> void override;
// This is a static member because it is also used by the cpu module.
static std::tuple<double, double, double> getLoad();
private:
util::SleeperThread thread_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/memory.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <fstream>
#include <unordered_map>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Memory : public ALabel {
public:
Memory(const std::string&, const Json::Value&);
virtual ~Memory() = default;
auto update() -> void override;
private:
void parseMeminfo();
std::unordered_map<std::string, unsigned long> meminfo_;
util::SleeperThread thread_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/mpd/mpd.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <mpd/client.h>
#include <spdlog/spdlog.h>
#include <condition_variable>
#include <thread>
#include "ALabel.hpp"
#include "modules/mpd/state.hpp"
namespace waybar::modules {
class MPD : public ALabel {
friend class detail::Context;
// State machine
detail::Context context_{this};
const std::string module_name_;
// Not using unique_ptr since we don't manage the pointer
// (It's either nullptr, or from the config)
const char* server_;
const unsigned port_;
const std::string password_;
unsigned timeout_;
detail::unique_connection connection_;
detail::unique_status status_;
mpd_state state_;
detail::unique_song song_;
public:
MPD(const std::string&, const Json::Value&);
virtual ~MPD() noexcept = default;
auto update() -> void override;
private:
std::string getTag(mpd_tag_type type, unsigned idx = 0) const;
std::string getFilename() const;
void setLabel();
std::string getStateIcon() const;
std::string getOptionIcon(const std::string& optionName, bool activated) const;
// GUI-side methods
bool handlePlayPause(GdkEventButton* const&);
void emit() { dp.emit(); }
// MPD-side, Non-GUI methods.
void tryConnect();
void checkErrors(mpd_connection* conn);
void fetchState();
void queryMPD();
inline bool stopped() const { return connection_ && state_ == MPD_STATE_STOP; }
inline bool playing() const { return connection_ && state_ == MPD_STATE_PLAY; }
inline bool paused() const { return connection_ && state_ == MPD_STATE_PAUSE; }
};
#if !defined(MPD_NOINLINE)
#include "modules/mpd/state.inl.hpp"
#endif
} // namespace waybar::modules
================================================
FILE: include/modules/mpd/state.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <mpd/client.h>
#include <spdlog/spdlog.h>
#include <condition_variable>
#include <thread>
#include "ALabel.hpp"
namespace waybar::modules {
class MPD;
} // namespace waybar::modules
namespace waybar::modules::detail {
using unique_connection = std::unique_ptr<mpd_connection, decltype(&mpd_connection_free)>;
using unique_status = std::unique_ptr<mpd_status, decltype(&mpd_status_free)>;
using unique_song = std::unique_ptr<mpd_song, decltype(&mpd_song_free)>;
class Context;
/// This state machine loosely follows a non-hierarchical, statechart
/// pattern, and includes ENTRY and EXIT actions.
///
/// The State class is the base class for all other states. The
/// entry and exit methods are automatically called when entering
/// into a new state and exiting from the current state. This
/// includes initially entering (Disconnected class) and exiting
/// Waybar.
///
/// The following nested "top-level" states are represented:
/// 1. Idle - await notification of MPD activity.
/// 2. All Non-Idle states:
/// 1. Playing - An active song is producing audio output.
/// 2. Paused - The current song is paused.
/// 3. Stopped - No song is actively playing.
/// 3. Disconnected - periodically attempt MPD (re-)connection.
///
/// NOTE: Since this statechart is non-hierarchical, the above
/// states are flattened into a set.
class State {
public:
virtual ~State() noexcept = default;
virtual void entry() noexcept { spdlog::debug("mpd: ignore entry action"); }
virtual void exit() noexcept { spdlog::debug("mpd: ignore exit action"); }
virtual void play() { spdlog::debug("mpd: ignore play state transition"); }
virtual void stop() { spdlog::debug("mpd: ignore stop state transition"); }
virtual void pause() { spdlog::debug("mpd: ignore pause state transition"); }
/// Request state update the GUI.
virtual void update() noexcept { spdlog::debug("mpd: ignoring update method request"); }
};
class Idle : public State {
Context* const ctx_;
sigc::connection idle_connection_;
public:
Idle(Context* const ctx) : ctx_{ctx} {}
virtual ~Idle() noexcept { this->exit(); };
void entry() noexcept override;
void exit() noexcept override;
void play() override;
void stop() override;
void pause() override;
void update() noexcept override;
private:
Idle(const Idle&) = delete;
Idle& operator=(const Idle&) = delete;
bool on_io(Glib::IOCondition const&);
};
class Playing : public State {
Context* const ctx_;
sigc::connection timer_connection_;
public:
Playing(Context* const ctx) : ctx_{ctx} {}
virtual ~Playing() noexcept { this->exit(); }
void entry() noexcept override;
void exit() noexcept override;
void pause() override;
void stop() override;
void update() noexcept override;
private:
Playing(Playing const&) = delete;
Playing& operator=(Playing const&) = delete;
bool on_timer();
};
class Paused : public State {
Context* const ctx_;
sigc::connection timer_connection_;
public:
Paused(Context* const ctx) : ctx_{ctx} {}
virtual ~Paused() noexcept { this->exit(); }
void entry() noexcept override;
void exit() noexcept override;
void play() override;
void stop() override;
void update() noexcept override;
private:
Paused(Paused const&) = delete;
Paused& operator=(Paused const&) = delete;
bool on_timer();
};
class Stopped : public State {
Context* const ctx_;
sigc::connection timer_connection_;
public:
Stopped(Context* const ctx) : ctx_{ctx} {}
virtual ~Stopped() noexcept { this->exit(); }
void entry() noexcept override;
void exit() noexcept override;
void play() override;
void pause() override;
void update() noexcept override;
private:
Stopped(Stopped const&) = delete;
Stopped& operator=(Stopped const&) = delete;
bool on_timer();
};
class Disconnected : public State {
Context* const ctx_;
sigc::connection timer_connection_;
int last_interval_;
public:
Disconnected(Context* const ctx) : ctx_{ctx} {}
virtual ~Disconnected() noexcept { this->exit(); }
void entry() noexcept override;
void exit() noexcept override;
void update() noexcept override;
private:
Disconnected(Disconnected const&) = delete;
Disconnected& operator=(Disconnected const&) = delete;
bool arm_timer(int interval) noexcept;
void disarm_timer() noexcept;
bool on_timer();
};
class Context {
std::unique_ptr<State> state_;
waybar::modules::MPD* mpd_module_;
friend class State;
friend class Playing;
friend class Paused;
friend class Stopped;
friend class Disconnected;
friend class Idle;
protected:
void setState(std::unique_ptr<State>&& new_state) noexcept {
if (state_.get() != nullptr) {
state_->exit();
}
state_ = std::move(new_state);
state_->entry();
}
bool is_connected() const;
bool is_playing() const;
bool is_paused() const;
bool is_stopped() const;
constexpr std::size_t interval() const;
void tryConnect() const;
void checkErrors(mpd_connection*) const;
void do_update();
void queryMPD() const;
void fetchState() const;
constexpr mpd_state state() const;
void emit() const;
[[nodiscard]] unique_connection& connection();
public:
explicit Context(waybar::modules::MPD* const mpd_module)
: state_{std::make_unique<Disconnected>(this)}, mpd_module_{mpd_module} {
state_->entry();
}
void play() { state_->play(); }
void stop() { state_->stop(); }
void pause() { state_->pause(); }
void update() noexcept { state_->update(); }
};
} // namespace waybar::modules::detail
================================================
FILE: include/modules/mpd/state.inl.hpp
================================================
#pragma once
namespace detail {
inline bool Context::is_connected() const { return mpd_module_->connection_ != nullptr; }
inline bool Context::is_playing() const { return mpd_module_->playing(); }
inline bool Context::is_paused() const { return mpd_module_->paused(); }
inline bool Context::is_stopped() const { return mpd_module_->stopped(); }
constexpr inline std::size_t Context::interval() const { return mpd_module_->interval_.count(); }
inline void Context::tryConnect() const { mpd_module_->tryConnect(); }
inline unique_connection& Context::connection() { return mpd_module_->connection_; }
constexpr inline mpd_state Context::state() const { return mpd_module_->state_; }
inline void Context::do_update() { mpd_module_->setLabel(); }
inline void Context::checkErrors(mpd_connection* conn) const { mpd_module_->checkErrors(conn); }
inline void Context::queryMPD() const { mpd_module_->queryMPD(); }
inline void Context::fetchState() const { mpd_module_->fetchState(); }
inline void Context::emit() const { mpd_module_->emit(); }
} // namespace detail
================================================
FILE: include/modules/mpris/mpris.hpp
================================================
#pragma once
#include <iostream>
#include <optional>
#include <string>
#include "gtkmm/box.h"
#include "gtkmm/label.h"
extern "C" {
#include <playerctl/playerctl.h>
}
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules::mpris {
class Mpris : public ALabel {
public:
Mpris(const std::string&, const Json::Value&);
virtual ~Mpris();
auto update() -> void override;
bool handleToggle(GdkEventButton* const&) override;
private:
static auto onPlayerNameAppeared(PlayerctlPlayerManager*, PlayerctlPlayerName*, gpointer) -> void;
static auto onPlayerNameVanished(PlayerctlPlayerManager*, PlayerctlPlayerName*, gpointer) -> void;
static auto onPlayerPlay(PlayerctlPlayer*, gpointer) -> void;
static auto onPlayerPause(PlayerctlPlayer*, gpointer) -> void;
static auto onPlayerStop(PlayerctlPlayer*, gpointer) -> void;
static auto onPlayerMetadata(PlayerctlPlayer*, GVariant*, gpointer) -> void;
struct PlayerInfo {
std::string name;
PlayerctlPlaybackStatus status;
std::string status_string;
std::optional<std::string> artist;
std::optional<std::string> album;
std::optional<std::string> title;
std::optional<std::string> length; // as HH:MM:SS
std::optional<std::string> position; // same format
};
auto getPlayerInfo() -> std::optional<PlayerInfo>;
auto getIconFromJson(const Json::Value&, const std::string&) -> std::string;
auto getArtistStr(const PlayerInfo&, bool) -> std::string;
auto getAlbumStr(const PlayerInfo&, bool) -> std::string;
auto getTitleStr(const PlayerInfo&, bool) -> std::string;
auto getLengthStr(const PlayerInfo&, bool) -> std::string;
auto getPositionStr(const PlayerInfo&, bool) -> std::string;
auto getDynamicStr(const PlayerInfo&, bool, bool) -> std::string;
// config
std::string format_playing_;
std::string format_paused_;
std::string format_stopped_;
std::string tooltip_;
std::string tooltip_playing_;
std::string tooltip_paused_;
std::string tooltip_stopped_;
int artist_len_;
int album_len_;
int title_len_;
int dynamic_len_;
std::vector<std::string> dynamic_prio_;
std::vector<std::string> dynamic_order_;
std::string dynamic_separator_;
bool truncate_hours_;
bool tooltip_len_limits_;
std::string ellipsis_;
std::string player_;
std::vector<std::string> ignored_players_;
PlayerctlPlayerManager* manager;
PlayerctlPlayer* player;
PlayerctlPlayer* last_active_player_ = nullptr;
std::string lastStatus;
std::string lastPlayer;
util::SleeperThread thread_;
std::chrono::time_point<std::chrono::system_clock> last_update_;
};
} // namespace waybar::modules::mpris
================================================
FILE: include/modules/network.hpp
================================================
#pragma once
#include <arpa/inet.h>
#include <fmt/format.h>
#include <linux/nl80211.h>
#include <netlink/genl/ctrl.h>
#include <netlink/genl/genl.h>
#include <netlink/netlink.h>
#include <sys/epoll.h>
#include <optional>
#include <vector>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
#ifdef WANT_RFKILL
#include "util/rfkill.hpp"
#endif
enum ip_addr_pref : uint8_t { IPV4, IPV6, IPV4_6 };
namespace waybar::modules {
class Network : public ALabel {
public:
Network(const std::string&, const Json::Value&);
virtual ~Network();
auto update() -> void override;
private:
static const uint8_t MAX_RETRY{5};
static const uint8_t EPOLL_MAX{200};
static int handleEvents(struct nl_msg*, void*);
static int handleEventsDone(struct nl_msg*, void*);
static int handleScan(struct nl_msg*, void*);
void askForStateDump(void);
void worker();
void createInfoSocket();
void createEventSocket();
void parseEssid(struct nlattr**);
void parseSignal(struct nlattr**);
void parseFreq(struct nlattr**);
void parseBssid(struct nlattr**);
bool associatedOrJoined(struct nlattr**);
bool matchInterface(const std::string& ifname, const std::vector<std::string>& altnames,
std::string& matched) const;
auto getInfo() -> void;
const std::string getNetworkState() const;
void clearIface();
std::optional<std::pair<unsigned long long, unsigned long long>> readBandwidthUsage();
int ifid_{-1};
ip_addr_pref addr_pref_{ip_addr_pref::IPV4};
struct sockaddr_nl nladdr_{0};
struct nl_sock* sock_{nullptr};
struct nl_sock* ev_sock_{nullptr};
int efd_{-1};
int ev_fd_{-1};
int nl80211_id_{-1};
std::mutex mutex_;
bool want_route_dump_{false};
bool want_link_dump_{false};
bool want_addr_dump_{false};
bool dump_in_progress_{false};
bool is_p2p_{false};
unsigned long long bandwidth_down_total_{0};
unsigned long long bandwidth_up_total_{0};
std::string state_;
std::string essid_;
std::string bssid_;
bool carrier_{false};
std::string ifname_;
std::string ipaddr_;
std::string ipaddr6_;
std::string gwaddr_;
std::string netmask_;
std::string netmask6_;
int cidr_{0};
int cidr6_{0};
int32_t signal_strength_dbm_;
uint8_t signal_strength_;
std::string signal_strength_app_;
uint32_t route_priority;
util::SleeperThread thread_;
util::SleeperThread thread_timer_;
#ifdef WANT_RFKILL
util::Rfkill rfkill_{RFKILL_TYPE_WLAN};
#endif
float frequency_{0};
};
} // namespace waybar::modules
================================================
FILE: include/modules/niri/backend.hpp
================================================
#pragma once
#include <list>
#include <mutex>
#include <string>
#include <utility>
#include "util/json.hpp"
namespace waybar::modules::niri {
class EventHandler {
public:
virtual void onEvent(const Json::Value& ev) = 0;
virtual ~EventHandler() = default;
};
class IPC {
public:
IPC();
void registerForIPC(const std::string& ev, EventHandler* ev_handler);
void unregisterForIPC(EventHandler* handler);
static Json::Value send(const Json::Value& request);
// The data members are only safe to access while dataMutex_ is locked.
std::lock_guard<std::mutex> lockData() { return std::lock_guard(dataMutex_); }
const std::vector<Json::Value>& workspaces() const { return workspaces_; }
const std::vector<Json::Value>& windows() const { return windows_; }
const std::vector<std::string>& keyboardLayoutNames() const { return keyboardLayoutNames_; }
unsigned keyboardLayoutCurrent() const { return keyboardLayoutCurrent_; }
private:
void startIPC();
static int connectToSocket();
void parseIPC(const std::string&);
std::mutex dataMutex_;
std::vector<Json::Value> workspaces_;
std::vector<Json::Value> windows_;
std::vector<std::string> keyboardLayoutNames_;
unsigned keyboardLayoutCurrent_;
util::JsonParser parser_;
std::mutex callbackMutex_;
std::list<std::pair<std::string, EventHandler*>> callbacks_;
};
inline std::unique_ptr<IPC> gIPC;
}; // namespace waybar::modules::niri
================================================
FILE: include/modules/niri/language.hpp
================================================
#pragma once
#include <string>
#include "ALabel.hpp"
#include "bar.hpp"
#include "modules/niri/backend.hpp"
namespace waybar::modules::niri {
class Language : public ALabel, public EventHandler {
public:
Language(const std::string&, const Bar&, const Json::Value&);
~Language() override;
void update() override;
private:
void updateFromIPC();
void onEvent(const Json::Value& ev) override;
void doUpdate();
struct Layout {
std::string full_name;
std::string short_name;
std::string variant;
std::string short_description;
};
static Layout getLayout(const std::string& fullName);
std::mutex mutex_;
const Bar& bar_;
std::vector<Layout> layouts_;
unsigned current_idx_;
std::string last_short_name_;
};
} // namespace waybar::modules::niri
================================================
FILE: include/modules/niri/window.hpp
================================================
#pragma once
#include <gtkmm/button.h>
#include <json/value.h>
#include "AAppIconLabel.hpp"
#include "bar.hpp"
#include "modules/niri/backend.hpp"
namespace waybar::modules::niri {
class Window : public AAppIconLabel, public EventHandler {
public:
Window(const std::string&, const Bar&, const Json::Value&);
~Window() override;
void update() override;
private:
void onEvent(const Json::Value& ev) override;
void doUpdate();
void setClass(const std::string& className, bool enable);
const Bar& bar_;
std::string oldAppId_;
};
} // namespace waybar::modules::niri
================================================
FILE: include/modules/niri/workspaces.hpp
================================================
#pragma once
#include <gtkmm/button.h>
#include <json/value.h>
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/niri/backend.hpp"
namespace waybar::modules::niri {
class Workspaces : public AModule, public EventHandler {
public:
Workspaces(const std::string&, const Bar&, const Json::Value&);
~Workspaces() override;
void update() override;
private:
void onEvent(const Json::Value& ev) override;
void doUpdate();
Gtk::Button& addButton(const Json::Value& ws);
std::string getIcon(const std::string& value, const Json::Value& ws);
const Bar& bar_;
Gtk::Box box_;
// Map from niri workspace id to button.
std::unordered_map<uint64_t, Gtk::Button> buttons_;
};
} // namespace waybar::modules::niri
================================================
FILE: include/modules/power_profiles_daemon.hpp
================================================
#pragma once
#include <fmt/format.h>
#include "ALabel.hpp"
#include "giomm/dbusproxy.h"
namespace waybar::modules {
struct Profile {
std::string name;
std::string driver;
Profile(std::string n, std::string d) : name(std::move(n)), driver(std::move(d)) {}
};
class PowerProfilesDaemon : public ALabel {
public:
PowerProfilesDaemon(const std::string&, const Json::Value&);
auto update() -> void override;
void profileChangedCb(const Gio::DBus::Proxy::MapChangedProperties&,
const std::vector<Glib::ustring>&);
void busConnectedCb(Glib::RefPtr<Gio::AsyncResult>& r);
void getAllPropsCb(Glib::RefPtr<Gio::AsyncResult>& r);
void setPropCb(Glib::RefPtr<Gio::AsyncResult>& r);
void populateInitState();
bool handleToggle(GdkEventButton* const& e) override;
private:
// True if we're connected to the dbug interface. False if we're
// not.
bool connected_;
// Look for a profile name in the list of available profiles and
// switch activeProfile_ to it.
void switchToProfile(std::string const&);
// Used to toggle/display the profiles
std::vector<Profile> availableProfiles_;
// Points to the active profile in the profiles list
std::vector<Profile>::iterator activeProfile_;
// Current CSS class applied to the label
std::string currentStyle_;
// Format string
std::string tooltipFormat_;
// DBus Proxy used to track the current active profile
Glib::RefPtr<Gio::DBus::Proxy> powerProfilesProxy_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/privacy/privacy.hpp
================================================
#pragma once
#include <string>
#include "gtkmm/box.h"
#include "modules/privacy/privacy_item.hpp"
#include "util/pipewire/pipewire_backend.hpp"
#include "util/pipewire/privacy_node_info.hpp"
using waybar::util::PipewireBackend::PrivacyNodeInfo;
namespace waybar::modules::privacy {
class Privacy : public AModule {
public:
Privacy(const std::string&, const Json::Value&, Gtk::Orientation, const std::string& pos);
auto update() -> void override;
void onPrivacyNodesChanged();
private:
std::list<PrivacyNodeInfo*> nodes_screenshare; // Screen is being shared
std::list<PrivacyNodeInfo*> nodes_audio_in; // Application is using the microphone
std::list<PrivacyNodeInfo*> nodes_audio_out; // Application is outputting audio
std::mutex mutex_;
sigc::connection visibility_conn;
// Config
Gtk::Box box_;
uint iconSpacing = 4;
uint iconSize = 20;
uint transition_duration = 250;
std::set<std::pair<PrivacyNodeType, std::string>> ignore;
bool ignore_monitor = true;
std::shared_ptr<util::PipewireBackend::PipewireBackend> backend = nullptr;
};
} // namespace waybar::modules::privacy
================================================
FILE: include/modules/privacy/privacy_item.hpp
================================================
#pragma once
#include <json/value.h>
#include <string>
#include "gtkmm/box.h"
#include "gtkmm/image.h"
#include "gtkmm/revealer.h"
#include "util/pipewire/privacy_node_info.hpp"
using waybar::util::PipewireBackend::PrivacyNodeInfo;
using waybar::util::PipewireBackend::PrivacyNodeType;
namespace waybar::modules::privacy {
class PrivacyItem : public Gtk::Revealer {
public:
PrivacyItem(const Json::Value& config_, enum PrivacyNodeType privacy_type_,
std::list<PrivacyNodeInfo*>* nodes, Gtk::Orientation orientation,
const std::string& pos, const uint icon_size, const uint transition_duration);
enum PrivacyNodeType privacy_type;
void set_in_use(bool in_use);
private:
std::list<PrivacyNodeInfo*>* nodes;
sigc::connection signal_conn;
Gtk::Box tooltip_window;
bool init = false;
bool in_use = false;
// Config
std::string iconName = "image-missing-symbolic";
bool tooltip = true;
uint tooltipIconSize = 24;
Gtk::Box box_;
Gtk::Image icon_;
void update_tooltip();
};
} // namespace waybar::modules::privacy
================================================
FILE: include/modules/pulseaudio.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <algorithm>
#include <array>
#include <memory>
#include "ALabel.hpp"
#include "util/audio_backend.hpp"
namespace waybar::modules {
class Pulseaudio : public ALabel {
public:
Pulseaudio(const std::string&, const Json::Value&);
virtual ~Pulseaudio() = default;
auto update() -> void override;
private:
bool handleScroll(GdkEventScroll* e) override;
const std::vector<std::string> getPulseIcon() const;
std::shared_ptr<util::AudioBackend> backend = nullptr;
};
} // namespace waybar::modules
================================================
FILE: include/modules/pulseaudio_slider.hpp
================================================
#pragma once
#include <memory>
#include "ASlider.hpp"
#include "util/audio_backend.hpp"
namespace waybar::modules {
enum class PulseaudioSliderTarget {
Sink,
Source,
};
class PulseaudioSlider : public ASlider {
public:
PulseaudioSlider(const std::string&, const Json::Value&);
virtual ~PulseaudioSlider() = default;
void update() override;
void onValueChanged() override;
private:
std::shared_ptr<util::AudioBackend> backend = nullptr;
PulseaudioSliderTarget target = PulseaudioSliderTarget::Sink;
};
} // namespace waybar::modules
================================================
FILE: include/modules/river/layout.hpp
================================================
#pragma once
#include <wayland-client.h>
#include "ALabel.hpp"
#include "bar.hpp"
#include "river-status-unstable-v1-client-protocol.h"
namespace waybar::modules::river {
class Layout : public waybar::ALabel {
public:
Layout(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Layout();
// Handlers for wayland events
void handle_name(const char* name);
void handle_clear();
void handle_focused_output(struct wl_output* output);
void handle_unfocused_output(struct wl_output* output);
struct zriver_status_manager_v1* status_manager_;
struct wl_seat* seat_;
private:
const waybar::Bar& bar_;
std::string name_;
struct wl_output* output_; // stores the output this module belongs to
struct wl_output* focused_output_; // stores the currently focused output
struct zriver_output_status_v1* output_status_;
struct zriver_seat_status_v1* seat_status_;
};
} /* namespace waybar::modules::river */
================================================
FILE: include/modules/river/mode.hpp
================================================
#pragma once
#include <wayland-client.h>
#include "ALabel.hpp"
#include "bar.hpp"
#include "river-status-unstable-v1-client-protocol.h"
namespace waybar::modules::river {
class Mode : public waybar::ALabel {
public:
Mode(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Mode();
// Handlers for wayland events
void handle_mode(const char* mode);
struct zriver_status_manager_v1* status_manager_;
struct wl_seat* seat_;
private:
const waybar::Bar& bar_;
std::string mode_;
struct zriver_seat_status_v1* seat_status_;
};
} /* namespace waybar::modules::river */
================================================
FILE: include/modules/river/tags.hpp
================================================
#pragma once
#include <gtkmm/button.h>
#include <wayland-client.h>
#include "AModule.hpp"
#include "bar.hpp"
#include "river-control-unstable-v1-client-protocol.h"
#include "river-status-unstable-v1-client-protocol.h"
#include "xdg-output-unstable-v1-client-protocol.h"
namespace waybar::modules::river {
class Tags : public waybar::AModule {
public:
Tags(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Tags();
// Handlers for wayland events
void handle_focused_tags(uint32_t tags);
void handle_view_tags(struct wl_array* tags);
void handle_urgent_tags(uint32_t tags);
void handle_show();
void handle_primary_clicked(uint32_t tag);
bool handle_button_press(GdkEventButton* event_button, uint32_t tag);
struct zriver_status_manager_v1* status_manager_;
struct zriver_control_v1* control_;
struct wl_seat* seat_;
private:
const waybar::Bar& bar_;
Gtk::Box box_;
std::vector<Gtk::Button> buttons_;
struct zriver_output_status_v1* output_status_;
};
} /* namespace waybar::modules::river */
================================================
FILE: include/modules/river/window.hpp
================================================
#pragma once
#include <gtkmm/button.h>
#include <wayland-client.h>
#include "ALabel.hpp"
#include "bar.hpp"
#include "river-status-unstable-v1-client-protocol.h"
#include "xdg-output-unstable-v1-client-protocol.h"
namespace waybar::modules::river {
class Window : public waybar::ALabel {
public:
Window(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Window();
// Handlers for wayland events
void handle_focused_view(const char* title);
void handle_focused_output(struct wl_output* output);
void handle_unfocused_output(struct wl_output* output);
struct zriver_status_manager_v1* status_manager_;
struct wl_seat* seat_;
private:
const waybar::Bar& bar_;
struct wl_output* output_; // stores the output this module belongs to
struct wl_output* focused_output_; // stores the currently focused output
struct zriver_seat_status_v1* seat_status_;
};
} /* namespace waybar::modules::river */
================================================
FILE: include/modules/simpleclock.hpp
================================================
#pragma once
#include <fmt/chrono.h>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Clock : public ALabel {
public:
Clock(const std::string&, const Json::Value&);
virtual ~Clock() = default;
auto update() -> void override;
private:
util::SleeperThread thread_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/sndio.hpp
================================================
#pragma once
#include <sndio.h>
#include <vector>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Sndio : public ALabel {
public:
Sndio(const std::string&, const Json::Value&);
virtual ~Sndio();
auto update() -> void override;
auto set_desc(struct sioctl_desc*, unsigned int) -> void;
auto put_val(unsigned int, unsigned int) -> void;
bool handleScroll(GdkEventScroll*) override;
bool handleToggle(GdkEventButton* const&) override;
private:
auto connect_to_sndio() -> void;
util::SleeperThread thread_;
struct sioctl_hdl* hdl_;
std::vector<struct pollfd> pfds_;
unsigned int addr_;
unsigned int volume_, old_volume_, maxval_;
bool muted_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/sni/host.hpp
================================================
#pragma once
#include <dbus-status-notifier-watcher.h>
#include <giomm.h>
#include <glibmm/refptr.h>
#include <json/json.h>
#include <tuple>
#include "bar.hpp"
#include "modules/sni/item.hpp"
namespace waybar::modules::SNI {
class Host {
public:
Host(const std::size_t id, const Json::Value&, const Bar&,
const std::function<void(std::unique_ptr<Item>&)>&,
const std::function<void(std::unique_ptr<Item>&)>&, const std::function<void()>&);
~Host();
private:
void busAcquired(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring);
void nameAppeared(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring,
const Glib::ustring&);
void nameVanished(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring);
static void proxyReady(GObject*, GAsyncResult*, gpointer);
static void registerHost(GObject*, GAsyncResult*, gpointer);
static void itemRegistered(SnWatcher*, const gchar*, gpointer);
static void itemUnregistered(SnWatcher*, const gchar*, gpointer);
void itemReady(Item&);
void itemInvalidated(Item&);
void removeItem(std::vector<std::unique_ptr<Item>>::iterator);
void clearItems();
std::tuple<std::string, std::string> getBusNameAndObjectPath(const std::string);
void addRegisteredItem(const std::string& service);
std::vector<std::unique_ptr<Item>> items_;
const std::string bus_name_;
const std::string object_path_;
std::size_t bus_name_id_;
std::size_t watcher_id_;
GCancellable* cancellable_ = nullptr;
SnWatcher* watcher_ = nullptr;
const Json::Value& config_;
const Bar& bar_;
const std::function<void(std::unique_ptr<Item>&)> on_add_;
const std::function<void(std::unique_ptr<Item>&)> on_remove_;
const std::function<void()> on_update_;
};
} // namespace waybar::modules::SNI
================================================
FILE: include/modules/sni/icon_manager.hpp
================================================
#pragma once
#include <json/json.h>
#include <spdlog/spdlog.h>
#include <string>
#include <unordered_map>
class IconManager {
public:
static IconManager& instance() {
static IconManager instance;
return instance;
}
void setIconsConfig(const Json::Value& icons_config) {
if (icons_config.isObject()) {
for (const auto& key : icons_config.getMemberNames()) {
std::string app_name = key;
const Json::Value& icon_value = icons_config[key];
if (icon_value.isString()) {
std::string icon_path = icon_value.asString();
icons_map_[app_name] = icon_path;
}
}
} else {
spdlog::warn("Invalid icon config format.");
}
}
std::string getIconForApp(const std::string& app_name) const {
auto it = icons_map_.find(app_name);
if (it != icons_map_.end()) {
return it->second;
}
return "";
}
private:
IconManager() = default;
std::unordered_map<std::string, std::string> icons_map_;
};
================================================
FILE: include/modules/sni/item.hpp
================================================
#pragma once
#include <dbus-status-notifier-item.h>
#include <giomm/dbusproxy.h>
#include <glibmm/refptr.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/icontheme.h>
#include <gtkmm/image.h>
#include <gtkmm/menu.h>
#include <json/json.h>
#include <libdbusmenu-gtk/dbusmenu-gtk.h>
#include <sigc++/trackable.h>
#include <functional>
#include <set>
#include <string_view>
#include "bar.hpp"
namespace waybar::modules::SNI {
struct ToolTip {
Glib::ustring icon_name;
Glib::ustring text;
};
class Item : public sigc::trackable {
public:
Item(const std::string&, const std::string&, const Json::Value&, const Bar&,
const std::function<void(Item&)>&, const std::function<void(Item&)>&,
const std::function<void()>&);
~Item();
bool isReady() const;
std::string bus_name;
std::string object_path;
int icon_size;
int effective_icon_size;
Gtk::Image image;
Gtk::EventBox event_box;
std::string category;
std::string id;
std::string title;
std::string icon_name;
Glib::RefPtr<Gdk::Pixbuf> icon_pixmap;
Glib::RefPtr<Gtk::IconTheme> icon_theme;
std::string overlay_icon_name;
Glib::RefPtr<Gdk::Pixbuf> overlay_icon_pixmap;
std::string attention_icon_name;
Glib::RefPtr<Gdk::Pixbuf> attention_icon_pixmap;
std::string attention_movie_name;
std::string icon_theme_path;
std::string menu;
ToolTip tooltip;
DbusmenuGtkMenu* dbus_menu = nullptr;
Gtk::Menu* gtk_menu = nullptr;
/**
* ItemIsMenu flag means that the item only supports the context menu.
* Default value is true because libappindicator supports neither ItemIsMenu nor Activate method
* while compliant SNI implementation would always reset the flag to desired value.
*/
bool item_is_menu = true;
private:
void onConfigure(GdkEventConfigure* ev);
void proxyReady(Glib::RefPtr<Gio::AsyncResult>& result);
void setProperty(const Glib::ustring& name, Glib::VariantBase& value);
void setStatus(const Glib::ustring& value);
void setReady();
void invalidate();
void setCustomIcon(const std::string& id);
void getUpdatedProperties();
void processUpdatedProperties(Glib::RefPtr<Gio::AsyncResult>& result);
void onSignal(const Glib::ustring& sender_name, const Glib::ustring& signal_name,
const Glib::VariantContainerBase& arguments);
void updateImage();
static Glib::RefPtr<Gdk::Pixbuf> extractPixBuf(GVariant* variant);
Glib::RefPtr<Gdk::Pixbuf> getIconPixbuf();
Glib::RefPtr<Gdk::Pixbuf> getAttentionIconPixbuf();
Glib::RefPtr<Gdk::Pixbuf> getOverlayIconPixbuf();
Glib::RefPtr<Gdk::Pixbuf> loadIconFromNameOrFile(const std::string& name, bool log_failure);
static Glib::RefPtr<Gdk::Pixbuf> overlayPixbufs(const Glib::RefPtr<Gdk::Pixbuf>&,
const Glib::RefPtr<Gdk::Pixbuf>&);
Glib::RefPtr<Gdk::Pixbuf> getIconByName(const std::string& name, int size);
double getScaledIconSize();
static void onMenuDestroyed(Item* self, GObject* old_menu_pointer);
void makeMenu();
bool handleClick(GdkEventButton* const& /*ev*/);
bool handleScroll(GdkEventScroll* const&);
bool handleMouseEnter(GdkEventCrossing* const&);
bool handleMouseLeave(GdkEventCrossing* const&);
// smooth scrolling threshold
gdouble scroll_threshold_ = 0;
gdouble distance_scrolled_x_ = 0;
gdouble distance_scrolled_y_ = 0;
// visibility of items with Status == Passive
bool show_passive_ = false;
bool ready_ = false;
Glib::ustring status_ = "active";
const Bar& bar_;
const std::function<void(Item&)> on_ready_;
const std::function<void(Item&)> on_invalidate_;
const std::function<void()> on_updated_;
Glib::RefPtr<Gio::DBus::Proxy> proxy_;
Glib::RefPtr<Gio::Cancellable> cancellable_;
std::set<std::string_view> update_pending_;
};
} // namespace waybar::modules::SNI
================================================
FILE: include/modules/sni/tray.hpp
================================================
#pragma once
#include <fmt/format.h>
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/sni/host.hpp"
#include "modules/sni/watcher.hpp"
#include "util/json.hpp"
namespace waybar::modules::SNI {
class Tray : public AModule {
public:
Tray(const std::string&, const Bar&, const Json::Value&);
virtual ~Tray() = default;
auto update() -> void override;
private:
void onAdd(std::unique_ptr<Item>& item);
void onRemove(std::unique_ptr<Item>& item);
void queueUpdate();
static inline std::size_t nb_hosts_ = 0;
bool show_passive_ = false;
Gtk::Box box_;
SNI::Watcher::singleton watcher_;
SNI::Host host_;
};
} // namespace waybar::modules::SNI
================================================
FILE: include/modules/sni/watcher.hpp
================================================
#pragma once
#include <dbus-status-notifier-watcher.h>
#include <giomm.h>
#include <glibmm/refptr.h>
namespace waybar::modules::SNI {
class Watcher {
private:
Watcher();
public:
~Watcher();
using singleton = std::shared_ptr<Watcher>;
static singleton getInstance() {
static std::weak_ptr<Watcher> weak;
std::shared_ptr<Watcher> strong = weak.lock();
if (!strong) {
strong = std::shared_ptr<Watcher>(new Watcher());
weak = strong;
}
return strong;
}
private:
typedef enum { GF_WATCH_TYPE_HOST, GF_WATCH_TYPE_ITEM } GfWatchType;
typedef struct {
GfWatchType type;
Watcher* watcher;
gchar* service;
gchar* bus_name;
gchar* object_path;
guint watch_id;
} GfWatch;
void busAcquired(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring);
static gboolean handleRegisterHost(Watcher*, GDBusMethodInvocation*, const gchar*);
static gboolean handleRegisterItem(Watcher*, GDBusMethodInvocation*, const gchar*);
static GfWatch* gfWatchFind(GSList* list, const gchar* bus_name, const gchar* object_path);
static GfWatch* gfWatchNew(GfWatchType, const gchar*, const gchar*, const gchar*, Watcher*);
static void nameVanished(GDBusConnection* connection, const char* name, gpointer data);
static void gfWatchFree(gpointer data);
void updateRegisteredItems(SnWatcher* obj);
uint32_t bus_name_id_;
GSList* hosts_ = nullptr;
GSList* items_ = nullptr;
SnWatcher* watcher_ = nullptr;
};
} // namespace waybar::modules::SNI
================================================
FILE: include/modules/sway/bar.hpp
================================================
#pragma once
#include <atomic>
#include <string>
#include "modules/sway/ipc/client.hpp"
#include "util/SafeSignal.hpp"
#include "util/json.hpp"
namespace waybar {
class Bar;
namespace modules::sway {
/*
* Supported subset of i3/sway IPC barconfig object
*/
struct swaybar_config {
std::string id;
std::string mode;
std::string hidden_state;
};
/**
* swaybar IPC client
*/
class BarIpcClient {
public:
BarIpcClient(waybar::Bar& bar);
private:
void onInitialConfig(const struct Ipc::ipc_response& res);
void onIpcEvent(const struct Ipc::ipc_response&);
void onCmd(const struct Ipc::ipc_response&);
void onConfigUpdate(const swaybar_config& config);
void onVisibilityUpdate(bool visible_by_modifier);
void onModeUpdate(bool visible_by_modifier);
void onUrgencyUpdate(bool visible_by_urgency);
void update();
bool isModuleEnabled(const std::string& name);
Bar& bar_;
util::JsonParser parser_;
Ipc ipc_;
swaybar_config bar_config_;
std::string modifier_reset_;
bool visible_by_mode_ = false;
bool visible_by_modifier_ = false;
bool visible_by_urgency_ = false;
std::atomic<bool> modifier_no_action_ = false;
SafeSignal<bool> signal_mode_;
SafeSignal<bool> signal_visible_;
SafeSignal<bool> signal_urgency_;
SafeSignal<swaybar_config> signal_config_;
};
} // namespace modules::sway
} // namespace waybar
================================================
FILE: include/modules/sway/ipc/client.hpp
================================================
#pragma once
#include <sigc++/sigc++.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <cstring>
#include <memory>
#include <mutex>
#include <stdexcept>
#include <string>
#include "ipc.hpp"
#include "util/SafeSignal.hpp"
#include "util/scoped_fd.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules::sway {
class Ipc {
public:
Ipc();
~Ipc();
struct ipc_response {
uint32_t size;
uint32_t type;
std::string payload;
};
::waybar::SafeSignal<const struct ipc_response&> signal_event;
::waybar::SafeSignal<const struct ipc_response&> signal_cmd;
void sendCmd(uint32_t type, const std::string& payload = "");
void subscribe(const std::string& payload);
void handleEvent();
void setWorker(std::function<void()>&& func);
protected:
static inline const std::string ipc_magic_ = "i3-ipc";
static inline const size_t ipc_header_size_ = ipc_magic_.size() + 8;
const std::string getSocketPath() const;
int open(const std::string&) const;
struct ipc_response send(int fd, uint32_t type, const std::string& payload = "");
struct ipc_response recv(int fd);
util::ScopedFd fd_;
util::ScopedFd fd_event_;
std::mutex mutex_;
util::SleeperThread thread_;
};
} // namespace waybar::modules::sway
================================================
FILE: include/modules/sway/ipc/ipc.hpp
================================================
#pragma once
#include <cstdint>
#define event_mask(ev) (1u << (ev & 0x7F))
enum ipc_command_type : uint32_t {
// i3 command types - see i3's I3_REPLY_TYPE constants
IPC_COMMAND = 0,
IPC_GET_WORKSPACES = 1,
IPC_SUBSCRIBE = 2,
IPC_GET_OUTPUTS = 3,
IPC_GET_TREE = 4,
IPC_GET_MARKS = 5,
IPC_GET_BAR_CONFIG = 6,
IPC_GET_VERSION = 7,
IPC_GET_BINDING_MODES = 8,
IPC_GET_CONFIG = 9,
IPC_SEND_TICK = 10,
// sway-specific command types
IPC_GET_INPUTS = 100,
IPC_GET_SEATS = 101,
// Events sent from sway to clients. Events have the highest bits set.
IPC_EVENT_WORKSPACE = ((1U << 31) | 0),
IPC_EVENT_OUTPUT = ((1U << 31) | 1),
IPC_EVENT_MODE = ((1U << 31) | 2),
IPC_EVENT_WINDOW = ((1U << 31) | 3),
IPC_EVENT_BARCONFIG_UPDATE = ((1U << 31) | 4),
IPC_EVENT_BINDING = ((1U << 31) | 5),
IPC_EVENT_SHUTDOWN = ((1U << 31) | 6),
IPC_EVENT_TICK = ((1U << 31) | 7),
// sway-specific event types
IPC_EVENT_BAR_STATE_UPDATE = ((1U << 31) | 20),
IPC_EVENT_INPUT = ((1U << 31) | 21),
};
================================================
FILE: include/modules/sway/language.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <xkbcommon/xkbregistry.h>
#include <map>
#include <string>
#include "ALabel.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
#include "util/json.hpp"
namespace waybar::modules::sway {
class Language : public ALabel, public sigc::trackable {
public:
Language(const std::string& id, const Json::Value& config);
virtual ~Language() = default;
auto update() -> void override;
private:
enum class DisplayedShortFlag { None = 0, ShortName = 1, ShortDescription = 1 << 1 };
struct Layout {
std::string full_name;
std::string short_name;
std::string variant;
std::string short_description;
std::string country_flag() const;
};
class XKBContext {
public:
XKBContext();
~XKBContext();
auto next_layout() -> Layout*;
private:
rxkb_context* context_ = nullptr;
rxkb_layout* xkb_layout_ = nullptr;
Layout* layout_ = nullptr;
std::map<std::string, rxkb_layout*> base_layouts_by_name_;
};
void onEvent(const struct Ipc::ipc_response&);
void onCmd(const struct Ipc::ipc_response&);
auto set_current_layout(const std::string& current_layout) -> void;
auto init_layouts_map(const std::vector<std::string>& used_layouts) -> void;
const static std::string XKB_LAYOUT_NAMES_KEY;
const static std::string XKB_ACTIVE_LAYOUT_NAME_KEY;
Layout layout_;
std::string tooltip_format_ = "";
std::map<std::string, Layout> layouts_map_;
bool hide_single_;
bool is_variant_displayed;
std::byte displayed_short_flag = static_cast<std::byte>(DisplayedShortFlag::None);
util::JsonParser parser_;
std::mutex mutex_;
Ipc ipc_;
};
} // namespace waybar::modules::sway
================================================
FILE: include/modules/sway/mode.hpp
================================================
#pragma once
#include <fmt/format.h>
#include "ALabel.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
#include "util/json.hpp"
namespace waybar::modules::sway {
class Mode : public ALabel, public sigc::trackable {
public:
Mode(const std::string&, const Json::Value&);
virtual ~Mode() = default;
auto update() -> void override;
private:
void onEvent(const struct Ipc::ipc_response&);
std::string mode_;
util::JsonParser parser_;
std::mutex mutex_;
Ipc ipc_;
};
} // namespace waybar::modules::sway
================================================
FILE: include/modules/sway/scratchpad.hpp
================================================
#pragma once
#include <gtkmm/label.h>
#include <mutex>
#include <string>
#include "ALabel.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
#include "util/json.hpp"
namespace waybar::modules::sway {
class Scratchpad : public ALabel {
public:
Scratchpad(const std::string&, const Json::Value&);
virtual ~Scratchpad() = default;
auto update() -> void override;
private:
auto getTree() -> void;
auto onCmd(const struct Ipc::ipc_response&) -> void;
auto onEvent(const struct Ipc::ipc_response&) -> void;
std::string tooltip_format_;
bool show_empty_;
bool tooltip_enabled_;
std::string tooltip_text_;
int count_;
std::mutex mutex_;
Ipc ipc_;
util::JsonParser parser_;
};
} // namespace waybar::modules::sway
================================================
FILE: include/modules/sway/window.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <tuple>
#include "AAppIconLabel.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
#include "util/json.hpp"
namespace waybar::modules::sway {
class Window : public AAppIconLabel, public sigc::trackable {
public:
Window(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Window() = default;
auto update() -> void override;
private:
void setClass(const std::string& classname, bool enable);
void onEvent(const struct Ipc::ipc_response&);
void onCmd(const struct Ipc::ipc_response&);
std::tuple<std::size_t, int, int, std::string, std::string, std::string, std::string, std::string,
std::string>
getFocusedNode(const Json::Value& nodes, std::string& output);
void getTree();
const Bar& bar_;
std::string window_;
int windowId_;
std::string app_id_;
std::string app_class_;
std::string layout_;
std::string old_app_id_;
std::size_t app_nb_;
std::string shell_;
std::string marks_;
int floating_count_;
util::JsonParser parser_;
std::mutex mutex_;
Ipc ipc_;
};
} // namespace waybar::modules::sway
================================================
FILE: include/modules/sway/workspaces.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <string_view>
#include <unordered_map>
#include "AModule.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
#include "util/json.hpp"
#include "util/regex_collection.hpp"
namespace waybar::modules::sway {
class Workspaces : public AModule, public sigc::trackable {
public:
Workspaces(const std::string&, const waybar::Bar&, const Json::Value&);
~Workspaces() override = default;
auto update() -> void override;
private:
static constexpr std::string_view workspace_switch_cmd_ = "workspace {} \"{}\"";
static constexpr std::string_view persistent_workspace_switch_cmd_ =
R"(workspace {} "{}"; move workspace to output "{}"; workspace {} "{}")";
static int convertWorkspaceNameToNum(const std::string& name);
static int windowRewritePriorityFunction(std::string const& window_rule);
void onCmd(const struct Ipc::ipc_response&);
void onEvent(const struct Ipc::ipc_response&);
bool filterButtons();
static bool hasFlag(const Json::Value&, const std::string&);
void updateWindows(const Json::Value&, std::string&);
Gtk::Button& addButton(const Json::Value&);
void onButtonReady(const Json::Value&, Gtk::Button&);
std::string getIcon(const std::string&, const Json::Value&);
std::string getCycleWorkspace(std::vector<Json::Value>::iterator, bool prev) const;
uint16_t getWorkspaceIndex(const std::string& name) const;
static std::string trimWorkspaceName(const std::string&);
bool handleScroll(GdkEventScroll* /*unused*/) override;
const Bar& bar_;
std::vector<Json::Value> workspaces_;
std::vector<std::string> high_priority_named_;
std::vector<std::string> workspaces_order_;
Gtk::Box box_;
std::string m_formatWindowSeparator;
util::RegexCollection m_windowRewriteRules;
util::JsonParser parser_;
std::unordered_map<std::string, Gtk::Button> buttons_;
std::mutex mutex_;
Ipc ipc_;
};
} // namespace waybar::modules::sway
================================================
FILE: include/modules/systemd_failed_units.hpp
================================================
#pragma once
#include <giomm/dbusproxy.h>
#include <string>
#include <vector>
#include "ALabel.hpp"
namespace waybar::modules {
class SystemdFailedUnits : public ALabel {
public:
SystemdFailedUnits(const std::string&, const Json::Value&);
virtual ~SystemdFailedUnits() = default;
auto update() -> void override;
private:
struct FailedUnit {
std::string name;
std::string description;
std::string load_state;
std::string active_state;
std::string sub_state;
std::string scope;
};
bool hide_on_ok_;
std::string format_ok_;
std::string tooltip_format_;
std::string tooltip_format_ok_;
std::string tooltip_unit_format_;
bool update_pending_;
std::string system_state_, user_state_, overall_state_;
uint32_t nr_failed_system_, nr_failed_user_, nr_failed_;
std::string last_status_;
Glib::RefPtr<Gio::DBus::Proxy> system_props_proxy_, user_props_proxy_;
Glib::RefPtr<Gio::DBus::Proxy> system_manager_proxy_, user_manager_proxy_;
std::vector<FailedUnit> failed_units_;
void notify_cb(const Glib::ustring& sender_name, const Glib::ustring& signal_name,
const Glib::VariantContainerBase& arguments);
void RequestFailedUnits();
void RequestFailedUnitsList();
void RequestSystemState();
std::vector<FailedUnit> LoadFailedUnitsList(const char* kind,
Glib::RefPtr<Gio::DBus::Proxy>& proxy,
const std::string& scope);
std::string BuildTooltipFailedList() const;
void updateData();
};
} // namespace waybar::modules
================================================
FILE: include/modules/temperature.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <fstream>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Temperature : public ALabel {
public:
Temperature(const std::string&, const Json::Value&);
virtual ~Temperature() = default;
auto update() -> void override;
private:
float getTemperature();
bool isCritical(uint16_t);
bool isWarning(uint16_t);
std::string file_path_;
util::SleeperThread thread_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/upower.hpp
================================================
#pragma once
#include <giomm/dbusconnection.h>
#include <gtkmm/icontheme.h>
#include <libupower-glib/upower.h>
#include <unordered_map>
#include "AIconLabel.hpp"
namespace waybar::modules {
class UPower final : public AIconLabel {
public:
UPower(const std::string&, const Json::Value&);
virtual ~UPower();
auto update() -> void override;
private:
const std::string NO_BATTERY{"battery-missing-symbolic"};
// Config
bool showIcon_{true};
bool hideIfEmpty_{true};
int iconSize_{20};
int tooltip_spacing_{4};
int tooltip_padding_{4};
Gtk::Box contentBox_; // tooltip box
std::string tooltipFormat_;
// UPower device info
struct upDevice_output {
UpDevice* upDevice{NULL};
double percentage{0.0};
double temperature{0.0};
guint64 time_full{0u};
guint64 time_empty{0u};
gchar* icon_name{(char*)'\0'};
bool upDeviceValid{false};
UpDeviceState state;
UpDeviceKind kind;
char* nativePath{(char*)'\0'};
char* model{(char*)'\0'};
};
// Technical variables
std::string nativePath_;
std::string model_;
std::string lastStatus_;
Glib::ustring label_markup_;
std::mutex mutex_;
Glib::RefPtr<Gtk::IconTheme> gtkTheme_;
bool sleeping_;
// Technical functions
void addDevice(UpDevice*);
void removeDevice(const gchar*);
void removeDevices();
void resetDevices();
void setDisplayDevice();
const Glib::ustring getText(const upDevice_output& upDevice_, const std::string& format);
bool queryTooltipCb(int, int, bool, const Glib::RefPtr<Gtk::Tooltip>&);
// DBUS variables
guint watcherID_;
Glib::RefPtr<Gio::DBus::Connection> conn_;
guint subscrID_{0u};
// UPower variables
UpClient* upClient_;
upDevice_output upDevice_; // Device to display
typedef std::unordered_map<std::string, upDevice_output> Devices;
Devices devices_;
bool upRunning_{true};
// DBus callbacks
void getConn_cb(Glib::RefPtr<Gio::AsyncResult>& result);
void onAppear(const Glib::RefPtr<Gio::DBus::Connection>&, const Glib::ustring&,
const Glib::ustring&);
void onVanished(const Glib::RefPtr<Gio::DBus::Connection>&, const Glib::ustring&);
void prepareForSleep_cb(const Glib::RefPtr<Gio::DBus::Connection>& connection,
const Glib::ustring& sender_name, const Glib::ustring& object_path,
const Glib::ustring& interface_name, const Glib::ustring& signal_name,
const Glib::VariantContainerBase& parameters);
// UPower callbacks
static void deviceAdded_cb(UpClient* client, UpDevice* device, gpointer data);
static void deviceRemoved_cb(UpClient* client, const gchar* objectPath, gpointer data);
static void deviceNotify_cb(UpDevice* device, GParamSpec* pspec, gpointer user_data);
// UPower secondary functions
void getUpDeviceInfo(upDevice_output& upDevice_);
};
} // namespace waybar::modules
================================================
FILE: include/modules/user.hpp
================================================
#pragma once
#include <fmt/chrono.h>
#include <gdkmm/pixbuf.h>
#include <glibmm/refptr.h>
#include "AIconLabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class User : public AIconLabel {
public:
User(const std::string&, const Json::Value&);
virtual ~User() = default;
auto update() -> void override;
bool handleToggle(GdkEventButton* const& e) override;
private:
util::SleeperThread thread_;
static constexpr inline int defaultUserImageWidth_ = 20;
static constexpr inline int defaultUserImageHeight_ = 20;
long uptime_as_seconds();
std::string get_user_login() const;
std::string get_user_home_dir() const;
std::string get_default_user_avatar_path() const;
void init_default_user_avatar(int width, int height);
void init_user_avatar(const std::string& path, int width, int height);
void init_avatar(const Json::Value& config);
void init_update_worker();
};
} // namespace waybar::modules
================================================
FILE: include/modules/wayfire/backend.hpp
================================================
#pragma once
#include <json/json.h>
#include <unistd.h>
#include <functional>
#include <list>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <unordered_map>
#include <utility>
#include "util/scoped_fd.hpp"
namespace waybar::modules::wayfire {
using EventHandler = std::function<void(const std::string& event)>;
struct State {
/*
┌───────────┐ ┌───────────┐
│ output #1 │ │ output #2 │
└─────┬─────┘ └─────┬─────┘
└─┐ └─────┐─ ─ ─ ─ ─ ─ ─ ─ ┐
┌───────┴───────┐ ┌───────┴──────┐ ┌───────┴───────┐
│ wset #1 │ │ wset #2 │ │ wset #3 │
│┌────────────┐ │ │┌────────────┐│ │┌────────────┐ │
││ workspaces │ │ ││ workspaces ││ ││ workspaces │ │
│└─┬──────────┘ │ │└────────────┘│ │└─┬──────────┘ │
│ │ ┌─────────┐│ └──────────────┘ │ │ ┌─────────┐│
│ ├─┤ view #1 ││ │ └─┤ view #3 ││
│ │ └─────────┘│ │ └─────────┘│
│ │ ┌─────────┐│ └───────────────┘
│ └─┤ view #2 ││
│ └─────────┘│
└───────────────┘
*/
struct Output {
size_t id;
size_t w, h;
size_t wset_idx;
};
struct Workspace {
size_t num_views;
size_t num_sticky_views;
};
struct Wset {
std::optional<std::reference_wrapper<Output>> output;
std::vector<Workspace> wss;
size_t ws_w, ws_h, ws_x, ws_y;
size_t focused_view_id;
auto ws_idx() const { return ws_w * ws_y + ws_x; }
auto count_ws(const Json::Value& pos) -> Workspace&;
auto locate_ws(const Json::Value& geo) -> Workspace&;
auto locate_ws(const Json::Value& geo) const -> const Workspace&;
};
std::unordered_map<std::string, Output> outputs;
std::unordered_map<size_t, Wset> wsets;
std::unordered_map<size_t, Json::Value> views;
std::string focused_output_name;
size_t maybe_empty_focus_wset_idx = {};
size_t vswitch_sticky_view_id = {};
bool new_output_detected = {};
bool vswitching = {};
auto update_view(const Json::Value& view) -> void;
};
using Sock = util::ScopedFd;
class IPC : public std::enable_shared_from_this<IPC> {
static std::weak_ptr<IPC> instance;
Json::CharReaderBuilder reader_builder;
Json::StreamWriterBuilder writer_builder;
std::list<std::pair<std::string, std::reference_wrapper<const EventHandler>>> handlers;
std::mutex handlers_mutex;
State state;
std::mutex state_mutex;
IPC() = default;
static auto connect() -> Sock;
auto receive(Sock& sock) -> Json::Value;
auto start() -> void;
auto root_event_handler(const std::string& event, const Json::Value& data) -> void;
auto update_state_handler(const std::string& event, const Json::Value& data) -> void;
public:
static auto get_instance() -> std::shared_ptr<IPC>;
auto send(const std::string& method, Json::Value&& data) -> Json::Value;
auto register_handler(const std::string& event, const EventHandler& handler) -> void;
auto unregister_handler(EventHandler& handler) -> void;
auto lock_state() -> std::lock_guard<std::mutex> { return std::lock_guard{state_mutex}; }
auto& get_outputs() const { return state.outputs; }
auto& get_wsets() const { return state.wsets; }
auto& get_views() const { return state.views; }
auto& get_focused_output_name() const { return state.focused_output_name; }
};
} // namespace waybar::modules::wayfire
================================================
FILE: include/modules/wayfire/window.hpp
================================================
#pragma once
#include "AAppIconLabel.hpp"
#include "bar.hpp"
#include "modules/wayfire/backend.hpp"
namespace waybar::modules::wayfire {
class Window : public AAppIconLabel {
std::shared_ptr<IPC> ipc;
EventHandler handler;
const Bar& bar_;
std::string old_app_id_;
public:
Window(const std::string& id, const Bar& bar, const Json::Value& config);
~Window() override;
auto update() -> void override;
auto update_icon_label() -> void;
};
} // namespace waybar::modules::wayfire
================================================
FILE: include/modules/wayfire/workspaces.hpp
================================================
#pragma once
#include <gtkmm/button.h>
#include <json/json.h>
#include <memory>
#include <vector>
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/wayfire/backend.hpp"
namespace waybar::modules::wayfire {
class Workspaces : public AModule {
std::shared_ptr<IPC> ipc;
EventHandler handler;
const Bar& bar_;
Gtk::Box box_;
std::vector<Gtk::Button> buttons_;
auto handleScroll(GdkEventScroll* e) -> bool override;
auto update() -> void override;
auto update_box() -> void;
public:
Workspaces(const std::string& id, const Bar& bar, const Json::Value& config);
~Workspaces() override;
};
} // namespace waybar::modules::wayfire
================================================
FILE: include/modules/wireplumber.hpp
================================================
#pragma once
#include <fmt/format.h>
#include <wp/wp.h>
#include <algorithm>
#include <array>
#include "ALabel.hpp"
namespace waybar::modules {
class Wireplumber : public ALabel {
public:
Wireplumber(const std::string&, const Json::Value&);
virtual ~Wireplumber();
auto update() -> void override;
private:
void asyncLoadRequiredApiModules();
void prepare(waybar::modules::Wireplumber* self);
void activatePlugins();
static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
static void updateNodeName(waybar::modules::Wireplumber* self, uint32_t id);
static void updateSourceVolume(waybar::modules::Wireplumber* self, uint32_t id);
static void updateSourceName(waybar::modules::Wireplumber* self, uint32_t id); // NEW
static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
static void onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
waybar::modules::Wireplumber* self);
static void onMixerApiLoaded(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self);
bool handleScroll(GdkEventScroll* e) override;
static std::list<waybar::modules::Wireplumber*> modules;
WpCore* wp_core_;
GPtrArray* apis_;
WpObjectManager* om_;
WpPlugin* mixer_api_;
WpPlugin* def_nodes_api_;
gchar* default_node_name_;
uint32_t pending_plugins_;
bool muted_;
double volume_;
double min_step_;
uint32_t node_id_{0};
std::string node_name_;
std::string source_name_;
gchar* type_;
uint32_t source_node_id_;
bool source_muted_;
double source_volume_;
gchar* default_source_name_;
};
} // namespace waybar::modules
================================================
FILE: include/modules/wlr/taskbar.hpp
================================================
#pragma once
#include <gdk/gdk.h>
#include <glibmm/refptr.h>
#include <gtkmm/box.h>
#include <gtkmm/button.h>
#include <gtkmm/icontheme.h>
#include <gtkmm/image.h>
#include <gtkmm/label.h>
#include <wayland-client.h>
#include <map>
#include <memory>
#include <string>
#include <unordered_set>
#include <vector>
#include "AModule.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "giomm/desktopappinfo.h"
#include "util/icon_loader.hpp"
#include "util/json.hpp"
#include "wlr-foreign-toplevel-management-unstable-v1-client-protocol.h"
namespace waybar::modules::wlr {
struct widget_geometry {
int x, y, w, h;
};
class Taskbar;
class Task {
public:
Task(const waybar::Bar&, const Json::Value&, Taskbar*, struct zwlr_foreign_toplevel_handle_v1*,
struct wl_seat*);
~Task();
public:
enum State {
MAXIMIZED = (1 << 0),
MINIMIZED = (1 << 1),
ACTIVE = (1 << 2),
FULLSCREEN = (1 << 3),
INVALID = (1 << 4)
};
// made public so TaskBar can reorder based on configuration.
Gtk::Button button;
struct widget_geometry minimize_hint;
private:
static uint32_t global_id;
private:
const waybar::Bar& bar_;
const Json::Value& config_;
Taskbar* tbar_;
struct zwlr_foreign_toplevel_handle_v1* handle_;
struct wl_seat* seat_;
uint32_t id_;
Gtk::Box content_;
Gtk::Image icon_;
Gtk::Label text_before_;
Gtk::Label text_after_;
Glib::RefPtr<Gio::DesktopAppInfo> app_info_;
bool button_visible_ = false;
bool ignored_ = false;
bool with_icon_ = false;
bool with_name_ = false;
std::string format_before_;
std::string format_after_;
std::string format_tooltip_;
std::string name_;
std::string title_;
std::string app_id_;
uint32_t state_ = 0;
int32_t drag_start_x;
int32_t drag_start_y;
int32_t drag_start_button = -1;
private:
std::string repr() const;
std::string state_string(bool = false) const;
void set_minimize_hint();
void on_button_size_allocated(Gtk::Allocation& alloc);
void hide_if_ignored();
public:
/* Getter functions */
uint32_t id() const { return id_; }
std::string title() const { return title_; }
std::string app_id() const { return app_id_; }
uint32_t state() const { return state_; }
bool maximized() const { return state_ & MAXIMIZED; }
bool minimized() const { return state_ & MINIMIZED; }
bool active() const { return state_ & ACTIVE; }
bool fullscreen() const { return state_ & FULLSCREEN; }
public:
/* Callbacks for the wlr protocol */
void handle_title(const char*);
void handle_app_id(const char*);
void handle_output_enter(struct wl_output*);
void handle_output_leave(struct wl_output*);
void handle_state(struct wl_array*);
void handle_done();
void handle_closed();
/* Callbacks for Gtk events */
bool handle_clicked(GdkEventButton*);
bool handle_button_release(GdkEventButton*);
bool handle_motion_notify(GdkEventMotion*);
void handle_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context,
Gtk::SelectionData& selection_data, guint info, guint time);
void handle_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y,
Gtk::SelectionData selection_data, guint info, guint time);
public:
bool operator==(const Task&) const;
bool operator!=(const Task&) const;
public:
void update();
public:
/* Interaction with the tasks */
void maximize(bool);
void minimize(bool);
void activate();
void fullscreen(bool);
void close();
};
using TaskPtr = std::unique_ptr<Task>;
class Taskbar : public waybar::AModule {
public:
Taskbar(const std::string&, const waybar::Bar&, const Json::Value&);
~Taskbar();
void update();
private:
const waybar::Bar& bar_;
Gtk::Box box_;
std::vector<TaskPtr> tasks_;
IconLoader icon_loader_;
std::unordered_set<std::string> ignore_list_;
std::map<std::string, std::string> app_ids_replace_map_;
struct zwlr_foreign_toplevel_manager_v1* manager_;
struct wl_seat* seat_;
public:
/* Callbacks for global registration */
void register_manager(struct wl_registry*, uint32_t name, uint32_t version);
void register_seat(struct wl_registry*, uint32_t name, uint32_t version);
/* Callbacks for the wlr protocol */
void handle_toplevel_create(struct zwlr_foreign_toplevel_handle_v1*);
void handle_finished();
public:
void add_button(Gtk::Button&);
void move_button(Gtk::Button&, int);
void remove_button(Gtk::Button&);
void remove_task(uint32_t);
bool show_output(struct wl_output*) const;
bool all_outputs() const;
const IconLoader& icon_loader() const;
const std::unordered_set<std::string>& ignore_list() const;
const std::map<std::string, std::string>& app_ids_replace_map() const;
};
} /* namespace waybar::modules::wlr */
================================================
FILE: include/util/SafeSignal.hpp
================================================
#pragma once
#include <glibmm/dispatcher.h>
#include <sigc++/signal.h>
#include <cstddef>
#include <functional>
#include <mutex>
#include <queue>
#include <thread>
#include <tuple>
#include <type_traits>
#include <utility>
#ifdef __OpenBSD__
#define SIGRTMIN SIGUSR1 - 1
#define SIGRTMAX SIGUSR1 + 1
#endif
namespace waybar {
/**
* Thread-safe signal wrapper.
* Uses Glib::Dispatcher to pass events to another thread and locked queue to pass the arguments.
*/
template <typename... Args>
struct SafeSignal : sigc::signal<void(std::decay_t<Args>...)> {
public:
SafeSignal() { dp_.connect(sigc::mem_fun(*this, &SafeSignal::handle_event)); }
void set_max_queued_events(std::size_t max_queued_events) {
std::unique_lock lock(mutex_);
max_queued_events_ = max_queued_events;
trim_queue_locked();
}
template <typename... EmitArgs>
void emit(EmitArgs&&... args) {
if (main_tid_ == std::this_thread::get_id()) {
/*
* Bypass the queue if the method is called the main thread.
* Ensures that events emitted from the main thread are processed synchronously and saves a
* few CPU cycles on locking/queuing.
* As a downside, this makes main thread events prioritized over the other threads and
* disrupts chronological order.
*/
signal_t::emit(std::forward<EmitArgs>(args)...);
} else {
{
std::unique_lock lock(mutex_);
if (max_queued_events_ != 0 && queue_.size() >= max_queued_events_) {
queue_.pop();
}
queue_.emplace(std::forward<EmitArgs>(args)...);
}
dp_.emit();
}
}
template <typename... EmitArgs>
inline void operator()(EmitArgs&&... args) {
emit(std::forward<EmitArgs>(args)...);
}
protected:
using signal_t = sigc::signal<void(std::decay_t<Args>...)>;
using slot_t = decltype(std::declval<signal_t>().make_slot());
using arg_tuple_t = std::tuple<std::decay_t<Args>...>;
// ensure that unwrapped methods are not accessible
using signal_t::emit_reverse;
using signal_t::make_slot;
void trim_queue_locked() {
if (max_queued_events_ == 0) {
return;
}
while (queue_.size() > max_queued_events_) {
queue_.pop();
}
}
void handle_event() {
for (std::unique_lock lock(mutex_); !queue_.empty(); lock.lock()) {
auto args = queue_.front();
queue_.pop();
lock.unlock();
std::apply(cached_fn_, args);
}
}
Glib::Dispatcher dp_;
std::mutex mutex_;
std::queue<arg_tuple_t> queue_;
std::size_t max_queued_events_ = 4096;
const std::thread::id main_tid_ = std::this_thread::get_id();
// cache functor for signal emission to avoid recreating it on each event
const slot_t cached_fn_ = make_slot();
};
} // namespace waybar
================================================
FILE: include/util/audio_backend.hpp
================================================
#pragma once
#include <json/value.h>
#include <pulse/context.h>
#include <pulse/introspect.h>
#include <pulse/thread-mainloop.h>
#include <pulse/volume.h>
#include <functional>
#include <memory>
#include <string>
#include "util/backend_common.hpp"
namespace waybar::util {
class AudioBackend {
private:
static void subscribeCb(pa_context*, pa_subscription_event_type_t, uint32_t, void*);
static void contextStateCb(pa_context*, void*);
static void sinkInfoCb(pa_context*, const pa_sink_info*, int, void*);
static void sourceInfoCb(pa_context*, const pa_source_info* i, int, void* data);
static void serverInfoCb(pa_context*, const pa_server_info*, void*);
static void volumeModifyCb(pa_context*, int, void*);
void connectContext();
pa_threaded_mainloop* mainloop_;
pa_mainloop_api* mainloop_api_;
pa_context* context_;
pa_cvolume pa_volume_;
// SINK
uint32_t sink_idx_{0};
uint16_t volume_;
bool muted_;
std::string port_name_;
std::string form_factor_;
std::string desc_;
std::string monitor_;
std::string current_sink_name_;
std::string default_sink_name;
bool default_sink_running_;
bool current_sink_running_;
// SOURCE
uint32_t source_idx_{0};
uint16_t source_volume_;
bool source_muted_;
std::string source_port_name_;
std::string source_desc_;
std::string default_source_name_;
std::vector<std::string> ignored_sinks_;
std::function<void()> on_updated_cb_ = NOOP;
/* Hack to keep constructor inaccessible but still public.
* This is required to be able to use std::make_shared.
* It is important to keep this class only accessible via a reference-counted
* pointer because the destructor will manually free memory, and this could be
* a problem with C++20's copy and move semantics.
*/
struct private_constructor_tag {};
public:
static std::shared_ptr<AudioBackend> getInstance(std::function<void()> on_updated_cb = NOOP);
AudioBackend(std::function<void()> on_updated_cb, private_constructor_tag tag);
~AudioBackend();
void changeVolume(uint16_t volume, uint16_t min_volume = 0, uint16_t max_volume = 100);
void changeVolume(ChangeType change_type, double step = 1, uint16_t max_volume = 100);
void setIgnoredSinks(const Json::Value& config);
std::string getSinkPortName() const { return port_name_; }
std::string getFormFactor() const { return form_factor_; }
std::string getSinkDesc() const { return desc_; }
std::string getMonitor() const { return monitor_; }
std::string getCurrentSinkName() const { return current_sink_name_; }
bool getCurrentSinkRunning() const { return current_sink_running_; }
uint16_t getSinkVolume() const { return volume_; }
bool getSinkMuted() const { return muted_; }
uint16_t getSourceVolume() const { return source_volume_; }
bool getSourceMuted() const { return source_muted_; }
std::string getSourcePortName() const { return source_port_name_; }
std::string getSourceDesc() const { return source_desc_; }
std::string getDefaultSourceName() const { return default_source_name_; }
void toggleSinkMute();
void toggleSinkMute(bool);
void toggleSourceMute();
void toggleSourceMute(bool);
bool isBluetooth();
};
} // namespace waybar::util
================================================
FILE: include/util/backend_common.hpp
================================================
#pragma once
#include "AModule.hpp"
namespace waybar::util {
const static auto NOOP = []() {};
enum class ChangeType : char { Increase, Decrease };
} // namespace waybar::util
================================================
FILE: include/util/backlight_backend.hpp
================================================
#pragma once
#include <libudev.h>
#include <spdlog/spdlog.h>
#include <chrono>
#include <mutex>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "giomm/dbusproxy.h"
#include "util/backend_common.hpp"
#include "util/sleeper_thread.hpp"
#define GET_BEST_DEVICE(varname, backend, preferred_device) \
decltype((backend).devices_) __devices; \
{ \
std::scoped_lock<std::mutex> lock((backend).udev_thread_mutex_); \
__devices = (backend).devices_; \
} \
auto varname = (backend).best_device(__devices, preferred_device);
namespace waybar::util {
class BacklightDevice {
public:
BacklightDevice() = default;
BacklightDevice(std::string name, int actual, int max, bool powered);
std::string name() const;
int get_actual() const;
void set_actual(int actual);
int get_max() const;
void set_max(int max);
bool get_powered() const;
void set_powered(bool powered);
friend inline bool operator==(const BacklightDevice& lhs, const BacklightDevice& rhs) {
return lhs.name_ == rhs.name_ && lhs.actual_ == rhs.actual_ && lhs.max_ == rhs.max_;
}
private:
std::string name_;
int actual_ = 1;
int max_ = 1;
bool powered_ = true;
};
class BacklightBackend {
public:
BacklightBackend(std::chrono::milliseconds interval, std::function<void()> on_updated_cb = NOOP);
// const inline BacklightDevice *get_best_device(std::string_view preferred_device);
const BacklightDevice* get_previous_best_device();
void set_previous_best_device(const BacklightDevice* device);
void set_brightness(const std::string& preferred_device, ChangeType change_type, double step);
void set_scaled_brightness(const std::string& preferred_device, int brightness);
int get_scaled_brightness(const std::string& preferred_device);
bool is_login_proxy_initialized() const { return static_cast<bool>(login_proxy_); }
static const BacklightDevice* best_device(const std::vector<BacklightDevice>& devices,
std::string_view);
std::vector<BacklightDevice> devices_;
std::mutex udev_thread_mutex_;
private:
void set_brightness_internal(const std::string& device_name, int brightness, int max_brightness);
std::function<void()> on_updated_cb_;
std::chrono::milliseconds polling_interval_;
std::optional<BacklightDevice> previous_best_;
// thread must destruct before shared data
util::SleeperThread udev_thread_;
Glib::RefPtr<Gio::DBus::Proxy> login_proxy_;
static constexpr int EPOLL_MAX_EVENTS = 16;
};
} // namespace waybar::util
================================================
FILE: include/util/clara.hpp
================================================
// Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See https://github.com/philsquared/Clara for more details
// Clara v1.1.5
#ifndef CLARA_HPP_INCLUDED
#define CLARA_HPP_INCLUDED
#ifndef CLARA_CONFIG_CONSOLE_WIDTH
#define CLARA_CONFIG_CONSOLE_WIDTH 80
#endif
#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CLARA_CONFIG_CONSOLE_WIDTH
#endif
#ifndef CLARA_CONFIG_OPTIONAL_TYPE
#ifdef __has_include
#if __has_include(<optional>) && __cplusplus >= 201703L
#include <optional>
#define CLARA_CONFIG_OPTIONAL_TYPE std::optional
#endif
#endif
#endif
// ----------- #included from clara_textflow.hpp -----------
// TextFlowCpp
//
// A single-header library for wrapping and laying out basic text, by Phil Nash
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// This project is hosted at https://github.com/philsquared/textflowcpp
#ifndef CLARA_TEXTFLOW_HPP_INCLUDED
#define CLARA_TEXTFLOW_HPP_INCLUDED
#include <cassert>
#include <ostream>
#include <sstream>
#include <vector>
#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
#endif
namespace clara {
namespace TextFlow {
inline auto isWhitespace(char c) -> bool {
static std::string chars = " \t\n\r";
return chars.find(c) != std::string::npos;
}
inline auto isBreakableBefore(char c) -> bool {
static std::string chars = "[({<|";
return chars.find(c) != std::string::npos;
}
inline auto isBreakableAfter(char c) -> bool {
static std::string chars = "])}>.,:;*+-=&/\\";
return chars.find(c) != std::string::npos;
}
class Columns;
class Column {
std::vector<std::string> m_strings;
size_t m_width = CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
size_t m_indent = 0;
size_t m_initialIndent = std::string::npos;
public:
class iterator {
friend Column;
Column const& m_column;
size_t m_stringIndex = 0;
size_t m_pos = 0;
size_t m_len = 0;
size_t m_end = 0;
bool m_suffix = false;
iterator(Column const& column, size_t stringIndex)
: m_column(column), m_stringIndex(stringIndex) {}
auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }
auto isBoundary(size_t at) const -> bool {
assert(at > 0);
assert(at <= line().size());
return at == line().size() || (isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) ||
isBreakableBefore(line()[at]) || isBreakableAfter(line()[at - 1]);
}
void calcLength() {
assert(m_stringIndex < m_column.m_strings.size());
m_suffix = false;
auto width = m_column.m_width - indent();
m_end = m_pos;
while (m_end < line().size() && line()[m_end] != '\n') ++m_end;
if (m_end < m_pos + width) {
m_len = m_end - m_pos;
} else {
size_t len = width;
while (len > 0 && !isBoundary(m_pos + len)) --len;
while (len > 0 && isWhitespace(line()[m_pos + len - 1])) --len;
if (len > 0) {
m_len = len;
} else {
m_suffix = true;
m_len = width - 1;
}
}
}
auto indent() const -> size_t {
auto initial =
m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;
return initial == std::string::npos ? m_column.m_indent : initial;
}
auto addIndentAndSuffix(std::string const& plain) const -> std::string {
return std::string(indent(), ' ') + (m_suffix ? plain + "-" : plain);
}
public:
using difference_type = std::ptrdiff_t;
using value_type = std::string;
using pointer = value_type*;
using reference = value_type&;
using iterator_category = std::forward_iterator_tag;
explicit iterator(Column const& column) : m_column(column) {
assert(m_column.m_width > m_column.m_indent);
assert(m_column.m_initialIndent == std::string::npos ||
m_column.m_width > m_column.m_initialIndent);
calcLength();
if (m_len == 0) m_stringIndex++; // Empty string
}
auto operator*() const -> std::string {
assert(m_stringIndex < m_column.m_strings.size());
assert(m_pos <= m_end);
return addIndentAndSuffix(line().substr(m_pos, m_len));
}
auto operator++() -> iterator& {
m_pos += m_len;
if (m_pos < line().size() && line()[m_pos] == '\n')
m_pos += 1;
else
while (m_pos < line().size() && isWhitespace(line()[m_pos])) ++m_pos;
if (m_pos == line().size()) {
m_pos = 0;
++m_stringIndex;
}
if (m_stringIndex < m_column.m_strings.size()) calcLength();
return *this;
}
auto operator++(int) -> iterator {
iterator prev(*this);
operator++();
return prev;
}
auto operator==(iterator const& other) const -> bool {
return m_pos == other.m_pos && m_stringIndex == other.m_stringIndex &&
&m_column == &other.m_column;
}
auto operator!=(iterator const& other) const -> bool { return !operator==(other); }
};
using const_iterator = iterator;
explicit Column(std::string const& text) { m_strings.push_back(text); }
auto width(size_t newWidth) -> Column& {
assert(newWidth > 0);
m_width = newWidth;
return *this;
}
auto indent(size_t newIndent) -> Column& {
m_indent = newIndent;
return *this;
}
auto initialIndent(size_t newIndent) -> Column& {
m_initialIndent = newIndent;
return *this;
}
auto width() const -> size_t { return m_width; }
auto begin() const -> iterator { return iterator(*this); }
auto end() const -> iterator { return {*this, m_strings.size()}; }
inline friend std::ostream& operator<<(std::ostream& os, Column const& col) {
bool first = true;
for (auto line : col) {
if (first)
first = false;
else
os << "\n";
os << line;
}
return os;
}
auto operator+(Column const& other) -> Columns;
auto toString() const -> std::string {
std::ostringstream oss;
oss << *this;
return oss.str();
}
};
class Spacer : public Column {
public:
explicit Spacer(size_t spaceWidth) : Column("") { width(spaceWidth); }
};
class Columns {
std::vector<Column> m_columns;
public:
class iterator {
friend Columns;
struct EndTag {};
std::vector<Column> const& m_columns;
std::vector<Column::iterator> m_iterators;
size_t m_activeIterators;
iterator(Columns const& columns, EndTag) : m_columns(columns.m_columns), m_activeIterators(0) {
m_iterators.reserve(m_columns.size());
for (auto const& col : m_columns) m_iterators.push_back(col.end());
}
public:
using difference_type = std::ptrdiff_t;
using value_type = std::string;
using pointer = value_type*;
using reference = value_type&;
using iterator_category = std::forward_iterator_tag;
explicit iterator(Columns const& columns)
: m_columns(columns.m_columns), m_activeIterators(m_columns.size()) {
m_iterators.reserve(m_columns.size());
for (auto const& col : m_columns) m_iterators.push_back(col.begin());
}
auto operator==(iterator const& other) const -> bool {
return m_iterators == other.m_iterators;
}
auto operator!=(iterator const& other) const -> bool {
return m_iterators != other.m_iterators;
}
auto operator*() const -> std::string {
std::string row, padding;
for (size_t i = 0; i < m_columns.size(); ++i) {
auto width = m_columns[i].width();
if (m_iterators[i] != m_columns[i].end()) {
std::string col = *m_iterators[i];
row += padding + col;
if (col.size() < width)
padding = std::string(width - col.size(), ' ');
else
padding = "";
} else {
padding += std::string(width, ' ');
}
}
return row;
}
auto operator++() -> iterator& {
for (size_t i = 0; i < m_columns.size(); ++i) {
if (m_iterators[i] != m_columns[i].end()) ++m_iterators[i];
}
return *this;
}
auto operator++(int) -> iterator {
iterator prev(*this);
operator++();
return prev;
}
};
using const_iterator = iterator;
auto begin() const -> iterator { return iterator(*this); }
auto end() const -> iterator { return {*this, iterator::EndTag()}; }
auto operator+=(Column const& col) -> Columns& {
m_columns.push_back(col);
return *this;
}
auto operator+(Column const& col) -> Columns {
Columns combined = *this;
combined += col;
return combined;
}
inline friend std::ostream& operator<<(std::ostream& os, Columns const& cols) {
bool first = true;
for (auto line : cols) {
if (first)
first = false;
else
os << "\n";
os << line;
}
return os;
}
auto toString() const -> std::string {
std::ostringstream oss;
oss << *this;
return oss.str();
}
};
inline auto Column::operator+(Column const& other) -> Columns {
Columns cols;
cols += *this;
cols += other;
return cols;
}
} // namespace TextFlow
} // namespace clara
#endif // CLARA_TEXTFLOW_HPP_INCLUDED
// ----------- end of #include from clara_textflow.hpp -----------
// ........... back in clara.hpp
#include <algorithm>
#include <memory>
#include <set>
#if !defined(CLARA_PLATFORM_WINDOWS) && \
(defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER))
#define CLARA_PLATFORM_WINDOWS
#endif
namespace clara {
namespace detail {
// Traits for extracting arg and return type of lambdas (for single argument lambdas)
template <typename L>
struct UnaryLambdaTraits : UnaryLambdaTraits<decltype(&L::operator())> {};
template <typename ClassT, typename ReturnT, typename... Args>
struct UnaryLambdaTraits<ReturnT (ClassT::*)(Args...) const> {
static const bool isValid = false;
};
template <typename ClassT, typename ReturnT, typename ArgT>
struct UnaryLambdaTraits<ReturnT (ClassT::*)(ArgT) const> {
static const bool isValid = true;
using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type;
using ReturnType = ReturnT;
};
class TokenStream;
// Transport for raw args (copied from main args, or supplied via init list for testing)
class Args {
friend TokenStream;
std::string m_exeName;
std::vector<std::string> m_args;
public:
Args(int argc, char const* const* argv) : m_exeName(argv[0]), m_args(argv + 1, argv + argc) {}
Args(std::initializer_list<std::string> args)
: m_exeName(*args.begin()), m_args(args.begin() + 1, args.end()) {}
auto exeName() const -> std::string { return m_exeName; }
};
// Wraps a token coming from a token stream. These may not directly correspond to strings as a
// single string may encode an option + its argument if the : or = form is used
enum class TokenType { Option, Argument };
struct Token {
TokenType type;
std::string token;
};
inline auto isOptPrefix(char c) -> bool {
return c == '-'
#ifdef CLARA_PLATFORM_WINDOWS
|| c == '/'
#endif
;
}
// Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled
class TokenStream {
using Iterator = std::vector<std::string>::const_iterator;
Iterator it;
Iterator itEnd;
std::vector<Token> m_tokenBuffer;
void loadBuffer() {
m_tokenBuffer.resize(0);
// Skip any empty strings
while (it != itEnd && it->empty()) ++it;
if (it != itEnd) {
auto const& next = *it;
if (isOptPrefix(next[0])) {
auto delimiterPos = next.find_first_of(" :=");
if (delimiterPos != std::string::npos) {
m_tokenBuffer.push_back({TokenType::Option, next.substr(0, delimiterPos)});
m_tokenBuffer.push_back({TokenType::Argument, next.substr(delimiterPos + 1)});
} else {
if (next[1] != '-' && next.size() > 2) {
std::string opt = "- ";
for (size_t i = 1; i < next.size(); ++i) {
opt[1] = next[i];
m_tokenBuffer.push_back({TokenType::Option, opt});
}
} else {
m_tokenBuffer.push_back({TokenType::Option, next});
}
}
} else {
m_tokenBuffer.push_back({TokenType::Argument, next});
}
}
}
public:
explicit TokenStream(Args const& args) : TokenStream(args.m_args.begin(), args.m_args.end()) {}
TokenStream(Iterator it, Iterator itEnd) : it(it), itEnd(itEnd) { loadBuffer(); }
explicit operator bool() const { return !m_tokenBuffer.empty() || it != itEnd; }
auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); }
auto operator*() const -> Token {
assert(!m_tokenBuffer.empty());
return m_tokenBuffer.front();
}
auto operator->() const -> Token const* {
assert(!m_tokenBuffer.empty());
return &m_tokenBuffer.front();
}
auto operator++() -> TokenStream& {
if (m_tokenBuffer.size() >= 2) {
m_tokenBuffer.erase(m_tokenBuffer.begin());
} else {
if (it != itEnd) ++it;
loadBuffer();
}
return *this;
}
};
class ResultBase {
public:
enum Type { Ok, LogicError, RuntimeError };
protected:
ResultBase(Type type) : m_type(type) {}
virtual ~ResultBase() = default;
virtual void enforceOk() const = 0;
Type m_type;
};
template <typename T>
class ResultValueBase : public ResultBase {
public:
auto value() const -> T const& {
enforceOk();
return m_value;
}
protected:
ResultValueBase(Type type) : ResultBase(type) {}
ResultValueBase(ResultValueBase const& other) : ResultBase(other) {
if (m_type == ResultBase::Ok) new (&m_value) T(other.m_value);
}
ResultValueBase(Type, T const& value) : ResultBase(Ok) { new (&m_value) T(value); }
auto operator=(ResultValueBase const& other) -> ResultValueBase& {
if (m_type == ResultBase::Ok) m_value.~T();
ResultBase::operator=(other);
if (m_type == ResultBase::Ok) new (&m_value) T(other.m_value);
return *this;
}
~ResultValueBase() override {
if (m_type == Ok) m_value.~T();
}
union {
T m_value;
};
};
template <>
class ResultValueBase<void> : public ResultBase {
protected:
using ResultBase::ResultBase;
};
template <typename T = void>
class BasicResult : public ResultValueBase<T> {
public:
template <typename U>
explicit BasicResult(BasicResult<U> const& other)
: ResultValueBase<T>(other.type()), m_errorMessage(other.errorMessage()) {
assert(type() != ResultBase::Ok);
}
template <typename U>
static auto ok(U const& value) -> BasicResult {
return {ResultBase::Ok, value};
}
static auto ok() -> BasicResult { return {ResultBase::Ok}; }
static auto logicError(std::string const& message) -> BasicResult {
return {ResultBase::LogicError, message};
}
static auto runtimeError(std::string const& message) -> BasicResult {
return {ResultBase::RuntimeError, message};
}
explicit operator bool() const { return m_type == ResultBase::Ok; }
auto type() const -> ResultBase::Type { return m_type; }
auto errorMessage() const -> std::string { return m_errorMessage; }
protected:
void enforceOk() const override {
// Errors shouldn't reach this point, but if they do
// the actual error message will be in m_errorMessage
assert(m_type != ResultBase::LogicError);
assert(m_type != ResultBase::RuntimeError);
if (m_type != ResultBase::Ok) std::abort();
}
std::string m_errorMessage; // Only populated if resultType is an error
BasicResult(ResultBase::Type type, std::string const& message)
: ResultValueBase<T>(type), m_errorMessage(message) {
assert(m_type != ResultBase::Ok);
}
using ResultValueBase<T>::ResultValueBase;
using ResultBase::m_type;
};
enum class ParseResultType { Matched, NoMatch, ShortCircuitAll, ShortCircuitSame };
class ParseState {
public:
ParseState(ParseResultType type, TokenStream const& remainingTokens)
: m_type(type), m_remainingTokens(remainingTokens) {}
auto type() const -> ParseResultType { return m_type; }
auto remainingTokens() const -> TokenStream { return m_remainingTokens; }
private:
ParseResultType m_type;
TokenStream m_remainingTokens;
};
using Result = BasicResult<void>;
using ParserResult = BasicResult<ParseResultType>;
using InternalParseResult = BasicResult<ParseState>;
struct HelpColumns {
std::string left;
std::string right;
};
template <typename T>
inline auto convertInto(std::string const& source, T& target) -> ParserResult {
std::stringstream ss;
ss << source;
ss >> target;
if (ss.fail())
return ParserResult::runtimeError("Unable to convert '" + source + "' to destination type");
else
return ParserResult::ok(ParseResultType::Matched);
}
inline auto convertInto(std::string const& source, std::string& target) -> ParserResult {
target = source;
return ParserResult::ok(ParseResultType::Matched);
}
inline auto convertInto(std::string const& source, bool& target) -> ParserResult {
std::string srcLC = source;
std::transform(srcLC.begin(), srcLC.end(), srcLC.begin(),
[](char c) { return static_cast<char>(::tolower(c)); });
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
target = true;
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
target = false;
else
return ParserResult::runtimeError("Expected a boolean value but did not recognise: '" + source +
"'");
return ParserResult::ok(ParseResultType::Matched);
}
#ifdef CLARA_CONFIG_OPTIONAL_TYPE
template <typename T>
inline auto convertInto(std::string const& source, CLARA_CONFIG_OPTIONAL_TYPE<T>& target)
-> ParserResult {
T temp;
auto result = convertInto(source, temp);
if (result) target = std::move(temp);
return result;
}
#endif // CLARA_CONFIG_OPTIONAL_TYPE
struct NonCopyable {
NonCopyable() = default;
NonCopyable(NonCopyable const&) = delete;
NonCopyable(NonCopyable&&) = delete;
NonCopyable& operator=(NonCopyable const&) = delete;
NonCopyable& operator=(NonCopyable&&) = delete;
};
struct BoundRef : NonCopyable {
virtual ~BoundRef() = default;
virtual auto isContainer() const -> bool { return false; }
virtual auto isFlag() const -> bool { return false; }
};
struct BoundValueRefBase : BoundRef {
virtual auto setValue(std::string const& arg) -> ParserResult = 0;
};
struct BoundFlagRefBase : BoundRef {
virtual auto setFlag(bool flag) -> ParserResult = 0;
virtual auto isFlag() const -> bool { return true; }
};
template <typename T>
struct BoundValueRef : BoundValueRefBase {
T& m_ref;
explicit BoundValueRef(T& ref) : m_ref(ref) {}
auto setValue(std::string const& arg) -> ParserResult override { return convertInto(arg, m_ref); }
};
template <typename T>
struct BoundValueRef<std::vector<T>> : BoundValueRefBase {
std::vector<T>& m_ref;
explicit BoundValueRef(std::vector<T>& ref) : m_ref(ref) {}
auto isContainer() const -> bool override { return true; }
auto setValue(std::string const& arg) -> ParserResult override {
T temp;
auto result = convertInto(arg, temp);
if (result) m_ref.push_back(temp);
return result;
}
};
struct BoundFlagRef : BoundFlagRefBase {
bool& m_ref;
explicit BoundFlagRef(bool& ref) : m_ref(ref) {}
auto setFlag(bool flag) -> ParserResult override {
m_ref = flag;
return ParserResult::ok(ParseResultType::Matched);
}
};
template <typename ReturnType>
struct LambdaInvoker {
static_assert(std::is_same<ReturnType, ParserResult>::value,
"Lambda must return void or clara::ParserResult");
template <typename L, typename ArgType>
static auto invoke(L const& lambda, ArgType const& arg) -> ParserResult {
return lambda(arg);
}
};
template <>
struct LambdaInvoker<void> {
template <typename L, typename ArgType>
static auto invoke(L const& lambda, ArgType const& arg) -> ParserResult {
lambda(arg);
return ParserResult::ok(ParseResultType::Matched);
}
};
template <typename ArgType, typename L>
inline auto invokeLambda(L const& lambda, std::string const& arg) -> ParserResul
gitextract_s9ytwrgg/ ├── .clang-format ├── .clang-tidy ├── .editorconfig ├── .envrc ├── .github/ │ ├── FUNDING.yml │ ├── labeler.yml │ └── workflows/ │ ├── clang-format.yml │ ├── clang-tidy.yml.bak │ ├── docker.yml │ ├── freebsd.yml │ ├── labeler.yml │ ├── linux.yml │ ├── nix-tests.yml │ └── nix-update-flake-lock.yml ├── .gitignore ├── .gitmodules ├── Dockerfiles/ │ ├── alpine │ ├── archlinux │ ├── debian │ ├── fedora │ ├── gentoo │ └── opensuse ├── LICENSE ├── Makefile ├── README.md ├── asan.supp ├── default.nix ├── flake.nix ├── include/ │ ├── AAppIconLabel.hpp │ ├── AIconLabel.hpp │ ├── ALabel.hpp │ ├── AModule.hpp │ ├── ASlider.hpp │ ├── IModule.hpp │ ├── bar.hpp │ ├── client.hpp │ ├── config.hpp │ ├── factory.hpp │ ├── group.hpp │ ├── modules/ │ │ ├── backlight.hpp │ │ ├── backlight_slider.hpp │ │ ├── battery.hpp │ │ ├── bluetooth.hpp │ │ ├── cava/ │ │ │ ├── cavaGLSL.hpp │ │ │ ├── cavaRaw.hpp │ │ │ ├── cava_backend.hpp │ │ │ └── cava_frontend.hpp │ │ ├── cffi.hpp │ │ ├── clock.hpp │ │ ├── cpu.hpp │ │ ├── cpu_frequency.hpp │ │ ├── cpu_usage.hpp │ │ ├── custom.hpp │ │ ├── disk.hpp │ │ ├── dwl/ │ │ │ ├── tags.hpp │ │ │ └── window.hpp │ │ ├── ext/ │ │ │ ├── workspace_manager.hpp │ │ │ └── workspace_manager_binding.hpp │ │ ├── gamemode.hpp │ │ ├── gps.hpp │ │ ├── hyprland/ │ │ │ ├── backend.hpp │ │ │ ├── language.hpp │ │ │ ├── submap.hpp │ │ │ ├── window.hpp │ │ │ ├── windowcount.hpp │ │ │ ├── windowcreationpayload.hpp │ │ │ ├── workspace.hpp │ │ │ └── workspaces.hpp │ │ ├── idle_inhibitor.hpp │ │ ├── image.hpp │ │ ├── inhibitor.hpp │ │ ├── jack.hpp │ │ ├── keyboard_state.hpp │ │ ├── load.hpp │ │ ├── memory.hpp │ │ ├── mpd/ │ │ │ ├── mpd.hpp │ │ │ ├── state.hpp │ │ │ └── state.inl.hpp │ │ ├── mpris/ │ │ │ └── mpris.hpp │ │ ├── network.hpp │ │ ├── niri/ │ │ │ ├── backend.hpp │ │ │ ├── language.hpp │ │ │ ├── window.hpp │ │ │ └── workspaces.hpp │ │ ├── power_profiles_daemon.hpp │ │ ├── privacy/ │ │ │ ├── privacy.hpp │ │ │ └── privacy_item.hpp │ │ ├── pulseaudio.hpp │ │ ├── pulseaudio_slider.hpp │ │ ├── river/ │ │ │ ├── layout.hpp │ │ │ ├── mode.hpp │ │ │ ├── tags.hpp │ │ │ └── window.hpp │ │ ├── simpleclock.hpp │ │ ├── sndio.hpp │ │ ├── sni/ │ │ │ ├── host.hpp │ │ │ ├── icon_manager.hpp │ │ │ ├── item.hpp │ │ │ ├── tray.hpp │ │ │ └── watcher.hpp │ │ ├── sway/ │ │ │ ├── bar.hpp │ │ │ ├── ipc/ │ │ │ │ ├── client.hpp │ │ │ │ └── ipc.hpp │ │ │ ├── language.hpp │ │ │ ├── mode.hpp │ │ │ ├── scratchpad.hpp │ │ │ ├── window.hpp │ │ │ └── workspaces.hpp │ │ ├── systemd_failed_units.hpp │ │ ├── temperature.hpp │ │ ├── upower.hpp │ │ ├── user.hpp │ │ ├── wayfire/ │ │ │ ├── backend.hpp │ │ │ ├── window.hpp │ │ │ └── workspaces.hpp │ │ ├── wireplumber.hpp │ │ └── wlr/ │ │ └── taskbar.hpp │ └── util/ │ ├── SafeSignal.hpp │ ├── audio_backend.hpp │ ├── backend_common.hpp │ ├── backlight_backend.hpp │ ├── clara.hpp │ ├── command.hpp │ ├── css_reload_helper.hpp │ ├── date.hpp │ ├── enum.hpp │ ├── format.hpp │ ├── gtk_icon.hpp │ ├── icon_loader.hpp │ ├── json.hpp │ ├── kill_signal.hpp │ ├── pipewire/ │ │ ├── pipewire_backend.hpp │ │ └── privacy_node_info.hpp │ ├── portal.hpp │ ├── prepare_for_sleep.h │ ├── regex_collection.hpp │ ├── rewrite_string.hpp │ ├── rfkill.hpp │ ├── sanitize_str.hpp │ ├── scope_guard.hpp │ ├── scoped_fd.hpp │ ├── sleeper_thread.hpp │ ├── string.hpp │ ├── udev_deleter.hpp │ └── ustring_clen.hpp ├── man/ │ ├── waybar-backlight-slider.5.scd │ ├── waybar-backlight.5.scd │ ├── waybar-battery.5.scd │ ├── waybar-bluetooth.5.scd │ ├── waybar-cava.5.scd │ ├── waybar-cffi.5.scd │ ├── waybar-clock.5.scd │ ├── waybar-cpu.5.scd │ ├── waybar-custom.5.scd │ ├── waybar-disk.5.scd │ ├── waybar-dwl-tags.5.scd │ ├── waybar-dwl-window.5.scd │ ├── waybar-ext-workspaces.5.scd │ ├── waybar-gamemode.5.scd │ ├── waybar-gps.5.scd │ ├── waybar-hyprland-language.5.scd │ ├── waybar-hyprland-submap.5.scd │ ├── waybar-hyprland-window.5.scd │ ├── waybar-hyprland-windowcount.5.scd │ ├── waybar-hyprland-workspaces.5.scd │ ├── waybar-idle-inhibitor.5.scd │ ├── waybar-image.5.scd │ ├── waybar-inhibitor.5.scd │ ├── waybar-jack.5.scd │ ├── waybar-keyboard-state.5.scd │ ├── waybar-memory.5.scd │ ├── waybar-menu.5.scd │ ├── waybar-mpd.5.scd │ ├── waybar-mpris.5.scd │ ├── waybar-network.5.scd │ ├── waybar-niri-language.5.scd │ ├── waybar-niri-window.5.scd │ ├── waybar-niri-workspaces.5.scd │ ├── waybar-power-profiles-daemon.5.scd │ ├── waybar-privacy.5.scd │ ├── waybar-pulseaudio-slider.5.scd │ ├── waybar-pulseaudio.5.scd │ ├── waybar-river-layout.5.scd │ ├── waybar-river-mode.5.scd │ ├── waybar-river-tags.5.scd │ ├── waybar-river-window.5.scd │ ├── waybar-sndio.5.scd │ ├── waybar-states.5.scd │ ├── waybar-styles.5.scd.in │ ├── waybar-sway-language.5.scd │ ├── waybar-sway-mode.5.scd │ ├── waybar-sway-scratchpad.5.scd │ ├── waybar-sway-window.5.scd │ ├── waybar-sway-workspaces.5.scd │ ├── waybar-systemd-failed-units.5.scd │ ├── waybar-temperature.5.scd │ ├── waybar-tray.5.scd │ ├── waybar-upower.5.scd │ ├── waybar-wayfire-window.5.scd │ ├── waybar-wayfire-workspaces.5.scd │ ├── waybar-wireplumber.5.scd │ ├── waybar-wlr-taskbar.5.scd │ └── waybar.5.scd.in ├── meson.build ├── meson_options.txt ├── nix/ │ └── default.nix ├── protocol/ │ ├── dbus-menu.xml │ ├── dbus-status-notifier-item.xml │ ├── dbus-status-notifier-watcher.xml │ ├── dwl-ipc-unstable-v2.xml │ ├── meson.build │ ├── river-control-unstable-v1.xml │ ├── river-status-unstable-v1.xml │ └── wlr-foreign-toplevel-management-unstable-v1.xml ├── resources/ │ ├── config.jsonc │ ├── custom_modules/ │ │ ├── cffi_example/ │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── main.c │ │ │ ├── meson.build │ │ │ └── waybar_cffi_module.h │ │ ├── mediaplayer.py │ │ └── power_menu.xml │ ├── icons/ │ │ ├── meson.build │ │ └── waybar_icons.gresource.xml │ ├── style.css │ └── waybar.service.in ├── src/ │ ├── AAppIconLabel.cpp │ ├── AIconLabel.cpp │ ├── ALabel.cpp │ ├── AModule.cpp │ ├── ASlider.cpp │ ├── bar.cpp │ ├── client.cpp │ ├── config.cpp │ ├── factory.cpp │ ├── group.cpp │ ├── main.cpp │ ├── modules/ │ │ ├── backlight.cpp │ │ ├── backlight_slider.cpp │ │ ├── battery.cpp │ │ ├── bluetooth.cpp │ │ ├── cava/ │ │ │ ├── cavaGLSL.cpp │ │ │ ├── cavaRaw.cpp │ │ │ └── cava_backend.cpp │ │ ├── cffi.cpp │ │ ├── clock.cpp │ │ ├── cpu.cpp │ │ ├── cpu_frequency/ │ │ │ ├── bsd.cpp │ │ │ ├── common.cpp │ │ │ └── linux.cpp │ │ ├── cpu_usage/ │ │ │ ├── bsd.cpp │ │ │ ├── common.cpp │ │ │ └── linux.cpp │ │ ├── custom.cpp │ │ ├── disk.cpp │ │ ├── dwl/ │ │ │ ├── tags.cpp │ │ │ └── window.cpp │ │ ├── ext/ │ │ │ ├── workspace_manager.cpp │ │ │ └── workspace_manager_binding.cpp │ │ ├── gamemode.cpp │ │ ├── gps.cpp │ │ ├── hyprland/ │ │ │ ├── backend.cpp │ │ │ ├── language.cpp │ │ │ ├── submap.cpp │ │ │ ├── window.cpp │ │ │ ├── windowcount.cpp │ │ │ ├── windowcreationpayload.cpp │ │ │ ├── workspace.cpp │ │ │ └── workspaces.cpp │ │ ├── idle_inhibitor.cpp │ │ ├── image.cpp │ │ ├── inhibitor.cpp │ │ ├── jack.cpp │ │ ├── keyboard_state.cpp │ │ ├── load.cpp │ │ ├── memory/ │ │ │ ├── bsd.cpp │ │ │ ├── common.cpp │ │ │ └── linux.cpp │ │ ├── mpd/ │ │ │ ├── mpd.cpp │ │ │ └── state.cpp │ │ ├── mpris/ │ │ │ └── mpris.cpp │ │ ├── network.cpp │ │ ├── niri/ │ │ │ ├── backend.cpp │ │ │ ├── language.cpp │ │ │ ├── window.cpp │ │ │ └── workspaces.cpp │ │ ├── power_profiles_daemon.cpp │ │ ├── privacy/ │ │ │ ├── privacy.cpp │ │ │ └── privacy_item.cpp │ │ ├── pulseaudio.cpp │ │ ├── pulseaudio_slider.cpp │ │ ├── river/ │ │ │ ├── layout.cpp │ │ │ ├── mode.cpp │ │ │ ├── tags.cpp │ │ │ └── window.cpp │ │ ├── simpleclock.cpp │ │ ├── sndio.cpp │ │ ├── sni/ │ │ │ ├── host.cpp │ │ │ ├── item.cpp │ │ │ ├── tray.cpp │ │ │ └── watcher.cpp │ │ ├── sway/ │ │ │ ├── bar.cpp │ │ │ ├── ipc/ │ │ │ │ └── client.cpp │ │ │ ├── language.cpp │ │ │ ├── mode.cpp │ │ │ ├── scratchpad.cpp │ │ │ ├── window.cpp │ │ │ └── workspaces.cpp │ │ ├── systemd_failed_units.cpp │ │ ├── temperature.cpp │ │ ├── upower.cpp │ │ ├── user.cpp │ │ ├── wayfire/ │ │ │ ├── backend.cpp │ │ │ ├── window.cpp │ │ │ └── workspaces.cpp │ │ ├── wireplumber.cpp │ │ └── wlr/ │ │ └── taskbar.cpp │ └── util/ │ ├── audio_backend.cpp │ ├── backlight_backend.cpp │ ├── css_reload_helper.cpp │ ├── enum.cpp │ ├── gtk_icon.cpp │ ├── icon_loader.cpp │ ├── pipewire/ │ │ ├── pipewire_backend.cpp │ │ └── privacy_node_info.cpp │ ├── portal.cpp │ ├── prepare_for_sleep.cpp │ ├── regex_collection.cpp │ ├── rewrite_string.cpp │ ├── rfkill.cpp │ ├── sanitize_str.cpp │ └── ustring_clen.cpp ├── test/ │ ├── config/ │ │ ├── hyprland-workspaces.json │ │ ├── include-1.json │ │ ├── include-2.json │ │ ├── include-multi-0.json │ │ ├── include-multi-1.json │ │ ├── include-multi-2.json │ │ ├── include-multi-3-0.json │ │ ├── include-multi-3.json │ │ ├── include-multi.json │ │ ├── include-relative-path.json │ │ ├── include-wildcard.json │ │ ├── include.json │ │ ├── modules/ │ │ │ ├── cpu.jsonc │ │ │ └── memory.jsonc │ │ ├── multi.json │ │ └── simple.json │ ├── config.cpp │ ├── hyprland/ │ │ ├── backend.cpp │ │ └── meson.build │ ├── main.cpp │ ├── meson.build │ └── utils/ │ ├── JsonParser.cpp │ ├── SafeSignal.cpp │ ├── command.cpp │ ├── css_reload_helper.cpp │ ├── date.cpp │ ├── fixtures/ │ │ └── GlibTestsFixture.hpp │ ├── meson.build │ └── sleeper_thread.cpp └── tsan.supp
SYMBOL INDEX (1204 symbols across 209 files)
FILE: include/AAppIconLabel.hpp
type waybar (line 8) | namespace waybar {
class AAppIconLabel (line 10) | class AAppIconLabel : public AIconLabel {
FILE: include/AIconLabel.hpp
type waybar (line 8) | namespace waybar {
class AIconLabel (line 10) | class AIconLabel : public ALabel {
FILE: include/ALabel.hpp
type waybar (line 9) | namespace waybar {
class ALabel (line 11) | class ALabel : public AModule {
FILE: include/AModule.hpp
type waybar (line 11) | namespace waybar {
class AModule (line 13) | class AModule : public IModule {
type SCROLL_DIR (line 34) | enum SCROLL_DIR { NONE, UP, DOWN, LEFT, RIGHT }
FILE: include/ASlider.hpp
type waybar (line 6) | namespace waybar {
class ASlider (line 8) | class ASlider : public AModule {
FILE: include/IModule.hpp
type waybar (line 5) | namespace waybar {
class IModule (line 7) | class IModule {
FILE: include/bar.hpp
type waybar (line 20) | namespace waybar {
class Factory (line 22) | class Factory
type waybar_output (line 23) | struct waybar_output {
type zxdg_output_v1 (line 28) | struct zxdg_output_v1
type bar_layer (line 32) | enum class bar_layer : uint8_t {
type bar_margins (line 38) | struct bar_margins {
type bar_mode (line 45) | struct bar_mode {
type modules::sway (line 53) | namespace modules::sway {
class BarIpcClient (line 54) | class BarIpcClient
class Bar (line 58) | class Bar : public sigc::trackable {
type bar_mode (line 60) | struct bar_mode
type waybar_output (line 65) | struct waybar_output
method Bar (line 66) | Bar(const Bar&) = delete;
type waybar_output (line 78) | struct waybar_output
type wl_surface (line 80) | struct wl_surface
type bar_margins (line 110) | struct bar_margins
FILE: include/client.hpp
type zwp_idle_inhibitor_v1 (line 13) | struct zwp_idle_inhibitor_v1
type zwp_idle_inhibit_manager_v1 (line 14) | struct zwp_idle_inhibit_manager_v1
type waybar (line 16) | namespace waybar {
class Client (line 18) | class Client {
type wl_display (line 26) | struct wl_display
type wl_registry (line 27) | struct wl_registry
type zxdg_output_manager_v1 (line 28) | struct zxdg_output_manager_v1
type zwp_idle_inhibit_manager_v1 (line 29) | struct zwp_idle_inhibit_manager_v1
method Client (line 35) | Client() = default;
type waybar_output (line 38) | struct waybar_output
type waybar_output (line 40) | struct waybar_output
type waybar_output (line 41) | struct waybar_output
type wl_registry (line 43) | struct wl_registry
type wl_registry (line 45) | struct wl_registry
type zxdg_output_v1 (line 46) | struct zxdg_output_v1
type zxdg_output_v1 (line 47) | struct zxdg_output_v1
type zxdg_output_v1 (line 48) | struct zxdg_output_v1
type waybar_output (line 56) | struct waybar_output
FILE: include/config.hpp
type waybar (line 12) | namespace waybar {
class Config (line 14) | class Config {
method Config (line 26) | Config() = default;
FILE: include/factory.hpp
type waybar (line 7) | namespace waybar {
class Bar (line 9) | class Bar
class Factory (line 11) | class Factory {
FILE: include/group.hpp
type waybar (line 10) | namespace waybar {
class Group (line 12) | class Group : public AModule {
FILE: include/modules/backlight.hpp
type udev (line 13) | struct udev
type udev_device (line 14) | struct udev_device
type waybar::modules (line 16) | namespace waybar::modules {
class Backlight (line 18) | class Backlight : public ALabel {
FILE: include/modules/backlight_slider.hpp
type waybar::modules (line 8) | namespace waybar::modules {
class BacklightSlider (line 10) | class BacklightSlider : public ASlider {
FILE: include/modules/battery.hpp
type waybar::modules (line 21) | namespace waybar::modules {
class Battery (line 25) | class Battery : public ALabel {
FILE: include/modules/bluetooth.hpp
type waybar::modules (line 13) | namespace waybar::modules {
class Bluetooth (line 15) | class Bluetooth : public ALabel {
type ControllerInfo (line 16) | struct ControllerInfo {
type DeviceInfo (line 29) | struct DeviceInfo {
FILE: include/modules/cava/cavaGLSL.hpp
type waybar::modules::cava (line 8) | namespace waybar::modules::cava {
class CavaGLSL (line 10) | class CavaGLSL final : public AModule, public Gtk::GLArea {
type ::cava::config_params (line 17) | struct ::cava::config_params
FILE: include/modules/cava/cavaRaw.hpp
type waybar::modules::cava (line 6) | namespace waybar::modules::cava {
class Cava (line 8) | class Cava final : public ALabel, public sigc::trackable {
FILE: include/modules/cava/cava_backend.hpp
type cava (line 8) | namespace cava {
type waybar::modules::cava (line 23) | namespace waybar::modules::cava {
class CavaBackend (line 26) | class CavaBackend final {
type ::cava::config_params (line 35) | struct ::cava::config_params
type ::cava::error_s (line 54) | struct ::cava::error_s
type ::cava::config_params (line 55) | struct ::cava::config_params
type ::cava::audio_raw (line 56) | struct ::cava::audio_raw
type ::cava::audio_data (line 57) | struct ::cava::audio_data
type ::cava::cava_plan (line 58) | struct ::cava::cava_plan
FILE: include/modules/cava/cava_frontend.hpp
type waybar::modules::cava (line 11) | namespace waybar::modules::cava {
function AModule (line 12) | AModule* getModule(const std::string& id, const Json::Value& config) {
FILE: include/modules/cffi.hpp
type waybar::modules (line 10) | namespace waybar::modules {
type ffi (line 12) | namespace ffi {
type wbcffi_module (line 14) | struct wbcffi_module
type wbcffi_config_entry (line 23) | struct wbcffi_config_entry {
class CFFI (line 30) | class CFFI : public AModule {
FILE: include/modules/clock.hpp
type waybar::modules (line 7) | namespace waybar::modules {
type CldMode (line 13) | enum class CldMode { MONTH, YEAR }
type WS (line 14) | enum class WS { LEFT, RIGHT, HIDDEN }
class Clock (line 16) | class Clock final : public ALabel {
FILE: include/modules/cpu.hpp
type waybar::modules (line 15) | namespace waybar::modules {
class Cpu (line 17) | class Cpu : public ALabel {
FILE: include/modules/cpu_frequency.hpp
type waybar::modules (line 15) | namespace waybar::modules {
class CpuFrequency (line 17) | class CpuFrequency : public ALabel {
FILE: include/modules/cpu_usage.hpp
type waybar::modules (line 15) | namespace waybar::modules {
class CpuUsage (line 17) | class CpuUsage : public ALabel {
FILE: include/modules/custom.hpp
type waybar::modules (line 13) | namespace waybar::modules {
class Custom (line 15) | class Custom : public ALabel {
FILE: include/modules/disk.hpp
type waybar::modules (line 12) | namespace waybar::modules {
class Disk (line 14) | class Disk : public ALabel {
FILE: include/modules/dwl/tags.hpp
type waybar::modules::dwl (line 11) | namespace waybar::modules::dwl {
class Tags (line 13) | class Tags : public waybar::AModule {
type zdwl_ipc_manager_v2 (line 24) | struct zdwl_ipc_manager_v2
type wl_seat (line 25) | struct wl_seat
type zdwl_ipc_output_v2 (line 31) | struct zdwl_ipc_output_v2
FILE: include/modules/dwl/window.hpp
type waybar::modules::dwl (line 12) | namespace waybar::modules::dwl {
class Window (line 14) | class Window : public AAppIconLabel, public sigc::trackable {
type zdwl_ipc_manager_v2 (line 25) | struct zdwl_ipc_manager_v2
type zdwl_ipc_output_v2 (line 35) | struct zdwl_ipc_output_v2
FILE: include/modules/ext/workspace_manager.hpp
type waybar::modules::ext (line 16) | namespace waybar::modules::ext {
class WorkspaceGroup (line 18) | class WorkspaceGroup
method u_int32_t (line 70) | u_int32_t id() const { return id_; }
class Workspace (line 19) | class Workspace
method ext_workspace_handle_v1 (line 96) | ext_workspace_handle_v1* handle() const { return ext_handle_; }
method u_int32_t (line 97) | u_int32_t id() const { return id_; }
method has_state (line 116) | bool has_state(uint32_t state) const { return (state_ & state) == st...
class WorkspaceManager (line 21) | class WorkspaceManager final : public AModule {
method set_needs_sorting (line 28) | void set_needs_sorting() { needs_sorting_ = true; }
class WorkspaceGroup (line 65) | class WorkspaceGroup {
method u_int32_t (line 70) | u_int32_t id() const { return id_; }
class Workspace (line 90) | class Workspace {
method ext_workspace_handle_v1 (line 96) | ext_workspace_handle_v1* handle() const { return ext_handle_; }
method u_int32_t (line 97) | u_int32_t id() const { return id_; }
method has_state (line 116) | bool has_state(uint32_t state) const { return (state_ & state) == st...
FILE: include/modules/ext/workspace_manager_binding.hpp
type waybar::modules::ext (line 3) | namespace waybar::modules::ext {
FILE: include/modules/gamemode.hpp
type waybar::modules (line 16) | namespace waybar::modules {
class Gamemode (line 18) | class Gamemode : public AModule {
FILE: include/modules/gps.hpp
type waybar::modules (line 15) | namespace waybar::modules {
class Gps (line 17) | class Gps : public ALabel {
FILE: include/modules/hyprland/backend.hpp
type waybar::modules::hyprland (line 13) | namespace waybar::modules::hyprland {
class EventHandler (line 15) | class EventHandler {
class IPC (line 23) | class IPC {
FILE: include/modules/hyprland/language.hpp
type waybar::modules::hyprland (line 12) | namespace waybar::modules::hyprland {
class Language (line 14) | class Language : public waybar::ALabel, public EventHandler {
type Layout (line 26) | struct Layout {
FILE: include/modules/hyprland/submap.hpp
type waybar::modules::hyprland (line 12) | namespace waybar::modules::hyprland {
class Submap (line 14) | class Submap : public waybar::ALabel, public EventHandler {
FILE: include/modules/hyprland/window.hpp
type waybar::modules::hyprland (line 12) | namespace waybar::modules::hyprland {
class Window (line 14) | class Window : public waybar::AAppIconLabel, public EventHandler {
type Workspace (line 22) | struct Workspace {
type WindowData (line 31) | struct WindowData {
FILE: include/modules/hyprland/windowcount.hpp
type waybar::modules::hyprland (line 11) | namespace waybar::modules::hyprland {
class WindowCount (line 13) | class WindowCount : public waybar::AAppIconLabel, public EventHandler {
type Workspace (line 21) | struct Workspace {
FILE: include/modules/hyprland/windowcreationpayload.hpp
type waybar::modules::hyprland (line 25) | namespace waybar::modules::hyprland {
class Workspaces (line 27) | class Workspaces
type WindowRepr (line 29) | struct WindowRepr {
method empty (line 37) | bool empty() const { return address.empty(); }
method setActive (line 38) | void setActive(bool value) { isActive = value; }
class WindowCreationPayload (line 41) | class WindowCreationPayload {
method reprIsReady (line 52) | bool reprIsReady() const { return std::holds_alternative<Repr>(m_win...
method setActive (line 54) | void setActive(bool value) { m_isActive = value; }
method getWorkspaceName (line 56) | std::string getWorkspaceName() const { return m_workspaceName; }
method WindowAddress (line 57) | WindowAddress getAddress() const { return m_windowAddress; }
FILE: include/modules/hyprland/workspace.hpp
type waybar::modules::hyprland (line 26) | namespace waybar::modules::hyprland {
class Workspaces (line 28) | class Workspaces
class Workspace (line 29) | class Workspace {
method id (line 36) | int id() const { return m_id; }
method name (line 37) | std::string name() const { return m_name; }
method output (line 38) | std::string output() const { return m_output; }
method isActive (line 39) | bool isActive() const { return m_isActive; }
method isSpecial (line 40) | bool isSpecial() const { return m_isSpecial; }
method isPersistent (line 41) | bool isPersistent() const { return m_isPersistentRule || m_isPersist...
method isPersistentConfig (line 42) | bool isPersistentConfig() const { return m_isPersistentConfig; }
method isPersistentRule (line 43) | bool isPersistentRule() const { return m_isPersistentRule; }
method isVisible (line 44) | bool isVisible() const { return m_isVisible; }
method isUrgent (line 45) | bool isUrgent() const { return m_isUrgent; }
method setActive (line 48) | void setActive(bool value = true) { m_isActive = value; }
method setPersistentRule (line 49) | void setPersistentRule(bool value = true) { m_isPersistentRule = val...
method setPersistentConfig (line 50) | void setPersistentConfig(bool value = true) { m_isPersistentConfig =...
method setUrgent (line 51) | void setUrgent(bool value = true) { m_isUrgent = value; }
method setVisible (line 52) | void setVisible(bool value = true) { m_isVisible = value; }
method setWindows (line 53) | void setWindows(uint value) { m_windows = value; }
method setName (line 54) | void setName(std::string const& value) { m_name = value; }
method setOutput (line 55) | void setOutput(std::string const& value) { m_output = value; }
method containsWindow (line 56) | bool containsWindow(WindowAddress const& addr) const {
FILE: include/modules/hyprland/workspaces.hpp
type waybar::modules::hyprland (line 28) | namespace waybar::modules::hyprland {
class Workspaces (line 30) | class Workspaces
method allOutputs (line 39) | auto allOutputs() const -> bool { return m_allOutputs; }
method showSpecial (line 40) | auto showSpecial() const -> bool { return m_showSpecial; }
method activeOnly (line 41) | auto activeOnly() const -> bool { return m_activeOnly; }
method specialVisibleOnly (line 42) | auto specialVisibleOnly() const -> bool { return m_specialVisibleOnl...
method persistentOnly (line 43) | auto persistentOnly() const -> bool { return m_persistentOnly; }
method moveToMonitor (line 44) | auto moveToMonitor() const -> bool { return m_moveToMonitor; }
method enableTaskbar (line 45) | auto enableTaskbar() const -> bool { return m_enableTaskbar; }
method taskbarWithIcon (line 46) | auto taskbarWithIcon() const -> bool { return m_taskbarWithIcon; }
method barScroll (line 47) | auto barScroll() const -> bool { return m_barScroll; }
method getBarOutput (line 49) | auto getBarOutput() const -> std::string { return m_bar.output->name; }
method formatBefore (line 50) | auto formatBefore() const -> std::string { return m_formatBefore; }
method formatAfter (line 51) | auto formatAfter() const -> std::string { return m_formatAfter; }
method taskbarFormatBefore (line 52) | auto taskbarFormatBefore() const -> std::string { return m_taskbarFo...
method taskbarFormatAfter (line 53) | auto taskbarFormatAfter() const -> std::string { return m_taskbarFor...
method taskbarIconSize (line 54) | auto taskbarIconSize() const -> int { return m_taskbarIconSize; }
method taskbarOrientation (line 55) | auto taskbarOrientation() const -> Gtk::Orientation { return m_taskb...
method taskbarReverseDirection (line 56) | auto taskbarReverseDirection() const -> bool { return m_taskbarRever...
method onClickWindow (line 57) | auto onClickWindow() const -> std::string { return m_onClickWindow; }
method getIgnoredWindows (line 58) | auto getIgnoredWindows() const -> std::vector<std::regex> { return m...
type ActiveWindowPosition (line 60) | enum class ActiveWindowPosition { NONE, FIRST, LAST }
method activeWindowPosition (line 61) | auto activeWindowPosition() const -> ActiveWindowPosition { return m...
method windowRewriteConfigUsesTitle (line 67) | bool windowRewriteConfigUsesTitle() const { return m_anyWindowRewrit...
method IconLoader (line 68) | const IconLoader& iconLoader() const { return m_iconLoader; }
type SortMethod (line 160) | enum class SortMethod { ID, NAME, NUMBER, SPECIAL_CENTERED, DEFAULT }
class Workspaces (line 32) | class Workspaces : public AModule, public EventHandler {
method allOutputs (line 39) | auto allOutputs() const -> bool { return m_allOutputs; }
method showSpecial (line 40) | auto showSpecial() const -> bool { return m_showSpecial; }
method activeOnly (line 41) | auto activeOnly() const -> bool { return m_activeOnly; }
method specialVisibleOnly (line 42) | auto specialVisibleOnly() const -> bool { return m_specialVisibleOnl...
method persistentOnly (line 43) | auto persistentOnly() const -> bool { return m_persistentOnly; }
method moveToMonitor (line 44) | auto moveToMonitor() const -> bool { return m_moveToMonitor; }
method enableTaskbar (line 45) | auto enableTaskbar() const -> bool { return m_enableTaskbar; }
method taskbarWithIcon (line 46) | auto taskbarWithIcon() const -> bool { return m_taskbarWithIcon; }
method barScroll (line 47) | auto barScroll() const -> bool { return m_barScroll; }
method getBarOutput (line 49) | auto getBarOutput() const -> std::string { return m_bar.output->name; }
method formatBefore (line 50) | auto formatBefore() const -> std::string { return m_formatBefore; }
method formatAfter (line 51) | auto formatAfter() const -> std::string { return m_formatAfter; }
method taskbarFormatBefore (line 52) | auto taskbarFormatBefore() const -> std::string { return m_taskbarFo...
method taskbarFormatAfter (line 53) | auto taskbarFormatAfter() const -> std::string { return m_taskbarFor...
method taskbarIconSize (line 54) | auto taskbarIconSize() const -> int { return m_taskbarIconSize; }
method taskbarOrientation (line 55) | auto taskbarOrientation() const -> Gtk::Orientation { return m_taskb...
method taskbarReverseDirection (line 56) | auto taskbarReverseDirection() const -> bool { return m_taskbarRever...
method onClickWindow (line 57) | auto onClickWindow() const -> std::string { return m_onClickWindow; }
method getIgnoredWindows (line 58) | auto getIgnoredWindows() const -> std::vector<std::regex> { return m...
type ActiveWindowPosition (line 60) | enum class ActiveWindowPosition { NONE, FIRST, LAST }
method activeWindowPosition (line 61) | auto activeWindowPosition() const -> ActiveWindowPosition { return m...
method windowRewriteConfigUsesTitle (line 67) | bool windowRewriteConfigUsesTitle() const { return m_anyWindowRewrit...
method IconLoader (line 68) | const IconLoader& iconLoader() const { return m_iconLoader; }
type SortMethod (line 160) | enum class SortMethod { ID, NAME, NUMBER, SPECIAL_CENTERED, DEFAULT }
FILE: include/modules/idle_inhibitor.hpp
type waybar::modules (line 9) | namespace waybar::modules {
class IdleInhibitor (line 11) | class IdleInhibitor : public ALabel {
type zwp_idle_inhibitor_v1 (line 26) | struct zwp_idle_inhibitor_v1
FILE: include/modules/image.hpp
type waybar::modules (line 15) | namespace waybar::modules {
class Image (line 17) | class Image : public AModule {
FILE: include/modules/inhibitor.hpp
type waybar::modules (line 10) | namespace waybar::modules {
class Inhibitor (line 12) | class Inhibitor : public ALabel {
FILE: include/modules/jack.hpp
type waybar::modules (line 12) | namespace waybar::modules {
class JACK (line 14) | class JACK : public ALabel {
FILE: include/modules/keyboard_state.hpp
type waybar::modules (line 19) | namespace waybar::modules {
class KeyboardState (line 21) | class KeyboardState : public AModule {
type libinput (line 43) | struct libinput
type libinput_device (line 44) | struct libinput_device
FILE: include/modules/load.hpp
type waybar::modules (line 15) | namespace waybar::modules {
class Load (line 17) | class Load : public ALabel {
FILE: include/modules/memory.hpp
type waybar::modules (line 11) | namespace waybar::modules {
class Memory (line 13) | class Memory : public ALabel {
FILE: include/modules/mpd/mpd.hpp
type waybar::modules (line 13) | namespace waybar::modules {
class MPD (line 15) | class MPD : public ALabel {
method emit (line 51) | void emit() { dp.emit(); }
method stopped (line 59) | inline bool stopped() const { return connection_ && state_ == MPD_ST...
method playing (line 60) | inline bool playing() const { return connection_ && state_ == MPD_ST...
method paused (line 61) | inline bool paused() const { return connection_ && state_ == MPD_STA...
FILE: include/modules/mpd/state.hpp
type waybar::modules (line 12) | namespace waybar::modules {
class MPD (line 13) | class MPD
type waybar::modules::detail (line 16) | namespace waybar::modules::detail {
class Context (line 22) | class Context
method setState (line 184) | void setState(std::unique_ptr<State>&& new_state) noexcept {
method Context (line 207) | explicit Context(waybar::modules::MPD* const mpd_module)
method play (line 212) | void play() { state_->play(); }
method stop (line 213) | void stop() { state_->stop(); }
method pause (line 214) | void pause() { state_->pause(); }
method update (line 215) | void update() noexcept { state_->update(); }
class State (line 44) | class State {
method entry (line 48) | virtual void entry() noexcept { spdlog::debug("mpd: ignore entry act...
method exit (line 49) | virtual void exit() noexcept { spdlog::debug("mpd: ignore exit actio...
method play (line 51) | virtual void play() { spdlog::debug("mpd: ignore play state transiti...
method stop (line 52) | virtual void stop() { spdlog::debug("mpd: ignore stop state transiti...
method pause (line 53) | virtual void pause() { spdlog::debug("mpd: ignore pause state transi...
method update (line 56) | virtual void update() noexcept { spdlog::debug("mpd: ignoring update...
class Idle (line 59) | class Idle : public State {
method Idle (line 64) | Idle(Context* const ctx) : ctx_{ctx} {}
method Idle (line 76) | Idle(const Idle&) = delete;
method Idle (line 77) | Idle& operator=(const Idle&) = delete;
class Playing (line 82) | class Playing : public State {
method Playing (line 87) | Playing(Context* const ctx) : ctx_{ctx} {}
method Playing (line 98) | Playing(Playing const&) = delete;
method Playing (line 99) | Playing& operator=(Playing const&) = delete;
class Paused (line 104) | class Paused : public State {
method Paused (line 109) | Paused(Context* const ctx) : ctx_{ctx} {}
method Paused (line 120) | Paused(Paused const&) = delete;
method Paused (line 121) | Paused& operator=(Paused const&) = delete;
class Stopped (line 126) | class Stopped : public State {
method Stopped (line 131) | Stopped(Context* const ctx) : ctx_{ctx} {}
method Stopped (line 142) | Stopped(Stopped const&) = delete;
method Stopped (line 143) | Stopped& operator=(Stopped const&) = delete;
class Disconnected (line 148) | class Disconnected : public State {
method Disconnected (line 154) | Disconnected(Context* const ctx) : ctx_{ctx} {}
method Disconnected (line 163) | Disconnected(Disconnected const&) = delete;
method Disconnected (line 164) | Disconnected& operator=(Disconnected const&) = delete;
class Context (line 172) | class Context {
method setState (line 184) | void setState(std::unique_ptr<State>&& new_state) noexcept {
method Context (line 207) | explicit Context(waybar::modules::MPD* const mpd_module)
method play (line 212) | void play() { state_->play(); }
method stop (line 213) | void stop() { state_->stop(); }
method pause (line 214) | void pause() { state_->pause(); }
method update (line 215) | void update() noexcept { state_->update(); }
FILE: include/modules/mpd/state.inl.hpp
type detail (line 3) | namespace detail {
function unique_connection (line 12) | inline unique_connection& Context::connection() { return mpd_module_->...
function mpd_state (line 13) | constexpr inline mpd_state Context::state() const { return mpd_module_...
FILE: include/modules/mpris/mpris.hpp
type waybar::modules::mpris (line 17) | namespace waybar::modules::mpris {
class Mpris (line 19) | class Mpris : public ALabel {
type PlayerInfo (line 34) | struct PlayerInfo {
FILE: include/modules/network.hpp
type ip_addr_pref (line 20) | enum ip_addr_pref : uint8_t { IPV4, IPV6, IPV4_6 }
type waybar::modules (line 22) | namespace waybar::modules {
class Network (line 24) | class Network : public ALabel {
type nl_msg (line 34) | struct nl_msg
type nl_msg (line 35) | struct nl_msg
type nl_msg (line 36) | struct nl_msg
type nlattr (line 43) | struct nlattr
type nlattr (line 44) | struct nlattr
type nlattr (line 45) | struct nlattr
type nlattr (line 46) | struct nlattr
type nlattr (line 47) | struct nlattr
type sockaddr_nl (line 57) | struct sockaddr_nl
type nl_sock (line 58) | struct nl_sock
type nl_sock (line 59) | struct nl_sock
FILE: include/modules/niri/backend.hpp
type waybar::modules::niri (line 10) | namespace waybar::modules::niri {
class EventHandler (line 12) | class EventHandler {
class IPC (line 18) | class IPC {
method lockData (line 28) | std::lock_guard<std::mutex> lockData() { return std::lock_guard(data...
method keyboardLayoutCurrent (line 32) | unsigned keyboardLayoutCurrent() const { return keyboardLayoutCurren...
FILE: include/modules/niri/language.hpp
type waybar::modules::niri (line 9) | namespace waybar::modules::niri {
class Language (line 11) | class Language : public ALabel, public EventHandler {
type Layout (line 22) | struct Layout {
FILE: include/modules/niri/window.hpp
type waybar::modules::niri (line 10) | namespace waybar::modules::niri {
class Window (line 12) | class Window : public AAppIconLabel, public EventHandler {
FILE: include/modules/niri/workspaces.hpp
type waybar::modules::niri (line 10) | namespace waybar::modules::niri {
class Workspaces (line 12) | class Workspaces : public AModule, public EventHandler {
FILE: include/modules/power_profiles_daemon.hpp
type waybar::modules (line 8) | namespace waybar::modules {
type Profile (line 10) | struct Profile {
method Profile (line 14) | Profile(std::string n, std::string d) : name(std::move(n)), driver(s...
class PowerProfilesDaemon (line 17) | class PowerProfilesDaemon : public ALabel {
FILE: include/modules/privacy/privacy.hpp
type waybar::modules::privacy (line 12) | namespace waybar::modules::privacy {
class Privacy (line 14) | class Privacy : public AModule {
FILE: include/modules/privacy/privacy_item.hpp
type waybar::modules::privacy (line 15) | namespace waybar::modules::privacy {
class PrivacyItem (line 17) | class PrivacyItem : public Gtk::Revealer {
type PrivacyNodeType (line 19) | enum PrivacyNodeType
type PrivacyNodeType (line 23) | enum PrivacyNodeType
FILE: include/modules/pulseaudio.hpp
type waybar::modules (line 12) | namespace waybar::modules {
class Pulseaudio (line 14) | class Pulseaudio : public ALabel {
FILE: include/modules/pulseaudio_slider.hpp
type waybar::modules (line 7) | namespace waybar::modules {
type PulseaudioSliderTarget (line 9) | enum class PulseaudioSliderTarget {
class PulseaudioSlider (line 14) | class PulseaudioSlider : public ASlider {
FILE: include/modules/river/layout.hpp
type waybar::modules::river (line 9) | namespace waybar::modules::river {
class Layout (line 11) | class Layout : public waybar::ALabel {
type wl_output (line 19) | struct wl_output
type wl_output (line 20) | struct wl_output
type zriver_status_manager_v1 (line 22) | struct zriver_status_manager_v1
type wl_seat (line 23) | struct wl_seat
type wl_output (line 28) | struct wl_output
type wl_output (line 29) | struct wl_output
type zriver_output_status_v1 (line 30) | struct zriver_output_status_v1
type zriver_seat_status_v1 (line 31) | struct zriver_seat_status_v1
FILE: include/modules/river/mode.hpp
type waybar::modules::river (line 9) | namespace waybar::modules::river {
class Mode (line 11) | class Mode : public waybar::ALabel {
type zriver_status_manager_v1 (line 19) | struct zriver_status_manager_v1
type wl_seat (line 20) | struct wl_seat
type zriver_seat_status_v1 (line 25) | struct zriver_seat_status_v1
FILE: include/modules/river/tags.hpp
type waybar::modules::river (line 12) | namespace waybar::modules::river {
class Tags (line 14) | class Tags : public waybar::AModule {
type wl_array (line 21) | struct wl_array
type zriver_status_manager_v1 (line 28) | struct zriver_status_manager_v1
type zriver_control_v1 (line 29) | struct zriver_control_v1
type wl_seat (line 30) | struct wl_seat
type zriver_output_status_v1 (line 36) | struct zriver_output_status_v1
FILE: include/modules/river/window.hpp
type waybar::modules::river (line 11) | namespace waybar::modules::river {
class Window (line 13) | class Window : public waybar::ALabel {
type wl_output (line 20) | struct wl_output
type wl_output (line 21) | struct wl_output
type zriver_status_manager_v1 (line 23) | struct zriver_status_manager_v1
type wl_seat (line 24) | struct wl_seat
type wl_output (line 28) | struct wl_output
type wl_output (line 29) | struct wl_output
type zriver_seat_status_v1 (line 30) | struct zriver_seat_status_v1
FILE: include/modules/simpleclock.hpp
type waybar::modules (line 8) | namespace waybar::modules {
class Clock (line 10) | class Clock : public ALabel {
FILE: include/modules/sndio.hpp
type waybar::modules (line 10) | namespace waybar::modules {
class Sndio (line 12) | class Sndio : public ALabel {
type sioctl_desc (line 17) | struct sioctl_desc
type sioctl_hdl (line 25) | struct sioctl_hdl
type pollfd (line 26) | struct pollfd
FILE: include/modules/sni/host.hpp
type waybar::modules::SNI (line 13) | namespace waybar::modules::SNI {
class Host (line 15) | class Host {
FILE: include/modules/sni/icon_manager.hpp
class IconManager (line 9) | class IconManager {
method IconManager (line 11) | static IconManager& instance() {
method setIconsConfig (line 16) | void setIconsConfig(const Json::Value& icons_config) {
method getIconForApp (line 32) | std::string getIconForApp(const std::string& app_name) const {
method IconManager (line 41) | IconManager() = default;
FILE: include/modules/sni/item.hpp
type waybar::modules::SNI (line 20) | namespace waybar::modules::SNI {
type ToolTip (line 22) | struct ToolTip {
class Item (line 27) | class Item : public sigc::trackable {
FILE: include/modules/sni/tray.hpp
type waybar::modules::SNI (line 11) | namespace waybar::modules::SNI {
class Tray (line 13) | class Tray : public AModule {
FILE: include/modules/sni/watcher.hpp
type waybar::modules::SNI (line 7) | namespace waybar::modules::SNI {
class Watcher (line 9) | class Watcher {
method singleton (line 17) | static singleton getInstance() {
FILE: include/modules/sway/bar.hpp
type waybar (line 9) | namespace waybar {
class Bar (line 11) | class Bar
type modules::sway (line 13) | namespace modules::sway {
type swaybar_config (line 18) | struct swaybar_config {
class BarIpcClient (line 27) | class BarIpcClient {
type Ipc::ipc_response (line 32) | struct Ipc::ipc_response
type Ipc::ipc_response (line 33) | struct Ipc::ipc_response
type Ipc::ipc_response (line 34) | struct Ipc::ipc_response
FILE: include/modules/sway/ipc/client.hpp
type waybar::modules::sway (line 19) | namespace waybar::modules::sway {
class Ipc (line 21) | class Ipc {
type ipc_response (line 26) | struct ipc_response {
type ipc_response (line 32) | struct ipc_response
type ipc_response (line 33) | struct ipc_response
type ipc_response (line 46) | struct ipc_response
type ipc_response (line 47) | struct ipc_response
FILE: include/modules/sway/ipc/ipc.hpp
type ipc_command_type (line 7) | enum ipc_command_type : uint32_t {
FILE: include/modules/sway/language.hpp
type waybar::modules::sway (line 15) | namespace waybar::modules::sway {
class Language (line 17) | class Language : public ALabel, public sigc::trackable {
type DisplayedShortFlag (line 24) | enum class DisplayedShortFlag { None = 0, ShortName = 1, ShortDescri...
type Layout (line 26) | struct Layout {
class XKBContext (line 34) | class XKBContext {
type Ipc::ipc_response (line 47) | struct Ipc::ipc_response
type Ipc::ipc_response (line 48) | struct Ipc::ipc_response
FILE: include/modules/sway/mode.hpp
type waybar::modules::sway (line 11) | namespace waybar::modules::sway {
class Mode (line 13) | class Mode : public ALabel, public sigc::trackable {
type Ipc::ipc_response (line 20) | struct Ipc::ipc_response
FILE: include/modules/sway/scratchpad.hpp
type waybar::modules::sway (line 14) | namespace waybar::modules::sway {
class Scratchpad (line 15) | class Scratchpad : public ALabel {
type Ipc::ipc_response (line 23) | struct Ipc::ipc_response
type Ipc::ipc_response (line 24) | struct Ipc::ipc_response
FILE: include/modules/sway/window.hpp
type waybar::modules::sway (line 13) | namespace waybar::modules::sway {
class Window (line 15) | class Window : public AAppIconLabel, public sigc::trackable {
type Ipc::ipc_response (line 23) | struct Ipc::ipc_response
type Ipc::ipc_response (line 24) | struct Ipc::ipc_response
FILE: include/modules/sway/workspaces.hpp
type waybar::modules::sway (line 17) | namespace waybar::modules::sway {
class Workspaces (line 19) | class Workspaces : public AModule, public sigc::trackable {
type Ipc::ipc_response (line 33) | struct Ipc::ipc_response
type Ipc::ipc_response (line 34) | struct Ipc::ipc_response
FILE: include/modules/systemd_failed_units.hpp
type waybar::modules (line 10) | namespace waybar::modules {
class SystemdFailedUnits (line 12) | class SystemdFailedUnits : public ALabel {
type FailedUnit (line 19) | struct FailedUnit {
FILE: include/modules/temperature.hpp
type waybar::modules (line 10) | namespace waybar::modules {
class Temperature (line 12) | class Temperature : public ALabel {
FILE: include/modules/upower.hpp
type waybar::modules (line 11) | namespace waybar::modules {
class UPower (line 13) | class UPower final : public AIconLabel {
type upDevice_output (line 32) | struct upDevice_output {
FILE: include/modules/user.hpp
type waybar::modules (line 10) | namespace waybar::modules {
class User (line 11) | class User : public AIconLabel {
FILE: include/modules/wayfire/backend.hpp
type waybar::modules::wayfire (line 17) | namespace waybar::modules::wayfire {
type State (line 21) | struct State {
type Output (line 41) | struct Output {
type Workspace (line 47) | struct Workspace {
type Wset (line 52) | struct Wset {
method ws_idx (line 58) | auto ws_idx() const { return ws_w * ws_y + ws_x; }
class IPC (line 78) | class IPC : public std::enable_shared_from_this<IPC> {
method IPC (line 87) | IPC() = default;
method lock_state (line 101) | auto lock_state() -> std::lock_guard<std::mutex> { return std::lock_...
FILE: include/modules/wayfire/window.hpp
type waybar::modules::wayfire (line 7) | namespace waybar::modules::wayfire {
class Window (line 9) | class Window : public AAppIconLabel {
FILE: include/modules/wayfire/workspaces.hpp
type waybar::modules::wayfire (line 13) | namespace waybar::modules::wayfire {
class Workspaces (line 15) | class Workspaces : public AModule {
FILE: include/modules/wireplumber.hpp
type waybar::modules (line 11) | namespace waybar::modules {
class Wireplumber (line 13) | class Wireplumber : public ALabel {
FILE: include/modules/wlr/taskbar.hpp
type waybar::modules::wlr (line 26) | namespace waybar::modules::wlr {
type widget_geometry (line 28) | struct widget_geometry {
class Taskbar (line 32) | class Taskbar
type zwlr_foreign_toplevel_manager_v1 (line 158) | struct zwlr_foreign_toplevel_manager_v1
type wl_seat (line 159) | struct wl_seat
type wl_registry (line 163) | struct wl_registry
type wl_registry (line 164) | struct wl_registry
type zwlr_foreign_toplevel_handle_v1 (line 167) | struct zwlr_foreign_toplevel_handle_v1
type wl_output (line 176) | struct wl_output
class Task (line 34) | class Task {
type zwlr_foreign_toplevel_handle_v1 (line 36) | struct zwlr_foreign_toplevel_handle_v1
type wl_seat (line 37) | struct wl_seat
type State (line 41) | enum State {
type widget_geometry (line 50) | struct widget_geometry
type zwlr_foreign_toplevel_handle_v1 (line 59) | struct zwlr_foreign_toplevel_handle_v1
type wl_seat (line 60) | struct wl_seat
method id (line 97) | uint32_t id() const { return id_; }
method title (line 98) | std::string title() const { return title_; }
method app_id (line 99) | std::string app_id() const { return app_id_; }
method state (line 100) | uint32_t state() const { return state_; }
method maximized (line 101) | bool maximized() const { return state_ & MAXIMIZED; }
method minimized (line 102) | bool minimized() const { return state_ & MINIMIZED; }
method active (line 103) | bool active() const { return state_ & ACTIVE; }
method fullscreen (line 104) | bool fullscreen() const { return state_ & FULLSCREEN; }
type wl_output (line 110) | struct wl_output
type wl_output (line 111) | struct wl_output
type wl_array (line 112) | struct wl_array
class Taskbar (line 143) | class Taskbar : public waybar::AModule {
type zwlr_foreign_toplevel_manager_v1 (line 158) | struct zwlr_foreign_toplevel_manager_v1
type wl_seat (line 159) | struct wl_seat
type wl_registry (line 163) | struct wl_registry
type wl_registry (line 164) | struct wl_registry
type zwlr_foreign_toplevel_handle_v1 (line 167) | struct zwlr_foreign_toplevel_handle_v1
type wl_output (line 176) | struct wl_output
FILE: include/util/SafeSignal.hpp
type waybar (line 20) | namespace waybar {
type SafeSignal (line 27) | struct SafeSignal : sigc::signal<void(std::decay_t<Args>...)> {
method SafeSignal (line 29) | SafeSignal() { dp_.connect(sigc::mem_fun(*this, &SafeSignal::handle_...
method set_max_queued_events (line 31) | void set_max_queued_events(std::size_t max_queued_events) {
method emit (line 38) | void emit(EmitArgs&&... args) {
method trim_queue_locked (line 73) | void trim_queue_locked() {
method handle_event (line 82) | void handle_event() {
FILE: include/util/audio_backend.hpp
type waybar::util (line 15) | namespace waybar::util {
class AudioBackend (line 17) | class AudioBackend {
type private_constructor_tag (line 62) | struct private_constructor_tag {}
method getSinkPortName (line 75) | std::string getSinkPortName() const { return port_name_; }
method getFormFactor (line 76) | std::string getFormFactor() const { return form_factor_; }
method getSinkDesc (line 77) | std::string getSinkDesc() const { return desc_; }
method getMonitor (line 78) | std::string getMonitor() const { return monitor_; }
method getCurrentSinkName (line 79) | std::string getCurrentSinkName() const { return current_sink_name_; }
method getCurrentSinkRunning (line 80) | bool getCurrentSinkRunning() const { return current_sink_running_; }
method getSinkVolume (line 81) | uint16_t getSinkVolume() const { return volume_; }
method getSinkMuted (line 82) | bool getSinkMuted() const { return muted_; }
method getSourceVolume (line 83) | uint16_t getSourceVolume() const { return source_volume_; }
method getSourceMuted (line 84) | bool getSourceMuted() const { return source_muted_; }
method getSourcePortName (line 85) | std::string getSourcePortName() const { return source_port_name_; }
method getSourceDesc (line 86) | std::string getSourceDesc() const { return source_desc_; }
method getDefaultSourceName (line 87) | std::string getDefaultSourceName() const { return default_source_nam...
FILE: include/util/backend_common.hpp
type waybar::util (line 5) | namespace waybar::util {
type ChangeType (line 8) | enum class ChangeType : char { Increase, Decrease }
FILE: include/util/backlight_backend.hpp
type waybar::util (line 25) | namespace waybar::util {
class BacklightDevice (line 27) | class BacklightDevice {
method BacklightDevice (line 29) | BacklightDevice() = default;
class BacklightBackend (line 50) | class BacklightBackend {
method is_login_proxy_initialized (line 64) | bool is_login_proxy_initialized() const { return static_cast<bool>(l...
FILE: include/util/clara.hpp
type clara (line 53) | namespace clara {
type TextFlow (line 54) | namespace TextFlow {
function isWhitespace (line 56) | inline auto isWhitespace(char c) -> bool {
function isBreakableBefore (line 60) | inline auto isBreakableBefore(char c) -> bool {
function isBreakableAfter (line 64) | inline auto isBreakableAfter(char c) -> bool {
class Columns (line 69) | class Columns
class iterator (line 235) | class iterator {
type EndTag (line 237) | struct EndTag {}
method iterator (line 243) | iterator(Columns const& columns, EndTag) : m_columns(columns.m_c...
method iterator (line 256) | explicit iterator(Columns const& columns)
method begin (line 301) | auto begin() const -> iterator { return iterator(*this); }
method end (line 302) | auto end() const -> iterator { return {*this, iterator::EndTag()}; }
method friend (line 314) | inline friend std::ostream& operator<<(std::ostream& os, Columns c...
method toString (line 326) | auto toString() const -> std::string {
class Column (line 71) | class Column {
class iterator (line 78) | class iterator {
method iterator (line 89) | iterator(Column const& column, size_t stringIndex)
method line (line 92) | auto line() const -> std::string const& { return m_column.m_stri...
method isBoundary (line 94) | auto isBoundary(size_t at) const -> bool {
method calcLength (line 102) | void calcLength() {
method indent (line 126) | auto indent() const -> size_t {
method addIndentAndSuffix (line 132) | auto addIndentAndSuffix(std::string const& plain) const -> std::...
method iterator (line 143) | explicit iterator(Column const& column) : m_column(column) {
method Column (line 185) | explicit Column(std::string const& text) { m_strings.push_back(tex...
method width (line 187) | auto width(size_t newWidth) -> Column& {
method indent (line 192) | auto indent(size_t newIndent) -> Column& {
method initialIndent (line 196) | auto initialIndent(size_t newIndent) -> Column& {
method width (line 201) | auto width() const -> size_t { return m_width; }
method begin (line 202) | auto begin() const -> iterator { return iterator(*this); }
method end (line 203) | auto end() const -> iterator { return {*this, m_strings.size()}; }
method friend (line 205) | inline friend std::ostream& operator<<(std::ostream& os, Column co...
method toString (line 219) | auto toString() const -> std::string {
class Spacer (line 226) | class Spacer : public Column {
method Spacer (line 228) | explicit Spacer(size_t spaceWidth) : Column("") { width(spaceWidth...
class Columns (line 231) | class Columns {
class iterator (line 235) | class iterator {
type EndTag (line 237) | struct EndTag {}
method iterator (line 243) | iterator(Columns const& columns, EndTag) : m_columns(columns.m_c...
method iterator (line 256) | explicit iterator(Columns const& columns)
method begin (line 301) | auto begin() const -> iterator { return iterator(*this); }
method end (line 302) | auto end() const -> iterator { return {*this, iterator::EndTag()}; }
method friend (line 314) | inline friend std::ostream& operator<<(std::ostream& os, Columns c...
method toString (line 326) | auto toString() const -> std::string {
type detail (line 357) | namespace detail {
type UnaryLambdaTraits (line 361) | struct UnaryLambdaTraits : UnaryLambdaTraits<decltype(&L::operator()...
type UnaryLambdaTraits<ReturnT (ClassT::*)(ArgT) const> (line 369) | struct UnaryLambdaTraits<ReturnT (ClassT::*)(ArgT) const> {
class TokenStream (line 375) | class TokenStream
method loadBuffer (line 415) | void loadBuffer() {
method TokenStream (line 446) | explicit TokenStream(Args const& args) : TokenStream(args.m_args.b...
method TokenStream (line 448) | TokenStream(Iterator it, Iterator itEnd) : it(it), itEnd(itEnd) { ...
method count (line 452) | auto count() const -> size_t { return m_tokenBuffer.size() + (itEn...
class Args (line 378) | class Args {
method Args (line 384) | Args(int argc, char const* const* argv) : m_exeName(argv[0]), m_ar...
method Args (line 386) | Args(std::initializer_list<std::string> args)
method exeName (line 389) | auto exeName() const -> std::string { return m_exeName; }
type TokenType (line 394) | enum class TokenType { Option, Argument }
type Token (line 395) | struct Token {
function isOptPrefix (line 400) | inline auto isOptPrefix(char c) -> bool {
class TokenStream (line 409) | class TokenStream {
method loadBuffer (line 415) | void loadBuffer() {
method TokenStream (line 446) | explicit TokenStream(Args const& args) : TokenStream(args.m_args.b...
method TokenStream (line 448) | TokenStream(Iterator it, Iterator itEnd) : it(it), itEnd(itEnd) { ...
method count (line 452) | auto count() const -> size_t { return m_tokenBuffer.size() + (itEn...
class ResultBase (line 475) | class ResultBase {
type Type (line 477) | enum Type { Ok, LogicError, RuntimeError }
method ResultBase (line 480) | ResultBase(Type type) : m_type(type) {}
class ResultValueBase (line 489) | class ResultValueBase : public ResultBase {
method value (line 491) | auto value() const -> T const& {
method ResultValueBase (line 497) | ResultValueBase(Type type) : ResultBase(type) {}
method ResultValueBase (line 499) | ResultValueBase(ResultValueBase const& other) : ResultBase(other) {
method ResultValueBase (line 503) | ResultValueBase(Type, T const& value) : ResultBase(Ok) { new (&m_v...
class ResultValueBase<void> (line 522) | class ResultValueBase<void> : public ResultBase {
class BasicResult (line 528) | class BasicResult : public ResultValueBase<T> {
method BasicResult (line 531) | explicit BasicResult(BasicResult<U> const& other)
method ok (line 537) | static auto ok(U const& value) -> BasicResult {
method ok (line 540) | static auto ok() -> BasicResult { return {ResultBase::Ok}; }
method logicError (line 541) | static auto logicError(std::string const& message) -> BasicResult {
method runtimeError (line 544) | static auto runtimeError(std::string const& message) -> BasicResult {
method type (line 549) | auto type() const -> ResultBase::Type { return m_type; }
method errorMessage (line 550) | auto errorMessage() const -> std::string { return m_errorMessage; }
method enforceOk (line 553) | void enforceOk() const override {
method BasicResult (line 563) | BasicResult(ResultBase::Type type, std::string const& message)
type ParseResultType (line 572) | enum class ParseResultType { Matched, NoMatch, ShortCircuitAll, Shor...
class ParseState (line 574) | class ParseState {
method ParseState (line 576) | ParseState(ParseResultType type, TokenStream const& remainingTokens)
method type (line 579) | auto type() const -> ParseResultType { return m_type; }
method remainingTokens (line 580) | auto remainingTokens() const -> TokenStream { return m_remainingTo...
type HelpColumns (line 591) | struct HelpColumns {
function convertInto (line 597) | inline auto convertInto(std::string const& source, T& target) -> Par...
function convertInto (line 606) | inline auto convertInto(std::string const& source, std::string& targ...
function convertInto (line 610) | inline auto convertInto(std::string const& source, bool& target) -> ...
function convertInto (line 625) | inline auto convertInto(std::string const& source, CLARA_CONFIG_OPTI...
type NonCopyable (line 634) | struct NonCopyable {
method NonCopyable (line 635) | NonCopyable() = default;
method NonCopyable (line 636) | NonCopyable(NonCopyable const&) = delete;
method NonCopyable (line 637) | NonCopyable(NonCopyable&&) = delete;
method NonCopyable (line 638) | NonCopyable& operator=(NonCopyable const&) = delete;
method NonCopyable (line 639) | NonCopyable& operator=(NonCopyable&&) = delete;
type BoundRef (line 642) | struct BoundRef : NonCopyable {
method isContainer (line 644) | virtual auto isContainer() const -> bool { return false; }
method isFlag (line 645) | virtual auto isFlag() const -> bool { return false; }
type BoundValueRefBase (line 647) | struct BoundValueRefBase : BoundRef {
type BoundFlagRefBase (line 650) | struct BoundFlagRefBase : BoundRef {
method isFlag (line 652) | virtual auto isFlag() const -> bool { return true; }
type BoundValueRef (line 656) | struct BoundValueRef : BoundValueRefBase {
method BoundValueRef (line 659) | explicit BoundValueRef(T& ref) : m_ref(ref) {}
method setValue (line 661) | auto setValue(std::string const& arg) -> ParserResult override { r...
type BoundValueRef<std::vector<T>> (line 665) | struct BoundValueRef<std::vector<T>> : BoundValueRefBase {
method BoundValueRef (line 668) | explicit BoundValueRef(std::vector<T>& ref) : m_ref(ref) {}
method isContainer (line 670) | auto isContainer() const -> bool override { return true; }
method setValue (line 672) | auto setValue(std::string const& arg) -> ParserResult override {
type BoundFlagRef (line 680) | struct BoundFlagRef : BoundFlagRefBase {
method BoundFlagRef (line 683) | explicit BoundFlagRef(bool& ref) : m_ref(ref) {}
method setFlag (line 685) | auto setFlag(bool flag) -> ParserResult override {
type LambdaInvoker (line 692) | struct LambdaInvoker {
method invoke (line 697) | static auto invoke(L const& lambda, ArgType const& arg) -> ParserR...
type LambdaInvoker<void> (line 703) | struct LambdaInvoker<void> {
method invoke (line 705) | static auto invoke(L const& lambda, ArgType const& arg) -> ParserR...
function invokeLambda (line 712) | inline auto invokeLambda(L const& lambda, std::string const& arg) ->...
type BoundLambda (line 720) | struct BoundLambda : BoundValueRefBase {
method BoundLambda (line 724) | explicit BoundLambda(L const& lambda) : m_lambda(lambda) {}
method setValue (line 726) | auto setValue(std::string const& arg) -> ParserResult override {
type BoundFlagLambda (line 732) | struct BoundFlagLambda : BoundFlagRefBase {
method BoundFlagLambda (line 739) | explicit BoundFlagLambda(L const& lambda) : m_lambda(lambda) {}
method setFlag (line 741) | auto setFlag(bool flag) -> ParserResult override {
type Optionality (line 746) | enum class Optionality { Optional, Required }
type Parser (line 748) | struct Parser
method getHelpColumns (line 1037) | auto getHelpColumns() const -> std::vector<HelpColumns> {
method writeToStream (line 1046) | void writeToStream(std::ostream& os) const {
method validate (line 1087) | auto validate() const -> Result override {
method parse (line 1101) | auto parse(std::string const& exeName, TokenStream const& tokens) ...
class ParserBase (line 750) | class ParserBase {
method validate (line 753) | virtual auto validate() const -> Result { return Result::ok(); }
method cardinality (line 756) | virtual auto cardinality() const -> size_t { return 1; }
method parse (line 758) | auto parse(Args const& args) const -> InternalParseResult {
class ComposableParserImpl (line 764) | class ComposableParserImpl : public ParserBase {
class ParserRefImpl (line 775) | class ParserRefImpl : public ComposableParserImpl<DerivedT> {
method ParserRefImpl (line 782) | explicit ParserRefImpl(std::shared_ptr<BoundRef> const& ref) : m_r...
method ParserRefImpl (line 786) | ParserRefImpl(T& ref, std::string const& hint)
method ParserRefImpl (line 790) | ParserRefImpl(LambdaT const& ref, std::string const& hint)
method optional (line 798) | auto optional() -> DerivedT& {
method required (line 803) | auto required() -> DerivedT& {
method isOptional (line 808) | auto isOptional() const -> bool { return m_optionality == Optional...
method cardinality (line 810) | auto cardinality() const -> size_t override {
method hint (line 817) | auto hint() const -> std::string { return m_hint; }
class ExeName (line 820) | class ExeName : public ComposableParserImpl<ExeName> {
method makeRef (line 825) | static auto makeRef(LambdaT const& lambda) -> std::shared_ptr<Boun...
method ExeName (line 830) | ExeName() : m_name(std::make_shared<std::string>("<executable>")) {}
method ExeName (line 832) | explicit ExeName(std::string& ref) : ExeName() {
method ExeName (line 837) | explicit ExeName(LambdaT const& lambda) : ExeName() {
method parse (line 842) | auto parse(std::string const&, TokenStream const& tokens) const ->...
method name (line 846) | auto name() const -> std::string { return *m_name; }
method set (line 847) | auto set(std::string const& newName) -> ParserResult {
class Arg (line 859) | class Arg : public ParserRefImpl<Arg> {
method parse (line 863) | auto parse(std::string const&, TokenStream const& tokens) const ->...
function normaliseOpt (line 883) | inline auto normaliseOpt(std::string const& optName) -> std::string {
class Opt (line 892) | class Opt : public ParserRefImpl<Opt> {
method Opt (line 898) | explicit Opt(LambdaT const& ref)
method Opt (line 901) | explicit Opt(bool& ref) : ParserRefImpl(std::make_shared<BoundFlag...
method Opt (line 904) | Opt(LambdaT const& ref, std::string const& hint) : ParserRefImpl(r...
method Opt (line 907) | Opt(T& ref, std::string const& hint) : ParserRefImpl(ref, hint) {}
method getHelpColumns (line 914) | auto getHelpColumns() const -> std::vector<HelpColumns> {
method isMatch (line 928) | auto isMatch(std::string const& optToken) const -> bool {
method parse (line 938) | auto parse(std::string const&, TokenStream const& tokens) const ->...
method validate (line 971) | auto validate() const -> Result override {
type Help (line 986) | struct Help : Opt {
method Help (line 987) | Help(bool& showHelpFlag)
type Parser (line 996) | struct Parser : ParserBase {
method getHelpColumns (line 1037) | auto getHelpColumns() const -> std::vector<HelpColumns> {
method writeToStream (line 1046) | void writeToStream(std::ostream& os) const {
method validate (line 1087) | auto validate() const -> Result override {
method parse (line 1101) | auto parse(std::string const& exeName, TokenStream const& tokens) ...
type clara (line 356) | namespace clara {
type TextFlow (line 54) | namespace TextFlow {
function isWhitespace (line 56) | inline auto isWhitespace(char c) -> bool {
function isBreakableBefore (line 60) | inline auto isBreakableBefore(char c) -> bool {
function isBreakableAfter (line 64) | inline auto isBreakableAfter(char c) -> bool {
class Columns (line 69) | class Columns
class iterator (line 235) | class iterator {
type EndTag (line 237) | struct EndTag {}
method iterator (line 243) | iterator(Columns const& columns, EndTag) : m_columns(columns.m_c...
method iterator (line 256) | explicit iterator(Columns const& columns)
method begin (line 301) | auto begin() const -> iterator { return iterator(*this); }
method end (line 302) | auto end() const -> iterator { return {*this, iterator::EndTag()}; }
method friend (line 314) | inline friend std::ostream& operator<<(std::ostream& os, Columns c...
method toString (line 326) | auto toString() const -> std::string {
class Column (line 71) | class Column {
class iterator (line 78) | class iterator {
method iterator (line 89) | iterator(Column const& column, size_t stringIndex)
method line (line 92) | auto line() const -> std::string const& { return m_column.m_stri...
method isBoundary (line 94) | auto isBoundary(size_t at) const -> bool {
method calcLength (line 102) | void calcLength() {
method indent (line 126) | auto indent() const -> size_t {
method addIndentAndSuffix (line 132) | auto addIndentAndSuffix(std::string const& plain) const -> std::...
method iterator (line 143) | explicit iterator(Column const& column) : m_column(column) {
method Column (line 185) | explicit Column(std::string const& text) { m_strings.push_back(tex...
method width (line 187) | auto width(size_t newWidth) -> Column& {
method indent (line 192) | auto indent(size_t newIndent) -> Column& {
method initialIndent (line 196) | auto initialIndent(size_t newIndent) -> Column& {
method width (line 201) | auto width() const -> size_t { return m_width; }
method begin (line 202) | auto begin() const -> iterator { return iterator(*this); }
method end (line 203) | auto end() const -> iterator { return {*this, m_strings.size()}; }
method friend (line 205) | inline friend std::ostream& operator<<(std::ostream& os, Column co...
method toString (line 219) | auto toString() const -> std::string {
class Spacer (line 226) | class Spacer : public Column {
method Spacer (line 228) | explicit Spacer(size_t spaceWidth) : Column("") { width(spaceWidth...
class Columns (line 231) | class Columns {
class iterator (line 235) | class iterator {
type EndTag (line 237) | struct EndTag {}
method iterator (line 243) | iterator(Columns const& columns, EndTag) : m_columns(columns.m_c...
method iterator (line 256) | explicit iterator(Columns const& columns)
method begin (line 301) | auto begin() const -> iterator { return iterator(*this); }
method end (line 302) | auto end() const -> iterator { return {*this, iterator::EndTag()}; }
method friend (line 314) | inline friend std::ostream& operator<<(std::ostream& os, Columns c...
method toString (line 326) | auto toString() const -> std::string {
type detail (line 357) | namespace detail {
type UnaryLambdaTraits (line 361) | struct UnaryLambdaTraits : UnaryLambdaTraits<decltype(&L::operator()...
type UnaryLambdaTraits<ReturnT (ClassT::*)(ArgT) const> (line 369) | struct UnaryLambdaTraits<ReturnT (ClassT::*)(ArgT) const> {
class TokenStream (line 375) | class TokenStream
method loadBuffer (line 415) | void loadBuffer() {
method TokenStream (line 446) | explicit TokenStream(Args const& args) : TokenStream(args.m_args.b...
method TokenStream (line 448) | TokenStream(Iterator it, Iterator itEnd) : it(it), itEnd(itEnd) { ...
method count (line 452) | auto count() const -> size_t { return m_tokenBuffer.size() + (itEn...
class Args (line 378) | class Args {
method Args (line 384) | Args(int argc, char const* const* argv) : m_exeName(argv[0]), m_ar...
method Args (line 386) | Args(std::initializer_list<std::string> args)
method exeName (line 389) | auto exeName() const -> std::string { return m_exeName; }
type TokenType (line 394) | enum class TokenType { Option, Argument }
type Token (line 395) | struct Token {
function isOptPrefix (line 400) | inline auto isOptPrefix(char c) -> bool {
class TokenStream (line 409) | class TokenStream {
method loadBuffer (line 415) | void loadBuffer() {
method TokenStream (line 446) | explicit TokenStream(Args const& args) : TokenStream(args.m_args.b...
method TokenStream (line 448) | TokenStream(Iterator it, Iterator itEnd) : it(it), itEnd(itEnd) { ...
method count (line 452) | auto count() const -> size_t { return m_tokenBuffer.size() + (itEn...
class ResultBase (line 475) | class ResultBase {
type Type (line 477) | enum Type { Ok, LogicError, RuntimeError }
method ResultBase (line 480) | ResultBase(Type type) : m_type(type) {}
class ResultValueBase (line 489) | class ResultValueBase : public ResultBase {
method value (line 491) | auto value() const -> T const& {
method ResultValueBase (line 497) | ResultValueBase(Type type) : ResultBase(type) {}
method ResultValueBase (line 499) | ResultValueBase(ResultValueBase const& other) : ResultBase(other) {
method ResultValueBase (line 503) | ResultValueBase(Type, T const& value) : ResultBase(Ok) { new (&m_v...
class ResultValueBase<void> (line 522) | class ResultValueBase<void> : public ResultBase {
class BasicResult (line 528) | class BasicResult : public ResultValueBase<T> {
method BasicResult (line 531) | explicit BasicResult(BasicResult<U> const& other)
method ok (line 537) | static auto ok(U const& value) -> BasicResult {
method ok (line 540) | static auto ok() -> BasicResult { return {ResultBase::Ok}; }
method logicError (line 541) | static auto logicError(std::string const& message) -> BasicResult {
method runtimeError (line 544) | static auto runtimeError(std::string const& message) -> BasicResult {
method type (line 549) | auto type() const -> ResultBase::Type { return m_type; }
method errorMessage (line 550) | auto errorMessage() const -> std::string { return m_errorMessage; }
method enforceOk (line 553) | void enforceOk() const override {
method BasicResult (line 563) | BasicResult(ResultBase::Type type, std::string const& message)
type ParseResultType (line 572) | enum class ParseResultType { Matched, NoMatch, ShortCircuitAll, Shor...
class ParseState (line 574) | class ParseState {
method ParseState (line 576) | ParseState(ParseResultType type, TokenStream const& remainingTokens)
method type (line 579) | auto type() const -> ParseResultType { return m_type; }
method remainingTokens (line 580) | auto remainingTokens() const -> TokenStream { return m_remainingTo...
type HelpColumns (line 591) | struct HelpColumns {
function convertInto (line 597) | inline auto convertInto(std::string const& source, T& target) -> Par...
function convertInto (line 606) | inline auto convertInto(std::string const& source, std::string& targ...
function convertInto (line 610) | inline auto convertInto(std::string const& source, bool& target) -> ...
function convertInto (line 625) | inline auto convertInto(std::string const& source, CLARA_CONFIG_OPTI...
type NonCopyable (line 634) | struct NonCopyable {
method NonCopyable (line 635) | NonCopyable() = default;
method NonCopyable (line 636) | NonCopyable(NonCopyable const&) = delete;
method NonCopyable (line 637) | NonCopyable(NonCopyable&&) = delete;
method NonCopyable (line 638) | NonCopyable& operator=(NonCopyable const&) = delete;
method NonCopyable (line 639) | NonCopyable& operator=(NonCopyable&&) = delete;
type BoundRef (line 642) | struct BoundRef : NonCopyable {
method isContainer (line 644) | virtual auto isContainer() const -> bool { return false; }
method isFlag (line 645) | virtual auto isFlag() const -> bool { return false; }
type BoundValueRefBase (line 647) | struct BoundValueRefBase : BoundRef {
type BoundFlagRefBase (line 650) | struct BoundFlagRefBase : BoundRef {
method isFlag (line 652) | virtual auto isFlag() const -> bool { return true; }
type BoundValueRef (line 656) | struct BoundValueRef : BoundValueRefBase {
method BoundValueRef (line 659) | explicit BoundValueRef(T& ref) : m_ref(ref) {}
method setValue (line 661) | auto setValue(std::string const& arg) -> ParserResult override { r...
type BoundValueRef<std::vector<T>> (line 665) | struct BoundValueRef<std::vector<T>> : BoundValueRefBase {
method BoundValueRef (line 668) | explicit BoundValueRef(std::vector<T>& ref) : m_ref(ref) {}
method isContainer (line 670) | auto isContainer() const -> bool override { return true; }
method setValue (line 672) | auto setValue(std::string const& arg) -> ParserResult override {
type BoundFlagRef (line 680) | struct BoundFlagRef : BoundFlagRefBase {
method BoundFlagRef (line 683) | explicit BoundFlagRef(bool& ref) : m_ref(ref) {}
method setFlag (line 685) | auto setFlag(bool flag) -> ParserResult override {
type LambdaInvoker (line 692) | struct LambdaInvoker {
method invoke (line 697) | static auto invoke(L const& lambda, ArgType const& arg) -> ParserR...
type LambdaInvoker<void> (line 703) | struct LambdaInvoker<void> {
method invoke (line 705) | static auto invoke(L const& lambda, ArgType const& arg) -> ParserR...
function invokeLambda (line 712) | inline auto invokeLambda(L const& lambda, std::string const& arg) ->...
type BoundLambda (line 720) | struct BoundLambda : BoundValueRefBase {
method BoundLambda (line 724) | explicit BoundLambda(L const& lambda) : m_lambda(lambda) {}
method setValue (line 726) | auto setValue(std::string const& arg) -> ParserResult override {
type BoundFlagLambda (line 732) | struct BoundFlagLambda : BoundFlagRefBase {
method BoundFlagLambda (line 739) | explicit BoundFlagLambda(L const& lambda) : m_lambda(lambda) {}
method setFlag (line 741) | auto setFlag(bool flag) -> ParserResult override {
type Optionality (line 746) | enum class Optionality { Optional, Required }
type Parser (line 748) | struct Parser
method getHelpColumns (line 1037) | auto getHelpColumns() const -> std::vector<HelpColumns> {
method writeToStream (line 1046) | void writeToStream(std::ostream& os) const {
method validate (line 1087) | auto validate() const -> Result override {
method parse (line 1101) | auto parse(std::string const& exeName, TokenStream const& tokens) ...
class ParserBase (line 750) | class ParserBase {
method validate (line 753) | virtual auto validate() const -> Result { return Result::ok(); }
method cardinality (line 756) | virtual auto cardinality() const -> size_t { return 1; }
method parse (line 758) | auto parse(Args const& args) const -> InternalParseResult {
class ComposableParserImpl (line 764) | class ComposableParserImpl : public ParserBase {
class ParserRefImpl (line 775) | class ParserRefImpl : public ComposableParserImpl<DerivedT> {
method ParserRefImpl (line 782) | explicit ParserRefImpl(std::shared_ptr<BoundRef> const& ref) : m_r...
method ParserRefImpl (line 786) | ParserRefImpl(T& ref, std::string const& hint)
method ParserRefImpl (line 790) | ParserRefImpl(LambdaT const& ref, std::string const& hint)
method optional (line 798) | auto optional() -> DerivedT& {
method required (line 803) | auto required() -> DerivedT& {
method isOptional (line 808) | auto isOptional() const -> bool { return m_optionality == Optional...
method cardinality (line 810) | auto cardinality() const -> size_t override {
method hint (line 817) | auto hint() const -> std::string { return m_hint; }
class ExeName (line 820) | class ExeName : public ComposableParserImpl<ExeName> {
method makeRef (line 825) | static auto makeRef(LambdaT const& lambda) -> std::shared_ptr<Boun...
method ExeName (line 830) | ExeName() : m_name(std::make_shared<std::string>("<executable>")) {}
method ExeName (line 832) | explicit ExeName(std::string& ref) : ExeName() {
method ExeName (line 837) | explicit ExeName(LambdaT const& lambda) : ExeName() {
method parse (line 842) | auto parse(std::string const&, TokenStream const& tokens) const ->...
method name (line 846) | auto name() const -> std::string { return *m_name; }
method set (line 847) | auto set(std::string const& newName) -> ParserResult {
class Arg (line 859) | class Arg : public ParserRefImpl<Arg> {
method parse (line 863) | auto parse(std::string const&, TokenStream const& tokens) const ->...
function normaliseOpt (line 883) | inline auto normaliseOpt(std::string const& optName) -> std::string {
class Opt (line 892) | class Opt : public ParserRefImpl<Opt> {
method Opt (line 898) | explicit Opt(LambdaT const& ref)
method Opt (line 901) | explicit Opt(bool& ref) : ParserRefImpl(std::make_shared<BoundFlag...
method Opt (line 904) | Opt(LambdaT const& ref, std::string const& hint) : ParserRefImpl(r...
method Opt (line 907) | Opt(T& ref, std::string const& hint) : ParserRefImpl(ref, hint) {}
method getHelpColumns (line 914) | auto getHelpColumns() const -> std::vector<HelpColumns> {
method isMatch (line 928) | auto isMatch(std::string const& optToken) const -> bool {
method parse (line 938) | auto parse(std::string const&, TokenStream const& tokens) const ->...
method validate (line 971) | auto validate() const -> Result override {
type Help (line 986) | struct Help : Opt {
method Help (line 987) | Help(bool& showHelpFlag)
type Parser (line 996) | struct Parser : ParserBase {
method getHelpColumns (line 1037) | auto getHelpColumns() const -> std::vector<HelpColumns> {
method writeToStream (line 1046) | void writeToStream(std::ostream& os) const {
method validate (line 1087) | auto validate() const -> Result override {
method parse (line 1101) | auto parse(std::string const& exeName, TokenStream const& tokens) ...
type UnaryLambdaTraits<ReturnT (ClassT::*)(Args...) const> (line 364) | struct UnaryLambdaTraits<ReturnT (ClassT::*)(Args...) const> {
FILE: include/util/command.hpp
type waybar::util::command (line 21) | namespace waybar::util::command {
type res (line 25) | struct res {
function read (line 30) | inline std::string read(FILE* fp) {
function close (line 46) | inline int close(FILE* fp, pid_t pid) {
function FILE (line 72) | inline FILE* open(const std::string& cmd, int& pid, const std::string&...
function exec (line 129) | inline struct res exec(const std::string& cmd, const std::string& outp...
function execNoRead (line 138) | inline struct res execNoRead(const std::string& cmd) {
function forkExec (line 146) | inline int32_t forkExec(const std::string& cmd, const std::string& out...
function forkExec (line 182) | inline int32_t forkExec(const std::string& cmd) { return forkExec(cmd,...
FILE: include/util/css_reload_helper.hpp
type pollfd (line 12) | struct pollfd
type waybar (line 14) | namespace waybar {
class CssReloadHelper (line 15) | class CssReloadHelper {
FILE: include/util/date.hpp
type date (line 15) | namespace date {
function format (line 25) | inline auto format(const char* spec, const T& arg) {
function format (line 30) | inline auto format(const std::locale& loc, const char* spec, const T& ...
type waybar::util::date::format (line 37) | namespace waybar::util::date::format {
type fmt::formatter<date::zoned_time<Duration, TimeZonePtr>> (line 47) | struct fmt::formatter<date::zoned_time<Duration, TimeZonePtr>> {
method parse (line 51) | constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
method format (line 67) | auto format(const date::zoned_time<Duration, TimeZonePtr>& ztime, Form...
FILE: include/util/enum.hpp
type waybar::util (line 7) | namespace waybar::util {
type EnumParser (line 10) | struct EnumParser {
FILE: include/util/format.hpp
class pow_format (line 6) | class pow_format {
method pow_format (line 8) | pow_format(long long val, std::string&& unit, bool binary = false)
type fmt (line 16) | namespace fmt {
type formatter<pow_format> (line 18) | struct formatter<pow_format> {
method parse (line 23) | constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
method format (line 48) | auto format(const pow_format& s, FormatContext& ctx) const -> declty...
type formatter<Glib::ustring> (line 93) | struct formatter<Glib::ustring> : formatter<std::string> {
method format (line 95) | auto format(const Glib::ustring& value, FormatContext& ctx) const {
FILE: include/util/gtk_icon.hpp
class DefaultGtkIconThemeWrapper (line 7) | class DefaultGtkIconThemeWrapper {
FILE: include/util/icon_loader.hpp
class IconLoader (line 15) | class IconLoader {
FILE: include/util/json.hpp
type fmt::formatter<Json::Value> (line 15) | struct fmt::formatter<Json::Value> : ostream_formatter {}
type waybar::util (line 19) | namespace waybar::util {
class JsonParser (line 21) | class JsonParser {
method JsonParser (line 23) | JsonParser() = default;
method parse (line 25) | Json::Value parse(const std::string& jsonStr) {
method replaceHexadecimalEscape (line 43) | static std::string replaceHexadecimalEscape(const std::string& str) {
FILE: include/util/kill_signal.hpp
type waybar::util (line 7) | namespace waybar::util {
type KillSignalAction (line 9) | enum class KillSignalAction : std::uint8_t {
FILE: include/util/pipewire/pipewire_backend.hpp
type waybar::util::PipewireBackend (line 10) | namespace waybar::util::PipewireBackend {
class PipewireBackend (line 12) | class PipewireBackend {
type PrivateConstructorTag (line 27) | struct PrivateConstructorTag {}
type spa_dict (line 39) | struct spa_dict
FILE: include/util/pipewire/privacy_node_info.hpp
type waybar::util::PipewireBackend (line 9) | namespace waybar::util::PipewireBackend {
type PrivacyNodeType (line 11) | enum PrivacyNodeType {
class PrivacyNodeInfo (line 18) | class PrivacyNodeInfo {
type pw_node_state (line 23) | enum pw_node_state
type spa_hook (line 33) | struct spa_hook
type spa_hook (line 34) | struct spa_hook
type pw_node_info (line 43) | struct pw_node_info
FILE: include/util/portal.hpp
type waybar (line 7) | namespace waybar {
type Appearance (line 9) | enum class Appearance {
class Portal (line 14) | class Portal : private Gio::DBus::Proxy {
method type_signal_appearance_changed (line 21) | type_signal_appearance_changed signal_appearance_changed() { return ...
type fmt::formatter<waybar::Appearance> (line 33) | struct fmt::formatter<waybar::Appearance> : formatter<fmt::string_view> {
FILE: include/util/prepare_for_sleep.h
function namespace (line 5) | namespace waybar::util {
FILE: include/util/regex_collection.hpp
type waybar::util (line 10) | namespace waybar::util {
type Rule (line 12) | struct Rule {
method Rule (line 20) | Rule(std::regex rule, std::string repr, int priority)
class RegexCollection (line 34) | class RegexCollection {
method RegexCollection (line 43) | RegexCollection() = default;
FILE: include/util/rewrite_string.hpp
type waybar::util (line 6) | namespace waybar::util {
FILE: include/util/rfkill.hpp
type waybar::util (line 10) | namespace waybar::util {
class Rfkill (line 12) | class Rfkill : public sigc::trackable {
type rfkill_type (line 14) | enum rfkill_type
type rfkill_event (line 18) | struct rfkill_event
type rfkill_type (line 21) | enum rfkill_type
FILE: include/util/sanitize_str.hpp
type waybar::util (line 4) | namespace waybar::util {
FILE: include/util/scope_guard.hpp
type waybar::util (line 5) | namespace waybar::util {
class ScopeGuard (line 8) | class ScopeGuard {
method ScopeGuard (line 10) | explicit ScopeGuard(Func&& exit_function) : f{std::forward<Func>(exi...
method ScopeGuard (line 11) | ScopeGuard(const ScopeGuard&) = delete;
method ScopeGuard (line 12) | ScopeGuard(ScopeGuard&&) = default;
method ScopeGuard (line 13) | ScopeGuard& operator=(const ScopeGuard&) = delete;
method ScopeGuard (line 14) | ScopeGuard& operator=(ScopeGuard&&) = default;
FILE: include/util/scoped_fd.hpp
type waybar::util (line 5) | namespace waybar::util {
class ScopedFd (line 7) | class ScopedFd {
method ScopedFd (line 9) | explicit ScopedFd(int fd = -1) : fd_(fd) {}
method ScopedFd (line 17) | ScopedFd(const ScopedFd&) = delete;
method ScopedFd (line 18) | ScopedFd& operator=(const ScopedFd&) = delete;
method ScopedFd (line 21) | ScopedFd(ScopedFd&& other) noexcept : fd_(other.fd_) { other.fd_ = -...
method ScopedFd (line 22) | ScopedFd& operator=(ScopedFd&& other) noexcept {
method get (line 33) | int get() const { return fd_; }
method reset (line 37) | void reset(int fd = -1) {
method release (line 44) | int release() {
FILE: include/util/sleeper_thread.hpp
type waybar::util (line 12) | namespace waybar::util {
class CancellationGuard (line 21) | class CancellationGuard {
method CancellationGuard (line 25) | CancellationGuard() { pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,...
class SleeperThread (line 29) | class SleeperThread {
method SleeperThread (line 31) | SleeperThread() = default;
method SleeperThread (line 33) | SleeperThread(std::function<void()> func)
method SleeperThread (line 45) | SleeperThread& operator=(std::function<void()> func) {
method isRunning (line 69) | bool isRunning() const { return do_run_.load(std::memory_order_relax...
method sleep (line 71) | auto sleep() {
method sleep_for (line 79) | auto sleep_for(std::chrono::system_clock::duration dur) {
method sleep_until (line 93) | auto sleep_until(
method wake_up (line 103) | void wake_up() {
method stop (line 111) | void stop() {
FILE: include/util/string.hpp
function ltrim (line 8) | inline std::string ltrim(const std::string& s) {
function rtrim (line 13) | inline std::string rtrim(const std::string& s) {
function trim (line 18) | inline std::string trim(const std::string& s) { return rtrim(ltrim(s)); }
function capitalize (line 20) | inline std::string capitalize(const std::string& str) {
function toLower (line 27) | inline std::string toLower(const std::string& str) {
function split (line 34) | inline std::vector<std::string> split(std::string_view s, std::string_vi...
FILE: include/util/udev_deleter.hpp
type waybar::util (line 5) | namespace waybar::util {
type UdevDeleter (line 6) | struct UdevDeleter {
type UdevDeviceDeleter (line 10) | struct UdevDeviceDeleter {
type UdevEnumerateDeleter (line 14) | struct UdevEnumerateDeleter {
type UdevMonitorDeleter (line 18) | struct UdevMonitorDeleter {
FILE: resources/custom_modules/cffi_example/main.c
type ExampleMod (line 4) | typedef struct {
function onclicked (line 13) | void onclicked(GtkButton* button) {
function wbcffi_deinit (line 57) | void wbcffi_deinit(void* instance) {
function wbcffi_update (line 62) | void wbcffi_update(void* instance) { printf("cffi_example inst=%p: Updat...
function wbcffi_refresh (line 64) | void wbcffi_refresh(void* instance, int signal) {
function wbcffi_doaction (line 68) | void wbcffi_doaction(void* instance, const char* name) {
FILE: resources/custom_modules/cffi_example/waybar_cffi_module.h
type wbcffi_module (line 14) | typedef struct wbcffi_module wbcffi_module;
type wbcffi_init_info (line 17) | typedef struct {
type wbcffi_config_entry (line 35) | typedef struct {
FILE: resources/custom_modules/mediaplayer.py
function signal_handler (line 17) | def signal_handler(sig, frame):
class PlayerManager (line 25) | class PlayerManager:
method __init__ (line 26) | def __init__(self, selected_player=None, excluded_player=[]):
method init_players (line 42) | def init_players(self):
method run (line 51) | def run(self):
method init_player (line 55) | def init_player(self, player):
method get_players (line 64) | def get_players(self) -> List[Player]:
method write_output (line 67) | def write_output(self, text, player):
method clear_output (line 77) | def clear_output(self):
method on_playback_status_changed (line 81) | def on_playback_status_changed(self, player, status, _=None):
method get_first_playing_player (line 85) | def get_first_playing_player(self):
method show_most_important_player (line 100) | def show_most_important_player(self):
method on_metadata_changed (line 111) | def on_metadata_changed(self, player, metadata, _=None):
method on_player_appeared (line 139) | def on_player_appeared(self, _, player):
method on_player_vanished (line 151) | def on_player_vanished(self, _, player):
function parse_arguments (line 155) | def parse_arguments():
function main (line 171) | def main():
FILE: src/AAppIconLabel.cpp
type waybar (line 14) | namespace waybar {
function toLowerCase (line 27) | std::string toLowerCase(const std::string& input) {
function getFileBySuffix (line 34) | std::optional<std::string> getFileBySuffix(const std::string& dir, con...
function getFileBySuffix (line 56) | std::optional<std::string> getFileBySuffix(const std::string& dir, con...
function getDesktopFilePath (line 60) | std::optional<std::string> getDesktopFilePath(const std::string& app_i...
function getIconName (line 90) | std::optional<Glib::ustring> getIconName(const std::string& app_identi...
FILE: src/AIconLabel.cpp
type waybar (line 6) | namespace waybar {
FILE: src/ALabel.cpp
type waybar (line 11) | namespace waybar {
FILE: src/AModule.cpp
type waybar (line 11) | namespace waybar {
FILE: src/ASlider.cpp
type waybar (line 6) | namespace waybar {
FILE: src/bar.cpp
type waybar (line 18) | namespace waybar {
function from_json (line 64) | void from_json(const Json::Value& j, bar_layer& l) {
function from_json (line 75) | void from_json(const Json::Value& j, bar_mode& m) {
function from_json (line 93) | void from_json(const Json::Value& j, Gtk::PositionType& pos) {
function to_string (line 105) | Glib::ustring to_string(Gtk::PositionType pos) {
function from_json (line 124) | void from_json(const Json::Value& j, std::map<Key, Value>& m) {
type waybar_output (line 134) | struct waybar_output
type bar_mode (line 346) | struct bar_mode
FILE: src/client.cpp
type wl_registry (line 19) | struct wl_registry
type zxdg_output_manager_v1 (line 24) | struct zxdg_output_manager_v1
type zwp_idle_inhibit_manager_v1 (line 27) | struct zwp_idle_inhibit_manager_v1
type wl_registry (line 32) | struct wl_registry
type waybar_output (line 37) | struct waybar_output
type zxdg_output_v1_listener (line 38) | struct zxdg_output_v1_listener
type zxdg_output_v1 (line 39) | struct zxdg_output_v1
type zxdg_output_v1 (line 40) | struct zxdg_output_v1
type waybar::waybar_output (line 51) | struct waybar::waybar_output
type waybar_output (line 60) | struct waybar_output
type zxdg_output_v1 (line 64) | struct zxdg_output_v1
type zxdg_output_v1 (line 93) | struct zxdg_output_v1
type zxdg_output_v1 (line 104) | struct zxdg_output_v1
type wl_registry_listener (line 208) | struct wl_registry_listener
FILE: src/config.cpp
type waybar (line 19) | namespace waybar {
function isValidOutput (line 177) | bool isValidOutput(const Json::Value& config, const std::string& name,
FILE: src/group.cpp
type waybar (line 10) | namespace waybar {
function getPreferredTransitionType (line 12) | Gtk::RevealerTransitionType getPreferredTransitionType(bool is_vertica...
FILE: src/main.cpp
function writeSignalToPipe (line 21) | static void writeSignalToPipe(int signum) {
function catchSignals (line 34) | static void catchSignals(waybar::SafeSignal<int>& signal_handler) {
function getActionForBar (line 78) | waybar::util::KillSignalAction getActionForBar(waybar::Bar* bar, int sig...
function handleUserSignal (line 89) | void handleUserSignal(int signal, bool& reload) {
function handleSignalMainThread (line 121) | static void handleSignalMainThread(int signum, bool& reload) {
function main (line 161) | int main(int argc, char* argv[]) {
FILE: src/modules/backlight_slider.cpp
type waybar::modules (line 5) | namespace waybar::modules {
FILE: src/modules/battery.cpp
type inotify_event (line 73) | struct inotify_event
function status_gt (line 183) | static bool status_gt(const std::string& a, const std::string& b) {
FILE: src/modules/bluetooth.cpp
function generateManager (line 15) | auto generateManager() -> GDBusManager {
function getBoolProperty (line 40) | auto getBoolProperty(GDBusProxy* proxy, const char* property_name) -> bo...
function getOptionalStringProperty (line 52) | auto getOptionalStringProperty(GDBusProxy* proxy, const char* property_n...
function getStringProperty (line 64) | auto getStringProperty(GDBusProxy* proxy, const char* property_name) -> ...
function getUcharProperty (line 72) | auto getUcharProperty(GDBusProxy* proxy, const char* property_name) -> u...
FILE: src/modules/cava/cavaGLSL.cpp
type colors (line 103) | struct colors {
function parse_color (line 109) | static void parse_color(char* color_string, struct colors* color) {
function GLuint (line 236) | GLuint waybar::modules::cava::CavaGLSL::loadShader(const std::string& fi...
FILE: src/modules/cava/cava_backend.cpp
function upThreadDelay (line 39) | static bool upThreadDelay(std::chrono::milliseconds& delay, std::chrono:...
function downThreadDelay (line 48) | static bool downThreadDelay(std::chrono::milliseconds& delay, std::chron...
type ::cava::config_params (line 270) | struct ::cava::config_params
FILE: src/modules/cffi.cpp
type waybar::modules (line 10) | namespace waybar::modules {
FILE: src/modules/clock.cpp
function cldRowsInMonth (line 226) | const unsigned cldRowsInMonth(const year_month& ym, const weekday& first...
function cldGetWeekForLine (line 230) | auto cldGetWeekForLine(const year_month& ym, const weekday& firstdow, co...
function getCalendarLine (line 239) | auto getCalendarLine(const year_month_day& currDate, const year_month ym...
FILE: src/modules/disk.cpp
type statvfs (line 20) | struct statvfs
FILE: src/modules/dwl/tags.cpp
type waybar::modules::dwl (line 17) | namespace waybar::modules::dwl {
function toggle_visibility (line 24) | static void toggle_visibility(void* data, zdwl_ipc_output_v2* zdwl_out...
function active (line 28) | static void active(void* data, zdwl_ipc_output_v2* zdwl_output_v2, uin...
function set_tag (line 32) | static void set_tag(void* data, zdwl_ipc_output_v2* zdwl_output_v2, ui...
function set_layout_symbol (line 40) | static void set_layout_symbol(void* data, zdwl_ipc_output_v2* zdwl_out...
function title (line 44) | static void title(void* data, zdwl_ipc_output_v2* zdwl_output_v2, cons...
function dwl_frame (line 48) | static void dwl_frame(void* data, zdwl_ipc_output_v2* zdwl_output_v2) {
function set_layout (line 52) | static void set_layout(void* data, zdwl_ipc_output_v2* zdwl_output_v2,...
function handle_global (line 71) | static void handle_global(void* data, struct wl_registry* registry, ui...
function handle_global_remove (line 84) | static void handle_global_remove(void* data, struct wl_registry* regis...
type wl_display (line 98) | struct wl_display
type wl_registry (line 99) | struct wl_registry
type wl_output (line 150) | struct wl_output
FILE: src/modules/dwl/window.cpp
type waybar::modules::dwl (line 15) | namespace waybar::modules::dwl {
function toggle_visibility (line 17) | static void toggle_visibility(void* data, zdwl_ipc_output_v2* zdwl_out...
function active (line 21) | static void active(void* data, zdwl_ipc_output_v2* zdwl_output_v2, uin...
function set_tag (line 25) | static void set_tag(void* data, zdwl_ipc_output_v2* zdwl_output_v2, ui...
function set_layout_symbol (line 30) | static void set_layout_symbol(void* data, zdwl_ipc_output_v2* zdwl_out...
function title (line 34) | static void title(void* data, zdwl_ipc_output_v2* zdwl_output_v2, cons...
function dwl_frame (line 38) | static void dwl_frame(void* data, zdwl_ipc_output_v2* zdwl_output_v2) {
function set_layout (line 42) | static void set_layout(void* data, zdwl_ipc_output_v2* zdwl_output_v2,...
function appid (line 46) | static void appid(void* data, zdwl_ipc_output_v2* zdwl_output_v2, cons...
function handle_global (line 61) | static void handle_global(void* data, struct wl_registry* registry, ui...
function handle_global_remove (line 69) | static void handle_global_remove(void* data, struct wl_registry* regis...
type wl_display (line 78) | struct wl_display
type wl_registry (line 79) | struct wl_registry
type wl_output (line 89) | struct wl_output
FILE: src/modules/ext/workspace_manager.cpp
type waybar::modules::ext (line 15) | namespace waybar::modules::ext {
FILE: src/modules/ext/workspace_manager_binding.cpp
type waybar::modules::ext (line 10) | namespace waybar::modules::ext {
function handle_global (line 12) | static void handle_global(void* data, wl_registry* registry, uint32_t ...
function handle_global_remove (line 19) | static void handle_global_remove(void* data, wl_registry* registry, ui...
function add_registry_listener (line 26) | void add_registry_listener(void* data) {
function workspace_manager_handle_workspace_group (line 34) | static void workspace_manager_handle_workspace_group(
function workspace_manager_handle_workspace (line 39) | static void workspace_manager_handle_workspace(void* data, ext_workspa...
function workspace_manager_handle_done (line 44) | static void workspace_manager_handle_done(void* data, ext_workspace_ma...
function workspace_manager_handle_finished (line 48) | static void workspace_manager_handle_finished(void* data, ext_workspac...
function ext_workspace_manager_v1 (line 59) | ext_workspace_manager_v1* workspace_manager_bind(wl_registry* registry...
function workspace_group_handle_capabilities (line 72) | static void workspace_group_handle_capabilities(void* data, ext_worksp...
function workspace_group_handle_output_enter (line 77) | static void workspace_group_handle_output_enter(void* data, ext_worksp...
function workspace_group_handle_output_leave (line 82) | static void workspace_group_handle_output_leave(void* data, ext_worksp...
function workspace_group_handle_workspace_enter (line 87) | static void workspace_group_handle_workspace_enter(void* data, ext_wor...
function workspace_group_handle_workspace_leave (line 92) | static void workspace_group_handle_workspace_leave(void* data, ext_wor...
function workspace_group_handle_removed (line 97) | static void workspace_group_handle_removed(void* data, ext_workspace_g...
function add_workspace_group_listener (line 109) | void add_workspace_group_listener(ext_workspace_group_handle_v1* works...
function workspace_handle_name (line 114) | void workspace_handle_name(void* data, struct ext_workspace_handle_v1*...
function workspace_handle_id (line 118) | void workspace_handle_id(void* data, struct ext_workspace_handle_v1* _...
function workspace_handle_coordinates (line 122) | void workspace_handle_coordinates(void* data, struct ext_workspace_han...
function workspace_handle_state (line 133) | void workspace_handle_state(void* data, struct ext_workspace_handle_v1...
function workspace_handle_capabilities (line 138) | static void workspace_handle_capabilities(void* data,
function workspace_handle_removed (line 144) | void workspace_handle_removed(void* data, struct ext_workspace_handle_...
function add_workspace_listener (line 156) | void add_workspace_listener(ext_workspace_handle_v1* workspace_handle,...
FILE: src/modules/gamemode.cpp
type waybar::modules (line 23) | namespace waybar::modules {
FILE: src/modules/hyprland/backend.cpp
type waybar::modules::hyprland (line 20) | namespace waybar::modules::hyprland {
function IPC (line 74) | IPC& IPC::inst() {
type sockaddr_un (line 90) | struct sockaddr_un
type sockaddr_un (line 108) | struct sockaddr_un
type sockaddr (line 110) | struct sockaddr
FILE: src/modules/hyprland/language.cpp
type waybar::modules::hyprland (line 10) | namespace waybar::modules::hyprland {
FILE: src/modules/hyprland/submap.cpp
type waybar::modules::hyprland (line 5) | namespace waybar::modules::hyprland {
FILE: src/modules/hyprland/window.cpp
type waybar::modules::hyprland (line 16) | namespace waybar::modules::hyprland {
FILE: src/modules/hyprland/windowcount.cpp
type waybar::modules::hyprland (line 13) | namespace waybar::modules::hyprland {
FILE: src/modules/hyprland/windowcreationpayload.cpp
type waybar::modules::hyprland (line 12) | namespace waybar::modules::hyprland {
function WindowRepr (line 97) | WindowRepr WindowCreationPayload::repr(Workspaces& workspace_manager) {
FILE: src/modules/hyprland/workspace.cpp
type waybar::modules::hyprland (line 12) | namespace waybar::modules::hyprland {
function addOrRemoveClass (line 48) | void addOrRemoveClass(const Glib::RefPtr<Gtk::StyleContext>& context, ...
FILE: src/modules/hyprland/workspaces.cpp
type waybar::modules::hyprland (line 15) | namespace waybar::modules::hyprland {
function isDoubleSpecial (line 227) | bool isDoubleSpecial(std::string const& workspace_name) {
FILE: src/modules/inhibitor.cpp
function dbus (line 11) | auto dbus() -> DBus {
function getLocks (line 33) | auto getLocks(const DBus& bus, const std::string& inhibitors) -> int {
function checkInhibitor (line 58) | auto checkInhibitor(const std::string& inhibitor) -> const std::string& {
function getInhibitors (line 74) | auto getInhibitors(const Json::Value& config) -> std::string {
type waybar::modules (line 99) | namespace waybar::modules {
FILE: src/modules/jack.cpp
type waybar::modules (line 3) | namespace waybar::modules {
function bufSizeCallback (line 119) | int bufSizeCallback(jack_nframes_t size, void* obj) {
function sampleRateCallback (line 123) | int sampleRateCallback(jack_nframes_t rate, void* obj) {
function xrunCallback (line 127) | int xrunCallback(void* obj) { return static_cast<waybar::modules::JACK*>...
function shutdownCallback (line 129) | void shutdownCallback(void* obj) { return static_cast<waybar::modules::J...
FILE: src/modules/keyboard_state.cpp
class errno_error (line 20) | class errno_error : public std::runtime_error {
method errno_error (line 23) | errno_error(int code, const std::string& msg)
method errno_error (line 25) | errno_error(int code, const char* msg) : std::runtime_error(getErrorMs...
method getErrorMsg (line 28) | static auto getErrorMsg(int err, const char* msg) -> std::string {
function openFile (line 47) | auto openFile(const std::string& path, int flags) -> int {
function closeFile (line 59) | auto closeFile(int fd) -> void {
function openDevice (line 66) | auto openDevice(int fd) -> libevdev* {
function supportsLockStates (line 75) | auto supportsLockStates(const libevdev* dev) -> bool {
type libinput_interface (line 110) | struct libinput_interface
type pollfd (line 179) | struct pollfd
type libinput_event (line 182) | struct libinput_event
type inotify_event (line 209) | struct inotify_event
type inotify_event (line 217) | struct inotify_event
type inotify_event (line 217) | struct inotify_event
type inotify_event (line 244) | struct inotify_event
FILE: src/modules/memory/bsd.cpp
function get_total_memory (line 17) | static uint64_t get_total_memory() {
function get_free_memory (line 41) | static uint64_t get_free_memory() {
FILE: src/modules/memory/linux.cpp
function zfsArcSize (line 3) | static unsigned zfsArcSize() {
FILE: src/modules/mpd/mpd.cpp
type waybar::modules (line 13) | namespace waybar::modules {
function isServerUnavailable (line 260) | static bool isServerUnavailable(const std::error_code& ec) {
FILE: src/modules/mpd/state.cpp
type waybar::modules (line 8) | namespace waybar::modules {
function format_as (line 15) | auto format_as(enum mpd_idle val) {
type waybar::modules::detail (line 20) | namespace waybar::modules::detail {
type mpd_idle (line 87) | enum mpd_idle
FILE: src/modules/mpris/mpris.cpp
type waybar::modules::mpris (line 17) | namespace waybar::modules::mpris {
function utf8_truncate (line 205) | size_t utf8_truncate(std::string& str, size_t width = std::string::npo...
function utf8_width (line 234) | size_t utf8_width(const std::string& str) { return utf8_truncate(const...
function truncate (line 236) | void truncate(std::string& s, const std::string& ellipsis, size_t max_...
type ButtonAction (line 646) | struct ButtonAction {
FILE: src/modules/network.cpp
type epoll_event (line 173) | struct epoll_event
type epoll_event (line 183) | struct epoll_event
type epoll_event (line 231) | struct epoll_event
function wildcardMatch (line 410) | static bool wildcardMatch(const std::string& pattern, const std::string&...
type nl_msg (line 491) | struct nl_msg
type ifinfomsg (line 501) | struct ifinfomsg
type ifinfomsg (line 501) | struct ifinfomsg
type nlattr (line 502) | struct nlattr
type nlattr (line 540) | struct nlattr
function nla_for_each_nested (line 543) | nla_for_each_nested(prop, attrs[IFLA_PROP_LIST], rem) {
type ifaddrmsg (line 618) | struct ifaddrmsg
type ifaddrmsg (line 618) | struct ifaddrmsg
type rtattr (line 620) | struct rtattr
type in_addr (line 667) | struct in_addr
type in6_addr (line 672) | struct in6_addr
type rtmsg (line 710) | struct rtmsg
type rtmsg (line 710) | struct rtmsg
type rtattr (line 713) | struct rtattr
type ifinfomsg (line 790) | struct ifinfomsg
type rtgenmsg (line 834) | struct rtgenmsg
type nl_msg (line 855) | struct nl_msg
type nl_msg (line 862) | struct nl_msg
type nlattr (line 865) | struct nlattr
type nlattr (line 866) | struct nlattr
type nla_policy (line 867) | struct nla_policy
type nlattr (line 898) | struct nlattr
type nlattr (line 917) | struct nlattr
type nlattr (line 953) | struct nlattr
type nlattr (line 960) | struct nlattr
type nlattr (line 971) | struct nlattr
type nl_msg (line 987) | struct nl_msg
FILE: src/modules/niri/backend.cpp
type waybar::modules::niri (line 22) | namespace waybar::modules::niri {
type sockaddr_un (line 33) | struct sockaddr_un
type sockaddr_un (line 46) | struct sockaddr_un
type sockaddr (line 48) | struct sockaddr
FILE: src/modules/niri/language.cpp
type waybar::modules::niri (line 9) | namespace waybar::modules::niri {
FILE: src/modules/niri/window.cpp
type waybar::modules::niri (line 10) | namespace waybar::modules::niri {
FILE: src/modules/niri/workspaces.cpp
type waybar::modules::niri (line 7) | namespace waybar::modules::niri {
FILE: src/modules/power_profiles_daemon.cpp
type waybar::modules (line 8) | namespace waybar::modules {
FILE: src/modules/privacy/privacy.cpp
type waybar::modules::privacy (line 11) | namespace waybar::modules::privacy {
FILE: src/modules/privacy/privacy_item.cpp
type waybar::modules::privacy (line 13) | namespace waybar::modules::privacy {
type PrivacyNodeType (line 15) | enum PrivacyNodeType
FILE: src/modules/pulseaudio_slider.cpp
type waybar::modules (line 3) | namespace waybar::modules {
FILE: src/modules/river/layout.cpp
type waybar::modules::river (line 8) | namespace waybar::modules::river {
function listen_focused_tags (line 10) | static void listen_focused_tags(void* data, struct zriver_output_statu...
function listen_view_tags (line 15) | static void listen_view_tags(void* data, struct zriver_output_status_v...
function listen_urgent_tags (line 20) | static void listen_urgent_tags(void* data, struct zriver_output_status...
function listen_layout_name (line 25) | static void listen_layout_name(void* data, struct zriver_output_status...
function listen_layout_name_clear (line 30) | static void listen_layout_name_clear(void* data,
function listen_focused_output (line 35) | static void listen_focused_output(void* data, struct zriver_seat_statu...
function listen_unfocused_output (line 40) | static void listen_unfocused_output(void* data, struct zriver_seat_sta...
function listen_focused_view (line 45) | static void listen_focused_view(void* data, struct zriver_seat_status_...
function listen_mode (line 50) | static void listen_mode(void* data, struct zriver_seat_status_v1* zriv...
function handle_global (line 70) | static void handle_global(void* data, struct wl_registry* registry, ui...
function handle_global_remove (line 94) | static void handle_global_remove(void* data, struct wl_registry* regis...
type wl_display (line 107) | struct wl_display
type wl_registry (line 108) | struct wl_registry
type wl_output (line 166) | struct wl_output
type wl_output (line 174) | struct wl_output
FILE: src/modules/river/mode.cpp
type waybar::modules::river (line 8) | namespace waybar::modules::river {
function listen_focused_output (line 10) | static void listen_focused_output(void* data, struct zriver_seat_statu...
function listen_unfocused_output (line 15) | static void listen_unfocused_output(void* data, struct zriver_seat_sta...
function listen_focused_view (line 20) | static void listen_focused_view(void* data, struct zriver_seat_status_...
function listen_mode (line 25) | static void listen_mode(void* data, struct zriver_seat_status_v1* seat...
function handle_global (line 36) | static void handle_global(void* data, struct wl_registry* registry, ui...
function handle_global_remove (line 54) | static void handle_global_remove(void* data, struct wl_registry* regis...
type wl_display (line 68) | struct wl_display
type wl_registry (line 69) | struct wl_registry
FILE: src/modules/river/tags.cpp
type waybar::modules::river (line 13) | namespace waybar::modules::river {
function listen_focused_tags (line 15) | static void listen_focused_tags(void* data, struct zriver_output_statu...
function listen_view_tags (line 20) | static void listen_view_tags(void* data, struct zriver_output_status_v...
function listen_urgent_tags (line 25) | static void listen_urgent_tags(void* data, struct zriver_output_status...
function listen_command_success (line 36) | static void listen_command_success(void* data,
function listen_command_failure (line 42) | static void listen_command_failure(void* data,
function handle_global (line 53) | static void handle_global(void* data, struct wl_registry* registry, ui...
function handle_global_remove (line 77) | static void handle_global_remove(void* data, struct wl_registry* regis...
type wl_display (line 92) | struct wl_display
type wl_registry (line 93) | struct wl_registry
type wl_output (line 174) | struct wl_output
type wl_array (line 223) | struct wl_array
FILE: src/modules/river/window.cpp
type waybar::modules::river (line 10) | namespace waybar::modules::river {
function listen_focused_view (line 12) | static void listen_focused_view(void* data, struct zriver_seat_status_...
function listen_focused_output (line 17) | static void listen_focused_output(void* data, struct zriver_seat_statu...
function listen_unfocused_output (line 22) | static void listen_unfocused_output(void* data, struct zriver_seat_sta...
function listen_mode (line 27) | static void listen_mode(void* data, struct zriver_seat_status_v1* zriv...
function handle_global (line 39) | static void handle_global(void* data, struct wl_registry* registry, ui...
function handle_global_remove (line 54) | static void handle_global_remove(void* data, struct wl_registry* regis...
type wl_display (line 67) | struct wl_display
type wl_registry (line 68) | struct wl_registry
type wl_output (line 120) | struct wl_output
type wl_output (line 128) | struct wl_output
FILE: src/modules/sndio.cpp
type waybar::modules (line 10) | namespace waybar::modules {
function ondesc (line 12) | void ondesc(void* arg, struct sioctl_desc* d, int curval) {
function onval (line 21) | void onval(void* arg, unsigned int addr, unsigned int val) {
type sioctl_desc (line 127) | struct sioctl_desc
FILE: src/modules/sni/host.cpp
type waybar::modules::SNI (line 7) | namespace waybar::modules::SNI {
FILE: src/modules/sni/item.cpp
type fmt::formatter<Glib::VariantBase> (line 19) | struct fmt::formatter<Glib::VariantBase> : formatter<std::string> {
method is_printable (line 20) | bool is_printable(const Glib::VariantBase& value) const {
method format (line 27) | auto format(const Glib::VariantBase& value, FormatContext& ctx) const {
type waybar::modules::SNI (line 36) | namespace waybar::modules::SNI {
function T (line 139) | T get_variant(const Glib::VariantBase& value) {
function ToolTip (line 144) | ToolTip get_variant<ToolTip>(const Glib::VariantBase& value) {
function pixbuf_data_deleter (line 343) | static void pixbuf_data_deleter(const guint8* data) { g_free((void*)da...
FILE: src/modules/sni/tray.cpp
type waybar::modules::SNI (line 9) | namespace waybar::modules::SNI {
FILE: src/modules/sni/watcher.cpp
function gboolean (line 54) | gboolean Watcher::handleRegisterHost(Watcher* obj, GDBusMethodInvocation...
function gboolean (line 85) | gboolean Watcher::handleRegisterItem(Watcher* obj, GDBusMethodInvocation...
FILE: src/modules/sway/bar.cpp
type waybar::modules::sway (line 11) | namespace waybar::modules::sway {
function parseConfig (line 76) | struct swaybar_config parseConfig(const Json::Value& payload) {
type Ipc::ipc_response (line 90) | struct Ipc::ipc_response
type Ipc::ipc_response (line 100) | struct Ipc::ipc_response
type Ipc::ipc_response (line 152) | struct Ipc::ipc_response
FILE: src/modules/sway/ipc/client.cpp
type waybar::modules::sway (line 8) | namespace waybar::modules::sway {
type sockaddr_un (line 68) | struct sockaddr_un
type sockaddr_un (line 69) | struct sockaddr_un
type sockaddr_un (line 73) | struct sockaddr_un
type sockaddr (line 74) | struct sockaddr
type Ipc::ipc_response (line 80) | struct Ipc::ipc_response
type Ipc::ipc_response (line 118) | struct Ipc::ipc_response
FILE: src/modules/sway/language.cpp
type waybar::modules::sway (line 15) | namespace waybar::modules::sway {
type Ipc::ipc_response (line 48) | struct Ipc::ipc_response
type Ipc::ipc_response (line 80) | struct Ipc::ipc_response
FILE: src/modules/sway/mode.cpp
type waybar::modules::sway (line 5) | namespace waybar::modules::sway {
type Ipc::ipc_response (line 22) | struct Ipc::ipc_response
FILE: src/modules/sway/scratchpad.cpp
type waybar::modules::sway (line 7) | namespace waybar::modules::sway {
type Ipc::ipc_response (line 60) | struct Ipc::ipc_response
type Ipc::ipc_response (line 82) | struct Ipc::ipc_response
FILE: src/modules/sway/window.cpp
type waybar::modules::sway (line 17) | namespace waybar::modules::sway {
type Ipc::ipc_response (line 37) | struct Ipc::ipc_response
type Ipc::ipc_response (line 39) | struct Ipc::ipc_response
function leafNodesInWorkspace (line 121) | std::pair<int, int> leafNodesInWorkspace(const Json::Value& node) {
function getSingleChildNode (line 148) | std::optional<std::reference_wrapper<const Json::Value>> getSingleChil...
function getWindowInfo (line 172) | std::tuple<std::string, std::string, std::string, std::string> getWind...
function gfnWithWorkspace (line 195) | std::tuple<std::size_t, int, int, std::string, std::string, std::strin...
FILE: src/modules/sway/workspaces.cpp
type waybar::modules::sway (line 9) | namespace waybar::modules::sway {
type Ipc::ipc_response (line 92) | struct Ipc::ipc_response
type Ipc::ipc_response (line 100) | struct Ipc::ipc_response
function is_focused_recursive (line 498) | bool is_focused_recursive(const Json::Value& node) {
FILE: src/modules/systemd_failed_units.cpp
type waybar::modules (line 16) | namespace waybar::modules {
FILE: src/modules/upower.cpp
type waybar::modules (line 7) | namespace waybar::modules {
function getDeviceStatus (line 98) | static std::string_view getDeviceStatus(UpDeviceState& state) {
function getDeviceIcon (line 115) | static std::string_view getDeviceIcon(UpDeviceKind& kind) {
function secondsToString (line 175) | static std::string secondsToString(const std::chrono::seconds sec) {
FILE: src/modules/user.cpp
type waybar::modules (line 27) | namespace waybar::modules {
type sysinfo (line 57) | struct sysinfo
type timespec (line 64) | struct timespec
FILE: src/modules/wayfire/backend.cpp
type waybar::modules::wayfire (line 17) | namespace waybar::modules::wayfire {
function byteswap (line 22) | inline auto byteswap(uint32_t x) -> uint32_t {
function pack_and_write (line 27) | auto pack_and_write(Sock& sock, std::string&& buf) -> void {
function read_exact (line 34) | auto read_exact(Sock& sock, size_t n) -> std::string {
function is_mapped_toplevel_view (line 47) | inline auto is_mapped_toplevel_view(const Json::Value& view) -> bool {
FILE: src/modules/wayfire/window.cpp
type waybar::modules::wayfire (line 10) | namespace waybar::modules::wayfire {
FILE: src/modules/wayfire/workspaces.cpp
type waybar::modules::wayfire (line 12) | namespace waybar::modules::wayfire {
FILE: src/modules/wireplumber.cpp
function isValidNodeId (line 5) | bool isValidNodeId(uint32_t id) { return id > 0 && id < G_MAXUINT32; }
FILE: src/modules/wlr/taskbar.cpp
type waybar::modules::wlr (line 27) | namespace waybar::modules::wlr {
function tl_handle_title (line 32) | static void tl_handle_title(void* data, struct zwlr_foreign_toplevel_h...
function tl_handle_app_id (line 37) | static void tl_handle_app_id(void* data, struct zwlr_foreign_toplevel_...
function tl_handle_output_enter (line 42) | static void tl_handle_output_enter(void* data, struct zwlr_foreign_top...
function tl_handle_output_leave (line 47) | static void tl_handle_output_leave(void* data, struct zwlr_foreign_top...
function tl_handle_state (line 52) | static void tl_handle_state(void* data, struct zwlr_foreign_toplevel_h...
function tl_handle_done (line 57) | static void tl_handle_done(void* data, struct zwlr_foreign_toplevel_ha...
function tl_handle_parent (line 61) | static void tl_handle_parent(void* data, struct zwlr_foreign_toplevel_...
function tl_handle_closed (line 66) | static void tl_handle_closed(void* data, struct zwlr_foreign_toplevel_...
type zwlr_foreign_toplevel_handle_v1_listener (line 70) | struct zwlr_foreign_toplevel_handle_v1_listener
type zwlr_foreign_toplevel_handle_v1 (line 85) | struct zwlr_foreign_toplevel_handle_v1
type wl_seat (line 85) | struct wl_seat
type wl_output (line 283) | struct wl_output
type wl_output (line 302) | struct wl_output
type wl_array (line 314) | struct wl_array
function handle_global (line 550) | static void handle_global(void* data, struct wl_registry* registry, ui...
function handle_global_remove (line 559) | static void handle_global_remove(void* data, struct wl_registry* regis...
type wl_display (line 580) | struct wl_display
type wl_registry (line 581) | struct wl_registry
type wl_display (line 627) | struct wl_display
function tm_handle_toplevel (line 663) | static void tm_handle_toplevel(void* data, struct zwlr_foreign_topleve...
function tm_handle_finished (line 668) | static void tm_handle_finished(void* data, struct zwlr_foreign_topleve...
type zwlr_foreign_toplevel_manager_v1_listener (line 672) | struct zwlr_foreign_toplevel_manager_v1_listener
type wl_registry (line 677) | struct wl_registry
type zwlr_foreign_toplevel_manager_v1 (line 692) | struct zwlr_foreign_toplevel_manager_v1
type wl_registry (line 701) | struct wl_registry
type zwlr_foreign_toplevel_handle_v1 (line 711) | struct zwlr_foreign_toplevel_handle_v1
type wl_output (line 746) | struct wl_output
function IconLoader (line 754) | const IconLoader& Taskbar::icon_loader() const { return icon_loader_; }
FILE: src/util/audio_backend.cpp
type waybar::util (line 16) | namespace waybar::util {
type pa_subscription_mask (line 93) | enum pa_subscription_mask
FILE: src/util/backlight_backend.cpp
class FileDescriptor (line 14) | class FileDescriptor {
method FileDescriptor (line 16) | explicit FileDescriptor(int fd) : fd_(fd) {}
method FileDescriptor (line 17) | FileDescriptor(const FileDescriptor& other) = delete;
method FileDescriptor (line 18) | FileDescriptor(FileDescriptor&& other) noexcept = delete;
method FileDescriptor (line 19) | FileDescriptor& operator=(const FileDescriptor& other) = delete;
method FileDescriptor (line 20) | FileDescriptor& operator=(FileDescriptor&& other) noexcept = delete;
method get (line 28) | int get() const { return fd_; }
function check_eq (line 34) | void check_eq(int rc, int expected, const char* message = "eq, rc was: ") {
function check_neq (line 40) | void check_neq(int rc, int bad_rc, const char* message = "neq, rc was: ") {
function check0 (line 46) | void check0(int rc, const char* message = "rc wasn't 0") { check_eq(rc, ...
function check_gte (line 48) | void check_gte(int rc, int gte, const char* message = "rc was: ") {
function check_nn (line 54) | void check_nn(const void* ptr, const char* message = "ptr was null") {
type waybar::util (line 62) | namespace waybar::util {
function upsert_device (line 64) | static void upsert_device(std::vector<BacklightDevice>& devices, udev_...
function enumerate_devices (line 118) | static void enumerate_devices(std::vector<BacklightDevice>& devices, u...
function BacklightDevice (line 229) | const BacklightDevice* BacklightBackend::best_device(const std::vector...
function BacklightDevice (line 245) | const BacklightDevice* BacklightBackend::get_previous_best_device() {
FILE: src/util/enum.cpp
type waybar::util (line 13) | namespace waybar::util {
function EnumType (line 22) | EnumType EnumParser<EnumType>::parseStringToEnum(const std::string& str,
type EnumParser<modules::hyprland::Workspaces::SortMethod> (line 43) | struct EnumParser<modules::hyprland::Workspaces::SortMethod>
type EnumParser<modules::hyprland::Workspaces::ActiveWindowPosition> (line 44) | struct EnumParser<modules::hyprland::Workspaces::ActiveWindowPosition>
type EnumParser<util::KillSignalAction> (line 45) | struct EnumParser<util::KillSignalAction>
FILE: src/util/pipewire/pipewire_backend.cpp
type waybar::util::PipewireBackend (line 5) | namespace waybar::util::PipewireBackend {
function getNodeInfo (line 7) | static void getNodeInfo(void* data_, const struct pw_node_info* info) {
type pw_node_events (line 14) | struct pw_node_events
function proxyDestroy (line 19) | static void proxyDestroy(void* data) {
type pw_proxy_events (line 23) | struct pw_proxy_events
function registryEventGlobal (line 28) | static void registryEventGlobal(void* _data, uint32_t id, uint32_t per...
function registryEventGlobalRemove (line 34) | static void registryEventGlobalRemove(void* _data, uint32_t id) {
type pw_registry_events (line 38) | struct pw_registry_events
type pw_proxy (line 87) | struct pw_proxy
type spa_dict (line 113) | struct spa_dict
type PrivacyNodeType (line 119) | enum PrivacyNodeType
FILE: src/util/pipewire/privacy_node_info.cpp
type waybar::util::PipewireBackend (line 3) | namespace waybar::util::PipewireBackend {
type pw_node_info (line 35) | struct pw_node_info
type spa_dict_item (line 38) | struct spa_dict_item
FILE: src/util/portal.cpp
type waybar (line 12) | namespace waybar {
FILE: src/util/prepare_for_sleep.cpp
class PrepareForSleep (line 7) | class PrepareForSleep {
method PrepareForSleep (line 9) | PrepareForSleep() {
method prepareForSleep_cb (line 21) | static void prepareForSleep_cb(GDBusConnection* system_bus, const gcha...
method PrepareForSleep (line 35) | static PrepareForSleep& GetInstance() {
FILE: src/util/regex_collection.cpp
type waybar::util (line 9) | namespace waybar::util {
function default_priority_function (line 11) | int default_priority_function(std::string& key) { return 0; }
FILE: src/util/rewrite_string.cpp
type waybar::util (line 7) | namespace waybar::util {
function rewriteString (line 8) | std::string rewriteString(const std::string& value, const Json::Value&...
FILE: src/util/rfkill.cpp
type rfkill_type (line 29) | enum rfkill_type
type rfkill_event (line 54) | struct rfkill_event
FILE: src/util/sanitize_str.cpp
type waybar::util (line 6) | namespace waybar::util {
function sanitize_string (line 8) | std::string sanitize_string(std::string str) {
FILE: src/util/ustring_clen.cpp
function ustring_clen (line 3) | int ustring_clen(const Glib::ustring& str) {
FILE: test/hyprland/backend.cpp
class IPCTestHelper (line 15) | class IPCTestHelper : public hyprland::IPC {
method resetSocketFolder (line 17) | static void resetSocketFolder() { socketFolder_.clear(); }
function countOpenFds (line 20) | std::size_t countOpenFds() {
FILE: test/utils/SafeSignal.cpp
type TestObject (line 70) | struct TestObject {
method TestObject (line 75) | TestObject(const T& v) : value(v) {}
method TestObject (line 78) | TestObject(const TestObject& other)
method TestObject (line 81) | TestObject(TestObject&& other) noexcept
method TestObject (line 86) | TestObject& operator=(const TestObject& other) {
method TestObject (line 93) | TestObject& operator=(TestObject&& other) noexcept {
FILE: test/utils/command.cpp
function waybar_test_execl (line 26) | int waybar_test_execl(const char* path, const char* arg, ...) {
function waybar_test_execlp (line 33) | int waybar_test_execlp(const char* file, const char* arg, ...) {
FILE: test/utils/css_reload_helper.cpp
class CssReloadHelperTest (line 11) | class CssReloadHelperTest : public waybar::CssReloadHelper {
method CssReloadHelperTest (line 13) | CssReloadHelperTest() : CssReloadHelper("/tmp/waybar_test.css", [this]...
method callback (line 15) | void callback() { m_callbackCounter++; }
method getFileContents (line 18) | std::string getFileContents(const std::string& filename) override {
method findPath (line 22) | std::string findPath(const std::string& filename) override { return fi...
method setFileContents (line 24) | void setFileContents(const std::string& filename, const std::string& c...
method getCallbackCounter (line 28) | int getCallbackCounter() const { return m_callbackCounter; }
FILE: test/utils/fixtures/GlibTestsFixture.hpp
class GlibTestsFixture (line 6) | class GlibTestsFixture : public sigc::trackable {
method GlibTestsFixture (line 8) | GlibTestsFixture() : main_loop_{Glib::MainLoop::create()} {}
method setTimeout (line 10) | void setTimeout(int timeout) {
method run (line 15) | void run(std::function<void()> fn) {
method quit (line 20) | void quit() { main_loop_->quit(); }
FILE: test/utils/sleeper_thread.cpp
type waybar::util (line 15) | namespace waybar::util {
function run_in_subprocess (line 23) | int run_in_subprocess(int (*task)()) {
function run_reassignment_regression (line 43) | int run_reassignment_regression() {
function run_control_flag_stress (line 50) | int run_control_flag_stress() {
Condensed preview — 362 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,478K chars).
[
{
"path": ".clang-format",
"chars": 82,
"preview": "---\nBasedOnStyle: Google\nAlignConsecutiveDeclarations: false\nColumnLimit: 100\n...\n"
},
{
"path": ".clang-tidy",
"chars": 1397,
"preview": "Checks: >\n -*,\n bugprone-*\n misc-*,\n modernize-*,\n performance-*,\n portability-*,\n readability-*,\n -fuchsia-trai"
},
{
"path": ".editorconfig",
"chars": 312,
"preview": "# EditorConfig configuration for Waybar\n# http://EditorConfig.org\n\n# Top-most EditorConfig file\nroot = true\n\n[*]\nend_of_"
},
{
"path": ".envrc",
"chars": 10,
"preview": "use flake\n"
},
{
"path": ".github/FUNDING.yml",
"chars": 100,
"preview": "# These are supported funding model platforms\n\ngithub: Alexays\ncustom: https://paypal.me/ARouillard\n"
},
{
"path": ".github/labeler.yml",
"chars": 870,
"preview": "bug:\n - \"(crash|bug|error|coredump|freeze|segfault|issue|problem)\"\n\nenhancement:\n - \"(feature|enhancement|improvement|"
},
{
"path": ".github/workflows/clang-format.yml",
"chars": 434,
"preview": "name: clang-format\n\non: [push, pull_request]\n\nconcurrency:\n group: ${{ github.workflow }}-format-${{ github.event.pull_"
},
{
"path": ".github/workflows/clang-tidy.yml.bak",
"chars": 1603,
"preview": "name: clang-tidy\n\non: [push, pull_request]\n\nconcurrency:\n group: ${{ github.workflow }}-tidy-${{ github.event.pull_requ"
},
{
"path": ".github/workflows/docker.yml",
"chars": 947,
"preview": "name: Build and Push Docker Image\n\non:\n workflow_dispatch:\n schedule:\n # run monthly\n - cron: '0 0 1 * *'\n\njobs:"
},
{
"path": ".github/workflows/freebsd.yml",
"chars": 1274,
"preview": "name: freebsd\n\non: [push, pull_request]\n\nconcurrency:\n group: ${{ github.workflow }}-freebsd-${{ github.event.pull_requ"
},
{
"path": ".github/workflows/labeler.yml",
"chars": 383,
"preview": "name: \"Issue Labeler\"\non:\n issues:\n types: [opened, edited]\n\npermissions:\n issues: write\n contents: read\n\njobs:\n "
},
{
"path": ".github/workflows/linux.yml",
"chars": 731,
"preview": "name: linux\n\non: [push, pull_request]\n\nconcurrency:\n group: ${{ github.workflow }}-linux-${{ github.event.pull_request."
},
{
"path": ".github/workflows/nix-tests.yml",
"chars": 601,
"preview": "name: \"Nix-Tests\"\non:\n pull_request:\n push:\nconcurrency:\n group: ${{ github.workflow }}-nix-${{ github.event.pull_req"
},
{
"path": ".github/workflows/nix-update-flake-lock.yml",
"chars": 638,
"preview": "name: update-flake-lock\non:\n workflow_dispatch: # allows manual triggering\n schedule:\n - cron: '0 0 1 * *' # Run mo"
},
{
"path": ".gitignore",
"chars": 492,
"preview": ".DS_Store\n*~\nvgcore.*\n/.vscode\n/.idea\n/.cache\n*.swp\npackagecache\n/subprojects/**/\n/subprojects/.wraplock\n/build*\n/dist\n/"
},
{
"path": ".gitmodules",
"chars": 106,
"preview": "[submodule \"package/archlinux\"]\n\tpath = package/archlinux\n\turl = https://aur.archlinux.org/waybar-git.git\n"
},
{
"path": "Dockerfiles/alpine",
"chars": 304,
"preview": "# vim: ft=Dockerfile\n\nFROM alpine:latest\n\nRUN apk add --no-cache git meson alpine-sdk libinput-dev wayland-dev wayland-p"
},
{
"path": "Dockerfiles/archlinux",
"chars": 403,
"preview": "# vim: ft=Dockerfile\n\nFROM archlinux:base-devel\n\nRUN pacman -Syu --noconfirm && \\\n pacman -S --noconfirm git meson ba"
},
{
"path": "Dockerfiles/debian",
"chars": 1189,
"preview": "# vim: ft=Dockerfile\n\nFROM debian:sid-slim\n\nRUN apt update && \\\n apt install --no-install-recommends --no-install-sug"
},
{
"path": "Dockerfiles/fedora",
"chars": 960,
"preview": "# vim: ft=Dockerfile\n\nFROM fedora:latest\n\nRUN dnf install -y @c-development \\\n git-core glibc-langpack-en meson scdoc"
},
{
"path": "Dockerfiles/gentoo",
"chars": 708,
"preview": "# vim: ft=Dockerfile\n\nFROM gentoo/stage3:latest\n\nRUN export FEATURES=\"-ipc-sandbox -network-sandbox -pid-sandbox -sandbo"
},
{
"path": "Dockerfiles/opensuse",
"chars": 628,
"preview": "# vim: ft=Dockerfile\n\nFROM opensuse/tumbleweed:latest\n\nRUN zypper -n up && \\\n zypper addrepo https://download.opensus"
},
{
"path": "LICENSE",
"chars": 1061,
"preview": "MIT License\n\nCopyright (c) 2025 Alex\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof th"
},
{
"path": "Makefile",
"chars": 515,
"preview": ".PHONY: build build-debug run clean default install\n\ndefault: build\n\nbuild:\n\tmeson setup build\n\tninja -C build\n\nbuild-de"
},
{
"path": "README.md",
"chars": 3832,
"preview": "# Waybar [](LICENSE) [;\n in\n fetchTarball {\n url = \"https://"
},
{
"path": "flake.nix",
"chars": 3297,
"preview": "{\n description = \"Highly customizable Wayland bar for Sway and Wlroots based compositors\";\n\n inputs = {\n nixpkgs.ur"
},
{
"path": "include/AAppIconLabel.hpp",
"chars": 775,
"preview": "#pragma once\n\n#include <gtkmm/box.h>\n#include <gtkmm/image.h>\n\n#include \"AIconLabel.hpp\"\n\nnamespace waybar {\n\nclass AApp"
},
{
"path": "include/AIconLabel.hpp",
"chars": 570,
"preview": "#pragma once\n\n#include <gtkmm/box.h>\n#include <gtkmm/image.h>\n\n#include \"ALabel.hpp\"\n\nnamespace waybar {\n\nclass AIconLab"
},
{
"path": "include/ALabel.hpp",
"chars": 1124,
"preview": "#pragma once\n\n#include <glibmm/markup.h>\n#include <gtkmm/label.h>\n#include <json/json.h>\n\n#include \"AModule.hpp\"\n\nnamesp"
},
{
"path": "include/AModule.hpp",
"chars": 3487,
"preview": "#pragma once\n\n#include <glibmm/dispatcher.h>\n#include <glibmm/markup.h>\n#include <gtkmm.h>\n#include <gtkmm/eventbox.h>\n#"
},
{
"path": "include/ASlider.hpp",
"chars": 370,
"preview": "#pragma once\n\n#include \"AModule.hpp\"\n#include \"gtkmm/scale.h\"\n\nnamespace waybar {\n\nclass ASlider : public AModule {\n pub"
},
{
"path": "include/IModule.hpp",
"chars": 283,
"preview": "#pragma once\n\n#include <gtkmm/widget.h>\n\nnamespace waybar {\n\nclass IModule {\n public:\n virtual ~IModule() = default;\n "
},
{
"path": "include/bar.hpp",
"chars": 3285,
"preview": "#pragma once\n\n#include <gdkmm/monitor.h>\n#include <glibmm/refptr.h>\n#include <gtkmm/box.h>\n#include <gtkmm/cssprovider.h"
},
{
"path": "include/client.hpp",
"chars": 2214,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <gdk/gdk.h>\n#include <gdk/gdkwayland.h>\n#include <wayland-client.h>\n\n#inc"
},
{
"path": "include/config.hpp",
"chars": 1303,
"preview": "#pragma once\n\n#include <json/json.h>\n\n#include <optional>\n#include <string>\n\n#ifndef SYSCONFDIR\n#define SYSCONFDIR \"/etc"
},
{
"path": "include/factory.hpp",
"chars": 338,
"preview": "#pragma once\n\n#include <json/json.h>\n\n#include <AModule.hpp>\n\nnamespace waybar {\n\nclass Bar;\n\nclass Factory {\n public:\n "
},
{
"path": "include/group.hpp",
"chars": 959,
"preview": "#pragma once\n\n#include <gtkmm/box.h>\n#include <gtkmm/widget.h>\n#include <json/json.h>\n\n#include \"AModule.hpp\"\n#include \""
},
{
"path": "include/modules/backlight.hpp",
"chars": 618,
"preview": "#pragma once\n\n#include <memory>\n#include <optional>\n#include <string>\n#include <string_view>\n#include <vector>\n\n#include"
},
{
"path": "include/modules/backlight_slider.hpp",
"chars": 486,
"preview": "#pragma once\n\n#include <chrono>\n\n#include \"ASlider.hpp\"\n#include \"util/backlight_backend.hpp\"\n\nnamespace waybar::modules"
},
{
"path": "include/modules/battery.hpp",
"chars": 1549,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <filesystem>\n#if defined(__linux__)\n#include <sys/inotify.h>\n#endif\n#inc"
},
{
"path": "include/modules/bluetooth.hpp",
"chars": 2563,
"preview": "#pragma once\n\n#include \"ALabel.hpp\"\n#ifdef WANT_RFKILL\n#include \"util/rfkill.hpp\"\n#endif\n#include <gio/gio.h>\n\n#include "
},
{
"path": "include/modules/cava/cavaGLSL.hpp",
"chars": 1087,
"preview": "#pragma once\n\n#include <epoxy/gl.h>\n\n#include \"AModule.hpp\"\n#include \"cava_backend.hpp\"\n\nnamespace waybar::modules::cava"
},
{
"path": "include/modules/cava/cavaRaw.hpp",
"chars": 859,
"preview": "#pragma once\n\n#include \"ALabel.hpp\"\n#include \"cava_backend.hpp\"\n\nnamespace waybar::modules::cava {\n\nclass Cava final : p"
},
{
"path": "include/modules/cava/cava_backend.hpp",
"chars": 2290,
"preview": "#pragma once\n\n#include <json/json.h>\n#include <sigc++/sigc++.h>\n\n#include \"util/sleeper_thread.hpp\"\n\nnamespace cava {\nex"
},
{
"path": "include/modules/cava/cava_frontend.hpp",
"chars": 727,
"preview": "#pragma once\n\n#ifdef HAVE_LIBCAVA\n#include \"cavaRaw.hpp\"\n#include \"cava_backend.hpp\"\n#ifdef HAVE_LIBCAVAGLSL\n#include \"c"
},
{
"path": "include/modules/cffi.hpp",
"chars": 1569,
"preview": "#pragma once\n\n#include <string>\n\n#include \"AModule.hpp\"\n#include \"util/command.hpp\"\n#include \"util/json.hpp\"\n#include \"u"
},
{
"path": "include/modules/clock.hpp",
"chars": 3762,
"preview": "#pragma once\n\n#include \"ALabel.hpp\"\n#include \"util/date.hpp\"\n#include \"util/sleeper_thread.hpp\"\n\nnamespace waybar::modul"
},
{
"path": "include/modules/cpu.hpp",
"chars": 519,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <cstdint>\n#include <fstream>\n#include <numeric>\n#include <string>\n#inclu"
},
{
"path": "include/modules/cpu_frequency.hpp",
"chars": 675,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <cstdint>\n#include <fstream>\n#include <numeric>\n#include <string>\n#inclu"
},
{
"path": "include/modules/cpu_usage.hpp",
"chars": 791,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <cstdint>\n#include <fstream>\n#include <numeric>\n#include <string>\n#inclu"
},
{
"path": "include/modules/custom.hpp",
"chars": 1130,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <csignal>\n#include <string>\n\n#include \"ALabel.hpp\"\n#include \"util/comman"
},
{
"path": "include/modules/disk.hpp",
"chars": 527,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <sys/statvfs.h>\n\n#include <fstream>\n\n#include \"ALabel.hpp\"\n#include \"util"
},
{
"path": "include/modules/dwl/tags.hpp",
"chars": 877,
"preview": "#pragma once\n\n#include <gtkmm/button.h>\n#include <wayland-client.h>\n\n#include \"AModule.hpp\"\n#include \"bar.hpp\"\n#include "
},
{
"path": "include/modules/dwl/window.hpp",
"chars": 833,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <string>\n\n#include \"AAppIconLabel.hpp\"\n#include \"bar.hpp\"\n#include \"dwl-"
},
{
"path": "include/modules/ext/workspace_manager.hpp",
"chars": 4005,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <gtkmm/button.h>\n#include <gtkmm/image.h>\n#include <gtkmm/label.h>\n\n#incl"
},
{
"path": "include/modules/ext/workspace_manager_binding.hpp",
"chars": 544,
"preview": "#include \"ext-workspace-v1-client-protocol.h\"\n\nnamespace waybar::modules::ext {\nvoid add_registry_listener(void* data);\n"
},
{
"path": "include/modules/gamemode.hpp",
"chars": 2556,
"preview": "#pragma once\n\n#include <iostream>\n#include <map>\n#include <string>\n\n#include \"ALabel.hpp\"\n#include \"giomm/dbusconnection"
},
{
"path": "include/modules/gps.hpp",
"chars": 745,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <sys/statvfs.h>\n\n#ifdef WANT_RFKILL\n#include \"util/rfkill.hpp\"\n#endif\n\n#i"
},
{
"path": "include/modules/hyprland/backend.hpp",
"chars": 1417,
"preview": "#pragma once\n\n#include <atomic>\n#include <filesystem>\n#include <list>\n#include <mutex>\n#include <string>\n#include <threa"
},
{
"path": "include/modules/hyprland/language.hpp",
"chars": 829,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <string>\n\n#include \"ALabel.hpp\"\n#include \"bar.hpp\"\n#include \"modules/hyp"
},
{
"path": "include/modules/hyprland/submap.hpp",
"chars": 758,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <string>\n\n#include \"ALabel.hpp\"\n#include \"bar.hpp\"\n#include \"modules/hyp"
},
{
"path": "include/modules/hyprland/window.hpp",
"chars": 1570,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <string>\n\n#include \"AAppIconLabel.hpp\"\n#include \"bar.hpp\"\n#include \"modu"
},
{
"path": "include/modules/hyprland/windowcount.hpp",
"chars": 938,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <string>\n\n#include \"AAppIconLabel.hpp\"\n#include \"bar.hpp\"\n#include \"modu"
},
{
"path": "include/modules/hyprland/windowcreationpayload.hpp",
"chars": 2034,
"preview": "#pragma once\n\n#include <gtkmm/button.h>\n#include <gtkmm/label.h>\n#include <json/value.h>\n\n#include <cstddef>\n#include <c"
},
{
"path": "include/modules/hyprland/workspace.hpp",
"chars": 3399,
"preview": "#pragma once\n\n#include <gtkmm/button.h>\n#include <gtkmm/label.h>\n#include <json/value.h>\n\n#include <cstddef>\n#include <c"
},
{
"path": "include/modules/hyprland/workspaces.hpp",
"chars": 8674,
"preview": "#pragma once\n\n#include <gtkmm/button.h>\n#include <gtkmm/enums.h>\n#include <gtkmm/label.h>\n#include <json/value.h>\n#inclu"
},
{
"path": "include/modules/idle_inhibitor.hpp",
"chars": 623,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include \"ALabel.hpp\"\n#include \"bar.hpp\"\n#include \"client.hpp\"\n\nnamespace waybar:"
},
{
"path": "include/modules/image.hpp",
"chars": 773,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <gtkmm/image.h>\n\n#include <csignal>\n#include <string>\n\n#include \"ALabel.h"
},
{
"path": "include/modules/inhibitor.hpp",
"chars": 575,
"preview": "#pragma once\n\n#include <gio/gio.h>\n\n#include <memory>\n\n#include \"ALabel.hpp\"\n#include \"bar.hpp\"\n\nnamespace waybar::modul"
},
{
"path": "include/modules/jack.hpp",
"chars": 912,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <jack/jack.h>\n#include <jack/thread.h>\n\n#include <fstream>\n\n#include \"ALa"
},
{
"path": "include/modules/keyboard_state.hpp",
"chars": 1172,
"preview": "#pragma once\n\n#include <fmt/chrono.h>\n#include <gtkmm/label.h>\n\n#include <mutex>\n#include <set>\n#include <unordered_map>"
},
{
"path": "include/modules/load.hpp",
"chars": 594,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <cstdint>\n#include <fstream>\n#include <numeric>\n#include <string>\n#inclu"
},
{
"path": "include/modules/memory.hpp",
"chars": 488,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <fstream>\n#include <unordered_map>\n\n#include \"ALabel.hpp\"\n#include \"util"
},
{
"path": "include/modules/mpd/mpd.hpp",
"chars": 1673,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <mpd/client.h>\n#include <spdlog/spdlog.h>\n\n#include <condition_variable>\n"
},
{
"path": "include/modules/mpd/state.hpp",
"chars": 5610,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <mpd/client.h>\n#include <spdlog/spdlog.h>\n\n#include <condition_variable>\n"
},
{
"path": "include/modules/mpd/state.inl.hpp",
"chars": 1066,
"preview": "#pragma once\n\nnamespace detail {\n\ninline bool Context::is_connected() const { return mpd_module_->connection_ != nullptr"
},
{
"path": "include/modules/mpris/mpris.hpp",
"chars": 2672,
"preview": "#pragma once\n\n#include <iostream>\n#include <optional>\n#include <string>\n\n#include \"gtkmm/box.h\"\n#include \"gtkmm/label.h\""
},
{
"path": "include/modules/network.hpp",
"chars": 2514,
"preview": "#pragma once\n\n#include <arpa/inet.h>\n#include <fmt/format.h>\n#include <linux/nl80211.h>\n#include <netlink/genl/ctrl.h>\n#"
},
{
"path": "include/modules/niri/backend.hpp",
"chars": 1435,
"preview": "#pragma once\n\n#include <list>\n#include <mutex>\n#include <string>\n#include <utility>\n\n#include \"util/json.hpp\"\n\nnamespace"
},
{
"path": "include/modules/niri/language.hpp",
"chars": 794,
"preview": "#pragma once\n\n#include <string>\n\n#include \"ALabel.hpp\"\n#include \"bar.hpp\"\n#include \"modules/niri/backend.hpp\"\n\nnamespace"
},
{
"path": "include/modules/niri/window.hpp",
"chars": 589,
"preview": "#pragma once\n\n#include <gtkmm/button.h>\n#include <json/value.h>\n\n#include \"AAppIconLabel.hpp\"\n#include \"bar.hpp\"\n#includ"
},
{
"path": "include/modules/niri/workspaces.hpp",
"chars": 738,
"preview": "#pragma once\n\n#include <gtkmm/button.h>\n#include <json/value.h>\n\n#include \"AModule.hpp\"\n#include \"bar.hpp\"\n#include \"mod"
},
{
"path": "include/modules/power_profiles_daemon.hpp",
"chars": 1512,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include \"ALabel.hpp\"\n#include \"giomm/dbusproxy.h\"\n\nnamespace waybar::modules {\n\n"
},
{
"path": "include/modules/privacy/privacy.hpp",
"chars": 1131,
"preview": "#pragma once\n\n#include <string>\n\n#include \"gtkmm/box.h\"\n#include \"modules/privacy/privacy_item.hpp\"\n#include \"util/pipew"
},
{
"path": "include/modules/privacy/privacy_item.hpp",
"chars": 1083,
"preview": "#pragma once\n\n#include <json/value.h>\n\n#include <string>\n\n#include \"gtkmm/box.h\"\n#include \"gtkmm/image.h\"\n#include \"gtkm"
},
{
"path": "include/modules/pulseaudio.hpp",
"chars": 558,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <algorithm>\n#include <array>\n#include <memory>\n\n#include \"ALabel.hpp\"\n#i"
},
{
"path": "include/modules/pulseaudio_slider.hpp",
"chars": 557,
"preview": "#pragma once\n\n#include <memory>\n\n#include \"ASlider.hpp\"\n#include \"util/audio_backend.hpp\"\nnamespace waybar::modules {\n\ne"
},
{
"path": "include/modules/river/layout.hpp",
"chars": 960,
"preview": "#pragma once\n\n#include <wayland-client.h>\n\n#include \"ALabel.hpp\"\n#include \"bar.hpp\"\n#include \"river-status-unstable-v1-c"
},
{
"path": "include/modules/river/mode.hpp",
"chars": 608,
"preview": "#pragma once\n\n#include <wayland-client.h>\n\n#include \"ALabel.hpp\"\n#include \"bar.hpp\"\n#include \"river-status-unstable-v1-c"
},
{
"path": "include/modules/river/tags.hpp",
"chars": 1053,
"preview": "#pragma once\n\n#include <gtkmm/button.h>\n#include <wayland-client.h>\n\n#include \"AModule.hpp\"\n#include \"bar.hpp\"\n#include "
},
{
"path": "include/modules/river/window.hpp",
"chars": 953,
"preview": "#pragma once\n\n#include <gtkmm/button.h>\n#include <wayland-client.h>\n\n#include \"ALabel.hpp\"\n#include \"bar.hpp\"\n#include \""
},
{
"path": "include/modules/simpleclock.hpp",
"chars": 356,
"preview": "#pragma once\n\n#include <fmt/chrono.h>\n\n#include \"ALabel.hpp\"\n#include \"util/sleeper_thread.hpp\"\n\nnamespace waybar::modul"
},
{
"path": "include/modules/sndio.hpp",
"chars": 754,
"preview": "#pragma once\n\n#include <sndio.h>\n\n#include <vector>\n\n#include \"ALabel.hpp\"\n#include \"util/sleeper_thread.hpp\"\n\nnamespace"
},
{
"path": "include/modules/sni/host.hpp",
"chars": 1799,
"preview": "#pragma once\n\n#include <dbus-status-notifier-watcher.h>\n#include <giomm.h>\n#include <glibmm/refptr.h>\n#include <json/jso"
},
{
"path": "include/modules/sni/icon_manager.hpp",
"chars": 1003,
"preview": "#pragma once\n\n#include <json/json.h>\n#include <spdlog/spdlog.h>\n\n#include <string>\n#include <unordered_map>\n\nclass IconM"
},
{
"path": "include/modules/sni/item.hpp",
"chars": 3815,
"preview": "#pragma once\n\n#include <dbus-status-notifier-item.h>\n#include <giomm/dbusproxy.h>\n#include <glibmm/refptr.h>\n#include <g"
},
{
"path": "include/modules/sni/tray.hpp",
"chars": 679,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include \"AModule.hpp\"\n#include \"bar.hpp\"\n#include \"modules/sni/host.hpp\"\n#includ"
},
{
"path": "include/modules/sni/watcher.hpp",
"chars": 1519,
"preview": "#pragma once\n\n#include <dbus-status-notifier-watcher.h>\n#include <giomm.h>\n#include <glibmm/refptr.h>\n\nnamespace waybar:"
},
{
"path": "include/modules/sway/bar.hpp",
"chars": 1370,
"preview": "#pragma once\n#include <atomic>\n#include <string>\n\n#include \"modules/sway/ipc/client.hpp\"\n#include \"util/SafeSignal.hpp\"\n"
},
{
"path": "include/modules/sway/ipc/client.hpp",
"chars": 1282,
"preview": "#pragma once\n\n#include <sigc++/sigc++.h>\n#include <sys/socket.h>\n#include <sys/un.h>\n#include <unistd.h>\n\n#include <cstr"
},
{
"path": "include/modules/sway/ipc/ipc.hpp",
"chars": 1025,
"preview": "#pragma once\n\n#include <cstdint>\n\n#define event_mask(ev) (1u << (ev & 0x7F))\n\nenum ipc_command_type : uint32_t {\n // i3"
},
{
"path": "include/modules/sway/language.hpp",
"chars": 1729,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <xkbcommon/xkbregistry.h>\n\n#include <map>\n#include <string>\n\n#include \"AL"
},
{
"path": "include/modules/sway/mode.hpp",
"chars": 560,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include \"ALabel.hpp\"\n#include \"bar.hpp\"\n#include \"client.hpp\"\n#include \"modules/"
},
{
"path": "include/modules/sway/scratchpad.hpp",
"chars": 776,
"preview": "#pragma once\n\n#include <gtkmm/label.h>\n\n#include <mutex>\n#include <string>\n\n#include \"ALabel.hpp\"\n#include \"bar.hpp\"\n#in"
},
{
"path": "include/modules/sway/window.hpp",
"chars": 1162,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <tuple>\n\n#include \"AAppIconLabel.hpp\"\n#include \"bar.hpp\"\n#include \"clien"
},
{
"path": "include/modules/sway/workspaces.hpp",
"chars": 2027,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <gtkmm/button.h>\n#include <gtkmm/label.h>\n\n#include <string_view>\n#includ"
},
{
"path": "include/modules/systemd_failed_units.hpp",
"chars": 1595,
"preview": "#pragma once\n\n#include <giomm/dbusproxy.h>\n\n#include <string>\n#include <vector>\n\n#include \"ALabel.hpp\"\n\nnamespace waybar"
},
{
"path": "include/modules/temperature.hpp",
"chars": 504,
"preview": "#pragma once\n\n#include <fmt/format.h>\n\n#include <fstream>\n\n#include \"ALabel.hpp\"\n#include \"util/sleeper_thread.hpp\"\n\nnam"
},
{
"path": "include/modules/upower.hpp",
"chars": 2904,
"preview": "#pragma once\n\n#include <giomm/dbusconnection.h>\n#include <gtkmm/icontheme.h>\n#include <libupower-glib/upower.h>\n\n#includ"
},
{
"path": "include/modules/user.hpp",
"chars": 954,
"preview": "#pragma once\n\n#include <fmt/chrono.h>\n#include <gdkmm/pixbuf.h>\n#include <glibmm/refptr.h>\n\n#include \"AIconLabel.hpp\"\n#i"
},
{
"path": "include/modules/wayfire/backend.hpp",
"chars": 3364,
"preview": "#pragma once\n\n#include <json/json.h>\n#include <unistd.h>\n\n#include <functional>\n#include <list>\n#include <memory>\n#inclu"
},
{
"path": "include/modules/wayfire/window.hpp",
"chars": 501,
"preview": "#pragma once\n\n#include \"AAppIconLabel.hpp\"\n#include \"bar.hpp\"\n#include \"modules/wayfire/backend.hpp\"\n\nnamespace waybar::"
},
{
"path": "include/modules/wayfire/workspaces.hpp",
"chars": 665,
"preview": "#pragma once\n\n#include <gtkmm/button.h>\n#include <json/json.h>\n\n#include <memory>\n#include <vector>\n\n#include \"AModule.h"
},
{
"path": "include/modules/wireplumber.hpp",
"chars": 1915,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <wp/wp.h>\n\n#include <algorithm>\n#include <array>\n\n#include \"ALabel.hpp\"\n\n"
},
{
"path": "include/modules/wlr/taskbar.hpp",
"chars": 4807,
"preview": "#pragma once\n\n#include <gdk/gdk.h>\n#include <glibmm/refptr.h>\n#include <gtkmm/box.h>\n#include <gtkmm/button.h>\n#include "
},
{
"path": "include/util/SafeSignal.hpp",
"chars": 2773,
"preview": "#pragma once\n\n#include <glibmm/dispatcher.h>\n#include <sigc++/signal.h>\n\n#include <cstddef>\n#include <functional>\n#inclu"
},
{
"path": "include/util/audio_backend.hpp",
"chars": 3228,
"preview": "#pragma once\n\n#include <json/value.h>\n#include <pulse/context.h>\n#include <pulse/introspect.h>\n#include <pulse/thread-ma"
},
{
"path": "include/util/backend_common.hpp",
"chars": 180,
"preview": "#pragma once\n\n#include \"AModule.hpp\"\n\nnamespace waybar::util {\n\nconst static auto NOOP = []() {};\nenum class ChangeType "
},
{
"path": "include/util/backlight_backend.hpp",
"chars": 2771,
"preview": "#pragma once\n\n#include <libudev.h>\n#include <spdlog/spdlog.h>\n\n#include <chrono>\n#include <mutex>\n#include <optional>\n#i"
},
{
"path": "include/util/clara.hpp",
"chars": 35233,
"preview": "// Copyright 2017 Two Blue Cubes Ltd. All rights reserved.\n//\n// Distributed under the Boost Software License, Version 1"
},
{
"path": "include/util/command.hpp",
"chars": 4963,
"preview": "#pragma once\n\n#include <fcntl.h>\n#include <giomm.h>\n#include <spdlog/spdlog.h>\n#include <sys/wait.h>\n#include <unistd.h>"
},
{
"path": "include/util/css_reload_helper.hpp",
"chars": 1211,
"preview": "#pragma once\n\n#include <functional>\n#include <string>\n#include <unordered_map>\n#include <vector>\n\n#include \"giomm/file.h"
},
{
"path": "include/util/date.hpp",
"chars": 1878,
"preview": "#pragma once\n\n#include <chrono>\n\n#if HAVE_CHRONO_TIMEZONES\n#include <format>\n#else\n#include <date/tz.h>\n#include <fmt/fo"
},
{
"path": "include/util/enum.hpp",
"chars": 351,
"preview": "#pragma once\n\n#include <map>\n#include <stdexcept>\n#include <string>\n\nnamespace waybar::util {\n\ntemplate <typename EnumTy"
},
{
"path": "include/util/format.hpp",
"chars": 3222,
"preview": "#pragma once\n\n#include <fmt/format.h>\n#include <glibmm/ustring.h>\n\nclass pow_format {\n public:\n pow_format(long long va"
},
{
"path": "include/util/gtk_icon.hpp",
"chars": 396,
"preview": "#pragma once\n#include <gtkmm/icontheme.h>\n\n#include <mutex>\n#include <string>\n\nclass DefaultGtkIconThemeWrapper {\n priva"
},
{
"path": "include/util/icon_loader.hpp",
"chars": 1440,
"preview": "#pragma once\n\n#include <gdkmm/general.h>\n#include <gio/gdesktopappinfo.h>\n#include <giomm/desktopappinfo.h>\n#include <gl"
},
{
"path": "include/util/json.hpp",
"chars": 1222,
"preview": "#pragma once\n\n#include <fmt/ostream.h>\n#include <json/json.h>\n\n#include <algorithm>\n#include <codecvt>\n#include <iostrea"
},
{
"path": "include/util/kill_signal.hpp",
"chars": 640,
"preview": "#pragma once\n\n#include <json/value.h>\n\n#include <cstdint>\n\nnamespace waybar::util {\n\nenum class KillSignalAction : std::"
},
{
"path": "include/util/pipewire/pipewire_backend.hpp",
"chars": 1320,
"preview": "#pragma once\n\n#include <pipewire/pipewire.h>\n\n#include <unordered_map>\n\n#include \"util/backend_common.hpp\"\n#include \"uti"
},
{
"path": "include/util/pipewire/privacy_node_info.hpp",
"chars": 998,
"preview": "#pragma once\n\n#include <pipewire/pipewire.h>\n\n#include <string>\n\n#include \"util/gtk_icon.hpp\"\n\nnamespace waybar::util::P"
},
{
"path": "include/util/portal.hpp",
"chars": 939,
"preview": "#include <giomm/dbusproxy.h>\n\n#include <string>\n\n#include \"fmt/format.h\"\n\nnamespace waybar {\n\nenum class Appearance {\n "
},
{
"path": "include/util/prepare_for_sleep.h",
"chars": 219,
"preview": "#pragma once\n\n#include \"SafeSignal.hpp\"\n\nnamespace waybar::util {\n\n// Get a signal emitted with value true when entering"
},
{
"path": "include/util/regex_collection.hpp",
"chars": 1596,
"preview": "#pragma once\n\n#include <json/json.h>\n\n#include <functional>\n#include <regex>\n#include <string>\n#include <utility>\n\nnames"
},
{
"path": "include/util/rewrite_string.hpp",
"chars": 309,
"preview": "#pragma once\n#include <json/json.h>\n\n#include <string>\n\nnamespace waybar::util {\nstd::string rewriteString(const std::st"
},
{
"path": "include/util/rfkill.hpp",
"chars": 525,
"preview": "#pragma once\n\n#include <glibmm/iochannel.h>\n#include <linux/rfkill.h>\n#include <sigc++/signal.h>\n#include <sigc++/tracka"
},
{
"path": "include/util/sanitize_str.hpp",
"chars": 132,
"preview": "#pragma once\n#include <string>\n\nnamespace waybar::util {\nstd::string sanitize_string(std::string str);\n} // namespace w"
},
{
"path": "include/util/scope_guard.hpp",
"chars": 460,
"preview": "#pragma once\n\n#include <utility>\n\nnamespace waybar::util {\n\ntemplate <typename Func>\nclass ScopeGuard {\n public:\n expli"
},
{
"path": "include/util/scoped_fd.hpp",
"chars": 911,
"preview": "#pragma once\n\n#include <unistd.h>\n\nnamespace waybar::util {\n\nclass ScopedFd {\n public:\n explicit ScopedFd(int fd = -1) "
},
{
"path": "include/util/sleeper_thread.hpp",
"chars": 3895,
"preview": "#pragma once\n\n#include <atomic>\n#include <chrono>\n#include <condition_variable>\n#include <ctime>\n#include <functional>\n#"
},
{
"path": "include/util/string.hpp",
"chars": 1533,
"preview": "#pragma once\n\n#include <iostream>\n#include <string>\n\nconst std::string WHITESPACE = \" \\n\\r\\t\\f\\v\";\n\ninline std::string l"
},
{
"path": "include/util/udev_deleter.hpp",
"chars": 484,
"preview": "#pragma once\n\n#include <libudev.h>\n\nnamespace waybar::util {\nstruct UdevDeleter {\n void operator()(udev* ptr) const { u"
},
{
"path": "include/util/ustring_clen.hpp",
"chars": 122,
"preview": "#pragma once\n#include <glibmm/ustring.h>\n\n// calculate column width of ustring\nint ustring_clen(const Glib::ustring& str"
},
{
"path": "man/waybar-backlight-slider.5.scd",
"chars": 2013,
"preview": "waybar-backlight-slider(5)\n\n# NAME\n\nwaybar - backlight slider module\n\n# DESCRIPTION\n\nThe *backlight slider* module displ"
},
{
"path": "man/waybar-backlight.5.scd",
"chars": 2817,
"preview": "waybar-backlight(5)\n\n# NAME\n\nwaybar - backlight module\n\n# DESCRIPTION\n\nThe *backlight* module displays the current backl"
},
{
"path": "man/waybar-battery.5.scd",
"chars": 6810,
"preview": "waybar-battery(5)\n\n# NAME\n\nwaybar - battery module\n\n# DESCRIPTION\n\nThe *battery* module displays the current capacity an"
},
{
"path": "man/waybar-bluetooth.5.scd",
"chars": 7838,
"preview": "waybar-bluetooth(5)\n\n# NAME\n\nwaybar - bluetooth module\n\n# DESCRIPTION\n\nThe *bluetooth* module displays information about"
},
{
"path": "man/waybar-cava.5.scd",
"chars": 26956,
"preview": "waybar-cava(5) \"waybar-cava\" \"User Manual\"\n\n# NAME\n\nwaybar - cava module\n\n# DESCRIPTION\n\n*cava* module for karlstav/cava"
},
{
"path": "man/waybar-cffi.5.scd",
"chars": 921,
"preview": "waybar-cffi(5)\n# NAME\n\nwaybar - cffi module\n\n# DESCRIPTION\n\nThe *cffi* module gives full control of a GTK widget to a th"
},
{
"path": "man/waybar-clock.5.scd",
"chars": 7818,
"preview": "waybar-clock(5) \"waybar-clock\" \"User Manual\"\n\n# NAME\n\nwaybar - clock module\n\n# DESCRIPTION\n\n*clock* module displays curr"
},
{
"path": "man/waybar-cpu.5.scd",
"chars": 3197,
"preview": "waybar-cpu(5)\n\n# NAME\n\nwaybar - cpu module\n\n# DESCRIPTION\n\nThe *cpu* module displays the current CPU utilization.\n\n# CON"
},
{
"path": "man/waybar-custom.5.scd",
"chars": 6646,
"preview": "waybar-custom(5)\n# NAME\n\nwaybar - custom module\n\n# DESCRIPTION\n\nThe *custom* module displays either the output of a scri"
},
{
"path": "man/waybar-disk.5.scd",
"chars": 4032,
"preview": "waybar-disk(5)\n\n# NAME\n\nwaybar - disk module\n\n# DESCRIPTION\n\nThe *disk* module displays the current disk space used.\n\n# "
},
{
"path": "man/waybar-dwl-tags.5.scd",
"chars": 979,
"preview": "waybar-dwl-tags(5)\n\n# NAME\n\nwaybar - dwl tags module\n\n# DESCRIPTION\n\nThe *tags* module displays the current state of tag"
},
{
"path": "man/waybar-dwl-window.5.scd",
"chars": 2794,
"preview": "waybar-dwl-window(5)\n\n# NAME\n\nwaybar - dwl window module\n\n# DESCRIPTION\n\nThe *window* module displays the title of the c"
},
{
"path": "man/waybar-ext-workspaces.5.scd",
"chars": 2368,
"preview": "waybar-wlr-workspaces(5)\n\n# NAME\n\nwaybar - wlr workspaces module\n\n# DESCRIPTION\n\nThe *workspaces* module displays the cu"
},
{
"path": "man/waybar-gamemode.5.scd",
"chars": 1983,
"preview": "waybar-gamemode(5)\n\n# NAME\n\nwaybar - gamemode module\n\n# DESCRIPTION\n\nThe *gamemode* module displays if any game or appli"
},
{
"path": "man/waybar-gps.5.scd",
"chars": 2686,
"preview": "waybar-gps(5) \"waybar-gps\" \"User Manual\"\n\n# NAME\n\nwaybar - gps module\n\n# DESCRIPTION\n\n*gps* module for gpsd.\n\n\n# FILES\n\n"
},
{
"path": "man/waybar-hyprland-language.5.scd",
"chars": 1572,
"preview": "waybar-hyprland-language(5)\n\n# NAME\n\nwaybar - hyprland language module\n\n# DESCRIPTION\n\nThe *language* module displays th"
},
{
"path": "man/waybar-hyprland-submap.5.scd",
"chars": 2550,
"preview": "waybar-hyprland-submap(5)\n\n# NAME\n\nwaybar - hyprland submap module\n\n# DESCRIPTION\n\nThe *submap* module displays the curr"
},
{
"path": "man/waybar-hyprland-window.5.scd",
"chars": 2502,
"preview": "waybar-hyprland-window(5)\n\n# NAME\n\nwaybar - hyprland window module\n\n# DESCRIPTION\n\nThe *window* module displays the titl"
},
{
"path": "man/waybar-hyprland-windowcount.5.scd",
"chars": 1209,
"preview": "waybar-hyprland-windowcount(5)\n\n# NAME\n\nwaybar - hyprland window count module\n\n# DESCRIPTION\n\nThe *windowcount* module d"
},
{
"path": "man/waybar-hyprland-workspaces.5.scd",
"chars": 8642,
"preview": "waybar-hyprland-workspaces(5)\n\n# NAME\n\nwaybar - hyprland workspaces module\n\n# DESCRIPTION\n\nThe *workspaces* module displ"
},
{
"path": "man/waybar-idle-inhibitor.5.scd",
"chars": 3053,
"preview": "waybar-idle-inhibitor(5)\n\n# NAME\n\nwaybar - idle_inhibitor module\n\n# DESCRIPTION\n\nThe *idle_inhibitor* module can inhibit"
},
{
"path": "man/waybar-image.5.scd",
"chars": 2091,
"preview": "waybar-image(5)\n\n# NAME\n\nwaybar - image module\n\n# DESCRIPTION\n\nThe *image* module displays an image from a path.\n\n# CONF"
},
{
"path": "man/waybar-inhibitor.5.scd",
"chars": 2780,
"preview": "waybar-inhibitor(5)\n\n# NAME\n\nwaybar - inhibitor module\n\n# DESCRIPTION\n\nThe *inhibitor* module allows one to take an inhi"
},
{
"path": "man/waybar-jack.5.scd",
"chars": 3137,
"preview": "waybar-jack(5)\n\n# NAME\n\nwaybar - JACK module\n\n# DESCRIPTION\n\nThe *jack* module displays the current state of the JACK se"
},
{
"path": "man/waybar-keyboard-state.5.scd",
"chars": 2738,
"preview": "waybar-keyboard-state(5)\n\n# NAME\n\nwaybar - keyboard-state module\n\n# DESCRIPTION\n\nThe *keyboard-state* module displays th"
},
{
"path": "man/waybar-memory.5.scd",
"chars": 3191,
"preview": "waybar-memory(5)\n\n# NAME\n\nwaybar - memory module\n\n# DESCRIPTION\n\nThe *memory* module displays the current memory utiliza"
},
{
"path": "man/waybar-menu.5.scd",
"chars": 3892,
"preview": "waybar-menu(5)\n\n# NAME\n\nwaybar - menu property\n\n# OVERVIEW\n\n\nSome modules support a 'menu', which allows to have a popup"
},
{
"path": "man/waybar-mpd.5.scd",
"chars": 6963,
"preview": "waybar-mpd(5)\n\n# NAME\n\nwaybar - mpd module\n\n# DESCRIPTION\n\nThe *mpd* module displays information about a running \"Music "
},
{
"path": "man/waybar-mpris.5.scd",
"chars": 5478,
"preview": "waybar-mpris(5)\n\n# NAME\n\nwaybar - MPRIS module\n\n# DESCRIPTION\n\nThe *mpris* module displays currently playing media via l"
},
{
"path": "man/waybar-network.5.scd",
"chars": 5995,
"preview": "waybar-network(5)\n\n# NAME\n\nwaybar - network module\n\n# DESCRIPTION\n\nThe *network* module displays information about the c"
},
{
"path": "man/waybar-niri-language.5.scd",
"chars": 1583,
"preview": "waybar-niri-language(5)\n\n# NAME\n\nwaybar - niri language module\n\n# DESCRIPTION\n\nThe *language* module displays the curren"
},
{
"path": "man/waybar-niri-window.5.scd",
"chars": 1968,
"preview": "waybar-niri-window(5)\n\n# NAME\n\nwaybar - niri window module\n\n# DESCRIPTION\n\nThe *window* module displays the title of the"
},
{
"path": "man/waybar-niri-workspaces.5.scd",
"chars": 2718,
"preview": "waybar-niri-workspaces(5)\n\n# NAME\n\nwaybar - niri workspaces module\n\n# DESCRIPTION\n\nThe *workspaces* module displays the "
},
{
"path": "man/waybar-power-profiles-daemon.5.scd",
"chars": 1809,
"preview": "waybar-power-profiles-daemon(5)\n\n# NAME\n\nwaybar - power-profiles-daemon module\n\n# DESCRIPTION\n\nThe *power-profiles-daemo"
},
{
"path": "man/waybar-privacy.5.scd",
"chars": 2080,
"preview": "waybar-privacy(5)\n\n# NAME\n\nwaybar - privacy module\n\n# DESCRIPTION\n\nThe *privacy* module displays if any application is c"
},
{
"path": "man/waybar-pulseaudio-slider.5.scd",
"chars": 1839,
"preview": "waybar-pulseaudio-slider(5)\n\n# NAME\n\nwaybar - pulseaudio slider module\n\n# DESCRIPTION\n\nThe *pulseaudio slider* module di"
},
{
"path": "man/waybar-pulseaudio.5.scd",
"chars": 4889,
"preview": "waybar-pulseaudio(5)\n\n# NAME\n\nwaybar - pulseaudio module\n\n# DESCRIPTION\n\nThe *pulseaudio* module displays the current vo"
},
{
"path": "man/waybar-river-layout.5.scd",
"chars": 2026,
"preview": "waybar-river-layout(5)\n\n# NAME\n\nwaybar - river layout module\n\n# DESCRIPTION\n\nThe *layout* module displays the current la"
},
{
"path": "man/waybar-river-mode.5.scd",
"chars": 2108,
"preview": "waybar-river-mode(5)\n\n# NAME\n\nwaybar - river mode module\n\n# DESCRIPTION\n\nThe *mode* module displays the current mapping "
},
{
"path": "man/waybar-river-tags.5.scd",
"chars": 1104,
"preview": "waybar-river-tags(5)\n\n# NAME\n\nwaybar - river tags module\n\n# DESCRIPTION\n\nThe *tags* module displays the current state of"
},
{
"path": "man/waybar-river-window.5.scd",
"chars": 1838,
"preview": "waybar-river-window(5)\n\n# NAME\n\nwaybar - river window module\n\n# DESCRIPTION\n\nThe *window* module displays the title of t"
},
{
"path": "man/waybar-sndio.5.scd",
"chars": 2623,
"preview": "waybar-sndio(5)\n\n# NAME\n\nwaybar - sndio module\n\n# DESCRIPTION\n\nThe *sndio* module displays the current volume reported b"
},
{
"path": "man/waybar-states.5.scd",
"chars": 1229,
"preview": "waybar-states(5)\n\n# NAME\n\nwaybar - states property\n\n# OVERVIEW\n\nSome modules support 'states' which allows percentage va"
},
{
"path": "man/waybar-styles.5.scd.in",
"chars": 1860,
"preview": "waybar-styles(5)\n\n# NAME\n\nwaybar-styles - using stylesheets for waybar\n\n# DESCRIPTION\n\nWaybar uses Cascading Style Sheet"
},
{
"path": "man/waybar-sway-language.5.scd",
"chars": 1447,
"preview": "waybar-sway-language(5)\n\n# NAME\n\nwaybar - sway language module\n\n# DESCRIPTION\n\nThe *language* module displays the curren"
},
{
"path": "man/waybar-sway-mode.5.scd",
"chars": 2191,
"preview": "waybar-sway-mode(5)\n\n# NAME\n\nwaybar - sway mode module\n\n# DESCRIPTION\n\nThe *mode* module displays the current binding mo"
},
{
"path": "man/waybar-sway-scratchpad.5.scd",
"chars": 1618,
"preview": "waybar-sway-scratchpad(5)\n\n# NAME\n\nwaybar - sway scratchpad module\n\n# DESCRIPTION\n\nThe *scratchpad* module displays the "
},
{
"path": "man/waybar-sway-window.5.scd",
"chars": 4761,
"preview": "waybar-sway-window(5)\n\n# NAME\n\nwaybar - sway window module\n\n# DESCRIPTION\n\nThe *window* module displays the title of the"
},
{
"path": "man/waybar-sway-workspaces.5.scd",
"chars": 6217,
"preview": "waybar-sway-workspaces(5)\n\n# NAME\n\nwaybar - sway workspaces module\n\n# DESCRIPTION\n\nThe *workspaces* module displays the "
},
{
"path": "man/waybar-systemd-failed-units.5.scd",
"chars": 2965,
"preview": "waybar-systemd-failed-units(5)\n\n# NAME\n\nwaybar - systemd failed units monitor module\n\n# DESCRIPTION\n\nThe *systemd-failed"
},
{
"path": "man/waybar-temperature.5.scd",
"chars": 4429,
"preview": "waybar-temperature(5)\n\n# NAME\n\nwaybar - temperature module\n\n# DESCRIPTION\n\nThe *temperature* module displays the current"
},
{
"path": "man/waybar-tray.5.scd",
"chars": 1136,
"preview": "waybar-tray(5)\n\n# NAME\n\nwaybar - tray module\n\n# DESCRIPTION\n\n_WARNING_ *tray* is still in beta. There may be bugs. Break"
},
{
"path": "man/waybar-upower.5.scd",
"chars": 2660,
"preview": "waybar-upower(5)\n\n# NAME\n\nwaybar - upower module\n\n# DESCRIPTION\n\nThe *upower* module displays the main battery capacity "
},
{
"path": "man/waybar-wayfire-window.5.scd",
"chars": 1855,
"preview": "waybar-wayfire-window(5)\n\n# NAME\n\nwaybar - wayfire window module\n\n# DESCRIPTION\n\nThe *window* module displays the title "
},
{
"path": "man/waybar-wayfire-workspaces.5.scd",
"chars": 1876,
"preview": "waybar-wayfire-workspaces(5)\n\n# NAME\n\nwaybar - wayfire workspaces module\n\n# DESCRIPTION\n\nThe *workspaces* module display"
}
]
// ... and 162 more files (download for full content)
About this extraction
This page contains the full source code of the Alexays/Waybar GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 362 files (1.3 MB), approximately 374.4k tokens, and a symbol index with 1204 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.