pax_global_header 0000666 0000000 0000000 00000000064 14756031653 0014524 g ustar 00root root 0000000 0000000 52 comment=8490a1d9b9a5c8770dd63e9faca0a5e01acedcae
waybar-0.12.0/ 0000775 0000000 0000000 00000000000 14756031653 0013071 5 ustar 00root root 0000000 0000000 waybar-0.12.0/.clang-format 0000664 0000000 0000000 00000000122 14756031653 0015437 0 ustar 00root root 0000000 0000000 ---
BasedOnStyle: Google
AlignConsecutiveDeclarations: false
ColumnLimit: 100
...
waybar-0.12.0/.clang-tidy 0000664 0000000 0000000 00000002565 14756031653 0015135 0 ustar 00root root 0000000 0000000 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 }
waybar-0.12.0/.editorconfig 0000664 0000000 0000000 00000000470 14756031653 0015547 0 ustar 00root root 0000000 0000000 # 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
waybar-0.12.0/.envrc 0000664 0000000 0000000 00000000012 14756031653 0014200 0 ustar 00root root 0000000 0000000 use flake
waybar-0.12.0/.github/ 0000775 0000000 0000000 00000000000 14756031653 0014431 5 ustar 00root root 0000000 0000000 waybar-0.12.0/.github/FUNDING.yml 0000664 0000000 0000000 00000000144 14756031653 0016245 0 ustar 00root root 0000000 0000000 # These are supported funding model platforms
github: Alexays
custom: https://paypal.me/ARouillard
waybar-0.12.0/.github/labeler.yml 0000664 0000000 0000000 00000001546 14756031653 0016570 0 ustar 00root root 0000000 0000000 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)"
waybar-0.12.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14756031653 0016466 5 ustar 00root root 0000000 0000000 waybar-0.12.0/.github/workflows/clang-format.yml 0000664 0000000 0000000 00000000753 14756031653 0021570 0 ustar 00root root 0000000 0000000 name: clang-format
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-format-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.16.2
name: clang-format
with:
source: "."
extensions: "hpp,h,cpp,c"
style: "file:.clang-format"
clangFormatVersion: 19
waybar-0.12.0/.github/workflows/clang-tidy.yml.bak 0000664 0000000 0000000 00000003104 14756031653 0021776 0 ustar 00root root 0000000 0000000 name: clang-tidy
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-tidy-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
container:
image: alexays/waybar:debian
steps:
- uses: actions/checkout@v3
- 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
waybar-0.12.0/.github/workflows/docker.yml 0000664 0000000 0000000 00000001613 14756031653 0020461 0 ustar 00root root 0000000 0000000 name: Build and Push Docker Image
on:
schedule:
# run every night at midnight
- cron: '0 0 * * *'
jobs:
build-and-push:
runs-on: ubuntu-latest
if: 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@v4
- 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 }}
waybar-0.12.0/.github/workflows/freebsd.yml 0000664 0000000 0000000 00000002373 14756031653 0020630 0 ustar 00root root 0000000 0000000 name: freebsd
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-freebsd-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
clang:
# 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@v3
- name: Test in FreeBSD VM
uses: cross-platform-actions/action@v0.25.0
timeout-minutes: 180
env:
CPPFLAGS: '-isystem/usr/local/include'
LDFLAGS: '-L/usr/local/lib'
with:
operating_system: freebsd
version: "14.1"
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
waybar-0.12.0/.github/workflows/labeler.yml 0000664 0000000 0000000 00000000577 14756031653 0020630 0 ustar 00root root 0000000 0000000 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 }}
waybar-0.12.0/.github/workflows/linux.yml 0000664 0000000 0000000 00000001333 14756031653 0020350 0 ustar 00root root 0000000 0000000 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@v3
- 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
waybar-0.12.0/.github/workflows/nix-tests.yml 0000664 0000000 0000000 00000000705 14756031653 0021151 0 ustar 00root root 0000000 0000000 name: "Nix-Tests"
on:
pull_request:
push:
jobs:
nix-flake-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
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
waybar-0.12.0/.github/workflows/nix-update-flake-lock.yml 0000664 0000000 0000000 00000001202 14756031653 0023270 0 ustar 00root root 0000000 0000000 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@v4
- name: Install Nix
uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v21
waybar-0.12.0/.gitignore 0000664 0000000 0000000 00000000655 14756031653 0015067 0 ustar 00root root 0000000 0000000 .DS_Store
*~
vgcore.*
/.vscode
/.idea
/.cache
*.swp
packagecache
/subprojects/**/
/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
waybar-0.12.0/.gitmodules 0000664 0000000 0000000 00000000152 14756031653 0015244 0 ustar 00root root 0000000 0000000 [submodule "package/archlinux"]
path = package/archlinux
url = https://aur.archlinux.org/waybar-git.git
waybar-0.12.0/Dockerfiles/ 0000775 0000000 0000000 00000000000 14756031653 0015323 5 ustar 00root root 0000000 0000000 waybar-0.12.0/Dockerfiles/alpine 0000664 0000000 0000000 00000000460 14756031653 0016516 0 ustar 00root root 0000000 0000000 # 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
waybar-0.12.0/Dockerfiles/archlinux 0000664 0000000 0000000 00000000623 14756031653 0017244 0 ustar 00root root 0000000 0000000 # 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
waybar-0.12.0/Dockerfiles/debian 0000664 0000000 0000000 00000002240 14756031653 0016466 0 ustar 00root root 0000000 0000000 # vim: ft=Dockerfile
FROM debian:sid
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
waybar-0.12.0/Dockerfiles/fedora 0000664 0000000 0000000 00000001700 14756031653 0016504 0 ustar 00root root 0000000 0000000 # 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
waybar-0.12.0/Dockerfiles/gentoo 0000664 0000000 0000000 00000001310 14756031653 0016534 0 ustar 00root root 0000000 0000000 # 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.24.6 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
waybar-0.12.0/Dockerfiles/opensuse 0000664 0000000 0000000 00000001164 14756031653 0017111 0 ustar 00root root 0000000 0000000 # 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
waybar-0.12.0/LICENSE 0000664 0000000 0000000 00000002045 14756031653 0014077 0 ustar 00root root 0000000 0000000 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.
waybar-0.12.0/Makefile 0000664 0000000 0000000 00000000625 14756031653 0014534 0 ustar 00root root 0000000 0000000 .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 --no-rebuild --verbose --suite waybar
.PHONY: test
clean:
rm -rf build
waybar-0.12.0/README.md 0000664 0000000 0000000 00000006175 14756031653 0014361 0 ustar 00root root 0000000 0000000 # Waybar [](LICENSE) [](https://paypal.me/ARouillard)

> Highly customizable Wayland bar for Sway and Wlroots based compositors.
> Available in [all major distributions](https://github.com/Alexays/Waybar/wiki/Installation)
> *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
```
Contributions welcome!
Have fun :)
The style guidelines are [Google's](https://google.github.io/styleguide/cppguide.html)
## License
Waybar is licensed under the MIT license. [See LICENSE for more information](https://github.com/Alexays/Waybar/blob/master/LICENSE).
waybar-0.12.0/default.nix 0000664 0000000 0000000 00000000461 14756031653 0015236 0 ustar 00root root 0000000 0000000 (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
waybar-0.12.0/flake.lock 0000664 0000000 0000000 00000002036 14756031653 0015026 0 ustar 00root root 0000000 0000000 {
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1738142207,
"narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9d3ae807ebd2981d593cddd0080856873139aa40",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
waybar-0.12.0/flake.nix 0000664 0000000 0000000 00000004457 14756031653 0014705 0 ustar 00root root 0000000 0000000 {
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; [
clang-tools
gdb
]);
};
});
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;
});
};
}
waybar-0.12.0/include/ 0000775 0000000 0000000 00000000000 14756031653 0014514 5 ustar 00root root 0000000 0000000 waybar-0.12.0/include/AAppIconLabel.hpp 0000664 0000000 0000000 00000001407 14756031653 0017621 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#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
waybar-0.12.0/include/AIconLabel.hpp 0000664 0000000 0000000 00000001072 14756031653 0017156 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#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
waybar-0.12.0/include/ALabel.hpp 0000664 0000000 0000000 00000002143 14756031653 0016345 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#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 &alts, uint16_t max = 0);
protected:
Gtk::Label label_;
std::string format_;
const std::chrono::seconds 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 submenus_;
std::map menuActionsMap_;
static void handleGtkMenuEvent(GtkMenuItem *menuitem, gpointer data);
};
} // namespace waybar
waybar-0.12.0/include/AModule.hpp 0000664 0000000 0000000 00000006621 14756031653 0016560 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#include
#include
#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;
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_;
private:
bool handleUserEvent(GdkEventButton *const &ev);
const bool isTooltip;
const bool isExpand;
bool hasUserEvents_;
std::vector pid_;
gdouble distance_scrolled_y_;
gdouble distance_scrolled_x_;
std::map eventActionMap_;
static const inline std::map, 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
waybar-0.12.0/include/ASlider.hpp 0000664 0000000 0000000 00000000562 14756031653 0016553 0 ustar 00root root 0000000 0000000 #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 waybar-0.12.0/include/IModule.hpp 0000664 0000000 0000000 00000000433 14756031653 0016563 0 ustar 00root root 0000000 0000000 #pragma once
#include
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
waybar-0.12.0/include/bar.hpp 0000664 0000000 0000000 00000005635 14756031653 0016002 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "AModule.hpp"
#include "group.hpp"
#include "xdg-output-unstable-v1-client-protocol.h"
namespace waybar {
class Factory;
struct waybar_output {
Glib::RefPtr monitor;
std::string name;
std::string identifier;
std::unique_ptr 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;
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 handleSignal(int);
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> modules_left_;
std::vector> modules_center_;
std::vector> modules_right_;
#ifdef HAVE_SWAY
using BarIpcClient = modules::sway::BarIpcClient;
std::unique_ptr _ipc_client;
#endif
std::vector> modules_all_;
};
} // namespace waybar
waybar-0.12.0/include/client.hpp 0000664 0000000 0000000 00000004121 14756031653 0016501 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#include
#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_app;
Glib::RefPtr 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> bars;
Config config;
std::string bar_id;
private:
Client() = default;
const std::string getStyle(const std::string &style, std::optional appearance);
void bindInterfaces();
void handleOutput(struct waybar_output &output);
auto setupCss(const std::string &css_file) -> void;
struct waybar_output &getOutput(void *);
std::vector 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 monitor);
void handleMonitorRemoved(Glib::RefPtr monitor);
void handleDeferredMonitorRemoval(Glib::RefPtr monitor);
Glib::RefPtr style_context_;
Glib::RefPtr css_provider_;
std::unique_ptr portal;
std::list outputs_;
std::unique_ptr m_cssReloadHelper;
std::string m_cssFile;
};
} // namespace waybar
waybar-0.12.0/include/config.hpp 0000664 0000000 0000000 00000002220 14756031653 0016466 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#ifndef SYSCONFDIR
#define SYSCONFDIR "/etc"
#endif
namespace waybar {
class Config {
public:
static const std::vector 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 findConfigPath(
const std::vector &names, const std::vector &dirs = CONFIG_DIRS);
static std::vector tryExpandPath(const std::string &base,
const std::string &filename);
Config() = default;
void load(const std::string &config);
Json::Value &getConfig() { return config_; }
std::vector 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_);
std::string config_file_;
Json::Value config_;
};
} // namespace waybar
waybar-0.12.0/include/factory.hpp 0000664 0000000 0000000 00000000522 14756031653 0016673 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
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
waybar-0.12.0/include/group.hpp 0000664 0000000 0000000 00000001622 14756031653 0016362 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#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;
void show_group();
void hide_group();
};
} // namespace waybar
waybar-0.12.0/include/modules/ 0000775 0000000 0000000 00000000000 14756031653 0016164 5 ustar 00root root 0000000 0000000 waybar-0.12.0/include/modules/backlight.hpp 0000664 0000000 0000000 00000001154 14756031653 0020626 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#include
#include
#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
waybar-0.12.0/include/modules/backlight_slider.hpp 0000664 0000000 0000000 00000000746 14756031653 0022176 0 ustar 00root root 0000000 0000000 #pragma once
#include
#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 waybar-0.12.0/include/modules/battery.hpp 0000664 0000000 0000000 00000002346 14756031653 0020354 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#if defined(__linux__)
#include
#endif
#include
#include
#include
#include
#include "ALabel.hpp"
#include "bar.hpp"
#include "util/sleeper_thread.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 getInfos();
const std::string formatTimeRemaining(float hoursRemaining);
void setBarClass(std::string&);
int global_watch;
std::map batteries_;
fs::path adapter_;
int battery_watch_fd_;
int global_watch_fd_;
std::mutex battery_list_mutex_;
std::string old_status_;
bool warnFirstTime_{true};
const Bar& bar_;
util::SleeperThread thread_;
util::SleeperThread thread_battery_update_;
util::SleeperThread thread_timer_;
};
} // namespace waybar::modules
waybar-0.12.0/include/modules/bluetooth.hpp 0000664 0000000 0000000 00000005003 14756031653 0020700 0 ustar 00root root 0000000 0000000 #pragma once
#include "ALabel.hpp"
#ifdef WANT_RFKILL
#include "util/rfkill.hpp"
#endif
#include
#include
#include
#include
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 name; // just use alias instead
std::string alias;
std::optional icon;
bool paired;
bool trusted;
bool blocked;
bool connected;
bool services_resolved;
// NOTE: experimental feature in bluez
std::optional 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;
auto getDeviceProperties(GDBusObject*, DeviceInfo&) -> bool;
auto getControllerProperties(GDBusObject*, ControllerInfo&) -> bool;
// Returns std::nullopt if no controller could be found
auto findCurController() -> std::optional;
auto findConnectedDevices(const std::string&, std::vector&) -> void;
#ifdef WANT_RFKILL
util::Rfkill rfkill_;
#endif
const std::unique_ptr manager_;
std::string state_;
std::optional cur_controller_;
std::vector connected_devices_;
DeviceInfo cur_focussed_device_;
std::string device_enumerate_;
std::vector device_preference_;
};
} // namespace waybar::modules
waybar-0.12.0/include/modules/cava.hpp 0000664 0000000 0000000 00000002771 14756031653 0017616 0 ustar 00root root 0000000 0000000 #pragma once
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace cava {
extern "C" {
#include
}
} // namespace cava
namespace waybar::modules {
using namespace std::literals::chrono_literals;
class Cava final : public ALabel {
public:
Cava(const std::string&, const Json::Value&);
virtual ~Cava();
auto update() -> void override;
auto doAction(const std::string& name) -> void override;
private:
util::SleeperThread thread_;
util::SleeperThread thread_fetch_input_;
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_; //{new cava_plan{}};
// Cava API to read audio source
cava::ptr input_source_;
// Delay to handle audio source
std::chrono::milliseconds frame_time_milsec_{1s};
// Text to display
std::string text_{""};
int rePaint_{1};
std::chrono::seconds fetch_input_delay_{4};
std::chrono::seconds suspend_silence_delay_{0};
bool silence_{false};
bool hide_on_silence_{false};
std::string format_silent_{""};
int sleep_counter_{0};
// Cava method
void pause_resume();
// ModuleActionMap
static inline std::map actionMap_{
{"mode", &waybar::modules::Cava::pause_resume}};
};
} // namespace waybar::modules
waybar-0.12.0/include/modules/cffi.hpp 0000664 0000000 0000000 00000003041 14756031653 0017602 0 ustar 00root root 0000000 0000000 #pragma once
#include
#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 init = nullptr;
std::function deinit = nullptr;
std::function refresh = [](void*, int) {};
std::function doAction = [](void*, const char*) {};
std::function update = [](void*) {};
} hooks_;
};
} // namespace waybar::modules
waybar-0.12.0/include/modules/clock.hpp 0000664 0000000 0000000 00000006613 14756031653 0017776 0 ustar 00root root 0000000 0000000 #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 m_tooltip_; // tooltip as a separate Gtk::Label
bool query_tlp_cb(int, int, bool, const Glib::RefPtr& 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 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
months cldCurrShift_{0}; // calendar months shift
int cldShift_{1}; // calendar months shift factor
year_month_day cldYearShift_; // calendar Year mode. Cached ymd
std::string cldYearCached_; // calendar Year mode. Cached calendar
year_month cldMonShift_; // calendar Month mode. Cached ym
std::string cldMonCached_; // calendar Month mode. Cached calendar
day cldBaseDay_{0}; // calendar Cached day. Is used when today is changing(midnight)
std::string cldText_{""}; // calendar text to print
CldMode cldMode_{CldMode::MONTH};
auto get_calendar(const year_month_day& today, const year_month_day& ymd, const time_zone* tz)
-> const std::string;
// get local time zone
auto local_zone() -> const time_zone*;
// time zoned time in tooltip
const bool tzInTooltip_; // if need to print time zones text
std::vector tzList_; // time zones list
int tzCurrIdx_; // current time zone index for tzList_
std::string tzText_{""}; // time zones text to print
util::SleeperThread thread_;
// ordinal date in tooltip
const bool ordInTooltip_;
std::string ordText_{""};
auto get_ordinal_date(const year_month_day& today) -> std::string;
auto getTZtext(sys_seconds now) -> std::string;
auto first_day_of_week() -> 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 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
waybar-0.12.0/include/modules/cpu.hpp 0000664 0000000 0000000 00000001007 14756031653 0017462 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#include
#include
#include
#include
#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> prev_times_;
util::SleeperThread thread_;
};
} // namespace waybar::modules
waybar-0.12.0/include/modules/cpu_frequency.hpp 0000664 0000000 0000000 00000001243 14756031653 0021545 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#include
#include
#include
#include
#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 getCpuFrequency();
private:
static std::vector parseCpuFrequencies();
util::SleeperThread thread_;
};
} // namespace waybar::modules
waybar-0.12.0/include/modules/cpu_usage.hpp 0000664 0000000 0000000 00000001427 14756031653 0020654 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#include
#include
#include
#include
#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::string> getCpuUsage(
std::vector>&);
private:
static std::vector> parseCpuinfo();
std::vector> prev_times_;
util::SleeperThread thread_;
};
} // namespace waybar::modules
waybar-0.12.0/include/modules/custom.hpp 0000664 0000000 0000000 00000002106 14756031653 0020206 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#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_;
const bool tooltip_format_enabled_;
std::vector class_;
int percentage_;
FILE* fp_;
int pid_;
util::command::res output_;
util::JsonParser parser_;
util::SleeperThread thread_;
};
} // namespace waybar::modules
waybar-0.12.0/include/modules/disk.hpp 0000664 0000000 0000000 00000001016 14756031653 0017625 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#include
#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
waybar-0.12.0/include/modules/dwl/ 0000775 0000000 0000000 00000000000 14756031653 0016752 5 ustar 00root root 0000000 0000000 waybar-0.12.0/include/modules/dwl/tags.hpp 0000664 0000000 0000000 00000001560 14756031653 0020423 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#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 buttons_;
struct zdwl_ipc_output_v2 *output_status_;
};
} /* namespace waybar::modules::dwl */
waybar-0.12.0/include/modules/dwl/window.hpp 0000664 0000000 0000000 00000001504 14756031653 0020772 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include
#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
waybar-0.12.0/include/modules/gamemode.hpp 0000664 0000000 0000000 00000005001 14756031653 0020447 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include