pax_global_header 0000666 0000000 0000000 00000000064 14646030705 0014517 g ustar 00root root 0000000 0000000 52 comment=15e1547661bfc5fe9b3d45bb0d9cea11cf07db7f
waybar-0.10.4/ 0000775 0000000 0000000 00000000000 14646030705 0013066 5 ustar 00root root 0000000 0000000 waybar-0.10.4/.clang-format 0000664 0000000 0000000 00000000122 14646030705 0015434 0 ustar 00root root 0000000 0000000 ---
BasedOnStyle: Google
AlignConsecutiveDeclarations: false
ColumnLimit: 100
...
waybar-0.10.4/.clang-tidy 0000664 0000000 0000000 00000002565 14646030705 0015132 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.10.4/.editorconfig 0000664 0000000 0000000 00000000470 14646030705 0015544 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.10.4/.envrc 0000664 0000000 0000000 00000000012 14646030705 0014175 0 ustar 00root root 0000000 0000000 use flake
waybar-0.10.4/.github/ 0000775 0000000 0000000 00000000000 14646030705 0014426 5 ustar 00root root 0000000 0000000 waybar-0.10.4/.github/FUNDING.yml 0000664 0000000 0000000 00000000144 14646030705 0016242 0 ustar 00root root 0000000 0000000 # These are supported funding model platforms
github: Alexays
custom: https://paypal.me/ARouillard
waybar-0.10.4/.github/labeler.yml 0000664 0000000 0000000 00000001546 14646030705 0016565 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.10.4/.github/workflows/ 0000775 0000000 0000000 00000000000 14646030705 0016463 5 ustar 00root root 0000000 0000000 waybar-0.10.4/.github/workflows/clang-format.yml 0000664 0000000 0000000 00000000705 14646030705 0021562 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"
clangFormatVersion: 16
waybar-0.10.4/.github/workflows/clang-tidy.yml.bak 0000664 0000000 0000000 00000003104 14646030705 0021773 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.10.4/.github/workflows/docker.yml 0000664 0000000 0000000 00000001535 14646030705 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
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.10.4/.github/workflows/freebsd.yml 0000664 0000000 0000000 00000002373 14646030705 0020625 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.10.4/.github/workflows/labeler.yml 0000664 0000000 0000000 00000000577 14646030705 0020625 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.10.4/.github/workflows/linux.yml 0000664 0000000 0000000 00000001333 14646030705 0020345 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.10.4/.github/workflows/nix-tests.yml 0000664 0000000 0000000 00000000705 14646030705 0021146 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.10.4/.github/workflows/nix-update-flake-lock.yml 0000664 0000000 0000000 00000001061 14646030705 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
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.10.4/.gitignore 0000664 0000000 0000000 00000000655 14646030705 0015064 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.10.4/.gitmodules 0000664 0000000 0000000 00000000152 14646030705 0015241 0 ustar 00root root 0000000 0000000 [submodule "package/archlinux"]
path = package/archlinux
url = https://aur.archlinux.org/waybar-git.git
waybar-0.10.4/Dockerfiles/ 0000775 0000000 0000000 00000000000 14646030705 0015320 5 ustar 00root root 0000000 0000000 waybar-0.10.4/Dockerfiles/alpine 0000664 0000000 0000000 00000000460 14646030705 0016513 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.10.4/Dockerfiles/archlinux 0000664 0000000 0000000 00000000623 14646030705 0017241 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.10.4/Dockerfiles/debian 0000664 0000000 0000000 00000002240 14646030705 0016463 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.10.4/Dockerfiles/fedora 0000664 0000000 0000000 00000001700 14646030705 0016501 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.10.4/Dockerfiles/gentoo 0000664 0000000 0000000 00000001310 14646030705 0016531 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.10.4/Dockerfiles/opensuse 0000664 0000000 0000000 00000001164 14646030705 0017106 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.10.4/LICENSE 0000664 0000000 0000000 00000002045 14646030705 0014074 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2018 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.10.4/Makefile 0000664 0000000 0000000 00000000625 14646030705 0014531 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.10.4/README.md 0000664 0000000 0000000 00000006061 14646030705 0014350 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)
- DWL (Tags, Focused window name) [requires dwl ipc patch](https://github.com/djpohly/dwl/wiki/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.10.4/default.nix 0000664 0000000 0000000 00000000461 14646030705 0015233 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.10.4/flake.lock 0000664 0000000 0000000 00000002036 14646030705 0015023 0 ustar 00root root 0000000 0000000 {
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1720957393,
"narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "693bc46d169f5af9c992095736e82c3488bf7dbb",
"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.10.4/flake.nix 0000664 0000000 0000000 00000004457 14646030705 0014702 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.10.4/include/ 0000775 0000000 0000000 00000000000 14646030705 0014511 5 ustar 00root root 0000000 0000000 waybar-0.10.4/include/AAppIconLabel.hpp 0000664 0000000 0000000 00000001407 14646030705 0017616 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.10.4/include/AIconLabel.hpp 0000664 0000000 0000000 00000001072 14646030705 0017153 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.10.4/include/ALabel.hpp 0000664 0000000 0000000 00000002143 14646030705 0016342 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.10.4/include/AModule.hpp 0000664 0000000 0000000 00000006532 14646030705 0016556 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;
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;
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.10.4/include/ASlider.hpp 0000664 0000000 0000000 00000000562 14646030705 0016550 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.10.4/include/IModule.hpp 0000664 0000000 0000000 00000000433 14646030705 0016560 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.10.4/include/bar.hpp 0000664 0000000 0000000 00000005625 14646030705 0015776 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 {
std::optional layer;
bool exclusive;
bool passthrough;
bool visible;
};
#ifdef HAVE_SWAY
namespace modules::sway {
class BarIpcClient;
}
#endif // HAVE_SWAY
class Bar {
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 visible);
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.10.4/include/client.hpp 0000664 0000000 0000000 00000004121 14646030705 0016476 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.10.4/include/config.hpp 0000664 0000000 0000000 00000001770 14646030705 0016474 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);
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.10.4/include/factory.hpp 0000664 0000000 0000000 00000000522 14646030705 0016670 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.10.4/include/group.hpp 0000664 0000000 0000000 00000001621 14646030705 0016356 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);
virtual ~Group() = 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.10.4/include/modules/ 0000775 0000000 0000000 00000000000 14646030705 0016161 5 ustar 00root root 0000000 0000000 waybar-0.10.4/include/modules/backlight.hpp 0000664 0000000 0000000 00000001154 14646030705 0020623 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.10.4/include/modules/backlight_slider.hpp 0000664 0000000 0000000 00000000746 14646030705 0022173 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.10.4/include/modules/battery.hpp 0000664 0000000 0000000 00000002346 14646030705 0020351 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.10.4/include/modules/bluetooth.hpp 0000664 0000000 0000000 00000005003 14646030705 0020675 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.10.4/include/modules/cava.hpp 0000664 0000000 0000000 00000002733 14646030705 0017611 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};
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.10.4/include/modules/cffi.hpp 0000664 0000000 0000000 00000003041 14646030705 0017577 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.10.4/include/modules/clock.hpp 0000664 0000000 0000000 00000006612 14646030705 0017772 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.10.4/include/modules/cpu.hpp 0000664 0000000 0000000 00000001007 14646030705 0017457 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.10.4/include/modules/cpu_frequency.hpp 0000664 0000000 0000000 00000001243 14646030705 0021542 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.10.4/include/modules/cpu_usage.hpp 0000664 0000000 0000000 00000001427 14646030705 0020651 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.10.4/include/modules/custom.hpp 0000664 0000000 0000000 00000002106 14646030705 0020203 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.10.4/include/modules/disk.hpp 0000664 0000000 0000000 00000001016 14646030705 0017622 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.10.4/include/modules/dwl/ 0000775 0000000 0000000 00000000000 14646030705 0016747 5 ustar 00root root 0000000 0000000 waybar-0.10.4/include/modules/dwl/tags.hpp 0000664 0000000 0000000 00000001560 14646030705 0020420 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.10.4/include/modules/dwl/window.hpp 0000664 0000000 0000000 00000001504 14646030705 0020767 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.10.4/include/modules/gamemode.hpp 0000664 0000000 0000000 00000005001 14646030705 0020444 0 ustar 00root root 0000000 0000000 #pragma once
#include
#include