diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 66c465ba..0e7e2944 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -1,14 +1,15 @@
name: Build and Push Docker Image
on:
+ workflow_dispatch:
schedule:
- # run every night at midnight
- - cron: '0 0 * * *'
+ # run monthly
+ - cron: '0 0 1 * *'
jobs:
build-and-push:
runs-on: ubuntu-latest
- if: github.repository == 'Alexays/Waybar'
+ 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:
diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml
index ca0dcbc8..b9114c31 100644
--- a/.github/workflows/freebsd.yml
+++ b/.github/workflows/freebsd.yml
@@ -14,14 +14,14 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Test in FreeBSD VM
- uses: cross-platform-actions/action@v0.25.0
+ uses: cross-platform-actions/action@v0.28.0
timeout-minutes: 180
env:
CPPFLAGS: '-isystem/usr/local/include'
LDFLAGS: '-L/usr/local/lib'
with:
operating_system: freebsd
- version: "14.1"
+ version: "14.2"
environment_variables: CPPFLAGS LDFLAGS
sync_files: runner-to-vm
run: |
diff --git a/Dockerfiles/debian b/Dockerfiles/debian
index f479062d..c2584ccf 100644
--- a/Dockerfiles/debian
+++ b/Dockerfiles/debian
@@ -1,6 +1,6 @@
# vim: ft=Dockerfile
-FROM debian:sid
+FROM debian:sid-slim
RUN apt update && \
apt install --no-install-recommends --no-install-suggests -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/README.md b/README.md
index 5266e916..4edf2253 100644
--- a/README.md
+++ b/README.md
@@ -116,6 +116,36 @@ sudo apt install \
libxkbregistry-dev
```
+On Arch, you can use this command:
+
+```
+pacman -S \
+ gtkmm3 \
+ jsoncpp \
+ libsigc++ \
+ fmt \
+ wayland \
+ chrono-date \
+ spdlog \
+ gtk3 \
+ gobject-introspection \
+ libgirepository \
+ libpulse \
+ libnl \
+ libappindicator-gtk3 \
+ libdbusmenu-gtk3 \
+ libmpdclient \
+ sndio \
+ libevdev \
+ libxkbcommon \
+ upower \
+ meson \
+ cmake \
+ scdoc \
+ wayland-protocols \
+ glib2-devel
+```
+
Contributions welcome!
Have fun :)
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 27290894..0818b622 100644
--- a/flake.lock
+++ b/flake.lock
@@ -3,11 +3,11 @@
"flake-compat": {
"flake": false,
"locked": {
- "lastModified": 1733328505,
- "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
+ "lastModified": 1747046372,
+ "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
- "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
+ "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
@@ -18,11 +18,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1743315132,
- "narHash": "sha256-6hl6L/tRnwubHcA4pfUUtk542wn2Om+D4UnDhlDW9BE=",
+ "lastModified": 1753694789,
+ "narHash": "sha256-cKgvtz6fKuK1Xr5LQW/zOUiAC0oSQoA9nOISB0pJZqM=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "52faf482a3889b7619003c0daec593a1912fddc1",
+ "rev": "dc9637876d0dcc8c9e5e22986b857632effeb727",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index 571c4934..7c7a2281 100644
--- a/flake.nix
+++ b/flake.nix
@@ -9,47 +9,96 @@
};
};
- outputs = { self, nixpkgs, ... }:
+ 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
- ];
- }));
+ 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)
- ]);
+ 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";
+ 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;
+ # 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
- ]);
+ # overrides for local development
+ nativeBuildInputs =
+ pkgs.waybar.nativeBuildInputs
+ ++ (with pkgs; [
+ nixfmt-rfc-style
+ clang-tools
+ gdb
+ ]);
+ };
+ });
+
+ formatter = genSystems (
+ pkgs:
+ pkgs.treefmt.withConfig {
+ settings = [
+ {
+ formatter = {
+ clang-format = {
+ options = [ "-i" ];
+ command = lib.getExe' pkgs.clang-tools "clang-format";
+ excludes = [ ];
+ includes = [
+ "*.c"
+ "*.cpp"
+ "*.h"
+ "*.hpp"
+ ];
};
- });
+ nixfmt = {
+ command = lib.getExe pkgs.nixfmt-rfc-style;
+ includes = [ "*.nix" ];
+ };
+ };
+ tree-root-file = ".git/index";
+ }
+ ];
+ }
+ );
overlays = {
default = self.overlays.waybar;
@@ -58,11 +107,15 @@
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");
+ (builtins.head (
+ builtins.split "'" (
+ builtins.elemAt (builtins.split " version: '" (builtins.readFile ./meson.build)) 2
+ )
+ ))
+ + "+date="
+ + (mkDate (self.lastModifiedDate or "19700101"))
+ + "_"
+ + (self.shortRev or "dirty");
};
};
};
diff --git a/include/AModule.hpp b/include/AModule.hpp
index 2ffc429c..2fcbfc23 100644
--- a/include/AModule.hpp
+++ b/include/AModule.hpp
@@ -36,6 +36,7 @@ class AModule : public IModule {
SCROLL_DIR getScrollDir(GdkEventScroll *e);
bool tooltipEnabled() const;
+ std::vector pid_children_;
const std::string name_;
const Json::Value &config_;
Gtk::EventBox event_box_;
@@ -54,7 +55,6 @@ class AModule : public IModule {
const bool isTooltip;
const bool isExpand;
bool hasUserEvents_;
- std::vector pid_;
gdouble distance_scrolled_y_;
gdouble distance_scrolled_x_;
std::map eventActionMap_;
diff --git a/include/bar.hpp b/include/bar.hpp
index 9b407abf..9953b1f5 100644
--- a/include/bar.hpp
+++ b/include/bar.hpp
@@ -14,6 +14,7 @@
#include "AModule.hpp"
#include "group.hpp"
+#include "util/kill_signal.hpp"
#include "xdg-output-unstable-v1-client-protocol.h"
namespace waybar {
@@ -68,7 +69,11 @@ class Bar : public sigc::trackable {
void setMode(const std::string &mode);
void setVisible(bool value);
void toggle();
+ void show();
+ void hide();
void handleSignal(int);
+ util::KillSignalAction getOnSigusr1Action();
+ util::KillSignalAction getOnSigusr2Action();
struct waybar_output *output;
Json::Value config;
@@ -118,6 +123,9 @@ class Bar : public sigc::trackable {
std::unique_ptr _ipc_client;
#endif
std::vector> modules_all_;
+
+ waybar::util::KillSignalAction onSigusr1 = util::SIGNALACTION_DEFAULT_SIGUSR1;
+ waybar::util::KillSignalAction onSigusr2 = util::SIGNALACTION_DEFAULT_SIGUSR2;
};
} // namespace waybar
diff --git a/include/config.hpp b/include/config.hpp
index 5256bb46..3490c3f1 100644
--- a/include/config.hpp
+++ b/include/config.hpp
@@ -35,6 +35,7 @@ class Config {
void setupConfig(Json::Value &dst, const std::string &config_file, int depth);
void resolveConfigIncludes(Json::Value &config, int depth);
void mergeConfig(Json::Value &a_config_, Json::Value &b_config_);
+ static std::optional findIncludePath(const std::string &name);
std::string config_file_;
diff --git a/include/modules/battery.hpp b/include/modules/battery.hpp
index 8e1a2ad2..c593e59b 100644
--- a/include/modules/battery.hpp
+++ b/include/modules/battery.hpp
@@ -35,6 +35,7 @@ class Battery : public ALabel {
std::tuple getInfos();
const std::string formatTimeRemaining(float hoursRemaining);
void setBarClass(std::string&);
+ void processEvents(std::string& state, std::string& status, uint8_t capacity);
int global_watch;
std::map batteries_;
@@ -43,6 +44,7 @@ class Battery : public ALabel {
int global_watch_fd_;
std::mutex battery_list_mutex_;
std::string old_status_;
+ std::string last_event_;
bool warnFirstTime_{true};
const Bar& bar_;
diff --git a/include/modules/clock.hpp b/include/modules/clock.hpp
index 40b4f80e..e34b7a8e 100644
--- a/include/modules/clock.hpp
+++ b/include/modules/clock.hpp
@@ -38,39 +38,39 @@ class Clock final : public ALabel {
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
+ 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};
- auto get_calendar(const year_month_day& today, const year_month_day& ymd, const time_zone* tz)
- -> const std::string;
+ 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 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
+ 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 get_ordinal_date(const date::year_month_day& today) -> std::string;
- auto getTZtext(sys_seconds now) -> std::string;
- auto first_day_of_week() -> weekday;
+ auto getTZtext(date::sys_seconds now) -> std::string;
+ auto first_day_of_week() -> date::weekday;
// Module actions
void cldModeSwitch();
void cldShift_up();
diff --git a/include/modules/ext/workspace_manager.hpp b/include/modules/ext/workspace_manager.hpp
new file mode 100644
index 00000000..0607b5ba
--- /dev/null
+++ b/include/modules/ext/workspace_manager.hpp
@@ -0,0 +1,143 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+
+#include