diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 00000000..3d4cf260
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,29 @@
+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 }
diff --git a/.envrc.sample b/.envrc
similarity index 100%
rename from .envrc.sample
rename to .envrc
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 00000000..a89e734f
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,65 @@
+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)"
diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml
new file mode 100644
index 00000000..0fad47c4
--- /dev/null
+++ b/.github/workflows/clang-format.yml
@@ -0,0 +1,22 @@
+name: clang-format
+
+on: [push, pull_request]
+
+concurrency:
+ group: ${{ github.workflow }}-format-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ # TODO: bump to clang 19 release
+ # - uses: DoozyX/clang-format-lint-action@v0.18.2
+ - uses: DoozyX/clang-format-lint-action@558090054b3f39e3d6af24f0cd73b319535da809
+ name: clang-format
+ with:
+ source: "."
+ extensions: "hpp,h,cpp,c"
+ style: "file:.clang-format"
+ clangFormatVersion: 19
diff --git a/.github/workflows/clang-tidy.yml.bak b/.github/workflows/clang-tidy.yml.bak
new file mode 100644
index 00000000..ec67fb7e
--- /dev/null
+++ b/.github/workflows/clang-tidy.yml.bak
@@ -0,0 +1,39 @@
+name: clang-tidy
+
+on: [push, pull_request]
+
+concurrency:
+ group: ${{ github.workflow }}-tidy-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ container:
+ image: alexays/waybar:debian
+ steps:
+ - uses: actions/checkout@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
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 00000000..0e7e2944
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,34 @@
+name: Build and Push Docker Image
+
+on:
+ workflow_dispatch:
+ schedule:
+ # run monthly
+ - cron: '0 0 1 * *'
+
+jobs:
+ build-and-push:
+ runs-on: ubuntu-latest
+ if: github.event_name != 'schedule' || github.repository == 'Alexays/Waybar'
+ strategy:
+ fail-fast: false # don't fail the other jobs if one of the images fails to build
+ matrix:
+ os: [ 'alpine', 'archlinux', 'debian', 'fedora', 'gentoo', 'opensuse' ]
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@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 }}
diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml
index 550f9453..e45a8dc4 100644
--- a/.github/workflows/freebsd.yml
+++ b/.github/workflows/freebsd.yml
@@ -1,29 +1,35 @@
name: freebsd
-on: [ push, pull_request ]
+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 macos-12 runner
+ build:
+ # Run actions in a FreeBSD VM on the ubuntu runner
# https://github.com/actions/runner/issues/385 - for FreeBSD runner support
- # https://github.com/actions/virtual-environments/issues/4060 - for lack of VirtualBox on MacOS 11 runners
- runs-on: macos-12
+ runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
- - name: Test in FreeBSD VM
- uses: vmactions/freebsd-vm@v0
- with:
- mem: 2048
- usesh: true
- prepare: |
- export CPPFLAGS=-isystem/usr/local/include LDFLAGS=-L/usr/local/lib # sndio
- sed -i '' 's/quarterly/latest/' /etc/pkg/FreeBSD.conf
- pkg install -y git # subprojects/date
- pkg install -y catch evdev-proto gtk-layer-shell gtkmm30 jsoncpp \
- libdbusmenu libevdev libfmt libmpdclient libudev-devd meson \
- pkgconf pulseaudio scdoc sndio spdlog wayland-protocols upower \
- libinotify
- run: |
- meson build -Dman-pages=enabled
- ninja -C build
- meson test -C build --no-rebuild --print-errorlogs --suite waybar
+ - 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.3"
+ 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
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
new file mode 100644
index 00000000..94dc42d2
--- /dev/null
+++ b/.github/workflows/labeler.yml
@@ -0,0 +1,19 @@
+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 }}
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
deleted file mode 100644
index d11d2ccc..00000000
--- a/.github/workflows/lint.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: Linter
-
-on: [push, pull_request]
-
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - uses: DoozyX/clang-format-lint-action@v0.13
- with:
- source: '.'
- extensions: 'h,cpp,c'
- clangFormatVersion: 12
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index 1c00a5ed..c36f68e2 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -2,9 +2,14 @@ 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
@@ -13,10 +18,7 @@ jobs:
- fedora
- opensuse
- gentoo
- cpp_std: [c++17]
- include:
- - distro: fedora
- cpp_std: c++20
+ cpp_std: [c++20]
runs-on: ubuntu-latest
container:
@@ -25,7 +27,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: configure
- run: meson -Dman-pages=enabled -Dcpp_std=${{matrix.cpp_std}} build
+ run: meson setup -Dman-pages=enabled -Dcpp_std=${{matrix.cpp_std}} build
- name: build
run: ninja -C build
- name: test
diff --git a/.github/workflows/nix-tests.yml b/.github/workflows/nix-tests.yml
new file mode 100644
index 00000000..8859ecb5
--- /dev/null
+++ b/.github/workflows/nix-tests.yml
@@ -0,0 +1,17 @@
+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
diff --git a/.github/workflows/nix-update-flake-lock.yml b/.github/workflows/nix-update-flake-lock.yml
new file mode 100644
index 00000000..a1679ead
--- /dev/null
+++ b/.github/workflows/nix-update-flake-lock.yml
@@ -0,0 +1,22 @@
+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
diff --git a/.gitignore b/.gitignore
index 4d7babf3..b486237e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,3 +44,9 @@ packagecache
*.out
*.app
/.direnv/
+
+# Nix
+result
+result-*
+
+.ccls-cache
diff --git a/Dockerfiles/archlinux b/Dockerfiles/archlinux
index cab4146b..d4274a46 100644
--- a/Dockerfiles/archlinux
+++ b/Dockerfiles/archlinux
@@ -3,5 +3,5 @@
FROM archlinux:base-devel
RUN pacman -Syu --noconfirm && \
- pacman -S --noconfirm git meson base-devel libinput wayland wayland-protocols pixman libxkbcommon mesa gtkmm3 jsoncpp pugixml scdoc libpulse libdbusmenu-gtk3 libmpdclient gobject-introspection libxkbcommon playerctl && \
+ 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
diff --git a/Dockerfiles/debian b/Dockerfiles/debian
index 578588c7..c2584ccf 100644
--- a/Dockerfiles/debian
+++ b/Dockerfiles/debian
@@ -1,7 +1,49 @@
# vim: ft=Dockerfile
-FROM debian:sid
+FROM debian:sid-slim
-RUN apt-get update && \
- apt-get install -y build-essential meson ninja-build git pkg-config libinput10 libpugixml-dev libinput-dev wayland-protocols libwayland-client0 libwayland-cursor0 libwayland-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev libxkbcommon-dev libudev-dev libpixman-1-dev libgtkmm-3.0-dev libjsoncpp-dev scdoc libdbusmenu-gtk3-dev libnl-3-dev libnl-genl-3-dev libpulse-dev libmpdclient-dev gobject-introspection libgirepository1.0-dev libxkbcommon-dev libxkbregistry-dev libxkbregistry0 libplayerctl-dev && \
- apt-get clean
+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
diff --git a/Dockerfiles/fedora b/Dockerfiles/fedora
index 5892159c..9dc0337b 100644
--- a/Dockerfiles/fedora
+++ b/Dockerfiles/fedora
@@ -29,6 +29,6 @@ RUN dnf install -y @c-development \
'pkgconfig(wayland-client)' \
'pkgconfig(wayland-cursor)' \
'pkgconfig(wayland-protocols)' \
- 'pkgconfig(wireplumber-0.4)' \
+ 'pkgconfig(wireplumber-0.5)' \
'pkgconfig(xkbregistry)' && \
dnf clean all -y
diff --git a/Dockerfiles/gentoo b/Dockerfiles/gentoo
index f2ec0dc9..f7023825 100644
--- a/Dockerfiles/gentoo
+++ b/Dockerfiles/gentoo
@@ -6,6 +6,6 @@ RUN export FEATURES="-ipc-sandbox -network-sandbox -pid-sandbox -sandbox -usersa
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 \
+ USE="wayland gtk3 gtk -doc X pulseaudio minimal" emerge dev-vcs/git dev-libs/wayland dev-libs/wayland-protocols dev-cpp/gtkmm:3.0 x11-libs/libxkbcommon \
x11-libs/gtk+:3 dev-libs/libdbusmenu dev-libs/libnl sys-power/upower media-libs/libpulse dev-libs/libevdev media-libs/libmpdclient \
media-sound/sndio gui-libs/gtk-layer-shell app-text/scdoc media-sound/playerctl dev-libs/iniparser sci-libs/fftw
diff --git a/Dockerfiles/opensuse b/Dockerfiles/opensuse
index bdb42fbf..6ac3e058 100644
--- a/Dockerfiles/opensuse
+++ b/Dockerfiles/opensuse
@@ -6,4 +6,4 @@ 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
+ 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
diff --git a/LICENSE b/LICENSE
index 41eb81d8..d1bad1b4 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2018 Alex
+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
diff --git a/Makefile b/Makefile
index b1dbfc6e..3bb11199 100644
--- a/Makefile
+++ b/Makefile
@@ -3,11 +3,11 @@
default: build
build:
- meson build
+ meson setup build
ninja -C build
build-debug:
- meson build --buildtype=debug
+ meson setup build --buildtype=debug
ninja -C build
install: build
diff --git a/README.md b/README.md
index 718ceb44..5266e916 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,24 @@
# Waybar [](LICENSE) [](https://paypal.me/ARouillard)

> Highly customizable Wayland bar for Sway and Wlroots based compositors.
-> Available in Arch [community](https://www.archlinux.org/packages/extra/x86_64/waybar/) or
-[AUR](https://aur.archlinux.org/packages/waybar-git/), [Gentoo](https://packages.gentoo.org/packages/gui-apps/waybar), [openSUSE](https://build.opensuse.org/package/show/X11:Wayland/waybar), and [Alpine Linux](https://pkgs.alpinelinux.org/packages?name=waybar).
+> 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 (Focused window name)
-- DWL (Tags) [requires dwl ipc patch](https://github.com/djpohly/dwl/wiki/ipc)
+- 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
@@ -36,7 +38,7 @@
Waybar is available from a number of Linux distributions:
-[](https://repology.org/project/waybar/versions)
+[](https://repology.org/project/waybar/versions)
An Ubuntu PPA with more recent versions is available
[here](https://launchpad.net/~nschloe/+archive/ubuntu/waybar).
@@ -47,7 +49,7 @@ An Ubuntu PPA with more recent versions is available
```bash
$ git clone https://github.com/Alexays/Waybar
$ cd Waybar
-$ meson build
+$ meson setup build
$ ninja -C build
$ ./build/waybar
# If you want to install it
diff --git a/default.nix b/default.nix
index 2cccff28..6466507b 100644
--- a/default.nix
+++ b/default.nix
@@ -1,10 +1,9 @@
-(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
+(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
diff --git a/flake.lock b/flake.lock
index b10c9bf7..34545ed4 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,32 +1,13 @@
{
"nodes": {
- "devshell": {
- "inputs": {
- "flake-utils": "flake-utils",
- "nixpkgs": "nixpkgs"
- },
- "locked": {
- "lastModified": 1676293499,
- "narHash": "sha256-uIOTlTxvrXxpKeTvwBI1JGDGtCxMXE3BI0LFwoQMhiQ=",
- "owner": "numtide",
- "repo": "devshell",
- "rev": "71e3022e3ab20bbf1342640547ef5bc14fb43bf4",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "devshell",
- "type": "github"
- }
- },
"flake-compat": {
"flake": false,
"locked": {
- "lastModified": 1673956053,
- "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
+ "lastModified": 1747046372,
+ "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
- "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
+ "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
@@ -35,59 +16,13 @@
"type": "github"
}
},
- "flake-utils": {
- "locked": {
- "lastModified": 1642700792,
- "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
- "flake-utils_2": {
- "locked": {
- "lastModified": 1676283394,
- "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
"nixpkgs": {
"locked": {
- "lastModified": 1643381941,
- "narHash": "sha256-pHTwvnN4tTsEKkWlXQ8JMY423epos8wUOhthpwJjtpc=",
+ "lastModified": 1748460289,
+ "narHash": "sha256-7doLyJBzCllvqX4gszYtmZUToxKvMUrg45EUWaUYmBg=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "5efc8ca954272c4376ac929f4c5ffefcc20551d5",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixpkgs-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs_2": {
- "locked": {
- "lastModified": 1676300157,
- "narHash": "sha256-1HjRzfp6LOLfcj/HJHdVKWAkX9QRAouoh6AjzJiIerU=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "545c7a31e5dedea4a6d372712a18e00ce097d462",
+ "rev": "96ec055edbe5ee227f28cdbc3f1ddf1df5965102",
"type": "github"
},
"original": {
@@ -99,10 +34,8 @@
},
"root": {
"inputs": {
- "devshell": "devshell",
"flake-compat": "flake-compat",
- "flake-utils": "flake-utils_2",
- "nixpkgs": "nixpkgs_2"
+ "nixpkgs": "nixpkgs"
}
}
},
diff --git a/flake.nix b/flake.nix
index 97f4ed57..7c7a2281 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,93 +1,128 @@
{
- description = "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
+ description = "Highly customizable Wayland bar for Sway and Wlroots based compositors";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
- devshell.url = "github:numtide/devshell";
- flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
- outputs = { self, flake-utils, devshell, nixpkgs, flake-compat }:
+ outputs =
+ { self, nixpkgs, ... }:
let
inherit (nixpkgs) lib;
- genSystems = lib.genAttrs [
- "x86_64-linux"
- ];
+ genSystems =
+ func:
+ lib.genAttrs
+ [
+ "x86_64-linux"
+ "aarch64-linux"
+ ]
+ (
+ system:
+ func (
+ import nixpkgs {
+ inherit system;
+ overlays = with self.overlays; [
+ waybar
+ ];
+ }
+ )
+ );
- pkgsFor = genSystems (system:
- import nixpkgs {
- inherit system;
- });
-
- mkDate = longDate: (lib.concatStringsSep "-" [
- (builtins.substring 0 4 longDate)
- (builtins.substring 4 2 longDate)
- (builtins.substring 6 2 longDate)
- ]);
+ mkDate =
+ longDate:
+ (lib.concatStringsSep "-" [
+ (builtins.substring 0 4 longDate)
+ (builtins.substring 4 2 longDate)
+ (builtins.substring 6 2 longDate)
+ ]);
in
{
- overlays.default = _: prev: {
- waybar = prev.callPackage ./nix/default.nix {
- version = prev.waybar.version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
- };
- };
- packages = genSystems
- (system:
- (self.overlays.default null pkgsFor.${system})
- // {
- default = self.packages.${system}.waybar;
- });
- } //
- flake-utils.lib.eachDefaultSystem (system: {
- devShell =
- let pkgs = import nixpkgs {
- inherit system;
+ devShells = genSystems (pkgs: {
+ default = pkgs.mkShell {
+ name = "waybar-shell";
- overlays = [ devshell.overlay ];
+ # inherit attributes from upstream nixpkgs derivation
+ inherit (pkgs.waybar)
+ buildInputs
+ depsBuildBuild
+ depsBuildBuildPropagated
+ depsBuildTarget
+ depsBuildTargetPropagated
+ depsHostHost
+ depsHostHostPropagated
+ depsTargetTarget
+ depsTargetTargetPropagated
+ propagatedBuildInputs
+ propagatedNativeBuildInputs
+ strictDeps
+ ;
+
+ # overrides for local development
+ nativeBuildInputs =
+ pkgs.waybar.nativeBuildInputs
+ ++ (with pkgs; [
+ nixfmt-rfc-style
+ clang-tools
+ gdb
+ ]);
};
- in
- pkgs.devshell.mkShell {
- imports = [ "${pkgs.devshell.extraModulesDir}/language/c.nix" ];
- commands = [
+ });
+
+ formatter = genSystems (
+ pkgs:
+ pkgs.treefmt.withConfig {
+ settings = [
{
- package = pkgs.devshell.cli;
- help = "Per project developer environments";
+ formatter = {
+ clang-format = {
+ options = [ "-i" ];
+ command = lib.getExe' pkgs.clang-tools "clang-format";
+ excludes = [ ];
+ includes = [
+ "*.c"
+ "*.cpp"
+ "*.h"
+ "*.hpp"
+ ];
+ };
+ nixfmt = {
+ command = lib.getExe pkgs.nixfmt-rfc-style;
+ includes = [ "*.nix" ];
+ };
+ };
+ tree-root-file = ".git/index";
}
];
- devshell.packages = with pkgs; [
- clang-tools
- gdb
- # from nativeBuildInputs
- gnumake
- meson
- ninja
- pkg-config
- scdoc
- ] ++ (map lib.getDev [
- # from buildInputs
- wayland wlroots gtkmm3 libsigcxx jsoncpp spdlog gtk-layer-shell howard-hinnant-date libxkbcommon
- # optional dependencies
- gobject-introspection glib playerctl python3.pkgs.pygobject3
- libevdev libinput libjack2 libmpdclient playerctl libnl
- libpulseaudio sndio sway libdbusmenu-gtk3 udev upower wireplumber
+ }
+ );
- # from propagated build inputs?
- at-spi2-atk atkmm cairo cairomm catch2 fmt_8 fontconfig
- gdk-pixbuf glibmm gtk3 harfbuzz pango pangomm wayland-protocols
- ]);
- env = with pkgs; [
- { name = "CPLUS_INCLUDE_PATH"; prefix = "$DEVSHELL_DIR/include"; }
- { name = "PKG_CONFIG_PATH"; prefix = "$DEVSHELL_DIR/lib/pkgconfig"; }
- { name = "PKG_CONFIG_PATH"; prefix = "$DEVSHELL_DIR/share/pkgconfig"; }
- { name = "PATH"; prefix = "${wayland.bin}/bin"; }
- { name = "LIBRARY_PATH"; prefix = "${lib.getLib sndio}/lib"; }
- { name = "LIBRARY_PATH"; prefix = "${lib.getLib zlib}/lib"; }
- { name = "LIBRARY_PATH"; prefix = "${lib.getLib howard-hinnant-date}/lib"; }
- ];
+ 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;
+ });
+ };
}
diff --git a/include/AAppIconLabel.hpp b/include/AAppIconLabel.hpp
new file mode 100644
index 00000000..d09ab14a
--- /dev/null
+++ b/include/AAppIconLabel.hpp
@@ -0,0 +1,27 @@
+#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
diff --git a/include/ALabel.hpp b/include/ALabel.hpp
index 888c65a8..a1aae9da 100644
--- a/include/ALabel.hpp
+++ b/include/ALabel.hpp
@@ -27,6 +27,10 @@ class ALabel : public AModule {
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
diff --git a/include/AModule.hpp b/include/AModule.hpp
index 03bf25e1..2fcbfc23 100644
--- a/include/AModule.hpp
+++ b/include/AModule.hpp
@@ -2,6 +2,7 @@
#include
#include
+#include
#include
#include
@@ -11,14 +12,19 @@ namespace waybar {
class AModule : public IModule {
public:
- virtual ~AModule();
+ static constexpr const char *MODULE_CLASS = "module";
+
+ ~AModule() override;
auto update() -> void override;
- virtual auto refresh(int) -> void{};
+ 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
@@ -28,34 +34,49 @@ class AModule : public IModule {
enum SCROLL_DIR { NONE, UP, DOWN, LEFT, RIGHT };
SCROLL_DIR getScrollDir(GdkEventScroll *e);
- bool tooltipEnabled();
+ bool tooltipEnabled() const;
std::vector pid_children_;
const std::string name_;
const Json::Value &config_;
Gtk::EventBox event_box_;
+ virtual void setCursor(Gdk::CursorType const &c);
+
virtual bool handleToggle(GdkEventButton *const &ev);
+ virtual bool handleMouseEnter(GdkEventCrossing *const &ev);
+ virtual bool handleMouseLeave(GdkEventCrossing *const &ev);
virtual bool handleScroll(GdkEventScroll *);
+ virtual bool handleRelease(GdkEventButton *const &ev);
+ GObject *menu_;
private:
+ bool handleUserEvent(GdkEventButton *const &ev);
+ const bool isTooltip;
+ const bool isExpand;
+ bool hasUserEvents_;
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"}};
};
diff --git a/include/ASlider.hpp b/include/ASlider.hpp
new file mode 100644
index 00000000..44cde507
--- /dev/null
+++ b/include/ASlider.hpp
@@ -0,0 +1,19 @@
+#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
\ No newline at end of file
diff --git a/include/bar.hpp b/include/bar.hpp
index 7c5525f6..9b407abf 100644
--- a/include/bar.hpp
+++ b/include/bar.hpp
@@ -9,9 +9,11 @@
#include
#include
+#include
#include
#include "AModule.hpp"
+#include "group.hpp"
#include "xdg-output-unstable-v1-client-protocol.h"
namespace waybar {
@@ -52,35 +54,19 @@ class BarIpcClient;
}
#endif // HAVE_SWAY
-class BarSurface {
- protected:
- BarSurface() = default;
-
+class Bar : public sigc::trackable {
public:
- virtual void setExclusiveZone(bool enable) = 0;
- virtual void setLayer(bar_layer layer) = 0;
- virtual void setMargins(const struct bar_margins &margins) = 0;
- virtual void setPassThrough(bool enable) = 0;
- virtual void setPosition(const std::string_view &position) = 0;
- virtual void setSize(uint32_t width, uint32_t height) = 0;
- virtual void commit(){};
-
- virtual ~BarSurface() = default;
-};
-
-class Bar {
- public:
- using bar_mode_map = std::map;
+ using bar_mode_map = std::map;
static const bar_mode_map PRESET_MODES;
- static const std::string_view MODE_DEFAULT;
- static const std::string_view MODE_INVISIBLE;
+ 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_view &);
- void setVisible(bool visible);
+ void setMode(const std::string &mode);
+ void setVisible(bool value);
void toggle();
void handleSignal(int);
@@ -88,8 +74,12 @@ class Bar {
Json::Value config;
struct wl_surface *surface;
bool visible = true;
- bool vertical = false;
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;
@@ -98,16 +88,24 @@ class Bar {
private:
void onMap(GdkEventAny *);
auto setupWidgets() -> void;
- void getModules(const Factory &, const std::string &, Gtk::Box *);
+ 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};
- std::unique_ptr surface_impl_;
+ struct bar_margins margins_;
+ uint32_t width_, height_;
+ bool passthrough_;
+
Gtk::Box left_;
Gtk::Box center_;
Gtk::Box right_;
diff --git a/include/client.hpp b/include/client.hpp
index aaba3b6b..0e68f002 100644
--- a/include/client.hpp
+++ b/include/client.hpp
@@ -7,8 +7,9 @@
#include "bar.hpp"
#include "config.hpp"
+#include "util/css_reload_helper.hpp"
+#include "util/portal.hpp"
-struct zwlr_layer_shell_v1;
struct zwp_idle_inhibitor_v1;
struct zwp_idle_inhibit_manager_v1;
@@ -24,7 +25,6 @@ class Client {
Glib::RefPtr gdk_display;
struct wl_display *wl_display = nullptr;
struct wl_registry *registry = nullptr;
- struct zwlr_layer_shell_v1 *layer_shell = nullptr;
struct zxdg_output_manager_v1 *xdg_output_manager = nullptr;
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager = nullptr;
std::vector> bars;
@@ -33,7 +33,7 @@ class Client {
private:
Client() = default;
- const std::string getStyle(const std::string &style);
+ 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;
@@ -52,7 +52,10 @@ class Client {
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
diff --git a/include/config.hpp b/include/config.hpp
index 66945542..5256bb46 100644
--- a/include/config.hpp
+++ b/include/config.hpp
@@ -20,6 +20,9 @@ class Config {
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);
diff --git a/include/factory.hpp b/include/factory.hpp
index 90d0ac1d..f805aab5 100644
--- a/include/factory.hpp
+++ b/include/factory.hpp
@@ -1,104 +1,17 @@
#pragma once
#include
-#if defined(HAVE_CHRONO_TIMEZONES) || defined(HAVE_LIBDATE)
-#include "modules/clock.hpp"
-#else
-#include "modules/simpleclock.hpp"
-#endif
-#ifdef HAVE_SWAY
-#include "modules/sway/language.hpp"
-#include "modules/sway/mode.hpp"
-#include "modules/sway/scratchpad.hpp"
-#include "modules/sway/window.hpp"
-#include "modules/sway/workspaces.hpp"
-#endif
-#ifdef HAVE_WLR
-#include "modules/wlr/taskbar.hpp"
-#include "modules/wlr/workspace_manager.hpp"
-#endif
-#ifdef HAVE_RIVER
-#include "modules/river/layout.hpp"
-#include "modules/river/mode.hpp"
-#include "modules/river/tags.hpp"
-#include "modules/river/window.hpp"
-#endif
-#ifdef HAVE_DWL
-#include "modules/dwl/tags.hpp"
-#endif
-#ifdef HAVE_HYPRLAND
-#include "modules/hyprland/backend.hpp"
-#include "modules/hyprland/language.hpp"
-#include "modules/hyprland/submap.hpp"
-#include "modules/hyprland/window.hpp"
-#include "modules/hyprland/workspaces.hpp"
-#endif
-#if defined(__FreeBSD__) || (defined(__linux__) && !defined(NO_FILESYSTEM))
-#include "modules/battery.hpp"
-#endif
-#if defined(HAVE_CPU_LINUX) || defined(HAVE_CPU_BSD)
-#include "modules/cpu.hpp"
-#endif
-#include "modules/idle_inhibitor.hpp"
-#if defined(HAVE_MEMORY_LINUX) || defined(HAVE_MEMORY_BSD)
-#include "modules/memory.hpp"
-#endif
-#include "modules/disk.hpp"
-#ifdef HAVE_DBUSMENU
-#include "modules/sni/tray.hpp"
-#endif
-#ifdef HAVE_MPRIS
-#include "modules/mpris/mpris.hpp"
-#endif
-#ifdef HAVE_LIBNL
-#include "modules/network.hpp"
-#endif
-#ifdef HAVE_LIBUDEV
-#include "modules/backlight.hpp"
-#endif
-#ifdef HAVE_LIBEVDEV
-#include "modules/keyboard_state.hpp"
-#endif
-#ifdef HAVE_GAMEMODE
-#include "modules/gamemode.hpp"
-#endif
-#ifdef HAVE_UPOWER
-#include "modules/upower/upower.hpp"
-#endif
-#ifdef HAVE_LIBPULSE
-#include "modules/pulseaudio.hpp"
-#endif
-#ifdef HAVE_LIBMPDCLIENT
-#include "modules/mpd/mpd.hpp"
-#endif
-#ifdef HAVE_LIBSNDIO
-#include "modules/sndio.hpp"
-#endif
-#ifdef HAVE_GIO_UNIX
-#include "modules/bluetooth.hpp"
-#include "modules/inhibitor.hpp"
-#endif
-#ifdef HAVE_LIBJACK
-#include "modules/jack.hpp"
-#endif
-#ifdef HAVE_LIBWIREPLUMBER
-#include "modules/wireplumber.hpp"
-#endif
-#ifdef HAVE_LIBCAVA
-#include "modules/cava.hpp"
-#endif
-#include "bar.hpp"
-#include "modules/custom.hpp"
-#include "modules/image.hpp"
-#include "modules/temperature.hpp"
-#include "modules/user.hpp"
+
+#include
namespace waybar {
+class Bar;
+
class Factory {
public:
Factory(const Bar& bar, const Json::Value& config);
- AModule* makeModule(const std::string& name) const;
+ AModule* makeModule(const std::string& name, const std::string& pos) const;
private:
const Bar& bar_;
diff --git a/include/group.hpp b/include/group.hpp
index 60e31c96..5ce331a8 100644
--- a/include/group.hpp
+++ b/include/group.hpp
@@ -5,18 +5,33 @@
#include
#include "AModule.hpp"
-#include "bar.hpp"
-#include "factory.hpp"
+#include "gtkmm/revealer.h"
namespace waybar {
class Group : public AModule {
public:
- Group(const std::string&, const std::string&, const Json::Value&, bool);
- ~Group() = default;
+ Group(const std::string &, const std::string &, const Json::Value &, bool);
+ ~Group() override = default;
auto update() -> void override;
- operator Gtk::Widget&() 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
diff --git a/include/modules/backlight.hpp b/include/modules/backlight.hpp
index ade4bc78..110cd434 100644
--- a/include/modules/backlight.hpp
+++ b/include/modules/backlight.hpp
@@ -1,14 +1,14 @@
#pragma once
+#include
#include
#include
#include
#include
#include "ALabel.hpp"
-#include "giomm/dbusproxy.h"
+#include "util/backlight_backend.hpp"
#include "util/json.hpp"
-#include "util/sleeper_thread.hpp"
struct udev;
struct udev_device;
@@ -16,54 +16,17 @@ struct udev_device;
namespace waybar::modules {
class Backlight : public ALabel {
- class BacklightDev {
- public:
- BacklightDev() = default;
- BacklightDev(std::string name, int actual, int max, bool powered);
- std::string_view name() const;
- int get_actual() const;
- void set_actual(int actual);
- int get_max() const;
- void set_max(int max);
- bool get_powered() const;
- void set_powered(bool powered);
- friend inline bool operator==(const BacklightDev &lhs, const BacklightDev &rhs) {
- return lhs.name_ == rhs.name_ && lhs.actual_ == rhs.actual_ && lhs.max_ == rhs.max_;
- }
-
- private:
- std::string name_;
- int actual_ = 1;
- int max_ = 1;
- bool powered_ = true;
- };
-
public:
Backlight(const std::string &, const Json::Value &);
- virtual ~Backlight();
+ virtual ~Backlight() = default;
auto update() -> void override;
- private:
- template
- static const BacklightDev *best_device(ForwardIt first, ForwardIt last, std::string_view);
- template
- static void upsert_device(ForwardIt first, ForwardIt last, Inserter inserter, udev_device *dev);
- template
- static void enumerate_devices(ForwardIt first, ForwardIt last, Inserter inserter, udev *udev);
-
bool handleScroll(GdkEventScroll *e) override;
const std::string preferred_device_;
- static constexpr int EPOLL_MAX_EVENTS = 16;
- std::optional previous_best_;
std::string previous_format_;
- std::mutex udev_thread_mutex_;
- std::vector devices_;
- // thread must destruct before shared data
- util::SleeperThread udev_thread_;
-
- Glib::RefPtr login_proxy_;
+ util::BacklightBackend backend;
};
} // namespace waybar::modules
diff --git a/include/modules/backlight_slider.hpp b/include/modules/backlight_slider.hpp
new file mode 100644
index 00000000..437c53c4
--- /dev/null
+++ b/include/modules/backlight_slider.hpp
@@ -0,0 +1,24 @@
+#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
\ No newline at end of file
diff --git a/include/modules/battery.hpp b/include/modules/battery.hpp
index 017b0e48..8e1a2ad2 100644
--- a/include/modules/battery.hpp
+++ b/include/modules/battery.hpp
@@ -1,11 +1,8 @@
#pragma once
-#ifdef FILESYSTEM_EXPERIMENTAL
-#include
-#else
-#include
-#endif
#include
+
+#include
#if defined(__linux__)
#include
#endif
@@ -16,19 +13,16 @@
#include
#include "ALabel.hpp"
+#include "bar.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
-#ifdef FILESYSTEM_EXPERIMENTAL
-namespace fs = std::experimental::filesystem;
-#else
namespace fs = std::filesystem;
-#endif
class Battery : public ALabel {
public:
- Battery(const std::string&, const Json::Value&);
+ Battery(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Battery();
auto update() -> void override;
@@ -38,8 +32,9 @@ class Battery : public ALabel {
void refreshBatteries();
void worker();
const std::string getAdapterStatus(uint8_t capacity) const;
- const std::tuple getInfos();
+ std::tuple getInfos();
const std::string formatTimeRemaining(float hoursRemaining);
+ void setBarClass(std::string&);
int global_watch;
std::map batteries_;
@@ -49,6 +44,7 @@ class Battery : public ALabel {
std::mutex battery_list_mutex_;
std::string old_status_;
bool warnFirstTime_{true};
+ const Bar& bar_;
util::SleeperThread thread_;
util::SleeperThread thread_battery_update_;
diff --git a/include/modules/bluetooth.hpp b/include/modules/bluetooth.hpp
index 18481e31..b89383a0 100644
--- a/include/modules/bluetooth.hpp
+++ b/include/modules/bluetooth.hpp
@@ -49,6 +49,9 @@ class Bluetooth : public ALabel {
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*,
@@ -59,7 +62,8 @@ class Bluetooth : public ALabel {
auto getDeviceProperties(GDBusObject*, DeviceInfo&) -> bool;
auto getControllerProperties(GDBusObject*, ControllerInfo&) -> bool;
- auto findCurController(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
@@ -68,7 +72,7 @@ class Bluetooth : public ALabel {
const std::unique_ptr manager_;
std::string state_;
- ControllerInfo cur_controller_;
+ std::optional cur_controller_;
std::vector connected_devices_;
DeviceInfo cur_focussed_device_;
std::string device_enumerate_;
diff --git a/include/modules/cava.hpp b/include/modules/cava.hpp
index d4da2b77..1a88c7b7 100644
--- a/include/modules/cava.hpp
+++ b/include/modules/cava.hpp
@@ -3,9 +3,20 @@
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
+namespace cava {
extern "C" {
+// Need sdl_glsl output feature to be enabled on libcava
+#ifndef SDL_GLSL
+#define SDL_GLSL
+#endif
+
#include
+
+#ifdef SDL_GLSL
+#undef SDL_GLSL
+#endif
}
+} // namespace cava
namespace waybar::modules {
using namespace std::literals::chrono_literals;
@@ -21,13 +32,13 @@ class Cava final : public ALabel {
util::SleeperThread thread_;
util::SleeperThread thread_fetch_input_;
- struct error_s error_ {}; // cava errors
- struct config_params prm_ {}; // cava parameters
- struct audio_raw audio_raw_ {}; // cava handled raw audio data(is based on audio_data)
- struct audio_data audio_data_ {}; // cava audio data
- struct cava_plan* plan_; //{new cava_plan{}};
+ 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
- ptr input_source_;
+ cava::ptr input_source_;
// Delay to handle audio source
std::chrono::milliseconds frame_time_milsec_{1s};
// Text to display
@@ -36,11 +47,13 @@ class Cava final : public ALabel {
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_{
+ static inline std::map actionMap_{
{"mode", &waybar::modules::Cava::pause_resume}};
};
} // namespace waybar::modules
diff --git a/include/modules/cffi.hpp b/include/modules/cffi.hpp
new file mode 100644
index 00000000..85f12989
--- /dev/null
+++ b/include/modules/cffi.hpp
@@ -0,0 +1,60 @@
+#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
diff --git a/include/modules/clock.hpp b/include/modules/clock.hpp
index fab38111..e34b7a8e 100644
--- a/include/modules/clock.hpp
+++ b/include/modules/clock.hpp
@@ -6,67 +6,86 @@
namespace waybar::modules {
-const std::string kCalendarPlaceholder = "calendar";
-const std::string KTimezonedTimeListPlaceholder = "timezoned_time_list";
-
-enum class WeeksSide {
- LEFT,
- RIGHT,
- HIDDEN,
-};
+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& name) -> void override;
+ auto doAction(const std::string&) -> void override;
private:
- util::SleeperThread thread_;
- std::locale locale_;
- std::vector time_zones_;
- int current_time_zone_idx_;
- bool is_calendar_in_tooltip_;
- bool is_timezoned_list_in_tooltip_;
-
- auto first_day_of_week() -> date::weekday;
- const date::time_zone* current_timezone();
- bool is_timezone_fixed();
- auto timezones_text(std::chrono::system_clock::time_point* now) -> std::string;
-
- /*Calendar properties*/
- WeeksSide cldWPos_{WeeksSide::HIDDEN};
+ 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
+ date::months cldCurrShift_{0}; // calendar months shift
+ int cldShift_{1}; // calendar months shift factor
+ date::year_month_day cldYearShift_; // calendar Year mode. Cached ymd
+ std::string cldYearCached_; // calendar Year mode. Cached calendar
+ date::year_month cldMonShift_; // calendar Month mode. Cached ym
+ std::string cldMonCached_; // calendar Month mode. Cached calendar
+ date::day cldBaseDay_{0}; // calendar Cached day. Is used when today is changing(midnight)
+ std::string cldText_{""}; // calendar text to print
CldMode cldMode_{CldMode::MONTH};
- uint cldMonCols_{3}; // Count of the month in the row
- int cldMonColLen_{20}; // Length of the month column
- int cldWnLen_{3}; // Length of the week number
- date::year_month_day cldYearShift_;
- date::year_month cldMonShift_;
- date::months cldCurrShift_{0};
- date::months cldShift_{0};
- std::string cldYearCached_{};
- std::string cldMonCached_{};
- date::day cldBaseDay_{0};
- /*Calendar functions*/
- auto get_calendar(const date::zoned_seconds& now, const date::zoned_seconds& wtime)
- -> std::string;
- /*Clock actions*/
+ auto get_calendar(const date::year_month_day& today, const date::year_month_day& ymd,
+ const date::time_zone* tz) -> const std::string;
+
+ // get local time zone
+ auto local_zone() -> const date::time_zone*;
+
+ // time zoned time in tooltip
+ const bool tzInTooltip_; // if need to print time zones text
+ std::vector 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 date::year_month_day& today) -> std::string;
+
+ auto getTZtext(date::sys_seconds now) -> std::string;
+ auto first_day_of_week() -> date::weekday;
+ // Module actions
void cldModeSwitch();
void cldShift_up();
void cldShift_down();
+ void cldShift_reset();
void tz_up();
void tz_down();
-
- // ModuleActionMap
- static inline std::map actionMap_{
+ // 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
diff --git a/include/modules/cpu.hpp b/include/modules/cpu.hpp
index a5235486..7f78c165 100644
--- a/include/modules/cpu.hpp
+++ b/include/modules/cpu.hpp
@@ -21,12 +21,6 @@ class Cpu : public ALabel {
auto update() -> void override;
private:
- double getCpuLoad();
- std::tuple, std::string> getCpuUsage();
- std::tuple getCpuFrequency();
- std::vector> parseCpuinfo();
- std::vector parseCpuFrequencies();
-
std::vector> prev_times_;
util::SleeperThread thread_;
diff --git a/include/modules/cpu_frequency.hpp b/include/modules/cpu_frequency.hpp
new file mode 100644
index 00000000..49ca1b86
--- /dev/null
+++ b/include/modules/cpu_frequency.hpp
@@ -0,0 +1,32 @@
+#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
diff --git a/include/modules/cpu_usage.hpp b/include/modules/cpu_usage.hpp
new file mode 100644
index 00000000..c93a1734
--- /dev/null
+++ b/include/modules/cpu_usage.hpp
@@ -0,0 +1,35 @@
+#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
diff --git a/include/modules/custom.hpp b/include/modules/custom.hpp
index a6024a84..6c17c6e4 100644
--- a/include/modules/custom.hpp
+++ b/include/modules/custom.hpp
@@ -14,7 +14,7 @@ namespace waybar::modules {
class Custom : public ALabel {
public:
- Custom(const std::string&, const std::string&, const Json::Value&);
+ Custom(const std::string&, const std::string&, const Json::Value&, const std::string&);
virtual ~Custom();
auto update() -> void override;
void refresh(int /*signal*/) override;
@@ -22,6 +22,7 @@ class Custom : public ALabel {
private:
void delayWorker();
void continuousWorker();
+ void waitingWorker();
void parseOutputRaw();
void parseOutputJson();
void handleEvent();
@@ -29,10 +30,12 @@ class Custom : public ALabel {
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_;
diff --git a/include/modules/disk.hpp b/include/modules/disk.hpp
index 2a307c9e..1b4f3176 100644
--- a/include/modules/disk.hpp
+++ b/include/modules/disk.hpp
@@ -20,6 +20,9 @@ class Disk : public ALabel {
private:
util::SleeperThread thread_;
std::string path_;
+ std::string unit_;
+
+ float calc_specific_divisor(const std::string divisor);
};
} // namespace waybar::modules
diff --git a/include/modules/dwl/window.hpp b/include/modules/dwl/window.hpp
new file mode 100644
index 00000000..43586399
--- /dev/null
+++ b/include/modules/dwl/window.hpp
@@ -0,0 +1,38 @@
+#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
diff --git a/include/modules/hyprland/backend.hpp b/include/modules/hyprland/backend.hpp
index e23b1582..cfd0b258 100644
--- a/include/modules/hyprland/backend.hpp
+++ b/include/modules/hyprland/backend.hpp
@@ -1,10 +1,11 @@
#pragma once
-#include
+
+#include
#include
-#include
#include
#include
#include
+#include
#include "util/json.hpp"
@@ -18,23 +19,31 @@ class EventHandler {
class IPC {
public:
- IPC() { startIPC(); }
+ IPC();
+ ~IPC();
+ static IPC& inst();
- void registerForIPC(const std::string&, EventHandler*);
- void unregisterForIPC(EventHandler*);
+ void registerForIPC(const std::string& ev, EventHandler* ev_handler);
+ void unregisterForIPC(EventHandler* handler);
- std::string getSocket1Reply(const std::string& rq);
+ static std::string getSocket1Reply(const std::string& rq);
Json::Value getSocket1JsonReply(const std::string& rq);
+ static std::filesystem::path getSocketFolder(const char* instanceSig);
+
+ protected:
+ static std::filesystem::path socketFolder_;
private:
- void startIPC();
+ void socketListener();
void parseIPC(const std::string&);
- std::mutex callbackMutex;
+ std::thread ipcThread_;
+ std::mutex callbackMutex_;
util::JsonParser parser_;
- std::list> callbacks;
+ std::list> callbacks_;
+ int socketfd_; // the hyprland socket file descriptor
+ bool running_ = true;
};
-inline std::unique_ptr gIPC;
inline bool modulesReady = false;
}; // namespace waybar::modules::hyprland
diff --git a/include/modules/hyprland/language.hpp b/include/modules/hyprland/language.hpp
index 30789d06..ec59e5c3 100644
--- a/include/modules/hyprland/language.hpp
+++ b/include/modules/hyprland/language.hpp
@@ -1,5 +1,9 @@
+#pragma once
+
#include
+#include
+
#include "ALabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
@@ -26,13 +30,15 @@ class Language : public waybar::ALabel, public EventHandler {
std::string short_description;
};
- auto getLayout(const std::string&) -> Layout;
+ static auto getLayout(const std::string&) -> Layout;
std::mutex mutex_;
const Bar& bar_;
util::JsonParser parser_;
Layout layout_;
+
+ IPC& m_ipc;
};
} // namespace waybar::modules::hyprland
diff --git a/include/modules/hyprland/submap.hpp b/include/modules/hyprland/submap.hpp
index e2a84981..7e3425ef 100644
--- a/include/modules/hyprland/submap.hpp
+++ b/include/modules/hyprland/submap.hpp
@@ -1,5 +1,9 @@
+#pragma once
+
#include
+#include
+
#include "ALabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
@@ -10,17 +14,22 @@ namespace waybar::modules::hyprland {
class Submap : public waybar::ALabel, public EventHandler {
public:
Submap(const std::string&, const waybar::Bar&, const Json::Value&);
- virtual ~Submap();
+ ~Submap() override;
auto update() -> void override;
private:
- void onEvent(const std::string&) override;
+ auto parseConfig(const Json::Value&) -> void;
+ void onEvent(const std::string& ev) override;
std::mutex mutex_;
const Bar& bar_;
util::JsonParser parser_;
std::string submap_;
+ bool always_on_ = false;
+ std::string default_submap_ = "Default";
+
+ IPC& m_ipc;
};
} // namespace waybar::modules::hyprland
diff --git a/include/modules/hyprland/window.hpp b/include/modules/hyprland/window.hpp
index 950be05f..2be64594 100644
--- a/include/modules/hyprland/window.hpp
+++ b/include/modules/hyprland/window.hpp
@@ -1,16 +1,20 @@
+#pragma once
+
#include
-#include "ALabel.hpp"
+#include
+
+#include "AAppIconLabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "util/json.hpp"
namespace waybar::modules::hyprland {
-class Window : public waybar::ALabel, public EventHandler {
+class Window : public waybar::AAppIconLabel, public EventHandler {
public:
Window(const std::string&, const waybar::Bar&, const Json::Value&);
- virtual ~Window();
+ ~Window() override;
auto update() -> void override;
@@ -21,26 +25,43 @@ class Window : public waybar::ALabel, public EventHandler {
std::string last_window;
std::string last_window_title;
- static auto parse(const Json::Value&) -> Workspace;
+ static auto parse(const Json::Value& value) -> Workspace;
};
- auto getActiveWorkspace(const std::string&) -> Workspace;
- auto getActiveWorkspace() -> Workspace;
- void onEvent(const std::string&) override;
+ struct WindowData {
+ bool floating;
+ int monitor = -1;
+ std::string class_name;
+ std::string initial_class_name;
+ std::string title;
+ std::string initial_title;
+ bool fullscreen;
+ bool grouped;
+
+ static auto parse(const Json::Value&) -> WindowData;
+ };
+
+ static auto getActiveWorkspace(const std::string&) -> Workspace;
+ static auto getActiveWorkspace() -> Workspace;
+ void onEvent(const std::string& ev) override;
void queryActiveWorkspace();
void setClass(const std::string&, bool enable);
- bool separate_outputs;
+ bool separateOutputs_;
std::mutex mutex_;
const Bar& bar_;
util::JsonParser parser_;
- std::string last_title_;
+ WindowData windowData_;
Workspace workspace_;
- std::string solo_class_;
- std::string last_solo_class_;
+ std::string soloClass_;
+ std::string lastSoloClass_;
bool solo_;
- bool all_floating_;
+ bool allFloating_;
+ bool swallowing_;
bool fullscreen_;
+ bool focused_;
+
+ IPC& m_ipc;
};
} // namespace waybar::modules::hyprland
diff --git a/include/modules/hyprland/windowcreationpayload.hpp b/include/modules/hyprland/windowcreationpayload.hpp
new file mode 100644
index 00000000..e4180ed9
--- /dev/null
+++ b/include/modules/hyprland/windowcreationpayload.hpp
@@ -0,0 +1,61 @@
+#pragma once
+
+#include
+#include
+#include
+
+#include
+#include
+#include