Compare commits

...

553 Commits

Author SHA1 Message Date
blankie 9c2695133c
mpd: Add a format option for artist + title, or filename 2024-03-26 10:38:58 +11:00
Alexis Rouillard b652b4296d
Merge pull request #3066 from MauroGuida/master
fix(sway/workspaces): Visible class doesn't work on visible and empty workspaces
2024-03-25 19:03:06 +01:00
Alexis Rouillard e8627e140c
Merge pull request #3068 from ordy/master
(Fix) Alt format on group modules
2024-03-25 19:01:48 +01:00
Alexis Rouillard d6c0d59224
Merge pull request #3081 from iynaix/master
nix: build against wireplumber 0.5
2024-03-25 17:13:11 +01:00
Lin Xianyi 5056309963 nix: build against wireplumber 0.5 2024-03-25 22:47:37 +08:00
Alexis Rouillard 487ab23259
Merge pull request #3076 from cptpcrd/reload-config
Fix reloading config
2024-03-24 22:06:56 +01:00
cptpcrd e3ceaf63d1 Fix reloading config
Fully clear the configuration before reloading, so that when the config
is read and merged in there are no existing values which mergeConfig
refuses to overwrite.
2024-03-24 15:41:19 -04:00
Alexis Rouillard c6cbf57a38
Merge pull request #3067 from encbar5/restore_intertible_month_scroll
Fix clock on-scroll value not being used for calendar
2024-03-24 17:19:27 +01:00
encbar5 abd7ca2a1e Fix clock on-scroll value not being used for calendar, which was broken by 86a3898 2024-03-24 10:37:31 -05:00
Sano 70ef406d6b check for group modules array in key conversion 2024-03-23 18:39:22 +01:00
Mauro Guida 7cd2a6c003 fix(sway/workspaces): Visible class doesn't work on visible and empty workspaces 2024-03-23 13:02:39 +01:00
Alexis Rouillard cc084f5f86
Merge pull request #3028 from bartelsielski/upower-warning_level
Upower warning level
2024-03-22 23:22:56 +01:00
Alex 19f3ce6f85 fix: lint 2024-03-22 23:21:57 +01:00
Alexis Rouillard 32e241dc47
Merge pull request #2917 from alttabber/master
Add always on option for hyprland/submap
2024-03-22 23:21:17 +01:00
Alexis Rouillard c4907a6065
Merge pull request #3005 from eyusupov/dwl-title
Add dwl/window module
2024-03-22 23:20:26 +01:00
Alexis Rouillard f228c13802
Merge pull request #2638 from staticssleever668/fix_mold_linking
refactor(backlight): use concrete types for some helper functions
2024-03-22 23:19:49 +01:00
Alexis Rouillard e30ddda23a
Merge pull request #2987 from tomben13/master
[hyprland/workspaces] New options to change on click behaviour and active workspace status
2024-03-22 23:16:57 +01:00
Alexis Rouillard 38634a0ca8
Merge pull request #3034 from wispl/master
Add empty workspace style for Sway
2024-03-22 23:13:29 +01:00
Alex fe0716bf39 fix: lint 2024-03-22 23:13:10 +01:00
Alexis Rouillard 9d95eaaac4
Merge pull request #2919 from tokyovigilante/wireplumber-0.5
Update Wireplumber API to 0.5
2024-03-22 23:12:07 +01:00
Ryan Walklin 2326727ccb Update Wireplumber API to 0.5
The WP component loader API has changed to be asynchronous, so implement a (GAsyncReadyCallback)-based loader to manage them. Logging integration change was required for 0.5.0 RCs but not for the 0.5.0 release.

Fix clang-tidy and clang-format warnings. Note these are significantly wider than the changes for 0.5.0 so optional beyond the existing patchset.
2024-03-21 13:37:03 +13:00
Alexis Rouillard 1ecca055f7
Merge pull request #3051 from MauroGuida/master
fix(sway/workspaces): visible class doesn't work
2024-03-20 15:26:31 +01:00
Mauro Guida c841bf567b fix(sway/workspaces): visible class doesn't work 2024-03-20 15:03:25 +01:00
Alexis Rouillard 49a13ab28f
Merge pull request #3049 from MauroGuida/master
fix(wlr/taskbar): crash on taskbar drag and drop event
2024-03-20 14:02:41 +01:00
Mauro Guida 6d690ad48b fix(wlr/taskbar): crash on taskbar drag and drop event 2024-03-20 13:28:35 +01:00
Alexis Rouillard b9688eb067
Merge pull request #3032 from leiserfg/ppd-right-click
Make right-click to circle down ppd
2024-03-20 10:34:10 +01:00
wispl 0fcf6bcebc Document sway workspace button.empty 2024-03-19 22:56:20 -04:00
wispl cf3389e5d7 Add empty workspace style for Sway 2024-03-19 22:56:20 -04:00
Alexis Rouillard cbe42a8536
Merge pull request #3037 from grimpy/fixperistentclass
Fix peristent class on buttons
2024-03-19 22:56:37 +01:00
Alexis Rouillard 73e24af71c
Merge pull request #3039 from hrdl-github/fix-floating
Also consider floating nodes when checking for flags
2024-03-19 14:25:20 +01:00
hrdl 856a34e16d Also consider floating nodes when checking for flags
Fixes #3030
2024-03-19 11:53:04 +01:00
Jo De Boeck 2ffd9a94a5
Fix peristent class on buttons
Fixes: #3009

Signed-off-by: Jo De Boeck <deboeck.jo@gmail.com>
2024-03-19 08:22:33 +02:00
leiserfg 67218d5554
Make right-click to circle down ppd 2024-03-18 21:49:40 +01:00
Bartel Sielski bbb69bd977 upower: Initialize variables
There are code paths in which some of these variables were used but not
initialized, causing undefined behavior.
2024-03-18 20:38:50 +01:00
Bartel Sielski bd8b215416 upower: Add 'low' and 'critical' CSS classes
Add secondary CSS class based on the 'warning_level' field reported by UPower
over D-Bus.  This makes it possible to add custom styling when the battery is
near empty.
2024-03-18 20:36:46 +01:00
Alexis Rouillard 2c927de4c6
Merge pull request #3023 from tomben13/fix_segfault 2024-03-17 23:09:38 +01:00
Tom Benham 736309ef1f Fixed segfault 2024-03-17 23:00:48 +01:00
Alexis Rouillard ca17bdb214
Merge pull request #2968 from jramrath/hyprland_workspaces_monitor_class
Hyprland workspaces `hosting-monitor` css class
2024-03-17 13:06:50 +01:00
Jannik f014a7d2e5
man docs & different css class name 2024-03-16 21:22:01 +01:00
Alexis Rouillard 376b4d1c09
Merge pull request #3015 from DreamMaoMao/master 2024-03-16 13:54:06 +01:00
DreamMaoMao c5a6299398 fix:dwl tag crash when use wlr-randr enable monitor 2024-03-16 20:10:05 +08:00
Alexis Rouillard 8174dce776
Merge pull request #3011 from nicolarevelant/master
Use the correct thermal zone in FreeBSD
2024-03-15 17:37:07 +01:00
Nicola Revelant 01ff7ebb36 Fix clang-format to src/modules/temperature.cpp 2024-03-15 17:12:31 +01:00
Nicola Revelant fbf66530a3 Explicit convert from std::string to const char* 2024-03-15 16:52:52 +01:00
Nicola Revelant e1f876b981 Fix fmt::format: missing argument 2024-03-15 16:36:54 +01:00
Alexis Rouillard 1eb509a86d
Merge pull request #3010 from luzpaz/repology-badge
README: tweak repology badge
2024-03-15 16:10:11 +01:00
Nicola Revelant 2d12236726 Use the correct thermal zone in FreeBSD 2024-03-15 16:09:18 +01:00
luzpaz 4ccefa0902
README: tweak repology badge
* Change repology badge header  
* Use 3 columns instead of 1 to display badge
2024-03-15 11:05:55 -04:00
Alexis Rouillard fc4b9fa22b
Merge pull request #3008 from alebastr/ppd-fix-initial-visibility 2024-03-15 10:16:56 +01:00
Aleksei Bavshin dcddddd3f1
fix(power-profiles-daemon): correctly set initial visibility
The bus error when the daemon is not reachable prevents the initial
update and keeps the module visible, as an empty section on the bar.

Do the update explicitly before connecting to set initial visibility.

While we at it, remove a couple of redundant `update()` calls.
2024-03-14 20:47:07 -07:00
Eldar Yusupov 17734f0364 Add dwl/window module 2024-03-14 23:51:46 +03:00
Alex 32eac3ccb7 chore: 0.10.0 2024-03-13 19:46:56 +01:00
Alexis Rouillard 20f08b881a
Merge pull request #2996 from rroohhh/feat/horizontal_scroll
feat: allow horizontal scroll
2024-03-13 19:45:20 +01:00
Alexis Rouillard 214858f413
Merge pull request #3001 from grimpy/fixpersitantworkspaces
Fix peristant workspaces for sway
2024-03-12 14:22:18 +01:00
Jo De Boeck 7b3d155608
Fix peristant workspaces for sway
Fixes: #2998

Signed-off-by: Jo De Boeck <deboeck.jo@gmail.com>
2024-03-12 04:40:54 +02:00
Robin Ole Heinemann 207e99876d feat: allow horizontal scroll 2024-03-08 21:48:27 +01:00
Tom Benham 68889494d0 Removed option `active-per-monitor` 2024-03-05 11:12:46 +01:00
Alexis Rouillard 4c46d7d245
Merge pull request #2887 from dann-merlin/master
Add justify config option for Labels
2024-03-05 09:01:44 +01:00
Merlin Sievers 25b85800a5 Add documentation for justify option 2024-03-04 20:00:57 +01:00
Alexis Rouillard 380607583e
Merge pull request #2971 from picnoir/pic/power-profiles-daemon
Introduce a power-profiles-daemon module
2024-03-04 14:25:16 +01:00
Tom Benham df7f1fffcf feat(hyprland/workspaces): added options `move-to-monitor` and `active-per-monitor` 2024-03-04 13:17:52 +01:00
Alexis Rouillard 26af1066e1
Merge pull request #2984 from alebastr/too-much-logs-mpd
mpd: less aggressive logging and reconnections
2024-03-03 10:05:22 +01:00
Alexis Rouillard 97cd2b47b8
Merge pull request #2986 from ErikReider/sway-workspaces-scroll-fix 2024-03-02 23:37:06 +01:00
Erik Reider 9de0e393ab Sway-Workspaces: Fixed scrolling not working
Fixes regression in bb843e0 that caused scrolling over the bar not working
2024-03-02 23:08:21 +01:00
Félix Baylac Jacqué 5578c122ab modules/power-profiles-daemon: kebab case name in config
power_profiles_daemon => power-profiles-daemon
2024-03-02 18:44:25 +01:00
Félix Baylac Jacqué 5ba7c9eb60 modules/power-profiles-daemon: add some right padding
The icon is not really centered in the box. This is likely coming from
a bogus glyph width calculation. It's not a big deal, but that's not
really pleasant aesthetically-wise.

Adding a bit of right padding makes it much more pleasant to watch. It
does not really disrupt a wider display form, like one that
explicitely writes the active profile.
2024-03-02 18:20:46 +01:00
Félix Baylac Jacqué cc759a8b8f Power profiles daemon: address review comments
Adding :
- A missing try/catch
- Glib::Error catch
- Remove the useless destructor
- Populate the profiles vector more efficiently
- Numerous nits
2024-03-02 18:20:46 +01:00
Félix Baylac Jacqué bddc870340 modules/power-profiles-daemon: add man page
There was no way to display the default value of format-icons without
breaking the table :(
2024-03-02 09:46:14 +01:00
Félix Baylac Jacqué 09bb6a055d modules/power_profiles_daemon: safely call dbus asynchronously
2 changes to address the review feedback:

1. Aleksei pointed out in this
   comment (https://github.com/Alexays/Waybar/pull/2971#issuecomment-1972364896)
   that there's no way to tell if a proxy is alive other than trying to
   call a method on it. We perform a little dance to check whether or
   not power-profiles-daemon is available on the system by calling
   properties.GetAll. If something responds, we assume
   power-profiles-daemon is installed, it's then safe to draw the
   widget and attach the callback to the active profile.
2. We replaced all the synchronous DBus operations by their async
   counterparts.
2024-03-01 12:55:37 +01:00
Félix Baylac Jacqué 61fed6a214 modules/power_profiles_daemon: add custom format from config
We move to a single icon label format to save space on the bar. We
still display the profile name and the driver in the tooltip.
2024-03-01 11:18:24 +01:00
Aleksei Bavshin c03fa38974
fix(mpd): use default interval in the example config
2 seconds is 2.5 times more often than the default for the module.
2024-03-01 00:53:12 -08:00
Aleksei Bavshin bb60d41842
fix(mpd): use timers with second granularity where possible
Reuse already armed timer in Disconnected state.
2024-03-01 00:27:23 -08:00
Aleksei Bavshin 653c24cee1
feat(mpd): tone down logs if the server is not running 2024-03-01 00:16:19 -08:00
Alexis Rouillard bdff489850
Merge pull request #2983 from alebastr/ci-freebsd-on-ubuntu
ci: move FreeBSD to ubuntu runners
2024-03-01 05:41:40 +01:00
Félix Baylac Jacqué 162b41c4d0 modules/power-profiles-daemon: apply clang-tidy suggestions 2024-02-29 21:46:27 +01:00
Aleksei Bavshin 55915f95f1
ci: move FreeBSD to ubuntu runners
With the recent runner hardware upgrade[1] and support in the
cross-platform-actions[2] it became possible to use a Linux runner for
this workflow.
Linux-based configuration appears to be faster and stabler than macOS,
so it's now recommended for use.

[1]: https://github.blog/2024-01-17-github-hosted-runners-double-the-power-for-open-source/
[2]: https://github.com/cross-platform-actions/action/releases/tag/v0.23.0
2024-02-28 23:56:10 -08:00
alttabber d9abc080e1 Fix merge conflict with #2930 2024-02-28 22:52:08 +01:00
Alexis Rouillard e7c7ef6814
Merge pull request #2979 from grimpy/filterscratch
Filter out special output __i3 which contains scratchpad
2024-02-28 10:38:33 +01:00
Alexis Rouillard 04f73e7303
Merge pull request #2973 from Azazel-Woodwind/feature/hyprland-window-improvements
Improved hyprland/window by fixing icon search and implementing configurable spacing
2024-02-28 09:29:54 +01:00
Azazel ba48d26dd4 chore: amend default icon spacing 2024-02-28 00:24:58 +00:00
Jo De Boeck 5a887fe1ef Filter out special output __i3 which contains scratchpad
Fixes: #2966

Signed-off-by: Jo De Boeck <deboeck.jo@gmail.com>
2024-02-27 23:43:00 +02:00
Alexis Rouillard e79ea93d7d
Merge pull request #2967 from aruhier/pr_hyprland_workspaces
hyprland/workspaces: Improve the workspaces persistency logic
2024-02-27 16:41:32 +01:00
Azazel 615c9050e7 fix: prevent icon showing when app_identifier is empty 2024-02-26 22:52:28 +00:00
Azazel c59bb509bd fix: hide icon if window is unfocused 2024-02-26 21:00:16 +00:00
Azazel a7d8b1bacf feat: re-add default and configurable icon spacing 2024-02-26 20:58:38 +00:00
Félix Baylac Jacqué 968f469289 modules/power-profiles-daemon: run clang format 2024-02-26 14:44:14 +01:00
Félix Baylac Jacqué c38d05b04f Introduce power-profiles-daemon module
We introduce a module in charge to display and toggle on click the
power profiles via power-profiles-daemon.

https://gitlab.freedesktop.org/upower/power-profiles-daemon

This daemon is pretty widespread. It's the component used by Gnome and
KDE to manage the power profiles. The power management daemon is a
pretty important software component for laptops and other
battery-powered devices.

We're using the daemon DBus interface to:

- Fetch the available power profiles.
- Track the active power profile.
- Change the active power profile.

The original author recently gave up maintenance on the project. The
Upower group took over the maintenance burden… …and created a new
DBus name for the project. The old name is still advertised for now.
We use the old name for compatibility sake: most distributions did not
release 0.20, which introduces this new DBus name. We'll likely revisit
this in the future and point to the new bus name. See the inline
comment for more details.

Given how widespread this daemon is, I activated the module in the
default configuration.
2024-02-26 14:44:14 +01:00
Azazel 695c786354 refactor: reuse toLowerCase function 2024-02-26 04:17:45 +00:00
Azazel 16aced7f9f feat: move name and classes from label_ to box_ 2024-02-26 04:07:03 +00:00
Anthony Ruhier d6d4d87cf7
Attributes doc format fix from the review
Co-authored-by: Tuur Vanhoutte <4633209+zjeffer@users.noreply.github.com>
2024-02-26 00:21:36 +01:00
Anthony Ruhier b3ee94d87a
Improve hyprland/workspaces persistency logic
Fixes #2945

Split the config and rule persistency in 2 attributes, one storing the
persistency as set in Waybar's config, the other one storing the
persistency as set in Hyprland.

It fixes some conflicts between the persistency state of a workspace as
set in Waybar's config and its dynamic state in Hyprland.

It allows to remove a persistent workspace in Waybar if this workspace
is removed from Hyprland and if the workspace is not set as persistent
in Waybar's config.
2024-02-26 00:14:25 +01:00
Azazel 3a5aa5ee83 feat: improve default spacing and add to config 2024-02-25 22:56:52 +00:00
Azazel 0ead42e52b feat: improve search of .desktop files 2024-02-25 22:55:30 +00:00
Alexis Rouillard 6703adc37f
Merge pull request #2972 from alebastr/config-tweaks
RFC: Rename config to config.jsonc
2024-02-25 23:43:25 +01:00
Aleksei Bavshin 43aabf046c
chore: rename config to config.jsonc
Only changes the name of the default config we install and does not
affect the lookup logic in any way.

Man pages were already fixed in #2744
2024-02-25 12:00:53 -08:00
Aleksei Bavshin 2108959644
chore(config): add modeline for Emacs json-mode
json-mode supports jsonc format since 1.8.0, but does not register
.jsonc as a file extension.
2024-02-25 11:21:58 -08:00
Alexis Rouillard 3a33c0b290
Merge pull request #2930 from zjeffer/fix/zjeffer/hyprland-clang-tidy
fix clang-tidy errors in hyprland module
2024-02-25 17:11:13 +01:00
Alexis Rouillard fb193529fc
Merge pull request #2961 from alebastr/sway-language-single-layout
feat(sway/language): option to hide module with single layout
2024-02-25 17:10:50 +01:00
Alexis Rouillard 75dce1ef4b
Merge pull request #2969 from alebastr/config-tweaks
Config tweaks
2024-02-25 17:10:22 +01:00
Jannik 9bc8de8876
fix clang complaints 2024-02-25 13:46:49 +01:00
zjeffer 42f4386e2e fix clang-tidy errors in hyprland module 2024-02-25 12:11:22 +01:00
zjeffer edd723d95c Change PrivateMember styling to use trailing underscore instead of m_ in .clang-tidy 2024-02-25 11:44:55 +01:00
Aleksei Bavshin 05fbbc1c43
style: align 'sway/mode' text with other modules
Use `box-shadow` instead of borders for consistent vertical alignment.
See 77c7e10 for a similar conversion of other modules.
2024-02-24 18:26:02 -08:00
Aleksei Bavshin 2540c07f1d
chore: wrap module lists in the config
"modules-right" has gotten too long, and it's easier to compare configs
that way.
2024-02-24 18:24:39 -08:00
Jannik 4cc2800a78
add 'onThisMonitor' css class 2024-02-25 00:52:33 +01:00
Jannik 16079eae09
update m_output 2024-02-25 00:51:52 +01:00
Aleksei Bavshin 188789592e
feat(sway/language): option to hide module with single layout 2024-02-24 00:30:45 -08:00
Aleksei Bavshin 99c48bca36
fix: formatting 2024-02-24 00:30:44 -08:00
Alexis Rouillard 601af3de81
Merge pull request #2958 from JonnyTischbein/mediaplayer-exclude 2024-02-24 00:06:03 +01:00
Jonny Tischbein 3d31e9a22a
mediaplayer: add exclude player option 2024-02-23 18:41:45 +01:00
Alexis Rouillard 793394c862
Merge pull request #2949 from aokblast/feat/bsd_cpufreq
feat: implement cpufreq for bsd by sysctl
2024-02-22 01:25:21 +01:00
aokblast 514d00803c
feat: implement cpufreq for bsd by sysctl 2024-02-22 04:47:09 +08:00
Alexis Rouillard 977c66e7c5
Merge pull request #2948 from alebastr/clang-tidy-fix
ci: fix clang-tidy action
2024-02-21 09:19:20 +01:00
Alex 450a344426 chore: only label issues 2024-02-21 09:19:03 +01:00
Aleksei Bavshin 5fc2b97194
ci: fix clang-tidy action 2024-02-20 17:22:33 -08:00
Alex efb2eb5073 chore: update cpp-linter 2024-02-20 22:24:30 +01:00
Alexis Rouillard 1606dce62e
Merge pull request #2944 from grimpy/waybarwindows
Implement windows formating in sway/workspaces
2024-02-20 18:34:32 +01:00
Jo De Boeck bb843e0494 Implement windows formating in sway/workspaces
This implementation mimics to some extend the implementation of hyprland

Signed-off-by: Jo De Boeck <deboeck.jo@gmail.com>
2024-02-20 19:12:26 +02:00
Alexis Rouillard 1b4008c58b
Merge pull request #2943 from iynaix/master
nix: update libcava version and removal of gtk-layer-shell meson option
2024-02-20 11:34:04 +01:00
Alex a45932973a fix: lint 2024-02-20 11:33:41 +01:00
Lin Xianyi 00ee538c95 nix: update libcava version and removal of gtk-layer-shell meson option 2024-02-20 17:57:07 +08:00
Alexis Rouillard 4ef5b48474
Merge pull request #2934 from tomben13/master
Fixed window#waybar.swallowing for module hyprland/window
2024-02-20 10:39:33 +01:00
Tom Benham e6aa06cdf3 window#waybar.swallowing -- backward compatibility 2024-02-20 09:39:03 +01:00
Alex e42635197c chore: more labels 2024-02-20 08:35:28 +01:00
Alex b8324be8c4 fix: token 2024-02-20 08:26:14 +01:00
Alexis Rouillard 197bc6a877
Merge pull request #2938 from thejch/click-special 2024-02-20 08:03:16 +01:00
Alexis Rouillard 536933ca24
Merge pull request #2940 from alebastr/clock 2024-02-20 08:02:08 +01:00
Alexis Rouillard a118af0d1b
Merge pull request #2939 from alebastr/ci-update-debian-dependencies 2024-02-20 08:01:18 +01:00
Aleksei Bavshin f885baba61
fix(clock): remove literal operator with reserved name
```
../include/util/date.hpp:34:26: warning: literal operator suffixes not preceded by ‘_’ are reserved for future standardization [-Wliteral-suffix]
   34 | constexpr decltype(auto) operator""d(unsigned long long d) noexcept {
```
2024-02-19 21:56:47 -08:00
Aleksei Bavshin a2deff3689
fix(clock): crash on scrolling with local timezone (`""`) in the list
While we at it, eliminate use of non-portable GCC conditional expression
syntax. There are no significant side-effects that would justify use of
the language extension.
2024-02-19 21:56:46 -08:00
Aleksei Bavshin 5d6acfd1d4
test: restore compatibility with older Catch2 releases 2024-02-19 17:00:01 -08:00
Aleksei Bavshin d59d6e8765
chore: remove duplicate fedora/c++20 job definition 2024-02-19 16:35:56 -08:00
Aleksei Bavshin bdb2f2bd1a
chore: update Debian CI dependencies
This should speed-up "linux (debian)" and "clang-tidy" builds and enable
lints for more modules.
2024-02-19 16:35:21 -08:00
Jeremy Huang 4a5444d196 fix click special 2024-02-19 16:16:46 -08:00
Alexis Rouillard ce5a1cf2f9
Merge pull request #2937 from alebastr/factory-includes
refactor: move all module includes to factory.cpp
2024-02-20 00:44:38 +01:00
Aleksei Bavshin c6f5cbdf0c
refactor: move all module includes to factory.cpp
None of these includes are required in the header.
2024-02-19 15:11:08 -08:00
Alexis Rouillard 6048e23e09
Merge pull request #2926 from alebastr/meson-cleanup
build: refactorings and deprecation fixes
2024-02-19 23:44:52 +01:00
Alexis Rouillard 3d75167e67
Merge pull request #2936 from Alexays/revert-2773-waybarwindows
Revert "Implement windows formating in sway/workspaces"
2024-02-19 23:28:15 +01:00
Alexis Rouillard ee2407496f
Revert "Implement windows formating in sway/workspaces" 2024-02-19 23:28:08 +01:00
Alex 175852e527 chore: auto label 2024-02-19 23:24:20 +01:00
Alexis Rouillard d36f15c26b
Merge pull request #2935 from Alexays/revert-2915-cpu_style
Revert "Add style class for CPU state"
2024-02-19 23:10:20 +01:00
Alexis Rouillard 742cd7f371
Revert "Add style class for CPU state" 2024-02-19 23:10:10 +01:00
Alex 41b2d0cb29 chore(workflows): concurrency 2024-02-19 23:09:24 +01:00
Aleksei Bavshin a95b6a39c9
build: mark bluetooth as Linux-specific 2024-02-19 14:08:22 -08:00
Alex bd0bf836c7 fix: lint 2024-02-19 23:07:50 +01:00
Alexis Rouillard ae1e11db22
Merge pull request #2773 from grimpy/waybarwindows
Implement windows formating in sway/workspaces
2024-02-19 23:05:24 +01:00
Alexis Rouillard 347197865f
Merge pull request #2885 from jones-josh/ordinal-date
Add ordinal date toolbar format specifier to clock module
2024-02-19 23:03:40 +01:00
Alexis Rouillard 91b79a2e9e
Merge pull request #2894 from jramrath/active-for-hyprland-special-workspaces
Add css classes to hyprland special workspaces
2024-02-19 23:02:17 +01:00
Alexis Rouillard 70dc388dff
Merge pull request #2915 from haasn/cpu_style
Add style class for CPU state
2024-02-19 22:58:21 +01:00
Alexis Rouillard bba8da76b6
Merge pull request #2836 from alebastr/require-gtk-layer-shell
Require gtk-layer-shell
2024-02-19 22:57:50 +01:00
Alexis Rouillard 9abd0da1c7
Merge pull request #2603 from zjeffer/hyprland/persistent-workspaces
Hyprland/workspaces: use Hyprland's workspace rules for persistency
2024-02-19 22:55:28 +01:00
Alexis Rouillard 6fbae3bd7b
Merge pull request #2888 from imran1008/hwmon-path-abs-subdir
Search for the first hwmon* directory
2024-02-19 22:53:31 +01:00
Alexis Rouillard 9191cae13b
Merge pull request #2923 from jones-josh/custom-tooltip-format
Add check for tooltip-format for custom modules
2024-02-19 22:47:22 +01:00
Alexis Rouillard a18b6dcc29
Merge pull request #2925 from LukashonakV/bump_cava
libcava bump 0.10.1
2024-02-19 22:47:04 +01:00
Alexis Rouillard c553e3028e
Merge pull request #2928 from zjeffer/fix/zjeffer/build-warnings
fix build warning in bar.cpp
2024-02-19 22:41:44 +01:00
Tom Benham 745d5687b8 Fixed window#waybar.swallowing for module hyprland/window 2024-02-19 22:23:03 +01:00
Aleksei Bavshin 8a4a44896a
refactor: merge BarSurface into Bar
With only one implementation left, the abstraction is no longer
necessary.
2024-02-19 03:00:38 -08:00
Aleksei Bavshin 4420447e74
fix(bar): use std::string for mode names
`string_view` leads to UAF when reading custom mode definitions from the
configuration.
2024-02-19 01:50:40 -08:00
zjeffer 11310b89f0 hyprland/workspaces: Use hyprland's persistent workspaces configuration 2024-02-18 16:04:47 +01:00
zjeffer a02bacdd53 fix build warning 2024-02-18 12:01:36 +01:00
Aleksei Bavshin 543290ab07
fix: `-Wnon-virtual-dtor` warning in CssReloadHelper
```
../include/util/css_reload_helper.hpp:15:7: warning: 'class waybar::CssReloadHelper' has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
```
2024-02-17 21:43:10 -08:00
Aleksei Bavshin fd5a03dc5f
build: disable catch2 unit-tests
The library tests take more time to complie than the entire Waybar.
2024-02-17 21:43:09 -08:00
Aleksei Bavshin f3063e86aa
build: install man pages only for enabled modules 2024-02-17 21:43:08 -08:00
Aleksei Bavshin 3cb587945a
fix: use `gtk_layer_set_keyboard_mode()`
`gtk_layer_set_keyboard_interactivity()` is deprecated and was removed
in gtk4-layer-shell.
Note that this bumps version requirement to 0.6.0
2024-02-17 11:23:19 -08:00
Aleksei Bavshin 9a21884272
feat!: drop RawSurfaceImpl with direct use of wlr-layer-shell
BREAKING CHANGE: gtk-layer-shell is now required and unconditionally
used. The corresponding config option is removed.

As a part of preparation for future versions of GTK, remove an ability
to use wlr-layer-shell directly. The APIs it required were dropped in
GTK4, and with the menus/tooltips positioning issue being practically
unsolvable it doesn't make sense to keep maintaining the code.
2024-02-17 11:23:17 -08:00
Aleksei Bavshin 4f5dd53571
chore: update gtk-layer-shell subproject to 0.8.2 2024-02-17 11:21:43 -08:00
Aleksei Bavshin 4b34486143
man: fix missing code block fence in hyprland-workspaces 2024-02-17 08:45:44 -08:00
Aleksei Bavshin 63935ba0fb
build: don't use sh for scdoc 2024-02-17 08:45:18 -08:00
Aleksei Bavshin d9f9fb51ff
build: use `/` instead of `join_paths` 2024-02-17 08:45:17 -08:00
Aleksei Bavshin c2f37705ad
build: address meson deprecation warnings:
- `ExternalProgram.path`
- `dependency.get_pkgconfig_variable`
- `meson.build_root`
- `meson.source_root`
2024-02-17 08:45:16 -08:00
Aleksei Bavshin 72406fa3f2
build: require gio-unix-2.0 unconditionally
We already use it without checking (`<gio/gdesktopappinfo.h>` in
wlr/taskbar), it's a transitive dependency of GTK and it's always
available on Unix platforms.
2024-02-17 08:33:31 -08:00
Aleksei Bavshin 104accdc34
build: drop std::filesystem checks
The `<experimental/filesystem>` and `-lc++experimental` aren't needed
since LLVM 9.0. And since we now require C++20, checking for the
`<filesystem>` support shouldn't be necessary either.
2024-02-17 08:33:22 -08:00
Viktar Lukashonak d7d4dca6ba
libcava bump 0.10.1
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2024-02-17 18:20:03 +03:00
Josh Jones 7f3e396383 add tooltip-format to custom module man page 2024-02-16 15:26:36 +01:00
Alexis Rouillard 3cd311819b
Merge pull request #2921 from alebastr/module-classes
Add `module` class to the root elements of the modules
2024-02-16 13:34:50 +01:00
Josh Jones 9c3881f6f8 add check for tooltip-format for custom modules 2024-02-16 01:33:04 +01:00
Aleksei Bavshin d590d508ca
feat: add `module` class to the root elements of the modules
Previously, the only way to select all the module labels was with the
following kind of selector:
```css
.modules-left > widget > label,
.modules-center > widget > label,
.modules-right > widget > label {
    /* ... */
}
```
(and a matching block for the `box` containers).

Now, this can be expressed as
```css
label.module, box.module {
    /* ... */
}
```
2024-02-14 22:41:13 -08:00
Aleksei Bavshin 2f555a6936
refactor(bar): use Gtk enums for position and orientation
Ensure that the position and the corresponding CSS class on window are
always set.
2024-02-14 22:11:21 -08:00
alttabber 9ea470410f Add always on option for hyprland/submap 2024-02-13 17:02:14 +01:00
Alexis Rouillard 28cd9dff47
Merge pull request #2916 from alttabber/master
Add style classes for hyprland/submap
2024-02-13 13:25:23 +01:00
alttabber 77c7b91b40 Add style classes for hyprland/submap 2024-02-13 11:46:27 +01:00
Niklas Haas a0bac34329 Add style class for CPU state
Fixes: https://github.com/Alexays/Waybar/issues/2911
2024-02-13 10:49:57 +01:00
Alexis Rouillard 2c244b5e83
Merge pull request #2912 from zjeffer/fix/zjeffer/build-warnings
Fix build warnings
2024-02-12 20:30:58 +01:00
zjeffer dd8d6fbe6c Fix build warnings 2024-02-12 20:09:22 +01:00
Jannik acf6611098
clang-format 2024-02-10 17:35:46 +01:00
Jannik a2925fa5da
fix 'visible' class for special workspaces 2024-02-10 17:26:44 +01:00
Jannik 240b49f9d2
Add 'empty' css class to special workspaces 2024-02-10 16:59:53 +01:00
Jannik d4331ce7fe
improve handling of special workspace name 2024-02-09 13:49:39 +01:00
Alexis Rouillard 4d076a71f7
Merge pull request #2899 from OpenSauce04/battery-full-no-alt
Make battery estimate inaccessible in the "Full" state on default config
2024-02-09 10:54:22 +01:00
OpenSauce04 90c2415b64 Battery estimate is no longer accessible in the "Full" state on default config 2024-02-08 15:10:21 +00:00
Jannik 692f8f4ea4
add/remove 'active' on 'focusedmon' IPC event 2024-02-07 22:42:05 +01:00
Jannik 61be2267ab
add 'visible' css class to special workspaces 2024-02-07 21:10:17 +01:00
Jannik c30541b954
remove whitespaces 2024-02-07 16:56:37 +01:00
Jannik 3bfcd5e086
Add 'active' css class to special workspaces 2024-02-07 16:33:19 +01:00
Alexis Rouillard b6f4a0dae2
Merge pull request #2881 from jramrath/drawer-direction
Fix: drawer not appearing on configured side
2024-02-06 16:18:52 +01:00
Imran Haider 92875711c6 Search for the first hwmon* directory
Background and Motivation
-------------------------
When the `hwmon-path-abs` and the `input-filename` fields are used for
the temperature module, we evaluated the following path:

```
[hwmon-path-abs] / [gap] / [input-filename]
```

where `gap` is the first file or directory in the `hwmon-path-abs`
directory. This usually works but it doesn't seem to work for NVME or
WiFi temperature sensors. For those cases, there are a bunch of other
files in the `hwmon-path-abs` directory. In the bad case, the first
selected file is not the one with the prefix `hwmon` and we end up
checking the wrong location for the `input-filename`.

Change description
------------------
We are simply going through the `hwmon-path-abs` directory and searching
for the first file/directory that begins with `hwmon`.

Test case
---------
I tested this on a AMD based Framework 13 laptop.
2024-02-05 21:40:24 -05:00
Merlin Sievers 89b3203bfa Add justify config option for Labels
This is especially useful for centering labels on vertical bars.
2024-02-05 14:44:59 +01:00
Jannik 08b32cb901
Removing unnecessary parts of transition_type handling 2024-02-04 16:17:06 +01:00
Josh Jones 1fa1045af9 remove duplicated segment 2024-02-04 16:11:39 +01:00
Josh Jones e02cb9cfb9 add ordinal format specifier to man clock 2024-02-04 15:49:14 +01:00
Josh Jones 718dd4afae add ordinal date toolbar format specifier to clock module 2024-02-04 15:41:39 +01:00
Jo De Boeck c641d52e06 Implement windows formating in sway/workspaces
This implementation mimics to some extend the implementation of hyprland

Signed-off-by: Jo De Boeck <deboeck.jo@gmail.com>
2024-02-03 12:31:06 +02:00
Jannik 029b380c15
Fix: drawer not appearing on configured side 2024-02-02 20:54:16 +01:00
Alexis Rouillard 4c5ff80bbd
Merge pull request #2874 from Alexays/fix-reload-style
fix: reload style
2024-01-31 23:09:54 +01:00
Alex f1016322b9 fix: tpyo 2024-01-31 22:59:09 +01:00
Alex 6dcae2cade fix: reload style 2024-01-31 22:57:20 +01:00
Alex fb6658e8fd chore: lint 2024-01-30 09:07:37 +01:00
Alexis Rouillard 1dce607c42
Merge pull request #2852 from dpayne/add_css_reload
Adding css reloader
2024-01-29 22:44:29 +01:00
dpayne 10cb4180f6 * Fixing clang tidy comments
* Fixing missing includes
* Fixing formatting
2024-01-28 14:44:25 -08:00
Alexis Rouillard 5534fc48b1
Merge pull request #2496 from zjeffer/tests/json
Fix JSON parsing with hexadecimal characters
2024-01-28 23:38:54 +01:00
dpayne 9556b0fe89 Adding a man page entry for the realod_style_on_change option 2024-01-28 14:25:00 -08:00
Alexis Rouillard ddad6ce136
Merge pull request #2866 from Jay-716/pa-reconnect
pulseaudio: reconnect context when pulseaudio server restarts
2024-01-28 17:04:57 +01:00
Jay-716 14d168c254
pulseaudio: extract context connecting into `connectContext()` 2024-01-27 23:47:39 +08:00
Jay-716 167f04a4df
pulseaudio: reconnect context when pulseaudio server restarts
When pulseaudio server restarts, the context is not reconnect
automatically. So the pulseaudio module will stop updating.
2024-01-25 23:59:32 +08:00
Alexis Rouillard 5f115785cf
Merge pull request #2862 from Sryther/master
Move `.empty` CSS class from Img to Box in the Image module
2024-01-25 16:12:02 +01:00
Alexis Rouillard 7caf0b9ec4
Merge pull request #2865 from chntllh/Battery-animations
Using steps() in animation to reduce cpu usage.
2024-01-25 16:11:00 +01:00
Paul Rey 94633c346a retrigger checks 2024-01-25 11:02:44 +01:00
Siddhartha Singh 7e76369ec8 Using steps() in animation 2024-01-25 14:00:21 +05:30
Paul Rey 002ff002fe Move `.empty` CSS class from Img to Box in the Image module
Since the GTK Image is hidden, the CSS class wasn't used for every cases.
2024-01-24 11:10:16 +01:00
Alexis Rouillard 0948a407d0
Merge pull request #2810 from ArneshRC/master
feat(battery): added support for battery state-based classes on the entire waybar
2024-01-23 22:45:24 +01:00
Arnesh Roychowdhury 90b5b21394
Merge branch 'Alexays:master' into master 2024-01-24 02:01:17 +05:30
Alexis Rouillard 8e2fa0fdbd
Merge pull request #2859 from Sryther/master
Add "empty" class for Image module when path/exec is returning an empty value.
2024-01-23 18:50:50 +01:00
Paul Rey 0af8f5c691
Add "empty" class for Image module when path/exec is returning an empty value. 2024-01-23 18:15:47 +01:00
dpayne 970a7519d4 Merge branch 'master' of github.com:Alexays/Waybar into add_css_reload 2024-01-22 12:40:02 -08:00
Alexis Rouillard 0d9c492998
Merge pull request #2855 from SquishyPandaDev/upower-ptr-fix
Fix module UPower display device poniter
2024-01-22 09:49:55 +01:00
SquishyPandaDev 82b632e4ec
Fix module UPower display device poniter
Force displayDevice to be a nullptr on class setup
2024-01-22 03:22:19 -05:00
Alexis Rouillard 27fec51439
Merge pull request #2853 from dpayne/fix_use_after_free_on_task_close 2024-01-22 09:01:48 +01:00
dpayne 20fa578b12 Adding config option to enable reloading style on file change 2024-01-21 21:02:01 -08:00
dpayne f7eca99496 Using Gio::FileMonitor for watching style changes 2024-01-21 20:49:13 -08:00
dpayne 53233e47a3 Fix use after free on task close 2024-01-21 19:08:23 -08:00
dpayne d7ed4f1fa8 Adding css reloader 2024-01-21 18:23:46 -08:00
ArneshRC d14a4a2b1a
fixed early dereference error 2024-01-19 16:00:13 +05:30
ArneshRC dacffdb095
removed duplicate code 2024-01-19 15:27:11 +05:30
ArneshRC 74e863ed73
updated man waybar-battery 2024-01-19 14:45:49 +05:30
Arnesh Roychowdhury 3de6d2e859
Merge branch 'Alexays:master' into master 2024-01-17 18:29:14 +05:30
Alexis Rouillard 6e12f81223
Merge pull request #2840 from m-bdf/clock-tz-changes
clock: fix construction with calendar.format.today
2024-01-17 13:44:28 +01:00
Maëlys Bras de fer 4f0fbaba8e clock: fix construction with calendar.format.today 2024-01-17 13:30:32 +01:00
Alexis Rouillard 392f83e71d
Merge pull request #2838 from m-bdf/clock-tz-changes 2024-01-16 22:48:31 +01:00
Maëlys Bras de fer d343f616fc clock: handle timezone changes (again again) 2024-01-16 21:35:42 +01:00
Arnesh Roychowdhury 8c502378aa
Merge branch 'Alexays:master' into master 2024-01-15 14:24:27 +05:30
Alexis Rouillard 07eabc5328
Merge pull request #2831 from JManch/tray-fix-spacing
fix(tray): completely hide tray when it is empty
2024-01-14 16:33:28 +01:00
Joshua Manchester 95ffc291f6
fix: hide tray event box instead of box 2024-01-14 15:06:06 +00:00
zjeffer 8f5d0098d6 Fixed json parsing with hexadecimal characters
* replace \x with \u00 to follow JSON spec
* fixes #2475 and #2495
* added unit tests for json parsing
2024-01-14 14:06:06 +01:00
Arnesh Roychowdhury 4eef1ce10f
Merge branch 'Alexays:master' into master 2024-01-13 16:07:11 +05:30
Alexis Rouillard f744d906be
Merge pull request #2820 from oxalica/feat/systemd-failed-units
Add module systemd-failed-units to monitor failed systemd units
2024-01-12 09:45:40 +01:00
Alexis Rouillard fa3ce14b25
Merge pull request #2817 from Syndelis/fix/window-rewrite-multiple-bars-no-overlap
Fix/Hyprland/Workspaces: Window Rewrite on multiple non-overlapping bars
2024-01-12 09:44:03 +01:00
Alexis Rouillard e6097229ce
Merge pull request #2814 from khaneliman/flake-update
flake update and direnv fix
2024-01-12 09:43:19 +01:00
Austin Horstman b239c77d74
fix: temporary catch2_3 override until upstreamed to nixpkgs 2024-01-10 12:17:46 -06:00
Brenno Lemos 9e08512927 feat: strip workspace qualifiers when creating windows 2024-01-10 02:24:51 -03:00
oxalica eedd1f8e6a Add module systemd-failed-units 2024-01-09 18:19:30 +08:00
Brenno Lemos c69a6dde67 chore: update Hyprland's featureset in readme 2024-01-08 20:31:15 -03:00
Brenno Lemos 4339030c9d feat: fetch clients data when moving workspaces accross monitors 2024-01-08 20:11:39 -03:00
Brenno Lemos bc7acbde5c fix: rename windows while queued for creation
this avoids the window arriving with the wrong icon when its eventually
able to be created
2024-01-08 18:30:53 -03:00
Brenno Lemos 512c6fb127 feat: add orphan windows attribute to workspaces
this attribute will keep every window that doesn't have an associated
workspace in the current bar
2024-01-08 18:30:53 -03:00
Austin Horstman b90af74d15
feat: enable direnv and fix flake devshell output 2024-01-08 12:47:32 -06:00
Arnesh Roychowdhury f1f3442e38
Merge branch 'Alexays:master' into master 2024-01-08 22:54:08 +05:30
Austin Horstman d4d5a54e63
chore: flake lock update 2024-01-08 09:37:48 -06:00
Alexis Rouillard 748fc809b5
Merge pull request #2813 from yangyingchao/master
Improvements for Hyprland worskspaces & backend
2024-01-08 14:03:23 +01:00
yangyingchao bdd7271da9 Improvements for Hyprland backend
1. Fix warnings reported by clang tidy
2. Use unique lock instead of manully lock/unlock on mutex.
   The RAII style locking makes sure mutex is unlocked when exceptions are thrown
2024-01-08 09:26:16 +08:00
yangyingchao a34e3ccc86 Improvements for Hyprland workspace
1. Utilize `m_mutex` to safeguard member fields of `hyprland::Workspaces` as they are modified by multiple threads, including the event listener thread and UI thread. This applies to all member fields, not just `m_workspacesToCreate`.

2. Tidy up the create/remove workspace code.
2024-01-08 09:14:36 +08:00
ArneshRC 3390c16f52
added support for battery state-based classes on the entire waybar 2024-01-07 17:22:34 +05:30
Alexis Rouillard 4b20f522f0
Merge pull request #2789 from DreamMaoMao/master
fix:#2769
2024-01-04 15:33:26 +01:00
Alexis Rouillard 4636309117
Merge pull request #2803 from LukashonakV/catch_bump
Catch2 bump
2024-01-04 15:33:06 +01:00
Viktar Lukashonak 7783c81861
Catch2 bump
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2024-01-04 17:22:27 +03:00
Alexis Rouillard 3e55d0d7f2
Merge pull request #2787 from scgtrp/master
hyprland/workspaces: allow using the original window class/title
2023-12-31 12:40:06 +01:00
Emily Ellis ff09ef6d71 hyprland/workspaces: allow using the original window class/title
This turns the values of window rewrite rules in hyprland/workspaces from static strings to format strings with the values {class} and {title} available.
2023-12-30 21:07:40 -05:00
Alexis Rouillard 99d26e44ee
Merge pull request #2778 from an-prata/master
fix `restart-interval` being ignored while `signal` is defined (#2650)
2023-12-29 10:59:13 +01:00
Evan Overman 19bf4d0544
clang format trailing whitespace 2023-12-28 19:38:01 -08:00
Evan Overman 6b860f8690
clang formating 2023-12-28 19:36:21 -08:00
Evan Overman 182272b8b5
fix #2650 2023-12-28 19:30:26 -08:00
DreamMaoMao e64d66ab24 fix:the workspace data is null in a small probability
update

fix clang-format warn

no manual unlock
2023-12-25 21:55:46 +08:00
Alexis Rouillard 41ebdc3cb6
Merge pull request #2768 from zjeffer/feat/zjeffer/freebsd-bump 2023-12-25 08:31:03 +01:00
Alexis Rouillard 8ccb959992
Merge pull request #2767 from zjeffer/master 2023-12-25 00:28:32 +01:00
zjeffer 13e904c20d Bump cross-platform-action to attempt fixing freebsd runner 2023-12-25 00:26:39 +01:00
zjeffer 77f0584d0d Bump clang-tidy cpp-linter-action version to v2.7.5 2023-12-24 23:08:22 +01:00
Alexis Rouillard d2767fb84a
Merge pull request #2760 from avannereau/wireplumber-scroll-fix
Fix wireplumber reverse-scroll option
2023-12-22 12:00:39 +01:00
Alan Vannereau 49caab47a6 Fix wireplumber reverse-scroll option 2023-12-22 11:50:41 +01:00
Alexis Rouillard 08361be9f0
Merge pull request #2756 from grimpy/custom_output_env_var
Pass WAYBAR_OUTPUT_NAME environment variable to custom exec scripts
2023-12-21 08:55:30 +01:00
Alexis Rouillard 2674982c7b
Merge pull request #2755 from zjeffer/master
Added clang-tidy GitHub action
2023-12-20 23:25:33 +01:00
Tuur Vanhoutte dbe02ebe41 Added clang-tidy GitHub action
Created clang-tidy.yml
Renamed lint.yml to clang-format.yml
2023-12-20 14:31:27 +01:00
Jo De Boeck 0ea5143493 Pass WAYBAR_OUTPUT_NAME environment variable to custom exec scripts
Signed-off-by: Jo De Boeck <deboeck.jo@gmail.com>
2023-12-19 22:54:12 +02:00
Alexis Rouillard f5370fcff5
Merge pull request #2573 from CromFr/cabi_plugins
C ABI plugin system
2023-12-18 14:10:02 +01:00
Alexis Rouillard 7b79281437
Merge pull request #2742 from zjeffer/feat/zjeffer/debian-docker-add-clang-tidy-requirements
Added sudo, python3-pip & python3-venv to debian image, required for clang-tidy GH action
2023-12-18 09:06:54 +01:00
Alexis Rouillard acc2da7310
Merge pull request #2744 from rpdelaney/jsonC
Specify config is JSONC
2023-12-18 09:06:28 +01:00
Ryan Delaney 68e525df58 Remove 'config' from list of valid locations
Since the file can also be named config.jsonc, that will remove ambiguity
2023-12-13 11:22:57 -05:00
Ryan Delaney 2cd67fdd0a The file can also be named config.jsonc 2023-12-13 10:40:13 -05:00
Ryan Delaney 2600f53bdd Clarify that the configuration file is JSON*C*
JSON is JSONC
2023-12-13 10:39:59 -05:00
zjeffer da9cc77db8 Added sudo, python3-pip & python3-venv to debian image, required for clang-tidy GH action 2023-12-13 11:54:04 +01:00
Crom (Thibaut CHARLES) 75f9141cac
Added cffi man page 2023-12-12 16:23:03 +01:00
Alexis Rouillard f03b684bd8
Merge pull request #2736 from Rice8Dyb6/master 2023-12-10 19:27:52 +01:00
Rice8Dyb6 4822f967b2 Sway/workspaces: fix persistent icon 2023-12-11 00:17:35 +07:00
Alexis Rouillard dc208b66b3
Merge pull request #2720 from zjeffer/master
Applied clang-tidy suggestions for hyprland workspaces
2023-12-07 08:34:19 +01:00
Alexis Rouillard 77ebc45336
Merge pull request #2731 from mcepl/patch-1 2023-12-07 08:25:49 +01:00
Matěj Cepl d94519a93c
Clear README.md from duplicated list of distributions
It doesn’t make sense to keep the list in README.md when we maintain it in Wiki as well.
2023-12-07 07:53:45 +01:00
zjeffer 4d5b715dc4 applied clang-tidy suggestions for hyprland workspaces 2023-12-06 21:58:26 +01:00
zjeffer 8a84cb609e clang-tidy: added StaticConstantCase CheckOption 2023-12-06 21:58:26 +01:00
Alexis Rouillard 5f8ae44233
Merge pull request #2703 from czadowanie/master
upower: show-icon config option
2023-12-05 23:34:43 +01:00
czadowanie 4283195803 man: add dot in upower/show-icon 2023-12-04 21:32:08 +01:00
czadowanie 44f309678b man: document upower/show-icon 2023-12-04 21:28:37 +01:00
Alexis Rouillard 4846ff7950
Merge pull request #2595 from zjeffer/master
Added initial .clang-tidy file
2023-12-04 09:29:12 +01:00
Alexis Rouillard 0ec2aada26
Merge pull request #2711 from chayleaf/flake
flake: update & cleanup
2023-12-04 09:28:16 +01:00
Alexis Rouillard dfa0f5701e
Merge pull request #2712 from khaneliman/fix/nix-flake
chore: lint fix
2023-12-04 09:28:05 +01:00
Austin Horstman b1744278d1
chore: lint fix 2023-12-01 22:05:40 -06:00
chayleaf 2e2cb67cf1
flake: update & cleanup 2023-12-02 02:41:59 +07:00
Alexis Rouillard 1572bc8c75
Merge pull request #2707 from alexbakker/fix-2154 2023-11-30 08:37:59 +01:00
Alexander Bakker 6be5f7cb29 Disconnect from PipeWire when destroying the WirePlumber module
This fixes a crash where PipeWire tries to send events to a destroyed
WirePlumber module.
2023-11-29 22:46:58 +01:00
czadowanie 2334faa7fd upower: show-icon config option 2023-11-28 19:39:08 +01:00
Alexis Rouillard 58db0baaf4
Merge pull request #2701 from thejch/hl-ws-click
Add button click check to hyprland workspaces module
2023-11-28 09:20:51 +01:00
Jeremy Huang 0162dbd485 add button single click check to hyprland workspaces 2023-11-27 16:20:05 -08:00
Alexis Rouillard 1fe4a4ee9d
Merge pull request #2686 from aruhier/pr_privacy_visibility
privacy: fix visibility when a module is disabled
2023-11-23 09:52:44 +01:00
Anthony Ruhier 50a4fe9623
privacy: fix visibility when a module is disabled
Only consider a privacy module as visible if it is enabled in the
configuration. Otherwise, when screensharing or audio-in or audio-out is
in use but the associated module is not enabled, the privacy widget is
empty but still considered as visible.
2023-11-23 00:45:31 +01:00
Alexis Rouillard 061c68ce92
Merge pull request #2677 from sjoblomj/master
Using 'image-missing' fallback if no taskbar icon is found
2023-11-20 14:03:52 +01:00
Alexis Rouillard 20b89d5d13
Merge pull request #2679 from aserowy/master
hyprland module: added sort_workspaces after rename occured
2023-11-20 14:02:39 +01:00
Alexis Rouillard c299ea9369
Merge pull request #2681 from tactikauan/master 2023-11-19 14:20:54 +01:00
Kauan Decarli d2dd2d553f cpu_usage/linux: count iowait toward idle time 2023-11-18 13:59:21 -03:00
aserowy b6b495e1bc hyprland module: added sort_workspaces after rename occured
Signed-off-by: aserowy <serowy@hotmail.com>
2023-11-18 11:36:47 +01:00
Johan Sjöblom d4559c7f00 Using 'image-missing' fallback if no taskbar icon is found 2023-11-16 16:59:05 +01:00
Alexis Rouillard 0a747ddafc
Merge pull request #2672 from fdev31/master 2023-11-15 17:53:48 +01:00
fdev31 375a38a489 Fix for #2646 2023-11-14 21:26:17 +01:00
Alexis Rouillard 9ac27de7d8
Merge pull request #2668 from LukashonakV/cpp20_clock 2023-11-13 08:34:59 +01:00
Viktar Lukashonak 7308893adb
Happy clang. fmt9-10
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-11-13 09:59:50 +03:00
Alexis Rouillard a51dd8fc52
Merge pull request #2659 from LukashonakV/cpp20_clock
c++20. clock chrono API. STL + format
2023-11-12 09:17:59 +01:00
Viktar Lukashonak 86a38980e4
c++20. clock chrono API. STL + format
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-11-10 17:57:26 +03:00
Alexis Rouillard c4330a1e36
Merge pull request #2648 from Mrcarrot1/wp-segfault
Fix segmentation fault in WirePlumber module
2023-11-06 16:58:40 +01:00
Caleb Harper 4d339f05af
Fix segmentation fault in WirePlumber module
The WirePlumber module assumes that either the node's name or
description will not be null. This leads to a segmentation fault when
both are.

The solution provided is to set self->node_name_ to a default value in
this case.
2023-11-06 09:50:13 -06:00
Alexis Rouillard e24adbc3c2
Merge pull request #2612 from ErikReider/privacy-module
Add Privacy Module
2023-11-06 09:42:35 +01:00
Alexis Rouillard 7d7a047fcc
Merge pull request #2643 from qbe/bugfix-dst-ambiguous-hour-err 2023-11-06 08:51:26 +01:00
Lukas Hannen aa1f8a428b avoid converting to local_time when converting to zoned_time afterwards 2023-11-06 01:28:48 +01:00
Yaroslav Chvanov c420b40668
refactor(backlight): use concrete types for some helper functions
This fixes linking of the best_device() function with 'mold' linker.
2023-11-04 18:31:25 +03:00
Erik Reider f21b1dfa4d fixed linter issues 2023-11-04 15:16:13 +01:00
Erik Reider 6050fa3a43 Added documentation 2023-11-04 15:16:13 +01:00
Erik Reider ca7c9a68f1 Made creation of privacy modules more modular 2023-11-04 14:05:01 +01:00
Alex 48ec834ec9 chore: 0.9.24 2023-11-03 14:07:07 +01:00
Alex e7c2e90236 Revert "custom: reap zombie processes on termination"
This reverts commit 1c1a39f597.
2023-11-03 14:06:50 +01:00
zjeffer 23bc4d66bf Added initial .clang-tidy file 2023-11-02 23:09:49 +01:00
Alex c6a9b63189 chore: 0.9.23 2023-11-02 14:16:55 +01:00
Alexis Rouillard 7dfc72003f
Merge pull request #2629 from andresilva/custom-fix-zombie-processes
custom: reap zombie processes on termination
2023-11-02 10:12:21 +01:00
André Silva 1c1a39f597
custom: reap zombie processes on termination 2023-11-02 01:57:55 +00:00
Alexis Rouillard 121dcc645f
Merge pull request #2628 from andresilva/fix-hyprland-workspaces-init
hyprland/workspaces: fix crash on monitor off/on
2023-11-01 23:12:32 +01:00
André Silva 8555456050
hyprland/workspaces: fix crash on monitor off/on 2023-11-01 22:04:19 +00:00
Alexis Rouillard 22dc87934a
Merge pull request #2626 from akliuxingyuan/master 2023-11-01 17:35:42 +01:00
akliuxingyuan 335a736eed tray: load_icon use request_size directly 2023-11-01 22:26:52 +08:00
Alexis Rouillard 1149e51f72
Merge pull request #2625 from LukashonakV/happyLinter 2023-11-01 08:27:13 +01:00
Viktar Lukashonak 9012cebbf2
Happy Linter
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-10-31 23:31:58 +03:00
Alexis Rouillard 6425bd2fe0
Merge pull request #2623 from LukashonakV/cavaBump 2023-10-31 21:13:52 +01:00
Alexis Rouillard 241938a86d
Merge pull request #2624 from sahib/master 2023-10-31 21:13:18 +01:00
Chris Pahl f511e61832 fix: custom: do not crash if input text is not valid utf-8 2023-10-31 19:41:42 +01:00
Viktar Lukashonak b9b89cce7e
Happy linter
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-10-31 20:47:56 +03:00
Viktar Lukashonak e9a66d68b7
Fix debug mode. cava issue
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-10-31 20:27:00 +03:00
Erik Reider 49caa4bf31 Add the PrivacyNodeInfo object as pw_proxy data 2023-10-31 11:38:01 +01:00
Erik Reider c60a8e9836 free pipewire listeners on proxy destruction 2023-10-31 08:52:54 +01:00
Alexis Rouillard b37d0df89b
Merge pull request #2622 from nomads-land/master 2023-10-31 07:44:29 +01:00
cvhere 67422eea36 Skips logging NoActivePlayer error msgs 2023-10-31 11:14:23 +05:30
Erik Reider c4226f3745 Readded signal_timeout instead of map to fix indicator being stuck 2023-10-30 18:01:47 +01:00
Erik Reider d32da917e4 Added tooltips 2023-10-29 00:17:53 +02:00
Erik Reider 46e36c0e68 Simplified the privacy_item hiding/showing logic 2023-10-28 18:30:50 +02:00
Erik Reider 86491e1512 Call module emit in privacy module contructor 2023-10-28 16:47:06 +02:00
Alexis Rouillard e46f66b468
Merge pull request #2613 from DreamMaoMao/master
Fixed variable synchronization exception caused by the "hyprland/workspace" module
2023-10-27 17:27:37 +02:00
DreamMaoMao 1f0ce1a5d9 Fixed variable synchronization exception caused by the "hyprland/workspace" module receiving create or delete IPC requests too quickly 2023-10-27 14:17:43 +08:00
Erik Reider 4a4c888d7d Fixed linter complaining 2023-10-27 00:01:40 +02:00
Erik Reider ace319b515 Updated default CSS to include the privacy module 2023-10-26 23:44:04 +02:00
Erik Reider e73ea8d608 Fixed cases where the module would be hidden when it should be visible 2023-10-26 23:37:10 +02:00
Erik Reider f7224d8459 Initial implementation 2023-10-26 23:22:02 +02:00
Alexis Rouillard 95b0647c91
chore: increase freebsd timeout 2023-10-26 22:17:20 +02:00
Alexis Rouillard 9ef8faf9b1
Merge pull request #2611 from taminob/bugfix/increase-freebsd-ci-timeout 2023-10-26 17:45:48 +02:00
Tamino Bauknecht 7d8c1494d7
cpu_usage: Fix ScopeGuard renaming in bsd-only file 2023-10-26 17:30:48 +02:00
Tamino Bauknecht 33f8a02fb5
ci: Increase freebsd timeout to 2h
After switching to a new FreeBSD action, the job seems to take longer
than 30 minutes.
Therefore, an increase in the timeout is necessary.
2023-10-26 17:19:26 +02:00
Alexis Rouillard 1618ee78b7
Merge pull request #2601 from taminob/bugfix/2598/fix-max-duration-sleep-for-bug
Fix sleep_for for max duration
2023-10-26 10:07:27 +02:00
Alex efab1daa7e chore: switch freebsd action 2023-10-25 18:35:58 +02:00
Alexis Rouillard 9a305b2d73
Merge pull request #2609 from taminob/feature/reduce-freebsd-ci-timeout
Reduce freebsd ci timeout
2023-10-25 18:28:10 +02:00
Crom (Thibaut CHARLES) 02c64f3f1e
Moved all waybar info into a single struct 2023-10-24 20:16:50 +02:00
Crom (Thibaut CHARLES) d86059016e
Send update dispatcher though FFI 2023-10-24 20:16:50 +02:00
Crom (Thibaut CHARLES) 088ca6b963
Added cffi/* module for third-party advanced modules 2023-10-24 20:16:50 +02:00
Crom (Thibaut CHARLES) 6ae354f564
PoC 2023-10-24 20:16:23 +02:00
Tamino Bauknecht 799fce0dc6
ci: Set freebsd to timeout after 30min
The job runs very unreliably and often times out after 6h of being stuck
in a boot loop.
This commit reduces the timeout to 30min.
2023-10-24 19:01:40 +02:00
Tamino Bauknecht 68dfd6aa3a
scope_guard/modules: Rename scope_guard to ScopeGuard
Using pascal case for the class name keeps it more consistent with the
majority of the other class names.
2023-10-24 17:51:38 +02:00
Tamino Bauknecht dd1de3efbf
Revert "Revert "Fix potential memory leaks""
This reverts commit 2d33c20231 and
reapplies various patches for memory leaks.
The reason for the revert was a bug for a maximum duration interval
which caused sleep_for() to cause unpredictable behavior.
2023-10-24 17:51:38 +02:00
Tamino Bauknecht 521dac8086
sleeper_thread: Make sleep_for more robust
In the previous fix for a passed max duration, the assumption was made
that at maximum one second will pass between the duration assignment and
the std::condition_variable::sleep_for() call.
This implementation makes the behavior more predictable by using
sleep_until() instead to emulate the sleep_for() behavior.
2023-10-24 17:51:34 +02:00
Tamino Bauknecht ad7d4eb07d
sleeper_thread: Allow sleep_for with max duration
The standard library has the implicit requirement that for
std::condition_variable::sleep_for() the duration must not cause an
overflow if added to the current time.
This commit will reduce the duration accordingly to fit into the
duration type.
2023-10-24 17:44:35 +02:00
Alexis Rouillard a459d8a9b3
Merge pull request #2605 from Syndelis/fix/hyprland-persistent-workspaces-disappear-when-empty 2023-10-24 08:31:11 +02:00
Brenno Lemos 4aee5977d6 fix: set workspace as persistent on create_workspace 2023-10-23 21:07:37 -03:00
Alexis Rouillard f2085fcd92
Merge pull request #2592 from zjeffer/hyprland/workspaces
General cleanup in hyprland/workspaces
2023-10-23 08:45:52 +02:00
Alexis Rouillard c47d75ceda
Merge pull request #2593 from x0rzavi/typo-fixes
docs: fix typos and improve language coherence
2023-10-23 08:45:08 +02:00
Alexis Rouillard 9ecdbcc7bc
Merge pull request #2596 from rehanzo/master 2023-10-22 09:46:35 +02:00
Alexis Rouillard dafe49d28c
Merge pull request #2599 from Alexays/revert-2586-bugfix/fix-potential-memory-leaks
Revert "Fix potential memory leaks"
2023-10-22 09:44:57 +02:00
Alexis Rouillard 2d33c20231
Revert "Fix potential memory leaks" 2023-10-22 09:44:46 +02:00
Rehan 5963bf6ace modules/mpris: change default interval value to 0 2023-10-21 18:14:46 -04:00
zjeffer dab1493644 cleanup onEvent, dont use try/catch for flow control 2023-10-21 19:33:55 +02:00
zjeffer acc911737d update window count inside the on_window_* functions 2023-10-21 18:53:53 +02:00
zjeffer 2d614c68f5 code review 2023-10-21 18:15:22 +02:00
Avishek Sen d0cab2a367
docs: fix typos and improve language coherence 2023-10-21 21:15:25 +05:30
zjeffer 7576611782 formatting 2023-10-21 17:06:02 +02:00
zjeffer ed65d9cdbd General cleanup in hyprland/workspaces 2023-10-21 16:52:23 +02:00
Alexis Rouillard dbb887b4a9
Merge pull request #2585 from davxy/master
Show the network interface with highest priority (aka lower metric)
2023-10-21 14:10:21 +02:00
Alexis Rouillard 06f4028697
Merge pull request #2588 from taminob/bugfix/fix-custom-module-signal-without-interval
Custom module: Allow signal without interrupt
2023-10-21 14:09:12 +02:00
Alexis Rouillard 3413b70413
Merge pull request #2586 from taminob/bugfix/fix-potential-memory-leaks
Fix potential memory leaks
2023-10-21 14:08:58 +02:00
Alexis Rouillard 6a8b510db8
Merge pull request #2589 from taminob/bugfix/lint-check-hpp-header-files 2023-10-21 12:56:57 +02:00
Tamino Bauknecht f598e348c4
ci: Update Linter job 2023-10-21 12:50:56 +02:00
Tamino Bauknecht 6dd2cfba34
ci: Lint header files with hpp file ending 2023-10-21 11:57:11 +02:00
Tamino Bauknecht ae748b2644
modules+util: fix actual (potential) memory leaks 2023-10-21 11:51:33 +02:00
Tamino Bauknecht a0b63d6b1e
modules: use scope_exit for deletion to make code more robust 2023-10-21 11:51:18 +02:00
Tamino Bauknecht 89e85db790
ALabel: make use of std::chrono::max() instead of magic number 2023-10-21 11:50:38 +02:00
Tamino Bauknecht a73669be6a
modules/upower: use smart pointer to avoid memory leak 2023-10-21 11:50:28 +02:00
Tamino Bauknecht 8c57756556
util: add scope_guard
This custom small implementation avoids adding an extra dependency like
Boost.ScopeExit
2023-10-21 11:50:06 +02:00
Tamino Bauknecht b8afde043c
sleeper_thread: allow interrupting sleep()
This keeps the function consistent with sleep_until() and sleep_for()
which both can be interrupted.
This is relevant to allow an update via a "signal" without an "interval"
in a custom module.
2023-10-20 23:57:54 +02:00
Alexis Rouillard eefd6e8336
Merge pull request #2578 from Syndelis/fix/hyprland-windows-disappearing 2023-10-20 10:24:56 +02:00
Davide Galassi 6829ed1bb4
Different interfaces have different index 2023-10-20 08:25:28 +02:00
Brenno Lemos 7d5577a2ed feat: create persistent workspaces after regular ones at init
feat: avoid recreating duplicate workspaces
2023-10-19 21:29:38 -03:00
Brenno Lemos a41225c4e0 Revert "fix: fill persistent workspaces' windows at init"
This reverts commit e14a3b8687.
2023-10-19 21:23:00 -03:00
Brenno Lemos a0d2d95b41 chore: remove unused function 2023-10-19 21:21:55 -03:00
Brenno Lemos e14a3b8687 fix: fill persistent workspaces' windows at init 2023-10-19 21:19:08 -03:00
Brenno Lemos 846842be80 feat: emit dispatcher when any window is created during update 2023-10-19 10:45:00 -03:00
Brenno Lemos e845db84ad feat: avoid recreating workspaces 2023-10-18 19:11:49 -03:00
Brenno Lemos 193040c41e feat: attempt to move windows out of the create window payload before taking them from workspaces 2023-10-18 19:11:49 -03:00
Alex 871f9a1269 fix: revert clock 2023-10-18 08:45:56 +02:00
Alex 5319cb6e10 fix: upower hidded on start 2023-10-17 20:12:24 +02:00
Alex 208928ded5 fix: lint 2023-10-17 19:29:06 +02:00
Alexis Rouillard 4d7eb3bd15
Merge pull request #2515 from chrisjshore/clock_fix
fix clock to work with fmt 10.x
2023-10-17 19:25:58 +02:00
Alexis Rouillard 6b73e2aa58
Merge pull request #2114 from mmhat/split-cpu-module
Split cpu module
2023-10-17 19:25:29 +02:00
Brenno Lemos 6ddd283d0f fix: special workspaces weren't registering windows because of the special qualifier prefix 2023-10-16 20:48:52 -03:00
Brenno Lemos e70a67d958 chore: lint
chore: swap push_back to emplace_back
2023-10-16 19:14:50 -03:00
Brenno Lemos 67c0c9a66c fix: delay window creation to await for hyprland to create a workspace 2023-10-16 19:07:00 -03:00
Alexis Rouillard 42741c963e
Merge pull request #2575 from Syndelis/feat/slider 2023-10-16 08:08:37 +02:00
Brenno Lemos 9d316de15a fix: avoid compiling audio_backend if pulse is not available 2023-10-15 18:12:31 -03:00
Brenno Lemos ecbcf242d5 feat: allow unmuting by moving the pulseaudio slider 2023-10-15 17:52:12 -03:00
Brenno Lemos fd3710d869 chore: suppress compiler warning 2023-10-15 17:52:12 -03:00
Brenno Lemos 11d7ca1d73 feat: backlight slider 2023-10-15 17:52:12 -03:00
Brenno Lemos c3779dd16e refactor: move backlight backend out of backlight module 2023-10-15 17:52:12 -03:00
Brenno Lemos 442a4b0da0 feat: pulseaudio slider module 2023-10-15 17:52:12 -03:00
Brenno Lemos c9e129cda2 feat: allow setting volume directly 2023-10-15 17:52:12 -03:00
Brenno Lemos 64d7fae03a refactor: move pulseaudio handling to separate class 2023-10-15 17:52:12 -03:00
Alexis Rouillard 44d8245605
Merge pull request #2560 from akshettrj/mpris-click-fix 2023-10-15 21:26:33 +02:00
Alexis Rouillard 93daf089b5
Merge pull request #2574 from Syndelis/feat/group-drawers 2023-10-15 21:26:04 +02:00
Alexis Rouillard 7645ae1907
Merge pull request #2563 from Syndelis/feat/hyprland-window-rename-by-title 2023-10-15 21:21:32 +02:00
Alexis Rouillard 3d496c2200
Merge pull request #2554 from mutoroglin/cava-hide-on-silence 2023-10-15 21:19:17 +02:00
Brenno Lemos ff9b6c9469 docs: fix weird man limitation 2023-10-14 22:14:13 -03:00
Brenno Lemos 05b97e9ec2 fix: add hover handler to every element in the group drawer 2023-10-14 22:13:01 -03:00
Brenno Lemos 8f32d102ae docs: include group drawer documentation 2023-10-14 18:50:45 -03:00
Brenno Lemos 5a380da3bb chore: remove redundant else statement 2023-10-14 18:39:42 -03:00
Brenno Lemos 5e44cb6ba2 refactor: move signal handler adding into separate method
fix: typo in handleMouseHover method name
2023-10-14 18:30:27 -03:00
Brenno Lemos fad858782c feat: improve drawer configuration 2023-10-14 18:24:50 -03:00
Brenno Lemos 5246ab15cb feat: add drawer bool option to group 2023-10-14 17:17:52 -03:00
Brenno Lemos bbb7fb0c82 refactor: don't use a group's box directly in bar 2023-10-14 13:23:11 -03:00
Brenno Lemos c59264d6b4 fix: clang < 16 can't emplace back struct with no constructor 2023-10-12 17:30:32 -03:00
Alexis Rouillard a3774dc586
Merge pull request #2568 from Syndelis/feat/hyprland-ignore-workspaces 2023-10-12 07:32:56 +02:00
Brenno Lemos ee652677a6 feat: ignore windows with empty classes or titles (if any rule uses title) 2023-10-11 11:40:49 -03:00
Brenno Lemos ceeb5bf8bd docs: include new ignore-workspaces example and documentation 2023-10-11 11:03:18 -03:00
Brenno Lemos c995bafa7a feat: add option to ignore workspaces based on regex 2023-10-11 10:59:33 -03:00
Brenno Lemos f8340d88be chore: lint unrelated file
this file was edited in #2558 but not linted
2023-10-09 15:26:07 -03:00
Brenno Lemos 592d5645a5 docs: include new feature in manual 2023-10-09 14:58:21 -03:00
Brenno Lemos f9a7ecf3a9 feat: optimize cache usage when window titles aren't involved 2023-10-09 14:49:38 -03:00
Brenno Lemos 387e54498e docs: document new regex collection class 2023-10-09 14:46:57 -03:00
Brenno Lemos fad43d4b16 feat: listen to windowtitle IPC event condiationally to update window rules 2023-10-09 14:42:53 -03:00
Brenno Lemos 8d057e6f96 refactor: separate regex rule matching and caching in separate class 2023-10-09 13:53:00 -03:00
Joerg Weislogel b2e88347b3 added description for configuration option hide-on-silence in man file 2023-10-09 17:05:12 +02:00
Akshett Rai Jindal 1af02e0a67 fix(modules/mpris): fix on-*-click typos
In all other places, the norm is to use `on-click-(middle|right)` but in
the mpris module, `on-(middle|right)-click` was being used which caused
clicks to malfunction if set to some custom commands
2023-10-09 11:48:49 +05:30
Alexis Rouillard 30cc88a4c5
Merge pull request #2558 from SWarrener/master 2023-10-08 22:37:46 +02:00
SWarrener 32d326ca4a Some missing backticks 2023-10-08 16:34:27 +01:00
SWarrener ae92d7d186 Updating man page with details of options to force specific units in disk size output 2023-10-08 16:26:06 +01:00
SWarrener c16e791cdc Adding options to allow disk outputs to always be in a specific unit 2023-10-08 16:24:50 +01:00
Christopher Shore fbd62e0071
Merge branch 'Alexays:master' into clock_fix 2023-10-07 18:39:56 -04:00
Joerg Weislogel 1eb0777799 add function to cava module to hide on silence 2023-10-07 12:50:24 +02:00
Alexis Rouillard 58e506a675
Merge pull request #2529 from Syndelis/feat/hyprland-window-workspaces
Feature: Hyprland dynamic window names on workspaces
2023-10-02 19:17:42 +02:00
Brenno Lemos 1b98a04c93 chore: lint unrelated files so the CI passes 2023-10-02 12:33:28 -03:00
Alexis Rouillard 4c0347d9f2
Merge pull request #2540 from Syndelis/fix/hyprland-special-workspaces 2023-09-25 22:33:36 +02:00
Brenno Lemos 9a3238c20b chore: avoid the creation and deletion of doubled-special workspaces
see hyprwm/Hyprland#3424 for more info

Co-authored-by: Gabriel Fox <Inbox@GabrielFox.Dev>
2023-09-25 17:13:26 -03:00
Brenno Lemos 6e48b236a1 fix: workspace special wasn't removed
fixes  #2505

Co-authored-by: Gabriel Fox <Inbox@GabrielFox.Dev>
2023-09-25 17:12:51 -03:00
Alexis Rouillard 16f6d9dfa0
Merge pull request #2534 from woojiq/fix-hyprland-default-icon 2023-09-24 09:25:37 +02:00
woojiq d37954322a fix(hyprland): use workspace `name` as default icon
Wlr and Sway modules use the workspace `name` as the default icon if no icon is provided. This adds the same behavior for the `hyprland/workspace` module.

Closes https://github.com/Alexays/Waybar/issues/2533
2023-09-23 21:55:18 +03:00
Brenno Lemos 258ab8b147 refactor: take window representation directly from old workspace on movewindow event 2023-09-22 21:12:42 -03:00
Brenno Lemos 6663ca3d75 chore: document new properties 2023-09-22 20:41:38 -03:00
Brenno Lemos adbc9d95de feat: optional default icon for 0-match classes
Co-authored-by: Gabriel Fox <Inbox@GabrielFox.Dev>
2023-09-22 19:16:59 -03:00
Brenno Lemos fbe544984c fix: ipc vs json window addr format mismatch
feat: ignore empty windows

Co-authored-by: Gabriel Fox <Inbox@GabrielFox.Dev>
2023-09-22 19:16:56 -03:00
Brenno Lemos b9d5912a4f feat: rewrite window classes
feat: cache window class rewrite resolution

Co-authored-by: Gabriel Fox <Inbox@GabrielFox.Dev>
2023-09-22 19:16:53 -03:00
Brenno Lemos 3e2761e81f feat: dynamically assign windows to workspaces
Co-authored-by: Gabriel Fox <Inbox@GabrielFox.Dev>
2023-09-22 19:12:50 -03:00
Alexis Rouillard 6997b34a81
Merge pull request #2517 from an-prata/master
Lighter Weight Signal-Based Custom Modules
2023-09-21 23:48:22 +02:00
Alexis Rouillard 5960e8f1ee
Merge pull request #2518 from idm1try/fix-bl-asahi
fix(backlight): wrong percentage numbers for device apple-panel-bl
2023-09-21 23:47:23 +02:00
idm1try 81ffeebfb1
fix: style
Co-authored-by: Alexis Rouillard <alexisr245@gmail.com>
2023-09-21 09:03:13 +05:00
Evan Overman f14fe96e19
add info to `interval` and `signal` in manpage for custom modules 2023-09-19 14:52:48 -07:00
idm1try 954bea36f4 chore: remove result dir by nix 2023-09-19 18:52:00 +05:00
idm1try 388c024298 fix(backlight): wrong percentage numbers for device apple-panel-bl 2023-09-19 18:50:39 +05:00
Alexis Rouillard 9b8adc1951
Merge pull request #2494 from KanuX-14/battery_fix
Fix battery not showing for some devices
2023-09-19 13:33:35 +02:00
Evan Overman bf371f70d1
add `waitingWorker()` to `Custom` 2023-09-18 14:56:14 -07:00
Evan Overman 7c28ffc856
add indefinite `sleep()` function to `SleeperThread` 2023-09-18 14:55:50 -07:00
Christopher Shore 14820e5d18
fix clock to work with fmt 10.x 2023-09-17 16:32:19 -04:00
Mann mit Hut 80a34eec81
Fixed formatting again 2023-09-13 23:25:39 +02:00
Mann mit Hut d5203e5b37
Fixed cpu module: Provide stub implementation for parseCpuFrequencies 2023-09-13 23:12:35 +02:00
Mann mit Hut 91b6629103
Fixed format errors 2023-09-13 21:59:42 +02:00
Mann mit Hut 93d66a9258
Moved cpu/common.cpp to cpu.cpp 2023-09-13 21:56:37 +02:00
Mann mit Hut 8d7341da6e
cpu module: Reuse getLoad of load module 2023-09-13 21:56:37 +02:00
Mann mit Hut d1602e383c
cpu module: Reuse getCpuUsage of cpu_usage module 2023-09-13 21:56:36 +02:00
Mann mit Hut c45f6681b3
cpu module: Reuse getCpuFrequency of cpu_frequency module 2023-09-13 21:56:35 +02:00
Mann mit Hut dce6a98f38
Added changes made to the cpu module 2023-09-13 21:56:34 +02:00
Mann mit Hut 982ffde002
Use labels instead of buttons 2023-09-13 21:56:33 +02:00
Mann mit Hut 888adb57ec
Introduce cpu_usage module 2023-09-13 21:56:32 +02:00
Mann mit Hut c36fe3a004
Introduce cpu_frequency module 2023-09-13 21:56:31 +02:00
Mann mit Hut 729564cc27
Introduced separate load module
The module provides the three system load averages. This is an
improvement compared what you can do with the cpu module: cpu
only provides the one minute sample and the state of the cpu module is
derived from the cpu usage which messes up the formating of the load
average. Also, at least on modern Linux systems, the load of a system
takes much more than the cpu utilization into account and it should
therefore live in a separate module.
2023-09-13 21:56:30 +02:00
Alexis Rouillard 4d32991bee
Merge pull request #2507 from hariseldon78/patch-1
Update workspaces.cpp
2023-09-13 18:21:22 +02:00
Roberto Previdi 69736d68aa
Update workspaces.cpp
Fix unchecked string to int conversion of workspace name (which can be a string)
Closes #2501
2023-09-13 18:20:13 +02:00
KanuX-14 28a2d15fef Update 'bat-compatibility' option to manual 2023-09-12 13:39:09 -03:00
Alexis Rouillard a90e275d5e
Merge pull request #2470 from 4e554c4c/darkmode
search for dark or light mode stylesheet
2023-09-11 09:36:05 +02:00
Alexis Rouillard fc67558717
Merge branch 'master' into darkmode 2023-09-11 09:25:45 +02:00
Alexis Rouillard 196b400abf
Merge pull request #2468 from khaneliman/persistent-rename
deprecate persistent_workspaces in favor of persistent-workspaces
2023-09-11 09:22:07 +02:00
Alexis Rouillard 05a2af2d7c
Merge pull request #2486 from khaneliman/workspace-sorting
feat: hyprland workspaces add sort-by
2023-09-11 09:21:35 +02:00
KanuX-14 1ff4464b2f Use adapter status if battery status is inexistent 2023-09-10 15:16:43 -03:00
KanuX-14 60611e9c2b Fix battery not showing for some devices
Adds 'bat-compatibility' boolean checking from configuration file.
2023-09-10 14:41:40 -03:00
Austin Horstman 79cf33b9f1
refactor: enumparser create implementation file 2023-09-09 17:59:40 -05:00
Austin Horstman b8630968b2
refactor: move capitalize string helper 2023-09-09 13:23:17 -05:00
Austin Horstman 2fee12d930
fix: enumparser capitalize everything to avoid issues 2023-09-09 12:14:52 -05:00
Austin Horstman 3ae2fe3272
refactor: PR review cleanup 2023-09-09 12:08:30 -05:00
Austin Horstman 2b8c92e8fd
refactor: enum utility allow overriding 2023-09-09 11:18:12 -05:00
Austin Horstman 8ce64ea784
refactor: make parsing sort-by more lenient 2023-09-09 10:04:49 -05:00
Austin Horstman 8ea2626de8
refactor: sort-by enum hyprland 2023-09-09 10:04:48 -05:00
Austin Horstman 65ba449460
chore: update man page index 2023-09-08 23:17:21 -05:00
Austin Horstman cbc12e5443
feat: hyprland workspaces add sort-by 2023-09-08 22:49:15 -05:00
Austin Horstman 587bd0cd62
refactor: cleanup hyprland workspaces constructor 2023-09-08 22:24:05 -05:00
Alexis Rouillard 309edd0585
Merge pull request #2485 from khaneliman/active-rename 2023-09-08 23:11:58 +02:00
Austin Horstman 2837b72064
fix: rename workspace active fix 2023-09-08 14:11:02 -05:00
Alexis Rouillard 38ef38b72f
Merge pull request #2477 from zjeffer/fix/urgent-icon 2023-09-07 20:33:22 +02:00
zjeffer 6c3565c520 Add urgent icon
Fixes #2476
2023-09-07 19:33:56 +02:00
Calvin Lee 9bb2c01a44 clean up client.cpp 2023-09-07 13:43:59 +00:00
Calvin Lee 09873f0ed9 search for dark or light mode stylesheet
summary:
-------
This commit adds xdg-desktop-portal support to waybar. If a portal
supporting `org.freedesktop.portal.Settings` exists, then it will be
queried for the current colorscheme. This colorscheme will then be used
to prefer a `style-light.css` or `style-dark.css` over the basic
`style.css`.

technical details:
-----------------
Appearance is provided by several libraries, such as libhandy (mobile)
and libadwaita. However, waybar links to neither of these libraries. As
the amount of code required to communicate with xdg-desktop portal as a
client is rather minimal, I believe doing so is better than linking to
an additional library.

The Gio library for communicating with dbus is rather messy, Instead of
the `Portal` class containing a `Gio::Dbus::Proxy`, it extends it which
simplifies signal handling.

`Portal` then exposes its own signal, which can be listened to by waybar
to update CSS.

For a reference implementation, please see another one of my projects:
https://github.com/4e554c4c/darkman.nvim/blob/main/portal.go

test plan:
---------
If no desktop portal which provides `Settings` exists, then waybar
continues with the log line
```
[2023-09-06 14:14:37.754] [info] Unable to receive desktop appearance: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
```

Furthermore, if `style-light.css` or `style-dark.css` do not exist, then
`style.css` will still be searched for.

Waybar has been tested with both light and dark startup. E.g. if the
appearance is dark on startup the log lines
```
[2023-09-06 14:27:45.379] [info] Discovered appearance 'dark'
[2023-09-06 14:27:45.379] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/style-dark.css
[2023-09-06 14:27:45.379] [debug] Found config file: $XDG_CONFIG_HOME/waybar/style-dark.css
[2023-09-06 14:27:45.379] [info] Using CSS file /home/pounce/.config/waybar/style-dark.css
```
will be observed.
If the color then changes to light during the operation of waybar, it
will change css files:
```
[2023-09-06 14:28:17.173] [info] Received new appearance 'dark'
[2023-09-06 14:28:17.173] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/style-light.css
[2023-09-06 14:28:17.173] [debug] Found config file: $XDG_CONFIG_HOME/waybar/style-light.css
[2023-09-06 14:28:17.173] [info] Using CSS file /home/pounce/.config/waybar/style-light.css
```

Finally, tested resetting waybar and toggling style (works, and style is
only changed once).

fixes: Alexays/Waybar#1973
2023-09-06 15:19:56 +00:00
khaneliman c9e1899594
refactor: deprecate instead of remove persistent_workspaces 2023-09-05 16:02:45 -05:00
khaneliman b405dc436c
refactor!: wlr persistent workspaces config rename 2023-09-05 16:02:22 -05:00
khaneliman 4a6c1269fb
refactor!: sway persistent workspaces config name rename 2023-09-05 16:02:21 -05:00
khaneliman 44ac6b8044
refactor!: hyprland persistent workspaces config option name standardization 2023-09-05 16:02:19 -05:00
Alexis Rouillard 80de22a159
Merge pull request #2408 from zjeffer/hyprland/workspaces_active-only
Implement 'active_only' option and 'visible' class in hyprland/workspaces
2023-09-05 22:59:49 +02:00
zjeffer 04b39ea64e hyprland/workspaces: implement 'active_only' option and visible class 2023-09-05 18:22:54 +02:00
Alexis Rouillard 116aa5cdbd
Merge pull request #2466 from maximbaz/hyprland-support-workspace-rename
hyprland/workspaces: react on renameworkspace event
2023-09-05 17:23:06 +02:00
Maxim Baz 9c49f46b01
hyprland/workspaces: react on renameworkspace event 2023-09-05 17:13:25 +02:00
Alexis Rouillard f7ff005dd5
Merge pull request #2460 from xercesblue/set_urgent_segfault
modules/hyprland: Fix segfault when attempting to set_urgent on a missing workspace
2023-09-05 08:42:39 +02:00
xercesblue d40ccd0da8 modules/hyprland: Fix segfault when attempting to set_urgent on a missing workspace 2023-09-04 16:57:00 -07:00
Alexis Rouillard 6f66af9ab9
Merge pull request #2134 from bruceblore/battery-weighted-percentage
Display battery percentage as weighted average of battery levels
2023-09-04 22:01:40 +02:00
Alexis Rouillard 2d27e484c7
Merge pull request #2417 from Cherser-s/sni-click-coordinate-fix
sni: fix passing relative coordinates to dbus methods
2023-09-04 22:01:04 +02:00
Alexis Rouillard a77ccf4bd1
Merge pull request #2457 from khaneliman/hyprland-cleanup
Hyprland linting cleanup
2023-09-04 22:00:44 +02:00
Austin Horstman 4cb8efbecc
chore: cpplint fixes hyprland classes 2023-09-03 00:18:31 -05:00
Austin Horstman 8fc4187713
refactor: replace strcpy with snprintf 2023-09-02 23:56:06 -05:00
Austin Horstman ce076927f3
chore: cpplint fixes hyprland headers 2023-09-02 23:56:04 -05:00
Alexis Rouillard 8eb614f69e
Merge pull request #2438 from khaneliman/hyprland-workspace-array
hyprland persistent workspace support new config declaration
2023-09-01 09:10:23 +02:00
Alexis Rouillard 347dd1c799
Merge pull request #2431 from zjeffer/fix/persistent-workspace-icon
hyprland/workspaces: Add "empty" icon and class
2023-09-01 09:09:32 +02:00
Alexis Rouillard 82b7e4ea01
Merge pull request #2414 from KosmX/add_release_v2
Release button event second attempt
2023-09-01 09:08:23 +02:00
Alexis Rouillard d7d4a6c632
Merge pull request #2442 from PucklaJ/hyprland_persistent
Show workspaces on all outputs if persistent_workspaces value is empty
2023-09-01 09:06:41 +02:00
PucklaJ a18b41911d hyprland/workspaces: Show workspace on all outputs if an empty array is given
This behaviour is consistent with sway/workspaces and wlr/workspaces
2023-08-30 13:35:19 +02:00
Austin Horstman 52309615c1
hyprland new persistent_workspace configuration style 2023-08-29 00:11:25 -05:00
Cherser-s 65dfabc430 sni: fix passing relative coordinates to dbus methods
Doesn't correctly handle the case with both margin and width/height being set at the same time.
2023-08-25 20:37:16 +03:00
Cherser-s 936937ec78 store margins and global window offset in the bar object 2023-08-25 20:37:14 +03:00
zjeffer e163dd8216 hyprland/workspaces: update manpage 2023-08-24 22:51:06 +02:00
zjeffer 06a9f98878 hyprland/workspaces: Add "empty" icon and class 2023-08-24 21:19:20 +02:00
KosmX 392e863e6d
Apply formatting 2023-08-16 17:33:36 +02:00
KosmX 2ff347f9a8
Add handleRelease method to release events
This commit shouldn't change the handleToggle behaviour,
it shouldn't break anything.
2023-08-16 17:14:49 +02:00
KosmX 1d8331d0c5
Add release events to event map 2023-08-16 17:12:32 +02:00
KosmX 718db71638
Refactor enable click condition
This shouldn't change behaviour.
2023-08-16 17:11:44 +02:00
Bruce Blore bad6cfae6f Added option to calculate battery percentage as total_energy * 100 / total_energy_full 2023-04-22 23:43:04 -07:00
206 changed files with 8894 additions and 3317 deletions

29
.clang-tidy Normal file
View File

@ -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 }

65
.github/labeler.yml vendored Normal file
View File

@ -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)"

19
.github/workflows/clang-format.yml vendored Normal file
View File

@ -0,0 +1,19 @@
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

39
.github/workflows/clang-tidy.yml vendored Normal file
View File

@ -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:
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

View File

@ -2,28 +2,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: jobs:
clang: clang:
# Run actions in a FreeBSD VM on the macos-12 runner # 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/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: ubuntu-latest
runs-on: macos-12
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Test in FreeBSD VM - name: Test in FreeBSD VM
uses: vmactions/freebsd-vm@v0 uses: cross-platform-actions/action@v0.23.0
timeout-minutes: 180
env:
CPPFLAGS: '-isystem/usr/local/include'
LDFLAGS: '-L/usr/local/lib'
with: with:
mem: 2048 operating_system: freebsd
usesh: true version: "13.2"
prepare: | environment_variables: CPPFLAGS LDFLAGS
export CPPFLAGS=-isystem/usr/local/include LDFLAGS=-L/usr/local/lib # sndio sync_files: runner-to-vm
sed -i '' 's/quarterly/latest/' /etc/pkg/FreeBSD.conf run: |
pkg install -y git # subprojects/date sudo sed -i '' 's/quarterly/latest/' /etc/pkg/FreeBSD.conf
pkg install -y catch evdev-proto gtk-layer-shell gtkmm30 jsoncpp \ 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 \ libdbusmenu libevdev libfmt libmpdclient libudev-devd meson \
pkgconf pulseaudio scdoc sndio spdlog wayland-protocols upower \ pkgconf pulseaudio scdoc sndio spdlog wayland-protocols upower \
libinotify libinotify
run: |
meson build -Dman-pages=enabled meson build -Dman-pages=enabled
ninja -C build ninja -C build
meson test -C build --no-rebuild --print-errorlogs --suite waybar meson test -C build --no-rebuild --print-errorlogs --suite waybar

19
.github/workflows/labeler.yml vendored Normal file
View File

@ -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 }}

View File

@ -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

View File

@ -2,6 +2,10 @@ name: linux
on: [push, pull_request] on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs: jobs:
build: build:
strategy: strategy:
@ -14,9 +18,6 @@ jobs:
- opensuse - opensuse
- gentoo - gentoo
cpp_std: [c++20] cpp_std: [c++20]
include:
- distro: fedora
cpp_std: c++20
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:

4
.gitignore vendored
View File

@ -44,3 +44,7 @@ packagecache
*.out *.out
*.app *.app
/.direnv/ /.direnv/
# Nix
result
result-*

View File

@ -2,6 +2,48 @@
FROM debian:sid FROM debian:sid
RUN apt-get update && \ RUN apt 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 install --no-install-recommends --no-install-suggests -y \
apt-get clean 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.4-dev \
libxkbcommon-dev \
libxkbregistry-dev \
locales \
meson \
ninja-build \
pkg-config \
python3-pip \
python3-venv \
scdoc \
sudo \
wayland-protocols \
&& apt clean

View File

@ -1,22 +1,23 @@
# Waybar [![Licence](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Paypal Donate](https://img.shields.io/badge/Donate-Paypal-2244dd.svg)](https://paypal.me/ARouillard)<br>![Waybar](https://raw.githubusercontent.com/alexays/waybar/master/preview-2.png) # Waybar [![Licence](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Paypal Donate](https://img.shields.io/badge/Donate-Paypal-2244dd.svg)](https://paypal.me/ARouillard)<br>![Waybar](https://raw.githubusercontent.com/alexays/waybar/master/preview-2.png)
> Highly customizable Wayland bar for Sway and Wlroots based compositors.<br> > Highly customizable Wayland bar for Sway and Wlroots based compositors.<br>
> Available in Arch [extra](https://www.archlinux.org/packages/extra/x86_64/waybar/) or > Available in [all major distributions](https://github.com/Alexays/Waybar/wiki/Installation)<br>
[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).<br>
> *Waybar [examples](https://github.com/Alexays/Waybar/wiki/Examples)* > *Waybar [examples](https://github.com/Alexays/Waybar/wiki/Examples)*
#### Current features #### Current features
- Sway (Workspaces, Binding mode, Focused window name) - Sway (Workspaces, Binding mode, Focused window name)
- River (Mapping mode, Tags, Focused window name) - River (Mapping mode, Tags, Focused window name)
- Hyprland (Focused window name) - Hyprland (Window Icons, Workspaces, Focused window name)
- DWL (Tags) [requires dwl ipc patch](https://github.com/djpohly/dwl/wiki/ipc) - 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) - Tray [#21](https://github.com/Alexays/Waybar/issues/21)
- Local time - Local time
- Battery - Battery
- UPower - UPower
- Power profiles daemon
- Network - Network
- Bluetooth - Bluetooth
- Pulseaudio - Pulseaudio
- Privacy Info
- Wireplumber - Wireplumber
- Disk - Disk
- Memory - Memory
@ -36,7 +37,7 @@
Waybar is available from a number of Linux distributions: Waybar is available from a number of Linux distributions:
[![Packaging status](https://repology.org/badge/vertical-allrepos/waybar.svg)](https://repology.org/project/waybar/versions) [![Packaging status](https://repology.org/badge/vertical-allrepos/waybar.svg?columns=3&header=Waybar%20Downstream%20Packaging)](https://repology.org/project/waybar/versions)
An Ubuntu PPA with more recent versions is available An Ubuntu PPA with more recent versions is available
[here](https://launchpad.net/~nschloe/+archive/ubuntu/waybar). [here](https://launchpad.net/~nschloe/+archive/ubuntu/waybar).

View File

@ -1,32 +1,13 @@
{ {
"nodes": { "nodes": {
"devshell": {
"inputs": {
"nixpkgs": "nixpkgs",
"systems": "systems"
},
"locked": {
"lastModified": 1692523566,
"narHash": "sha256-VDJDihK6jNebVw9y3qKCVD6+6QaC/x8kxZzL4MaIPPY=",
"owner": "numtide",
"repo": "devshell",
"rev": "d208c58e2f7afef838add5f18a9936b12a71d695",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1673956053, "lastModified": 1696426674,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -35,47 +16,13 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1677383253, "lastModified": 1711163522,
"narHash": "sha256-UfpzWfSxkfXHnb4boXZNaKsAcUrZT9Hw+tao1oZxd08=", "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9952d6bc395f5841262b006fbace8dd7e143b634", "rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1692638711,
"narHash": "sha256-J0LgSFgJVGCC1+j5R2QndadWI1oumusg6hCtYAzLID4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "91a22f76cd1716f9d0149e8a5c68424bb691de15",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -87,40 +34,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-utils": "flake-utils", "nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs_2"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
} }
} }
}, },

View File

@ -1,27 +1,22 @@
{ {
description = "Highly customizable Wayland bar for Sway and Wlroots based compositors."; description = "Highly customizable Wayland bar for Sway and Wlroots based compositors";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = { flake-compat = {
url = "github:edolstra/flake-compat"; url = "github:edolstra/flake-compat";
flake = false; flake = false;
}; };
}; };
outputs = { self, flake-utils, devshell, nixpkgs, flake-compat }: outputs = { self, nixpkgs, ... }:
let let
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
genSystems = lib.genAttrs [ genSystems = func: lib.genAttrs [
"x86_64-linux" "x86_64-linux"
]; "aarch64-linux"
]
pkgsFor = genSystems (system: (system: func (import nixpkgs { inherit system; }));
import nixpkgs {
inherit system;
});
mkDate = longDate: (lib.concatStringsSep "-" [ mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate) (builtins.substring 0 4 longDate)
@ -30,60 +25,43 @@
]); ]);
in in
{ {
overlays.default = final: prev: { devShells = genSystems
waybar = final.callPackage ./nix/default.nix { (pkgs:
version = prev.waybar.version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); {
}; default =
}; pkgs.mkShell
packages = genSystems {
(system: name = "waybar-shell";
(self.overlays.default pkgsFor.${system} pkgsFor.${system})
// {
default = self.packages.${system}.waybar;
});
} //
flake-utils.lib.eachDefaultSystem (system: {
devShell =
let pkgs = import nixpkgs {
inherit system;
overlays = [ devshell.overlays.default ]; # inherit attributes from upstream nixpkgs derivation
}; inherit (pkgs.waybar) buildInputs depsBuildBuild depsBuildBuildPropagated depsBuildTarget
in depsBuildTargetPropagated depsHostHost depsHostHostPropagated depsTargetTarget
pkgs.devshell.mkShell { depsTargetTargetPropagated propagatedBuildInputs propagatedNativeBuildInputs strictDeps;
imports = [ "${pkgs.devshell.extraModulesDir}/language/c.nix" ];
devshell.packages = with pkgs; [ # overrides for local development
nativeBuildInputs = pkgs.waybar.nativeBuildInputs ++ (with pkgs; [
clang-tools clang-tools
gdb 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 = final: prev: {
waybar = final.callPackage ./nix/default.nix {
# 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:
let packages = self.overlays.default pkgs pkgs;
in packages // {
default = packages.waybar;
});
};
} }

View File

@ -11,12 +11,15 @@ namespace waybar {
class AModule : public IModule { class AModule : public IModule {
public: public:
static constexpr const char *MODULE_CLASS = "module";
virtual ~AModule(); virtual ~AModule();
auto update() -> void override; auto update() -> void override;
virtual auto refresh(int) -> void{}; virtual auto refresh(int) -> void{};
operator Gtk::Widget &() override; operator Gtk::Widget &() override;
auto doAction(const std::string &name) -> void override; auto doAction(const std::string &name) -> void override;
/// Emitting on this dispatcher triggers a update() call
Glib::Dispatcher dp; Glib::Dispatcher dp;
protected: protected:
@ -36,26 +39,34 @@ class AModule : public IModule {
virtual bool handleToggle(GdkEventButton *const &ev); virtual bool handleToggle(GdkEventButton *const &ev);
virtual bool handleScroll(GdkEventScroll *); virtual bool handleScroll(GdkEventScroll *);
virtual bool handleRelease(GdkEventButton *const &ev);
private: private:
bool handleUserEvent(GdkEventButton *const &ev);
const bool isTooltip;
std::vector<int> pid_; std::vector<int> pid_;
gdouble distance_scrolled_y_; gdouble distance_scrolled_y_;
gdouble distance_scrolled_x_; gdouble distance_scrolled_x_;
std::map<std::string, std::string> eventActionMap_; std::map<std::string, std::string> eventActionMap_;
static const inline std::map<std::pair<uint, GdkEventType>, std::string> eventMap_{ static const inline std::map<std::pair<uint, GdkEventType>, std::string> eventMap_{
{std::make_pair(1, GdkEventType::GDK_BUTTON_PRESS), "on-click"}, {std::make_pair(1, GdkEventType::GDK_BUTTON_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_2BUTTON_PRESS), "on-double-click"},
{std::make_pair(1, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-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_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_2BUTTON_PRESS), "on-double-click-middle"},
{std::make_pair(2, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-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_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_2BUTTON_PRESS), "on-double-click-right"},
{std::make_pair(3, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-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_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_2BUTTON_PRESS), "on-double-click-backward"},
{std::make_pair(8, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-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_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_2BUTTON_PRESS), "on-double-click-forward"},
{std::make_pair(9, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click-forward"}}; {std::make_pair(9, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click-forward"}};
}; };

19
include/ASlider.hpp Normal file
View File

@ -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

View File

@ -12,6 +12,7 @@
#include <vector> #include <vector>
#include "AModule.hpp" #include "AModule.hpp"
#include "group.hpp"
#include "xdg-output-unstable-v1-client-protocol.h" #include "xdg-output-unstable-v1-client-protocol.h"
namespace waybar { namespace waybar {
@ -52,34 +53,18 @@ class BarIpcClient;
} }
#endif // HAVE_SWAY #endif // HAVE_SWAY
class BarSurface {
protected:
BarSurface() = default;
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 { class Bar {
public: public:
using bar_mode_map = std::map<std::string_view, struct bar_mode>; using bar_mode_map = std::map<std::string, struct bar_mode>;
static const bar_mode_map PRESET_MODES; static const bar_mode_map PRESET_MODES;
static const std::string_view MODE_DEFAULT; static const std::string MODE_DEFAULT;
static const std::string_view MODE_INVISIBLE; static const std::string MODE_INVISIBLE;
Bar(struct waybar_output *w_output, const Json::Value &); Bar(struct waybar_output *w_output, const Json::Value &);
Bar(const Bar &) = delete; Bar(const Bar &) = delete;
~Bar(); ~Bar();
void setMode(const std::string_view &); void setMode(const std::string &mode);
void setVisible(bool visible); void setVisible(bool visible);
void toggle(); void toggle();
void handleSignal(int); void handleSignal(int);
@ -88,8 +73,12 @@ class Bar {
Json::Value config; Json::Value config;
struct wl_surface *surface; struct wl_surface *surface;
bool visible = true; bool visible = true;
bool vertical = false;
Gtk::Window window; Gtk::Window window;
Gtk::Orientation orientation = Gtk::ORIENTATION_HORIZONTAL;
Gtk::PositionType position = Gtk::POS_TOP;
int x_global;
int y_global;
#ifdef HAVE_SWAY #ifdef HAVE_SWAY
std::string bar_id; std::string bar_id;
@ -98,16 +87,24 @@ class Bar {
private: private:
void onMap(GdkEventAny *); void onMap(GdkEventAny *);
auto setupWidgets() -> void; 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 setupAltFormatKeyForModule(const std::string &module_name);
void setupAltFormatKeyForModuleList(const char *module_list_name); void setupAltFormatKeyForModuleList(const char *module_list_name);
void setMode(const bar_mode &); 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 */ /* Copy initial set of modes to allow customization */
bar_mode_map configured_modes = PRESET_MODES; bar_mode_map configured_modes = PRESET_MODES;
std::string last_mode_{MODE_DEFAULT}; std::string last_mode_{MODE_DEFAULT};
std::unique_ptr<BarSurface> surface_impl_; struct bar_margins margins_;
uint32_t width_, height_;
bool passthrough_;
Gtk::Box left_; Gtk::Box left_;
Gtk::Box center_; Gtk::Box center_;
Gtk::Box right_; Gtk::Box right_;

View File

@ -7,8 +7,9 @@
#include "bar.hpp" #include "bar.hpp"
#include "config.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_inhibitor_v1;
struct zwp_idle_inhibit_manager_v1; struct zwp_idle_inhibit_manager_v1;
@ -24,7 +25,6 @@ class Client {
Glib::RefPtr<Gdk::Display> gdk_display; Glib::RefPtr<Gdk::Display> gdk_display;
struct wl_display *wl_display = nullptr; struct wl_display *wl_display = nullptr;
struct wl_registry *registry = nullptr; struct wl_registry *registry = nullptr;
struct zwlr_layer_shell_v1 *layer_shell = nullptr;
struct zxdg_output_manager_v1 *xdg_output_manager = nullptr; struct zxdg_output_manager_v1 *xdg_output_manager = nullptr;
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager = nullptr; struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager = nullptr;
std::vector<std::unique_ptr<Bar>> bars; std::vector<std::unique_ptr<Bar>> bars;
@ -33,7 +33,7 @@ class Client {
private: private:
Client() = default; Client() = default;
const std::string getStyle(const std::string &style); const std::string getStyle(const std::string &style, std::optional<Appearance> appearance);
void bindInterfaces(); void bindInterfaces();
void handleOutput(struct waybar_output &output); void handleOutput(struct waybar_output &output);
auto setupCss(const std::string &css_file) -> void; auto setupCss(const std::string &css_file) -> void;
@ -52,7 +52,10 @@ class Client {
Glib::RefPtr<Gtk::StyleContext> style_context_; Glib::RefPtr<Gtk::StyleContext> style_context_;
Glib::RefPtr<Gtk::CssProvider> css_provider_; Glib::RefPtr<Gtk::CssProvider> css_provider_;
std::unique_ptr<Portal> portal;
std::list<struct waybar_output> outputs_; std::list<struct waybar_output> outputs_;
std::unique_ptr<CssReloadHelper> m_cssReloadHelper;
std::string m_cssFile;
}; };
} // namespace waybar } // namespace waybar

View File

@ -1,104 +1,17 @@
#pragma once #pragma once
#include <json/json.h> #include <json/json.h>
#if defined(HAVE_CHRONO_TIMEZONES) || defined(HAVE_LIBDATE)
#include "modules/clock.hpp" #include <AModule.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"
namespace waybar { namespace waybar {
class Bar;
class Factory { class Factory {
public: public:
Factory(const Bar& bar, const Json::Value& config); 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: private:
const Bar& bar_; const Bar& bar_;

View File

@ -5,18 +5,31 @@
#include <json/json.h> #include <json/json.h>
#include "AModule.hpp" #include "AModule.hpp"
#include "bar.hpp" #include "gtkmm/revealer.h"
#include "factory.hpp"
namespace waybar { namespace waybar {
class Group : public AModule { class Group : public AModule {
public: public:
Group(const std::string&, const std::string&, const Json::Value&, bool); Group(const std::string&, const std::string&, const Json::Value&, bool);
~Group() = default; virtual ~Group() = default;
auto update() -> void override; auto update() -> void override;
operator Gtk::Widget&() override; operator Gtk::Widget&() override;
virtual Gtk::Box& getBox();
void addWidget(Gtk::Widget& widget);
bool handleMouseHover(GdkEventCrossing* const& e);
protected:
Gtk::Box box; Gtk::Box box;
Gtk::Box revealer_box;
Gtk::Revealer revealer;
bool is_first_widget = true;
bool is_drawer = false;
std::string add_class_to_drawer_children;
void addHoverHandlerTo(Gtk::Widget& widget);
}; };
} // namespace waybar } // namespace waybar

View File

@ -1,14 +1,14 @@
#pragma once #pragma once
#include <memory>
#include <optional> #include <optional>
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <vector> #include <vector>
#include "ALabel.hpp" #include "ALabel.hpp"
#include "giomm/dbusproxy.h" #include "util/backlight_backend.hpp"
#include "util/json.hpp" #include "util/json.hpp"
#include "util/sleeper_thread.hpp"
struct udev; struct udev;
struct udev_device; struct udev_device;
@ -16,54 +16,17 @@ struct udev_device;
namespace waybar::modules { namespace waybar::modules {
class Backlight : public ALabel { 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: public:
Backlight(const std::string &, const Json::Value &); Backlight(const std::string &, const Json::Value &);
virtual ~Backlight(); virtual ~Backlight() = default;
auto update() -> void override; auto update() -> void override;
private:
template <class ForwardIt>
static const BacklightDev *best_device(ForwardIt first, ForwardIt last, std::string_view);
template <class ForwardIt, class Inserter>
static void upsert_device(ForwardIt first, ForwardIt last, Inserter inserter, udev_device *dev);
template <class ForwardIt, class Inserter>
static void enumerate_devices(ForwardIt first, ForwardIt last, Inserter inserter, udev *udev);
bool handleScroll(GdkEventScroll *e) override; bool handleScroll(GdkEventScroll *e) override;
const std::string preferred_device_; const std::string preferred_device_;
static constexpr int EPOLL_MAX_EVENTS = 16;
std::optional<BacklightDev> previous_best_;
std::string previous_format_; std::string previous_format_;
std::mutex udev_thread_mutex_; util::BacklightBackend backend;
std::vector<BacklightDev> devices_;
// thread must destruct before shared data
util::SleeperThread udev_thread_;
Glib::RefPtr<Gio::DBus::Proxy> login_proxy_;
}; };
} // namespace waybar::modules } // namespace waybar::modules

View File

@ -0,0 +1,24 @@
#pragma once
#include <chrono>
#include "ASlider.hpp"
#include "util/backlight_backend.hpp"
namespace waybar::modules {
class BacklightSlider : public ASlider {
public:
BacklightSlider(const std::string&, const Json::Value&);
virtual ~BacklightSlider() = default;
void update() override;
void onValueChanged() override;
private:
std::chrono::milliseconds interval_;
std::string preferred_device_;
util::BacklightBackend backend;
};
} // namespace waybar::modules

View File

@ -1,11 +1,8 @@
#pragma once #pragma once
#ifdef FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
#else
#include <filesystem>
#endif
#include <fmt/format.h> #include <fmt/format.h>
#include <filesystem>
#if defined(__linux__) #if defined(__linux__)
#include <sys/inotify.h> #include <sys/inotify.h>
#endif #endif
@ -16,19 +13,16 @@
#include <vector> #include <vector>
#include "ALabel.hpp" #include "ALabel.hpp"
#include "bar.hpp"
#include "util/sleeper_thread.hpp" #include "util/sleeper_thread.hpp"
namespace waybar::modules { namespace waybar::modules {
#ifdef FILESYSTEM_EXPERIMENTAL
namespace fs = std::experimental::filesystem;
#else
namespace fs = std::filesystem; namespace fs = std::filesystem;
#endif
class Battery : public ALabel { class Battery : public ALabel {
public: public:
Battery(const std::string&, const Json::Value&); Battery(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Battery(); virtual ~Battery();
auto update() -> void override; auto update() -> void override;
@ -40,6 +34,7 @@ class Battery : public ALabel {
const std::string getAdapterStatus(uint8_t capacity) const; const std::string getAdapterStatus(uint8_t capacity) const;
const std::tuple<uint8_t, float, std::string, float> getInfos(); const std::tuple<uint8_t, float, std::string, float> getInfos();
const std::string formatTimeRemaining(float hoursRemaining); const std::string formatTimeRemaining(float hoursRemaining);
void setBarClass(std::string&);
int global_watch; int global_watch;
std::map<fs::path, int> batteries_; std::map<fs::path, int> batteries_;
@ -49,6 +44,7 @@ class Battery : public ALabel {
std::mutex battery_list_mutex_; std::mutex battery_list_mutex_;
std::string old_status_; std::string old_status_;
bool warnFirstTime_{true}; bool warnFirstTime_{true};
const Bar& bar_;
util::SleeperThread thread_; util::SleeperThread thread_;
util::SleeperThread thread_battery_update_; util::SleeperThread thread_battery_update_;

View File

@ -3,9 +3,11 @@
#include "ALabel.hpp" #include "ALabel.hpp"
#include "util/sleeper_thread.hpp" #include "util/sleeper_thread.hpp"
namespace cava {
extern "C" { extern "C" {
#include <cava/common.h> #include <cava/common.h>
} }
} // namespace cava
namespace waybar::modules { namespace waybar::modules {
using namespace std::literals::chrono_literals; using namespace std::literals::chrono_literals;
@ -21,13 +23,13 @@ class Cava final : public ALabel {
util::SleeperThread thread_; util::SleeperThread thread_;
util::SleeperThread thread_fetch_input_; util::SleeperThread thread_fetch_input_;
struct error_s error_ {}; // cava errors struct cava::error_s error_ {}; // cava errors
struct config_params prm_ {}; // cava parameters struct cava::config_params prm_ {}; // cava parameters
struct audio_raw audio_raw_ {}; // cava handled raw audio data(is based on audio_data) struct cava::audio_raw audio_raw_ {}; // cava handled raw audio data(is based on audio_data)
struct audio_data audio_data_ {}; // cava audio data struct cava::audio_data audio_data_ {}; // cava audio data
struct cava_plan* plan_; //{new cava_plan{}}; struct cava::cava_plan* plan_; //{new cava_plan{}};
// Cava API to read audio source // Cava API to read audio source
ptr input_source_; cava::ptr input_source_;
// Delay to handle audio source // Delay to handle audio source
std::chrono::milliseconds frame_time_milsec_{1s}; std::chrono::milliseconds frame_time_milsec_{1s};
// Text to display // Text to display
@ -36,6 +38,7 @@ class Cava final : public ALabel {
std::chrono::seconds fetch_input_delay_{4}; std::chrono::seconds fetch_input_delay_{4};
std::chrono::seconds suspend_silence_delay_{0}; std::chrono::seconds suspend_silence_delay_{0};
bool silence_{false}; bool silence_{false};
bool hide_on_silence_{false};
int sleep_counter_{0}; int sleep_counter_{0};
// Cava method // Cava method
void pause_resume(); void pause_resume();

60
include/modules/cffi.hpp Normal file
View File

@ -0,0 +1,60 @@
#pragma once
#include <string>
#include "AModule.hpp"
#include "util/command.hpp"
#include "util/json.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
namespace ffi {
extern "C" {
typedef struct wbcffi_module wbcffi_module;
typedef struct {
wbcffi_module* obj;
const char* waybar_version;
GtkContainer* (*get_root_widget)(wbcffi_module*);
void (*queue_update)(wbcffi_module*);
} wbcffi_init_info;
struct wbcffi_config_entry {
const char* key;
const char* value;
};
}
} // namespace ffi
class CFFI : public AModule {
public:
CFFI(const std::string&, const std::string&, const Json::Value&);
virtual ~CFFI();
virtual auto refresh(int signal) -> void override;
virtual auto doAction(const std::string& name) -> void override;
virtual auto update() -> void override;
private:
///
void* cffi_instance_ = nullptr;
typedef void*(InitFn)(const ffi::wbcffi_init_info* init_info,
const ffi::wbcffi_config_entry* config_entries, size_t config_entries_len);
typedef void(DenitFn)(void* instance);
typedef void(RefreshFn)(void* instance, int signal);
typedef void(DoActionFn)(void* instance, const char* name);
typedef void(UpdateFn)(void* instance);
// FFI hooks
struct {
std::function<InitFn> init = nullptr;
std::function<DenitFn> deinit = nullptr;
std::function<RefreshFn> refresh = [](void*, int) {};
std::function<DoActionFn> doAction = [](void*, const char*) {};
std::function<UpdateFn> update = [](void*) {};
} hooks_;
};
} // namespace waybar::modules

View File

@ -6,38 +6,27 @@
namespace waybar::modules { namespace waybar::modules {
const std::string kCalendarPlaceholder = "calendar"; const std::string kCldPlaceholder{"calendar"};
const std::string KTimezonedTimeListPlaceholder = "timezoned_time_list"; const std::string kTZPlaceholder{"tz_list"};
const std::string kOrdPlaceholder{"ordinal_date"};
enum class WeeksSide {
LEFT,
RIGHT,
HIDDEN,
};
enum class CldMode { MONTH, YEAR }; enum class CldMode { MONTH, YEAR };
enum class WS { LEFT, RIGHT, HIDDEN };
class Clock final : public ALabel { class Clock final : public ALabel {
public: public:
Clock(const std::string&, const Json::Value&); Clock(const std::string&, const Json::Value&);
virtual ~Clock() = default; virtual ~Clock() = default;
auto update() -> void override; auto update() -> void override;
auto doAction(const std::string& name) -> void override; auto doAction(const std::string&) -> void override;
private: private:
util::SleeperThread thread_; const std::locale locale_;
std::locale locale_; // tooltip
std::vector<const date::time_zone*> time_zones_; const std::string tlpFmt_;
int current_time_zone_idx_; std::string tlpText_{""}; // tooltip text to print
bool is_calendar_in_tooltip_; // Calendar
bool is_timezoned_list_in_tooltip_; const bool cldInTooltip_; // calendar in tooltip
auto first_day_of_week() -> date::weekday;
const date::time_zone* current_timezone();
auto timezones_text(std::chrono::system_clock::time_point now) -> std::string;
/*Calendar properties*/
WeeksSide cldWPos_{WeeksSide::HIDDEN};
/* /*
0 - calendar.format.months 0 - calendar.format.months
1 - calendar.format.weekdays 1 - calendar.format.weekdays
@ -47,27 +36,42 @@ class Clock final : public ALabel {
5 - tooltip-format 5 - tooltip-format
*/ */
std::map<int, std::string const> fmtMap_; std::map<int, std::string const> fmtMap_;
uint cldMonCols_{3}; // calendar count month columns
int cldWnLen_{3}; // calendar week number length
const int cldMonColLen_{20}; // calendar month column length
WS cldWPos_{WS::HIDDEN}; // calendar week side to print
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}; CldMode cldMode_{CldMode::MONTH};
uint cldMonCols_{3}; // Count of the month in the row auto get_calendar(const year_month_day& today, const year_month_day& ymd, const time_zone* tz)
int cldMonColLen_{20}; // Length of the month column -> const std::string;
int cldWnLen_{3}; // Length of the week number
date::year_month_day cldYearShift_; // time zoned time in tooltip
date::year_month cldMonShift_; const bool tzInTooltip_; // if need to print time zones text
date::months cldCurrShift_{0}; std::vector<const time_zone*> tzList_; // time zones list
date::months cldShift_{0}; int tzCurrIdx_; // current time zone index for tzList_
std::string cldYearCached_{}; std::string tzText_{""}; // time zones text to print
std::string cldMonCached_{}; util::SleeperThread thread_;
date::day cldBaseDay_{0};
/*Calendar functions*/ // ordinal date in tooltip
auto get_calendar(const date::year_month_day& today, const date::year_month_day& ymd, const bool ordInTooltip_;
const date::time_zone* tz) -> const std::string; std::string ordText_{""};
/*Clock actions*/ 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 cldModeSwitch();
void cldShift_up(); void cldShift_up();
void cldShift_down(); void cldShift_down();
void tz_up(); void tz_up();
void tz_down(); void tz_down();
// Module Action Map // Module Action Map
static inline std::map<const std::string, void (waybar::modules::Clock::*const)()> actionMap_{ static inline std::map<const std::string, void (waybar::modules::Clock::*const)()> actionMap_{
{"mode", &waybar::modules::Clock::cldModeSwitch}, {"mode", &waybar::modules::Clock::cldModeSwitch},
@ -76,4 +80,5 @@ class Clock final : public ALabel {
{"tz_up", &waybar::modules::Clock::tz_up}, {"tz_up", &waybar::modules::Clock::tz_up},
{"tz_down", &waybar::modules::Clock::tz_down}}; {"tz_down", &waybar::modules::Clock::tz_down}};
}; };
} // namespace waybar::modules } // namespace waybar::modules

View File

@ -21,12 +21,6 @@ class Cpu : public ALabel {
auto update() -> void override; auto update() -> void override;
private: private:
double getCpuLoad();
std::tuple<std::vector<uint16_t>, std::string> getCpuUsage();
std::tuple<float, float, float> getCpuFrequency();
std::vector<std::tuple<size_t, size_t>> parseCpuinfo();
std::vector<float> parseCpuFrequencies();
std::vector<std::tuple<size_t, size_t>> prev_times_; std::vector<std::tuple<size_t, size_t>> prev_times_;
util::SleeperThread thread_; util::SleeperThread thread_;

View File

@ -0,0 +1,32 @@
#pragma once
#include <fmt/format.h>
#include <cstdint>
#include <fstream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class CpuFrequency : public ALabel {
public:
CpuFrequency(const std::string&, const Json::Value&);
virtual ~CpuFrequency() = default;
auto update() -> void override;
// This is a static member because it is also used by the cpu module.
static std::tuple<float, float, float> getCpuFrequency();
private:
static std::vector<float> parseCpuFrequencies();
util::SleeperThread thread_;
};
} // namespace waybar::modules

View File

@ -0,0 +1,35 @@
#pragma once
#include <fmt/format.h>
#include <cstdint>
#include <fstream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class CpuUsage : public ALabel {
public:
CpuUsage(const std::string&, const Json::Value&);
virtual ~CpuUsage() = default;
auto update() -> void override;
// This is a static member because it is also used by the cpu module.
static std::tuple<std::vector<uint16_t>, std::string> getCpuUsage(
std::vector<std::tuple<size_t, size_t>>&);
private:
static std::vector<std::tuple<size_t, size_t>> parseCpuinfo();
std::vector<std::tuple<size_t, size_t>> prev_times_;
util::SleeperThread thread_;
};
} // namespace waybar::modules

View File

@ -14,7 +14,7 @@ namespace waybar::modules {
class Custom : public ALabel { class Custom : public ALabel {
public: 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(); virtual ~Custom();
auto update() -> void override; auto update() -> void override;
void refresh(int /*signal*/) override; void refresh(int /*signal*/) override;
@ -22,6 +22,7 @@ class Custom : public ALabel {
private: private:
void delayWorker(); void delayWorker();
void continuousWorker(); void continuousWorker();
void waitingWorker();
void parseOutputRaw(); void parseOutputRaw();
void parseOutputJson(); void parseOutputJson();
void handleEvent(); void handleEvent();
@ -29,6 +30,7 @@ class Custom : public ALabel {
bool handleToggle(GdkEventButton* const& e) override; bool handleToggle(GdkEventButton* const& e) override;
const std::string name_; const std::string name_;
const std::string output_name_;
std::string text_; std::string text_;
std::string id_; std::string id_;
std::string alt_; std::string alt_;

View File

@ -20,6 +20,9 @@ class Disk : public ALabel {
private: private:
util::SleeperThread thread_; util::SleeperThread thread_;
std::string path_; std::string path_;
std::string unit_;
float calc_specific_divisor(const std::string divisor);
}; };
} // namespace waybar::modules } // namespace waybar::modules

View File

@ -0,0 +1,38 @@
#pragma once
#include <fmt/format.h>
#include <string>
#include "AAppIconLabel.hpp"
#include "bar.hpp"
#include "dwl-ipc-unstable-v2-client-protocol.h"
#include "util/json.hpp"
namespace waybar::modules::dwl {
class Window : public AAppIconLabel, public sigc::trackable {
public:
Window(const std::string &, const waybar::Bar &, const Json::Value &);
virtual ~Window() = default;
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

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <functional>
#include <list> #include <list>
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include <string> #include <string>
#include <thread> #include <utility>
#include "util/json.hpp" #include "util/json.hpp"
@ -20,19 +20,19 @@ class IPC {
public: public:
IPC() { startIPC(); } IPC() { startIPC(); }
void registerForIPC(const std::string&, EventHandler*); void registerForIPC(const std::string& ev, EventHandler* ev_handler);
void unregisterForIPC(EventHandler*); 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); Json::Value getSocket1JsonReply(const std::string& rq);
private: private:
void startIPC(); void startIPC();
void parseIPC(const std::string&); void parseIPC(const std::string&);
std::mutex callbackMutex; std::mutex callbackMutex_;
util::JsonParser parser_; util::JsonParser parser_;
std::list<std::pair<std::string, EventHandler*>> callbacks; std::list<std::pair<std::string, EventHandler*>> callbacks_;
}; };
inline std::unique_ptr<IPC> gIPC; inline std::unique_ptr<IPC> gIPC;

View File

@ -1,5 +1,9 @@
#pragma once
#include <fmt/format.h> #include <fmt/format.h>
#include <string>
#include "ALabel.hpp" #include "ALabel.hpp"
#include "bar.hpp" #include "bar.hpp"
#include "modules/hyprland/backend.hpp" #include "modules/hyprland/backend.hpp"
@ -26,7 +30,7 @@ class Language : public waybar::ALabel, public EventHandler {
std::string short_description; std::string short_description;
}; };
auto getLayout(const std::string&) -> Layout; static auto getLayout(const std::string&) -> Layout;
std::mutex mutex_; std::mutex mutex_;
const Bar& bar_; const Bar& bar_;

View File

@ -1,5 +1,9 @@
#pragma once
#include <fmt/format.h> #include <fmt/format.h>
#include <string>
#include "ALabel.hpp" #include "ALabel.hpp"
#include "bar.hpp" #include "bar.hpp"
#include "modules/hyprland/backend.hpp" #include "modules/hyprland/backend.hpp"
@ -10,17 +14,20 @@ namespace waybar::modules::hyprland {
class Submap : public waybar::ALabel, public EventHandler { class Submap : public waybar::ALabel, public EventHandler {
public: public:
Submap(const std::string&, const waybar::Bar&, const Json::Value&); Submap(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Submap(); ~Submap() override;
auto update() -> void override; auto update() -> void override;
private: private:
void onEvent(const std::string&) override; auto parseConfig(const Json::Value&) -> void;
void onEvent(const std::string& ev) override;
std::mutex mutex_; std::mutex mutex_;
const Bar& bar_; const Bar& bar_;
util::JsonParser parser_; util::JsonParser parser_;
std::string submap_; std::string submap_;
bool always_on_ = false;
std::string default_submap_ = "Default";
}; };
} // namespace waybar::modules::hyprland } // namespace waybar::modules::hyprland

View File

@ -1,5 +1,9 @@
#pragma once
#include <fmt/format.h> #include <fmt/format.h>
#include <string>
#include "AAppIconLabel.hpp" #include "AAppIconLabel.hpp"
#include "bar.hpp" #include "bar.hpp"
#include "modules/hyprland/backend.hpp" #include "modules/hyprland/backend.hpp"
@ -10,7 +14,7 @@ namespace waybar::modules::hyprland {
class Window : public waybar::AAppIconLabel, public EventHandler { class Window : public waybar::AAppIconLabel, public EventHandler {
public: public:
Window(const std::string&, const waybar::Bar&, const Json::Value&); Window(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Window(); ~Window() override;
auto update() -> void override; auto update() -> void override;
@ -21,7 +25,7 @@ class Window : public waybar::AAppIconLabel, public EventHandler {
std::string last_window; std::string last_window;
std::string last_window_title; std::string last_window_title;
static auto parse(const Json::Value&) -> Workspace; static auto parse(const Json::Value& value) -> Workspace;
}; };
struct WindowData { struct WindowData {
@ -37,24 +41,25 @@ class Window : public waybar::AAppIconLabel, public EventHandler {
static auto parse(const Json::Value&) -> WindowData; static auto parse(const Json::Value&) -> WindowData;
}; };
auto getActiveWorkspace(const std::string&) -> Workspace; static auto getActiveWorkspace(const std::string&) -> Workspace;
auto getActiveWorkspace() -> Workspace; static auto getActiveWorkspace() -> Workspace;
void onEvent(const std::string&) override; void onEvent(const std::string& ev) override;
void queryActiveWorkspace(); void queryActiveWorkspace();
void setClass(const std::string&, bool enable); void setClass(const std::string&, bool enable);
bool separate_outputs; bool separateOutputs_;
std::mutex mutex_; std::mutex mutex_;
const Bar& bar_; const Bar& bar_;
util::JsonParser parser_; util::JsonParser parser_;
WindowData window_data_; WindowData windowData_;
Workspace workspace_; Workspace workspace_;
std::string solo_class_; std::string soloClass_;
std::string last_solo_class_; std::string lastSoloClass_;
bool solo_; bool solo_;
bool all_floating_; bool allFloating_;
bool swallowing_; bool swallowing_;
bool fullscreen_; bool fullscreen_;
bool focused_;
}; };
} // namespace waybar::modules::hyprland } // namespace waybar::modules::hyprland

View File

@ -1,50 +1,120 @@
#pragma once
#include <gtkmm/button.h> #include <gtkmm/button.h>
#include <gtkmm/label.h> #include <gtkmm/label.h>
#include <json/value.h>
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory> #include <memory>
#include <optional>
#include <regex>
#include <string>
#include <variant>
#include <vector>
#include "AModule.hpp" #include "AModule.hpp"
#include "bar.hpp" #include "bar.hpp"
#include "modules/hyprland/backend.hpp" #include "modules/hyprland/backend.hpp"
#include "util/enum.hpp"
#include "util/regex_collection.hpp"
using WindowAddress = std::string;
namespace waybar::modules::hyprland { namespace waybar::modules::hyprland {
class Workspaces;
class WindowCreationPayload {
public:
WindowCreationPayload(std::string workspace_name, WindowAddress window_address,
std::string window_repr);
WindowCreationPayload(std::string workspace_name, WindowAddress window_address,
std::string window_class, std::string window_title);
WindowCreationPayload(Json::Value const& client_data);
int incrementTimeSpentUncreated();
bool isEmpty(Workspaces& workspace_manager);
bool reprIsReady() const { return std::holds_alternative<Repr>(m_window); }
std::string repr(Workspaces& workspace_manager);
std::string getWorkspaceName() const { return m_workspaceName; }
WindowAddress getAddress() const { return m_windowAddress; }
void moveToWorksace(std::string& new_workspace_name);
private:
void clearAddr();
void clearWorkspaceName();
using Repr = std::string;
using ClassAndTitle = std::pair<std::string, std::string>;
std::variant<Repr, ClassAndTitle> m_window;
WindowAddress m_windowAddress;
std::string m_workspaceName;
int m_timeSpentUncreated = 0;
};
class Workspace { class Workspace {
public: public:
Workspace(const Json::Value& workspace_data); explicit Workspace(const Json::Value& workspace_data, Workspaces& workspace_manager,
std::string& select_icon(std::map<std::string, std::string>& icons_map); const Json::Value& clients_data = Json::Value::nullRef);
Gtk::Button& button() { return button_; }; std::string& selectIcon(std::map<std::string, std::string>& icons_map);
Gtk::Button& button() { return m_button; };
int id() const { return id_; }; int id() const { return m_id; };
std::string name() const { return name_; }; std::string name() const { return m_name; };
std::string output() const { return output_; }; std::string output() const { return m_output; };
bool active() const { return active_; }; bool isActive() const { return m_isActive; };
bool is_special() const { return is_special_; }; bool isSpecial() const { return m_isSpecial; };
bool is_persistent() const { return is_persistent_; }; bool isPersistent() const { return m_isPersistentRule || m_isPersistentConfig; };
bool is_empty() const { return windows_ == 0; }; bool isPersistentConfig() const { return m_isPersistentConfig; };
bool is_urgent() const { return is_urgent_; }; bool isPersistentRule() const { return m_isPersistentRule; };
bool isVisible() const { return m_isVisible; };
bool isEmpty() const { return m_windows == 0; };
bool isUrgent() const { return m_isUrgent; };
auto handle_clicked(GdkEventButton* bt) -> bool; bool handleClicked(GdkEventButton* bt) const;
void set_active(bool value = true) { active_ = value; }; void setActive(bool value = true) { m_isActive = value; };
void set_persistent(bool value = true) { is_persistent_ = value; }; void setPersistentRule(bool value = true) { m_isPersistentRule = value; };
void set_urgent(bool value = true) { is_urgent_ = value; }; void setPersistentConfig(bool value = true) { m_isPersistentConfig = value; };
void set_windows(uint value) { windows_ = value; }; void setUrgent(bool value = true) { m_isUrgent = value; };
void setVisible(bool value = true) { m_isVisible = value; };
void setWindows(uint value) { m_windows = value; };
void setName(std::string const& value) { m_name = value; };
void setOutput(std::string const& value) { m_output = value; };
bool containsWindow(WindowAddress const& addr) const { return m_windowMap.contains(addr); }
void insertWindow(WindowCreationPayload create_window_paylod);
std::string removeWindow(WindowAddress const& addr);
void initializeWindowMap(const Json::Value& clients_data);
bool onWindowOpened(WindowCreationPayload const& create_window_paylod);
std::optional<std::string> closeWindow(WindowAddress const& addr);
void update(const std::string& format, const std::string& icon); void update(const std::string& format, const std::string& icon);
private: private:
int id_; Workspaces& m_workspaceManager;
std::string name_;
std::string output_;
uint windows_;
bool active_ = false;
bool is_special_ = false;
bool is_persistent_ = false;
bool is_urgent_ = false;
Gtk::Button button_; int m_id;
Gtk::Box content_; std::string m_name;
Gtk::Label label_; std::string m_output;
uint m_windows;
bool m_isActive = false;
bool m_isSpecial = false;
bool m_isPersistentRule = false; // represents the persistent state in hyprland
bool m_isPersistentConfig = false; // represents the persistent state in the Waybar config
bool m_isUrgent = false;
bool m_isVisible = false;
std::map<WindowAddress, std::string> m_windowMap;
Gtk::Button m_button;
Gtk::Box m_content;
Gtk::Label m_label;
}; };
class Workspaces : public AModule, public EventHandler { class Workspaces : public AModule, public EventHandler {
@ -54,38 +124,103 @@ class Workspaces : public AModule, public EventHandler {
void update() override; void update() override;
void init(); void init();
auto all_outputs() const -> bool { return all_outputs_; } auto allOutputs() const -> bool { return m_allOutputs; }
auto show_special() const -> bool { return show_special_; } auto showSpecial() const -> bool { return m_showSpecial; }
auto activeOnly() const -> bool { return m_activeOnly; }
auto moveToMonitor() const -> bool { return m_moveToMonitor; }
auto get_bar_output() const -> std::string { return bar_.output->name; } auto getBarOutput() const -> std::string { return m_bar.output->name; }
std::string getRewrite(std::string window_class, std::string window_title);
std::string& getWindowSeparator() { return m_formatWindowSeparator; }
bool isWorkspaceIgnored(std::string const& workspace_name);
bool windowRewriteConfigUsesTitle() const { return m_anyWindowRewriteRuleUsesTitle; }
private: private:
void onEvent(const std::string&) override; void onEvent(const std::string& e) override;
void update_window_count(); void updateWindowCount();
void sort_workspaces(); void sortWorkspaces();
void create_workspace(Json::Value& value); void createWorkspace(Json::Value const& workspaceData,
void remove_workspace(std::string name); Json::Value const& clientsData = Json::Value::nullRef);
void set_urgent_workspace(std::string windowaddress); void removeWorkspace(std::string const& name);
void setUrgentWorkspace(std::string const& windowaddress);
void parseConfig(const Json::Value& config);
void registerIpc();
bool all_outputs_ = false; // workspace events
bool show_special_ = false; void onWorkspaceActivated(std::string const& payload);
void onSpecialWorkspaceActivated(std::string const& payload);
void onWorkspaceDestroyed(std::string const& payload);
void onWorkspaceCreated(std::string const& workspaceName,
Json::Value const& clientsData = Json::Value::nullRef);
void onWorkspaceMoved(std::string const& payload);
void onWorkspaceRenamed(std::string const& payload);
void fill_persistent_workspaces(); // monitor events
void create_persistent_workspaces(); void onMonitorFocused(std::string const& payload);
std::vector<std::string> persistent_workspaces_to_create_;
bool persistent_created_ = false;
std::string format_; // window events
std::map<std::string, std::string> icons_map_; void onWindowOpened(std::string const& payload);
bool with_icon_; void onWindowClosed(std::string const& addr);
uint64_t monitor_id_; void onWindowMoved(std::string const& payload);
std::string active_workspace_name_;
std::vector<std::unique_ptr<Workspace>> workspaces_; void onWindowTitleEvent(std::string const& payload);
std::vector<Json::Value> workspaces_to_create_;
std::vector<std::string> workspaces_to_remove_; void onConfigReloaded();
std::mutex mutex_;
const Bar& bar_; int windowRewritePriorityFunction(std::string const& window_rule);
Gtk::Box box_;
void doUpdate();
void extendOrphans(int workspaceId, Json::Value const& clientsJson);
void registerOrphanWindow(WindowCreationPayload create_window_payload);
void initializeWorkspaces();
void setCurrentMonitorId();
void loadPersistentWorkspacesFromConfig(Json::Value const& clientsJson);
void loadPersistentWorkspacesFromWorkspaceRules(const Json::Value& clientsJson);
bool m_allOutputs = false;
bool m_showSpecial = false;
bool m_activeOnly = false;
bool m_moveToMonitor = false;
Json::Value m_persistentWorkspaceConfig;
// Map for windows stored in workspaces not present in the current bar.
// This happens when the user has multiple monitors (hence, multiple bars)
// and doesn't share windows accross bars (a.k.a `all-outputs` = false)
std::map<WindowAddress, std::string> m_orphanWindowMap;
enum class SortMethod { ID, NAME, NUMBER, DEFAULT };
util::EnumParser<SortMethod> m_enumParser;
SortMethod m_sortBy = SortMethod::DEFAULT;
std::map<std::string, SortMethod> m_sortMap = {{"ID", SortMethod::ID},
{"NAME", SortMethod::NAME},
{"NUMBER", SortMethod::NUMBER},
{"DEFAULT", SortMethod::DEFAULT}};
std::string m_format;
std::map<std::string, std::string> m_iconsMap;
util::RegexCollection m_windowRewriteRules;
bool m_anyWindowRewriteRuleUsesTitle = false;
std::string m_formatWindowSeparator;
bool m_withIcon;
uint64_t m_monitorId;
std::string m_activeWorkspaceName;
std::string m_activeSpecialWorkspaceName;
std::vector<std::unique_ptr<Workspace>> m_workspaces;
std::vector<std::pair<Json::Value, Json::Value>> m_workspacesToCreate;
std::vector<std::string> m_workspacesToRemove;
std::vector<WindowCreationPayload> m_windowsToCreate;
std::vector<std::regex> m_ignoreWorkspaces;
std::mutex m_mutex;
const Bar& m_bar;
Gtk::Box m_box;
}; };
} // namespace waybar::modules::hyprland } // namespace waybar::modules::hyprland

30
include/modules/load.hpp Normal file
View File

@ -0,0 +1,30 @@
#pragma once
#include <fmt/format.h>
#include <cstdint>
#include <fstream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Load : public ALabel {
public:
Load(const std::string&, const Json::Value&);
virtual ~Load() = default;
auto update() -> void override;
// This is a static member because it is also used by the cpu module.
static std::tuple<double, double, double> getLoad();
private:
util::SleeperThread thread_;
};
} // namespace waybar::modules

View File

@ -41,6 +41,7 @@ class MPD : public ALabel {
private: private:
std::string getTag(mpd_tag_type type, unsigned idx = 0) const; std::string getTag(mpd_tag_type type, unsigned idx = 0) const;
Glib::ustring getArtistTitleOrFilename() const;
std::string getFilename() const; std::string getFilename() const;
void setLabel(); void setLabel();
std::string getStateIcon() const; std::string getStateIcon() const;

View File

@ -148,6 +148,7 @@ class Stopped : public State {
class Disconnected : public State { class Disconnected : public State {
Context* const ctx_; Context* const ctx_;
sigc::connection timer_connection_; sigc::connection timer_connection_;
int last_interval_;
public: public:
Disconnected(Context* const ctx) : ctx_{ctx} {} Disconnected(Context* const ctx) : ctx_{ctx} {}
@ -162,7 +163,7 @@ class Disconnected : public State {
Disconnected(Disconnected const&) = delete; Disconnected(Disconnected const&) = delete;
Disconnected& operator=(Disconnected const&) = delete; Disconnected& operator=(Disconnected const&) = delete;
void arm_timer(int interval) noexcept; bool arm_timer(int interval) noexcept;
void disarm_timer() noexcept; void disarm_timer() noexcept;
bool on_timer(); bool on_timer();

View File

@ -0,0 +1,46 @@
#pragma once
#include <fmt/format.h>
#include "ALabel.hpp"
#include "giomm/dbusproxy.h"
namespace waybar::modules {
struct Profile {
std::string name;
std::string driver;
};
class PowerProfilesDaemon : public ALabel {
public:
PowerProfilesDaemon(const std::string &, const Json::Value &);
auto update() -> void override;
void profileChangedCb(const Gio::DBus::Proxy::MapChangedProperties &,
const std::vector<Glib::ustring> &);
void busConnectedCb(Glib::RefPtr<Gio::AsyncResult> &r);
void getAllPropsCb(Glib::RefPtr<Gio::AsyncResult> &r);
void setPropCb(Glib::RefPtr<Gio::AsyncResult> &r);
void populateInitState();
bool handleToggle(GdkEventButton *const &e) override;
private:
// True if we're connected to the dbug interface. False if we're
// not.
bool connected_;
// Look for a profile name in the list of available profiles and
// switch activeProfile_ to it.
void switchToProfile(std::string const &);
// Used to toggle/display the profiles
std::vector<Profile> availableProfiles_;
// Points to the active profile in the profiles list
std::vector<Profile>::iterator activeProfile_;
// Current CSS class applied to the label
std::string currentStyle_;
// Format string
std::string tooltipFormat_;
// DBus Proxy used to track the current active profile
Glib::RefPtr<Gio::DBus::Proxy> powerProfilesProxy_;
};
} // namespace waybar::modules

View File

@ -0,0 +1,41 @@
#pragma once
#include <iostream>
#include <map>
#include <string>
#include "ALabel.hpp"
#include "gtkmm/box.h"
#include "modules/privacy/privacy_item.hpp"
#include "util/pipewire/pipewire_backend.hpp"
#include "util/pipewire/privacy_node_info.hpp"
using waybar::util::PipewireBackend::PrivacyNodeInfo;
namespace waybar::modules::privacy {
class Privacy : public AModule {
public:
Privacy(const std::string &, const Json::Value &, const std::string &pos);
auto update() -> void override;
void onPrivacyNodesChanged();
private:
std::list<PrivacyNodeInfo *> nodes_screenshare; // Screen is being shared
std::list<PrivacyNodeInfo *> nodes_audio_in; // Application is using the microphone
std::list<PrivacyNodeInfo *> nodes_audio_out; // Application is outputting audio
std::mutex mutex_;
sigc::connection visibility_conn;
// Config
Gtk::Box box_;
uint iconSpacing = 4;
uint iconSize = 20;
uint transition_duration = 250;
std::shared_ptr<util::PipewireBackend::PipewireBackend> backend = nullptr;
};
} // namespace waybar::modules::privacy

View File

@ -0,0 +1,51 @@
#pragma once
#include <json/value.h>
#include <iostream>
#include <map>
#include <mutex>
#include <string>
#include "gtkmm/box.h"
#include "gtkmm/image.h"
#include "gtkmm/revealer.h"
#include "util/pipewire/privacy_node_info.hpp"
using waybar::util::PipewireBackend::PrivacyNodeInfo;
using waybar::util::PipewireBackend::PrivacyNodeType;
namespace waybar::modules::privacy {
class PrivacyItem : public Gtk::Revealer {
public:
PrivacyItem(const Json::Value &config_, enum PrivacyNodeType privacy_type_,
std::list<PrivacyNodeInfo *> *nodes, const std::string &pos, const uint icon_size,
const uint transition_duration);
enum PrivacyNodeType privacy_type;
void set_in_use(bool in_use);
private:
std::list<PrivacyNodeInfo *> *nodes;
sigc::connection signal_conn;
Gtk::Box tooltip_window;
bool init = false;
bool in_use = false;
// Config
std::string iconName = "image-missing-symbolic";
bool tooltip = true;
uint tooltipIconSize = 24;
Gtk::Box box_;
Gtk::Image icon_;
void update_tooltip();
};
} // namespace waybar::modules::privacy

View File

@ -1,54 +1,27 @@
#pragma once #pragma once
#include <fmt/format.h> #include <fmt/format.h>
#include <pulse/pulseaudio.h>
#include <pulse/volume.h>
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <memory>
#include "ALabel.hpp" #include "ALabel.hpp"
#include "util/audio_backend.hpp"
namespace waybar::modules { namespace waybar::modules {
class Pulseaudio : public ALabel { class Pulseaudio : public ALabel {
public: public:
Pulseaudio(const std::string&, const Json::Value&); Pulseaudio(const std::string&, const Json::Value&);
virtual ~Pulseaudio(); virtual ~Pulseaudio() = default;
auto update() -> void override; auto update() -> void override;
private: private:
static void subscribeCb(pa_context*, pa_subscription_event_type_t, uint32_t, void*);
static void contextStateCb(pa_context*, void*);
static void sinkInfoCb(pa_context*, const pa_sink_info*, int, void*);
static void sourceInfoCb(pa_context*, const pa_source_info* i, int, void* data);
static void serverInfoCb(pa_context*, const pa_server_info*, void*);
static void volumeModifyCb(pa_context*, int, void*);
bool handleScroll(GdkEventScroll* e) override; bool handleScroll(GdkEventScroll* e) override;
const std::vector<std::string> getPulseIcon() const; const std::vector<std::string> getPulseIcon() const;
pa_threaded_mainloop* mainloop_; std::shared_ptr<util::AudioBackend> backend = nullptr;
pa_mainloop_api* mainloop_api_;
pa_context* context_;
// SINK
uint32_t sink_idx_{0};
uint16_t volume_;
pa_cvolume pa_volume_;
bool muted_;
std::string port_name_;
std::string form_factor_;
std::string desc_;
std::string monitor_;
std::string current_sink_name_;
bool current_sink_running_;
// SOURCE
uint32_t source_idx_{0};
uint16_t source_volume_;
bool source_muted_;
std::string source_port_name_;
std::string source_desc_;
std::string default_source_name_;
}; };
} // namespace waybar::modules } // namespace waybar::modules

View File

@ -0,0 +1,27 @@
#pragma once
#include <memory>
#include "ASlider.hpp"
#include "util/audio_backend.hpp"
namespace waybar::modules {
enum class PulseaudioSliderTarget {
Sink,
Source,
};
class PulseaudioSlider : public ASlider {
public:
PulseaudioSlider(const std::string&, const Json::Value&);
virtual ~PulseaudioSlider() = default;
void update() override;
void onValueChanged() override;
private:
std::shared_ptr<util::AudioBackend> backend = nullptr;
PulseaudioSliderTarget target = PulseaudioSliderTarget::Sink;
};
} // namespace waybar::modules

View File

@ -84,6 +84,8 @@ class Item : public sigc::trackable {
// visibility of items with Status == Passive // visibility of items with Status == Passive
bool show_passive_ = false; bool show_passive_ = false;
const Bar& bar_;
Glib::RefPtr<Gio::DBus::Proxy> proxy_; Glib::RefPtr<Gio::DBus::Proxy> proxy_;
Glib::RefPtr<Gio::Cancellable> cancellable_; Glib::RefPtr<Gio::Cancellable> cancellable_;
std::set<std::string_view> update_pending_; std::set<std::string_view> update_pending_;

View File

@ -56,6 +56,7 @@ class Language : public ALabel, public sigc::trackable {
Layout layout_; Layout layout_;
std::string tooltip_format_ = ""; std::string tooltip_format_ = "";
std::map<std::string, Layout> layouts_map_; std::map<std::string, Layout> layouts_map_;
bool hide_single_;
bool is_variant_displayed; bool is_variant_displayed;
std::byte displayed_short_flag = static_cast<std::byte>(DispayedShortFlag::None); std::byte displayed_short_flag = static_cast<std::byte>(DispayedShortFlag::None);

View File

@ -12,6 +12,7 @@
#include "client.hpp" #include "client.hpp"
#include "modules/sway/ipc/client.hpp" #include "modules/sway/ipc/client.hpp"
#include "util/json.hpp" #include "util/json.hpp"
#include "util/regex_collection.hpp"
namespace waybar::modules::sway { namespace waybar::modules::sway {
@ -27,10 +28,13 @@ class Workspaces : public AModule, public sigc::trackable {
R"(workspace {} "{}"; move workspace to output "{}"; workspace {} "{}")"; R"(workspace {} "{}"; move workspace to output "{}"; workspace {} "{}")";
static int convertWorkspaceNameToNum(std::string name); static int convertWorkspaceNameToNum(std::string name);
static int windowRewritePriorityFunction(std::string const& window_rule);
void onCmd(const struct Ipc::ipc_response&); void onCmd(const struct Ipc::ipc_response&);
void onEvent(const struct Ipc::ipc_response&); void onEvent(const struct Ipc::ipc_response&);
bool filterButtons(); bool filterButtons();
static bool hasFlag(const Json::Value&, const std::string&);
void updateWindows(const Json::Value&, std::string&);
Gtk::Button& addButton(const Json::Value&); Gtk::Button& addButton(const Json::Value&);
void onButtonReady(const Json::Value&, Gtk::Button&); void onButtonReady(const Json::Value&, Gtk::Button&);
std::string getIcon(const std::string&, const Json::Value&); std::string getIcon(const std::string&, const Json::Value&);
@ -44,6 +48,9 @@ class Workspaces : public AModule, public sigc::trackable {
std::vector<std::string> high_priority_named_; std::vector<std::string> high_priority_named_;
std::vector<std::string> workspaces_order_; std::vector<std::string> workspaces_order_;
Gtk::Box box_; Gtk::Box box_;
std::string m_formatWindowSeperator;
std::string m_windowRewriteDefault;
util::RegexCollection m_windowRewriteRules;
util::JsonParser parser_; util::JsonParser parser_;
std::unordered_map<std::string, Gtk::Button> buttons_; std::unordered_map<std::string, Gtk::Button> buttons_;
std::mutex mutex_; std::mutex mutex_;

View File

@ -0,0 +1,31 @@
#pragma once
#include <giomm/dbusproxy.h>
#include <string>
#include "ALabel.hpp"
namespace waybar::modules {
class SystemdFailedUnits : public ALabel {
public:
SystemdFailedUnits(const std::string &, const Json::Value &);
virtual ~SystemdFailedUnits();
auto update() -> void override;
private:
bool hide_on_ok;
std::string format_ok;
bool update_pending;
uint32_t nr_failed_system, nr_failed_user;
std::string last_status;
Glib::RefPtr<Gio::DBus::Proxy> system_proxy, user_proxy;
void notify_cb(const Glib::ustring &sender_name, const Glib::ustring &signal_name,
const Glib::VariantContainerBase &arguments);
void updateData();
};
} // namespace waybar::modules

View File

@ -66,12 +66,14 @@ class UPower : public AModule {
Devices devices; Devices devices;
std::mutex m_Mutex; std::mutex m_Mutex;
UpClient *client; UpClient *client;
UpDevice *displayDevice; UpDevice *displayDevice = nullptr;
guint login1_id; guint login1_id;
GDBusConnection *login1_connection; GDBusConnection *login1_connection;
UPowerTooltip *upower_tooltip; std::unique_ptr<UPowerTooltip> upower_tooltip;
std::string lastStatus; std::string lastStatus;
const char *lastWarningLevel;
bool showAltText; bool showAltText;
bool showIcon = true;
bool upowerRunning; bool upowerRunning;
guint upowerWatcher_id; guint upowerWatcher_id;
std::string nativePath_; std::string nativePath_;

View File

@ -2,6 +2,7 @@
#include <libupower-glib/upower.h> #include <libupower-glib/upower.h>
#include <memory>
#include <unordered_map> #include <unordered_map>
#include "gtkmm/box.h" #include "gtkmm/box.h"
@ -16,7 +17,7 @@ class UPowerTooltip : public Gtk::Window {
const std::string getDeviceIcon(UpDeviceKind& kind); const std::string getDeviceIcon(UpDeviceKind& kind);
Gtk::Box* contentBox; std::unique_ptr<Gtk::Box> contentBox;
uint iconSize; uint iconSize;
uint tooltipSpacing; uint tooltipSpacing;

View File

@ -17,12 +17,15 @@ class Wireplumber : public ALabel {
auto update() -> void override; auto update() -> void override;
private: private:
void loadRequiredApiModules(); void asyncLoadRequiredApiModules();
void prepare(); void prepare();
void activatePlugins(); void activatePlugins();
static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id); static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
static void updateNodeName(waybar::modules::Wireplumber* self, uint32_t id); static void updateNodeName(waybar::modules::Wireplumber* self, uint32_t id);
static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self); static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
static void onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
waybar::modules::Wireplumber* self);
static void onMixerApiLoaded(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
static void onObjectManagerInstalled(waybar::modules::Wireplumber* self); static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id); static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self); static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self);

View File

@ -0,0 +1,96 @@
#pragma once
#include <json/value.h>
#include <pulse/context.h>
#include <pulse/introspect.h>
#include <pulse/thread-mainloop.h>
#include <pulse/volume.h>
#include <functional>
#include <memory>
#include <string>
#include "util/backend_common.hpp"
namespace waybar::util {
class AudioBackend {
private:
static void subscribeCb(pa_context*, pa_subscription_event_type_t, uint32_t, void*);
static void contextStateCb(pa_context*, void*);
static void sinkInfoCb(pa_context*, const pa_sink_info*, int, void*);
static void sourceInfoCb(pa_context*, const pa_source_info* i, int, void* data);
static void serverInfoCb(pa_context*, const pa_server_info*, void*);
static void volumeModifyCb(pa_context*, int, void*);
void connectContext();
pa_threaded_mainloop* mainloop_;
pa_mainloop_api* mainloop_api_;
pa_context* context_;
pa_cvolume pa_volume_;
// SINK
uint32_t sink_idx_{0};
uint16_t volume_;
bool muted_;
std::string port_name_;
std::string form_factor_;
std::string desc_;
std::string monitor_;
std::string current_sink_name_;
bool current_sink_running_;
// SOURCE
uint32_t source_idx_{0};
uint16_t source_volume_;
bool source_muted_;
std::string source_port_name_;
std::string source_desc_;
std::string default_source_name_;
std::vector<std::string> ignored_sinks_;
std::function<void()> on_updated_cb_ = NOOP;
/* Hack to keep constructor inaccessible but still public.
* This is required to be able to use std::make_shared.
* It is important to keep this class only accessible via a reference-counted
* pointer because the destructor will manually free memory, and this could be
* a problem with C++20's copy and move semantics.
*/
struct private_constructor_tag {};
public:
static std::shared_ptr<AudioBackend> getInstance(std::function<void()> on_updated_cb = NOOP);
AudioBackend(std::function<void()> on_updated_cb, private_constructor_tag tag);
~AudioBackend();
void changeVolume(uint16_t volume, uint16_t min_volume = 0, uint16_t max_volume = 100);
void changeVolume(ChangeType change_type, double step = 1, uint16_t max_volume = 100);
void setIgnoredSinks(const Json::Value& config);
std::string getSinkPortName() const { return port_name_; }
std::string getFormFactor() const { return form_factor_; }
std::string getSinkDesc() const { return desc_; }
std::string getMonitor() const { return monitor_; }
std::string getCurrentSinkName() const { return current_sink_name_; }
bool getCurrentSinkRunning() const { return current_sink_running_; }
uint16_t getSinkVolume() const { return volume_; }
bool getSinkMuted() const { return muted_; }
uint16_t getSourceVolume() const { return source_volume_; }
bool getSourceMuted() const { return source_muted_; }
std::string getSourcePortName() const { return source_port_name_; }
std::string getSourceDesc() const { return source_desc_; }
std::string getDefaultSourceName() const { return default_source_name_; }
void toggleSinkMute();
void toggleSinkMute(bool);
void toggleSourceMute();
void toggleSourceMute(bool);
bool isBluetooth();
};
} // namespace waybar::util

View File

@ -0,0 +1,10 @@
#pragma once
#include "AModule.hpp"
namespace waybar::util {
const static auto NOOP = []() {};
enum class ChangeType : char { Increase, Decrease };
} // namespace waybar::util

View File

@ -0,0 +1,87 @@
#pragma once
#include <libudev.h>
#include <spdlog/spdlog.h>
#include <chrono>
#include <mutex>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "giomm/dbusproxy.h"
#include "util/backend_common.hpp"
#include "util/sleeper_thread.hpp"
#define GET_BEST_DEVICE(varname, backend, preferred_device) \
decltype((backend).devices_) __devices; \
{ \
std::scoped_lock<std::mutex> lock((backend).udev_thread_mutex_); \
__devices = (backend).devices_; \
} \
auto varname = (backend).best_device(__devices, preferred_device);
namespace waybar::util {
class BacklightDevice {
public:
BacklightDevice() = default;
BacklightDevice(std::string name, int actual, int max, bool powered);
std::string name() const;
int get_actual() const;
void set_actual(int actual);
int get_max() const;
void set_max(int max);
bool get_powered() const;
void set_powered(bool powered);
friend inline bool operator==(const BacklightDevice &lhs, const BacklightDevice &rhs) {
return lhs.name_ == rhs.name_ && lhs.actual_ == rhs.actual_ && lhs.max_ == rhs.max_;
}
private:
std::string name_;
int actual_ = 1;
int max_ = 1;
bool powered_ = true;
};
class BacklightBackend {
public:
BacklightBackend(std::chrono::milliseconds interval, std::function<void()> on_updated_cb = NOOP);
// const inline BacklightDevice *get_best_device(std::string_view preferred_device);
const BacklightDevice *get_previous_best_device();
void set_previous_best_device(const BacklightDevice *device);
void set_brightness(std::string preferred_device, ChangeType change_type, double step);
void set_scaled_brightness(std::string preferred_device, int brightness);
int get_scaled_brightness(std::string preferred_device);
bool is_login_proxy_initialized() const { return static_cast<bool>(login_proxy_); }
static const BacklightDevice *best_device(const std::vector<BacklightDevice> &devices,
std::string_view);
std::vector<BacklightDevice> devices_;
std::mutex udev_thread_mutex_;
private:
void set_brightness_internal(std::string device_name, int brightness, int max_brightness);
std::function<void()> on_updated_cb_;
std::chrono::milliseconds polling_interval_;
std::optional<BacklightDevice> previous_best_;
// thread must destruct before shared data
util::SleeperThread udev_thread_;
Glib::RefPtr<Gio::DBus::Proxy> login_proxy_;
static constexpr int EPOLL_MAX_EVENTS = 16;
};
} // namespace waybar::util

View File

@ -66,7 +66,7 @@ inline int close(FILE* fp, pid_t pid) {
return stat; return stat;
} }
inline FILE* open(const std::string& cmd, int& pid) { inline FILE* open(const std::string& cmd, int& pid, const std::string& output_name) {
if (cmd == "") return nullptr; if (cmd == "") return nullptr;
int fd[2]; int fd[2];
// Open the pipe with the close-on-exec flag set, so it will not be inherited // Open the pipe with the close-on-exec flag set, so it will not be inherited
@ -109,6 +109,9 @@ inline FILE* open(const std::string& cmd, int& pid) {
::close(fd[0]); ::close(fd[0]);
dup2(fd[1], 1); dup2(fd[1], 1);
setpgid(child_pid, child_pid); setpgid(child_pid, child_pid);
if (output_name != "") {
setenv("WAYBAR_OUTPUT_NAME", output_name.c_str(), 1);
}
execlp("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0); execlp("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0);
exit(0); exit(0);
} else { } else {
@ -118,9 +121,9 @@ inline FILE* open(const std::string& cmd, int& pid) {
return fdopen(fd[0], "r"); return fdopen(fd[0], "r");
} }
inline struct res exec(const std::string& cmd) { inline struct res exec(const std::string& cmd, const std::string& output_name) {
int pid; int pid;
auto fp = command::open(cmd, pid); auto fp = command::open(cmd, pid, output_name);
if (!fp) return {-1, ""}; if (!fp) return {-1, ""};
auto output = command::read(fp); auto output = command::read(fp);
auto stat = command::close(fp, pid); auto stat = command::close(fp, pid);
@ -129,7 +132,7 @@ inline struct res exec(const std::string& cmd) {
inline struct res execNoRead(const std::string& cmd) { inline struct res execNoRead(const std::string& cmd) {
int pid; int pid;
auto fp = command::open(cmd, pid); auto fp = command::open(cmd, pid, "");
if (!fp) return {-1, ""}; if (!fp) return {-1, ""};
auto stat = command::close(fp, pid); auto stat = command::close(fp, pid);
return {WEXITSTATUS(stat), ""}; return {WEXITSTATUS(stat), ""};

View File

@ -0,0 +1,49 @@
#pragma once
#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
#include "giomm/file.h"
#include "giomm/filemonitor.h"
#include "glibmm/refptr.h"
struct pollfd;
namespace waybar {
class CssReloadHelper {
public:
CssReloadHelper(std::string cssFile, std::function<void()> callback);
virtual ~CssReloadHelper() = default;
virtual void monitorChanges();
protected:
std::vector<std::string> parseImports(const std::string& cssFile);
void parseImports(const std::string& cssFile, std::unordered_map<std::string, bool>& imports);
void watchFiles(const std::vector<std::string>& files);
bool handleInotifyEvents(int fd);
bool watch(int inotifyFd, pollfd* pollFd);
virtual std::string getFileContents(const std::string& filename);
virtual std::string findPath(const std::string& filename);
void handleFileChange(Glib::RefPtr<Gio::File> const& file,
Glib::RefPtr<Gio::File> const& other_type,
Gio::FileMonitorEvent event_type);
private:
std::string m_cssFile;
std::function<void()> m_callback;
std::vector<std::tuple<Glib::RefPtr<Gio::FileMonitor>>> m_fileMonitors;
};
} // namespace waybar

View File

@ -1,34 +1,48 @@
#pragma once #pragma once
#include <fmt/format.h> #include <chrono>
#if HAVE_CHRONO_TIMEZONES #if HAVE_CHRONO_TIMEZONES
#include <chrono>
#include <format> #include <format>
/* Compatibility layer for <date/tz.h> on top of C++20 <chrono> */
namespace date {
using namespace std::chrono;
namespace literals {
using std::chrono::last;
}
inline auto format(const std::string& spec, const auto& ztime) {
return spec.empty() ? "" : std::vformat("{:L" + spec + "}", std::make_format_args(ztime));
}
inline auto format(const std::locale& loc, const std::string& spec, const auto& ztime) {
return spec.empty() ? "" : std::vformat(loc, "{:L" + spec + "}", std::make_format_args(ztime));
}
} // namespace date
#else #else
#include <date/tz.h> #include <date/tz.h>
#include <fmt/format.h>
#include <regex>
#endif #endif
// Date
namespace date {
#if HAVE_CHRONO_TIMEZONES
using namespace std::chrono;
using namespace std;
#else
using system_clock = std::chrono::system_clock;
using seconds = std::chrono::seconds;
template <typename T>
inline auto format(const char* spec, const T& arg) {
return date::format(std::regex_replace(spec, std::regex("\\{:L|\\}"), ""), arg);
}
template <typename T>
inline auto format(const std::locale& loc, const char* spec, const T& arg) {
return date::format(loc, std::regex_replace(spec, std::regex("\\{:L|\\}"), ""), arg);
}
#endif
} // namespace date
// Format
namespace waybar::util::date::format {
#if HAVE_CHRONO_TIMEZONES
using namespace std;
#else
using namespace fmt;
#endif
} // namespace waybar::util::date::format
#if not HAVE_CHRONO_TIMEZONES
template <typename Duration, typename TimeZonePtr> template <typename Duration, typename TimeZonePtr>
struct fmt::formatter<date::zoned_time<Duration, TimeZonePtr>> { struct fmt::formatter<date::zoned_time<Duration, TimeZonePtr>> {
std::string_view specs; std::string_view specs;
@ -58,3 +72,6 @@ struct fmt::formatter<date::zoned_time<Duration, TimeZonePtr>> {
return fmt::format_to(ctx.out(), "{}", date::format(fmt::to_string(specs), ztime)); return fmt::format_to(ctx.out(), "{}", date::format(fmt::to_string(specs), ztime));
} }
}; };
#endif
using namespace date;

19
include/util/enum.hpp Normal file
View File

@ -0,0 +1,19 @@
#pragma once
#include <map>
#include <stdexcept>
#include <string>
namespace waybar::util {
template <typename EnumType>
struct EnumParser {
public:
EnumParser();
~EnumParser();
EnumType parseStringToEnum(const std::string& str,
const std::map<std::string, EnumType>& enumMap);
};
} // namespace waybar::util

View File

@ -3,6 +3,12 @@
#include <fmt/ostream.h> #include <fmt/ostream.h>
#include <json/json.h> #include <json/json.h>
#include <algorithm>
#include <codecvt>
#include <iostream>
#include <locale>
#include <regex>
#if (FMT_VERSION >= 90000) #if (FMT_VERSION >= 90000)
template <> template <>
@ -12,25 +18,30 @@ struct fmt::formatter<Json::Value> : ostream_formatter {};
namespace waybar::util { namespace waybar::util {
struct JsonParser { class JsonParser {
JsonParser() {} public:
JsonParser() = default;
const Json::Value parse(const std::string& data) const { Json::Value parse(const std::string& jsonStr) {
Json::Value root(Json::objectValue); Json::Value root;
if (data.empty()) {
// replace all occurrences of "\x" with "\u00", because JSON doesn't allow "\x" escape sequences
std::string modifiedJsonStr = replaceHexadecimalEscape(jsonStr);
std::istringstream jsonStream(modifiedJsonStr);
std::string errs;
if (!Json::parseFromStream(m_readerBuilder, jsonStream, &root, &errs)) {
throw std::runtime_error("Error parsing JSON: " + errs);
}
return root; return root;
} }
std::unique_ptr<Json::CharReader> const reader(builder_.newCharReader());
std::string err;
bool res = reader->parse(data.c_str(), data.c_str() + data.size(), &root, &err);
if (!res) throw std::runtime_error(err);
return root;
}
~JsonParser() = default;
private: private:
Json::CharReaderBuilder builder_; Json::CharReaderBuilder m_readerBuilder;
};
static std::string replaceHexadecimalEscape(const std::string& str) {
static std::regex re("\\\\x");
return std::regex_replace(str, re, "\\u00");
}
};
} // namespace waybar::util } // namespace waybar::util

View File

@ -0,0 +1,40 @@
#pragma once
#include <pipewire/pipewire.h>
#include "util/backend_common.hpp"
#include "util/pipewire/privacy_node_info.hpp"
namespace waybar::util::PipewireBackend {
class PipewireBackend {
private:
pw_thread_loop* mainloop_;
pw_context* context_;
pw_core* core_;
spa_hook registry_listener;
/* Hack to keep constructor inaccessible but still public.
* This is required to be able to use std::make_shared.
* It is important to keep this class only accessible via a reference-counted
* pointer because the destructor will manually free memory, and this could be
* a problem with C++20's copy and move semantics.
*/
struct private_constructor_tag {};
public:
std::mutex mutex_;
pw_registry* registry;
sigc::signal<void> privacy_nodes_changed_signal_event;
std::unordered_map<uint32_t, PrivacyNodeInfo*> privacy_nodes;
static std::shared_ptr<PipewireBackend> getInstance();
PipewireBackend(private_constructor_tag tag);
~PipewireBackend();
};
} // namespace waybar::util::PipewireBackend

View File

@ -0,0 +1,62 @@
#pragma once
#include <pipewire/pipewire.h>
#include <string>
#include "util/gtk_icon.hpp"
namespace waybar::util::PipewireBackend {
enum PrivacyNodeType {
PRIVACY_NODE_TYPE_NONE,
PRIVACY_NODE_TYPE_VIDEO_INPUT,
PRIVACY_NODE_TYPE_AUDIO_INPUT,
PRIVACY_NODE_TYPE_AUDIO_OUTPUT
};
class PrivacyNodeInfo {
public:
PrivacyNodeType type = PRIVACY_NODE_TYPE_NONE;
uint32_t id;
uint32_t client_id;
enum pw_node_state state = PW_NODE_STATE_IDLE;
std::string media_class;
std::string media_name;
std::string node_name;
std::string application_name;
std::string pipewire_access_portal_app_id;
std::string application_icon_name;
struct spa_hook object_listener;
struct spa_hook proxy_listener;
void *data;
std::string get_name() {
const std::vector<std::string *> names{&application_name, &node_name};
std::string name = "Unknown Application";
for (auto &name_ : names) {
if (name_ != nullptr && name_->length() > 0) {
name = *name_;
name[0] = toupper(name[0]);
break;
}
}
return name;
}
std::string get_icon_name() {
const std::vector<std::string *> names{&application_icon_name, &pipewire_access_portal_app_id,
&application_name, &node_name};
const std::string name = "application-x-executable-symbolic";
for (auto &name_ : names) {
if (name_ != nullptr && name_->length() > 0 && DefaultGtkIconThemeWrapper::has_icon(*name_)) {
return *name_;
}
}
return name;
}
};
} // namespace waybar::util::PipewireBackend

38
include/util/portal.hpp Normal file
View File

@ -0,0 +1,38 @@
#include <giomm/dbusproxy.h>
#include <string>
#include "fmt/format.h"
namespace waybar {
using namespace Gio;
enum class Appearance {
UNKNOWN = 0,
DARK = 1,
LIGHT = 2,
};
class Portal : private DBus::Proxy {
public:
Portal();
void refreshAppearance();
Appearance getAppearance();
typedef sigc::signal<void, Appearance> type_signal_appearance_changed;
type_signal_appearance_changed signal_appearance_changed() { return m_signal_appearance_changed; }
private:
type_signal_appearance_changed m_signal_appearance_changed;
Appearance currentMode;
void on_signal(const Glib::ustring& sender_name, const Glib::ustring& signal_name,
const Glib::VariantContainerBase& parameters);
};
} // namespace waybar
template <>
struct fmt::formatter<waybar::Appearance> : formatter<fmt::string_view> {
// parse is inherited from formatter<string_view>.
auto format(waybar::Appearance c, format_context& ctx) const;
};

View File

@ -0,0 +1,51 @@
#pragma once
#include <json/json.h>
#include <functional>
#include <regex>
#include <string>
namespace waybar::util {
struct Rule {
std::regex rule;
std::string repr;
int priority;
// Fix for Clang < 16
// See https://en.cppreference.com/w/cpp/compiler_support/20 "Parenthesized initialization of
// aggregates"
Rule(std::regex rule, std::string repr, int priority)
: rule(rule), repr(repr), priority(priority) {}
};
int default_priority_function(std::string& key);
/* A collection of regexes and strings, with a default string to return if no regexes.
* When a regex is matched, the corresponding string is returned.
* All regexes that are matched are cached, so that the regexes are only
* evaluated once against a given string.
* Regexes may be given a higher priority than others, so that they are matched
* first. The priority function is given the regex string, and should return a
* higher number for higher priority regexes.
*/
class RegexCollection {
private:
std::vector<Rule> rules;
std::map<std::string, std::string> regex_cache;
std::string default_repr;
std::string& find_match(std::string& value, bool& matched_any);
public:
RegexCollection() = default;
RegexCollection(const Json::Value& map, std::string default_repr = "",
std::function<int(std::string&)> priority_function = default_priority_function);
~RegexCollection() = default;
std::string& get(std::string& value, bool& matched_any);
std::string& get(std::string& value);
};
} // namespace waybar::util

View File

@ -5,4 +5,6 @@
namespace waybar::util { namespace waybar::util {
std::string rewriteString(const std::string&, const Json::Value&); std::string rewriteString(const std::string&, const Json::Value&);
} std::string rewriteStringOnce(const std::string& value, const Json::Value& rules,
bool& matched_any);
} // namespace waybar::util

View File

@ -0,0 +1,21 @@
#pragma once
#include <utility>
namespace waybar::util {
template <typename Func>
class ScopeGuard {
public:
explicit ScopeGuard(Func&& exit_function) : f{std::forward<Func>(exit_function)} {}
ScopeGuard(const ScopeGuard&) = delete;
ScopeGuard(ScopeGuard&&) = default;
ScopeGuard& operator=(const ScopeGuard&) = delete;
ScopeGuard& operator=(ScopeGuard&&) = default;
~ScopeGuard() { f(); }
private:
Func f;
};
} // namespace waybar::util

View File

@ -58,10 +58,22 @@ class SleeperThread {
bool isRunning() const { return do_run_; } bool isRunning() const { return do_run_; }
auto sleep() {
std::unique_lock lk(mutex_);
CancellationGuard cancel_lock;
return condvar_.wait(lk, [this] { return signal_ || !do_run_; });
}
auto sleep_for(std::chrono::system_clock::duration dur) { auto sleep_for(std::chrono::system_clock::duration dur) {
std::unique_lock lk(mutex_); std::unique_lock lk(mutex_);
CancellationGuard cancel_lock; CancellationGuard cancel_lock;
return condvar_.wait_for(lk, dur, [this] { return signal_ || !do_run_; }); constexpr auto max_time_point = std::chrono::steady_clock::time_point::max();
auto wait_end = max_time_point;
auto now = std::chrono::steady_clock::now();
if (now < max_time_point - dur) {
wait_end = now + dur;
}
return condvar_.wait_until(lk, wait_end, [this] { return signal_ || !do_run_; });
} }
auto sleep_until( auto sleep_until(

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <iostream>
#include <string> #include <string>
const std::string WHITESPACE = " \n\r\t\f\v"; const std::string WHITESPACE = " \n\r\t\f\v";
@ -15,3 +16,10 @@ inline std::string rtrim(const std::string& s) {
} }
inline std::string trim(const std::string& s) { return rtrim(ltrim(s)); } inline std::string trim(const std::string& s) { return rtrim(ltrim(s)); }
inline std::string capitalize(const std::string& str) {
std::string result = str;
std::transform(result.begin(), result.end(), result.begin(),
[](unsigned char c) { return std::toupper(c); });
return result;
}

View File

@ -0,0 +1,88 @@
waybar-backlight-slider(5)
# NAME
waybar - backlight slider module
# DESCRIPTION
The *backlight slider* module displays and controls the current brightness of the default or preferred device.
The brightness can be controlled by dragging the slider across the bar or clicking on a specific position.
# CONFIGURATION
*min*: ++
typeof: int ++
default: 0 ++
The minimum volume value the slider should display and set.
*max*: ++
typeof: int ++
default: 100 ++
The maximum volume value the slider should display and set.
*orientation*: ++
typeof: string ++
default: horizontal ++
The orientation of the slider. Can be either `horizontal` or `vertical`.
*device*: ++
typeof: string ++
The name of the preferred device to control. If left empty, a device will be chosen automatically.
# EXAMPLES
```
"modules-right": [
"backlight-slider",
],
"backlight/slider": {
"min": 0,
"max": 100,
"orientation": "horizontal",
"device": "intel_backlight"
}
```
# STYLE
The slider is a component with multiple CSS Nodes, of which the following are exposed:
*#backlight-slider*: ++
Controls the style of the box *around* the slider and bar.
*#backlight-slider slider*: ++
Controls the style of the slider handle.
*#backlight-slider trough*: ++
Controls the style of the part of the bar that has not been filled.
*#backlight-slider highlight*: ++
Controls the style of the part of the bar that has been filled.
## STYLE EXAMPLE
```
#backlight-slider slider {
min-height: 0px;
min-width: 0px;
opacity: 0;
background-image: none;
border: none;
box-shadow: none;
}
#backlight-slider trough {
min-height: 80px;
min-width: 10px;
border-radius: 5px;
background-color: black;
}
#backlight-slider highlight {
min-width: 10px;
border-radius: 5px;
background-color: red;
}
```

View File

@ -26,11 +26,15 @@ The *backlight* module displays the current backlight level.
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*rotate*: ++ *rotate*: ++
typeof: integer ++ typeof: integer ++
@ -46,11 +50,11 @@ The *backlight* module displays the current backlight level.
*on-click-middle*: ++ *on-click-middle*: ++
typeof: string ++ typeof: string ++
Command to execute when middle-clicked on the module using mousewheel. Command to execute when middle-clicked on the module using mouse scroll wheel.
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when the module is right clicked. Command to execute when the module is right-clicked.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++
@ -75,7 +79,7 @@ The *backlight* module displays the current backlight level.
*scroll-step*: ++ *scroll-step*: ++
typeof: float ++ typeof: float ++
default: 1.0 ++ default: 1.0 ++
The speed in which to change the brightness when scrolling. The speed at which to change the brightness when scrolling.
# EXAMPLE: # EXAMPLE:

View File

@ -25,7 +25,7 @@ The *battery* module displays the current capacity and state (eg. charging) of y
*design-capacity*: ++ *design-capacity*: ++
typeof: bool ++ typeof: bool ++
default: false ++ default: false ++
Option to use the battery design capacity instead of it's current maximal capacity. Option to use the battery design capacity instead of its current maximal capacity.
*interval*: ++ *interval*: ++
typeof: integer ++ typeof: integer ++
@ -57,11 +57,15 @@ The *battery* module displays the current capacity and state (eg. charging) of y
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*rotate*: ++ *rotate*: ++
typeof: integer++ typeof: integer++
@ -77,7 +81,7 @@ The *battery* module displays the current capacity and state (eg. charging) of y
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++
@ -100,6 +104,11 @@ The *battery* module displays the current capacity and state (eg. charging) of y
default: true ++ default: true ++
Option to disable tooltip on hover. Option to disable tooltip on hover.
*bat-compatibility*: ++
typeof: bool ++
default: false ++
Option to enable battery compatibility if not detected.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{capacity}*: Capacity in percentage *{capacity}*: Capacity in percentage
@ -121,7 +130,7 @@ The three arguments are:
# CUSTOM FORMATS # CUSTOM FORMATS
The *battery* module allows one to define custom formats based on up to two factors. The best fitting format will be selected. The *battery* module allows one to define custom formats based on up to two factors. The best-fitting format will be selected.
*format-<state>*: With *states*, a custom format can be set depending on the capacity of your battery. *format-<state>*: With *states*, a custom format can be set depending on the capacity of your battery.
@ -132,8 +141,8 @@ The *battery* module allows one to define custom formats based on up to two fact
# STATES # STATES
- Every entry (*state*) consists of a *<name>* (typeof: *string*) and a *<value>* (typeof: *integer*). - Every entry (*state*) consists of a *<name>* (typeof: *string*) and a *<value>* (typeof: *integer*).
- The state can be addressed as a CSS class in the *style.css*. The name of the CSS class is the *<name>* of the state. Each class gets activated when the current capacity is equal or below the configured *<value>*. - The state can be addressed as a CSS class in the *style.css*. The name of the CSS class is the *<name>* of the state. Each class gets activated when the current capacity is equal to or below the configured *<value>*.
- Also each state can have its own *format*. Those con be configured via *format-<name>*. Or if you want to differentiate a bit more even as *format-<status>-<state>*. For more information see *custom-formats*. - Also each state can have its own *format*. Those can be configured via *format-<name>*. Or if you want to differentiate a bit more even as *format-<status>-<state>*. For more information see *custom-formats*.
@ -162,3 +171,10 @@ The *battery* module allows one to define custom formats based on up to two fact
- *<state>* can be defined in the *config*. For more information see *states*. - *<state>* can be defined in the *config*. For more information see *states*.
- *#battery.<status>.<state>* - *#battery.<status>.<state>*
- Combination of both *<status>* and *<state>*. - Combination of both *<status>* and *<state>*.
The following classes are applied to the entire Waybar rather than just the
battery widget:
- *window#waybar.battery-<state>*
- *<state>* can be defined in the *config*, as previously mentioned.

View File

@ -14,7 +14,7 @@ Addressed by *bluetooth*
*controller*: ++ *controller*: ++
typeof: string ++ typeof: string ++
Use the controller with the defined alias. Otherwise a random controller is used. Recommended to define when there is more than 1 controller available to the system. Use the controller with the defined alias. Otherwise, a random controller is used. Recommended to define when there is more than 1 controller available to the system.
*format-device-preference*: ++ *format-device-preference*: ++
typeof: array ++ typeof: array ++
@ -44,7 +44,7 @@ Addressed by *bluetooth*
*format-no-controller*: ++ *format-no-controller*: ++
typeof: string ++ typeof: string ++
This format is used when no bluetooth controller could be found This format is used when no bluetooth controller can be found
*format-icons*: ++ *format-icons*: ++
typeof: array/object ++ typeof: array/object ++
@ -62,11 +62,15 @@ Addressed by *bluetooth*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -78,7 +82,7 @@ Addressed by *bluetooth*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-scroll-up*: ++ *on-scroll-up*: ++
typeof: string ++ typeof: string ++
@ -119,7 +123,7 @@ Addressed by *bluetooth*
*tooltip-format-no-controller*: ++ *tooltip-format-no-controller*: ++
typeof: string ++ typeof: string ++
This format is used when no bluetooth controller could be found This format is used when no bluetooth controller can be found
*tooltip-format-enumerate-connected*: ++ *tooltip-format-enumerate-connected*: ++
typeof: string ++ typeof: string ++
@ -146,7 +150,7 @@ Addressed by *bluetooth*
*{device_alias}*: Alias of the displayed device. *{device_alias}*: Alias of the displayed device.
*{device_enumerate}*: Show a list of all connected devices, each on a separate line. Define the format of each device with the *tooltip-format-enumerate-connected* ++ *{device_enumerate}*: Show a list of all connected devices, each on a separate line. Define the format of each device with the *tooltip-format-enumerate-connected* ++
and/or *tooltip-format-enumerate-connected-battery* config options. Can only be used in the tooltip related format options. and/or *tooltip-format-enumerate-connected-battery* config options. Can only be used in the tooltip-related format options.
# EXPERIMENTAL BATTERY PERCENTAGE FEATURE # EXPERIMENTAL BATTERY PERCENTAGE FEATURE

View File

@ -35,7 +35,7 @@ libcava lives in:
|[ *framerate* |[ *framerate*
:[ integer :[ integer
:[ 30 :[ 30
:[ rames per second. Is used as a replacement for *interval* :[ Frames per second. Is used as a replacement for *interval*
|[ *autosens* |[ *autosens*
:[ integer :[ integer
:[ 1 :[ 1
@ -60,6 +60,10 @@ libcava lives in:
:[ integer :[ integer
:[ 5 :[ 5
:[ Seconds with no input before cava main thread goes to sleep mode :[ Seconds with no input before cava main thread goes to sleep mode
|[ *hide_on_silence*
:[ bool
:[ false
:[ Hides the widget if no input (after sleep_timer elapsed)
|[ *method* |[ *method*
:[ string :[ string
:[ pulse :[ pulse
@ -91,19 +95,19 @@ libcava lives in:
|[ *monstercat* |[ *monstercat*
:[ bool :[ bool
:[ false :[ false
:[ Disables or enables the so-called "Monstercat smoothing" with of without "waves" :[ Disables or enables the so-called "Monstercat smoothing" with or without "waves"
|[ *waves* |[ *waves*
:[ bool :[ bool
:[ false :[ false
:[ Disables or enables the so-called "Monstercat smoothing" with of without "waves" :[ Disables or enables the so-called "Monstercat smoothing" with or without "waves"
|[ *noise_reduction* |[ *noise_reduction*
:[ double :[ double
:[ 0.77 :[ 0.77
:[ Range between 0 - 1. The raw visualization is very noisy, this factor adjust the integral and gravity filters to keep the signal smooth. 1 - will be very slow and smooth, 0 - will be fast but noisy :[ Range between 0 - 1. The raw visualization is very noisy, this factor adjusts the integral and gravity filters to keep the signal smooth. 1 - will be very slow and smooth, 0 - will be fast but noisy
|[ *input_delay* |[ *input_delay*
:[ integer :[ integer
:[ 2 :[ 2
:[ Sets the delay before fetching audio source thread start working. On author machine Waybar starts much faster then pipewire audio server, and without a little delay cava module fails due to pipewire is not ready :[ Sets the delay before fetching audio source thread start working. On author's machine, Waybar starts much faster than pipewire audio server, and without a little delay cava module fails because pipewire is not ready
|[ *ascii_max_range* |[ *ascii_max_range*
:[ integer :[ integer
:[ 7 :[ 7
@ -120,14 +124,14 @@ libcava lives in:
Configuration can be provided as: Configuration can be provided as:
- The only cava configuration file which is provided through *cava_config*. The rest configuration can be skipped - The only cava configuration file which is provided through *cava_config*. The rest configuration can be skipped
- Without cava configuration file. In such case cava should be configured through provided list of the configuration option - Without cava configuration file. In such case cava should be configured through provided list of the configuration option
- Mix. When provided both And cava configuration file And configuration options. In such case waybar applies configuration file first then overrides particular options by the provided list of configuration options - Mix. When provided both And cava configuration file And configuration options. In such case, waybar applies configuration file first and then overrides particular options by the provided list of configuration options
# ACTIONS # ACTIONS
[- *String* [- *String*
:- *Action* :- *Action*
|[ *mode* |[ *mode*
:< Switch main cava thread and fetching audio source thread from/to pause/resume :< Switch main cava thread and fetch audio source thread from/to pause/resume
# DEPENDENCIES # DEPENDENCIES
@ -138,16 +142,16 @@ Configuration can be provided as:
. On start Waybar throws an exception "error while loading shared libraries: libcava.so: cannot open shared object file: No such file or directory". . On start Waybar throws an exception "error while loading shared libraries: libcava.so: cannot open shared object file: No such file or directory".
It might happen when libcava for some reason hasn't been registered in the system. sudo ldconfig should help It might happen when libcava for some reason hasn't been registered in the system. sudo ldconfig should help
. Waybar is starting but cava module doesn't react on the music . Waybar is starting but cava module doesn't react to the music
1. In such case for at first need to make sure usual cava application is working as well 1. In such cases at first need to make sure usual cava application is working as well
2. If so, need to comment all configuration options. Uncomment cava_config and provide the path to the working cava config 2. If so, need to comment all configuration options. Uncomment cava_config and provide the path to the working cava config
3. You might set too huge or too small input_delay. Try to setup to 4 seconds, restart waybar and check again 4 seconds past. Usual even on weak machines it should be enough 3. You might set too huge or too small input_delay. Try to setup to 4 seconds, restart waybar, and check again 4 seconds past. Usual even on weak machines it should be enough
4. You might accidentally switched action mode to pause mode 4. You might accidentally switch action mode to pause mode
# RISING ISSUES # RISING ISSUES
For clear understanding: this module is a cava API's consumer. So for any bugs related to cava engine you should contact to Cava upstream(https://github.com/karlstav/cava) ++ For clear understanding: this module is a cava API's consumer. So for any bugs related to cava engine you should contact Cava upstream(https://github.com/karlstav/cava) ++
with the one Exception. Cava upstream doesn't provide cava as a shared library. For that this module author made a fork libcava(https://github.com/LukashonakV/cava). ++ with the one Exception. Cava upstream doesn't provide cava as a shared library. For that, this module author made a fork libcava(https://github.com/LukashonakV/cava). ++
So the order is: So the order is:
. cava upstream . cava upstream
. libcava upstream. . libcava upstream.

37
man/waybar-cffi.5.scd Normal file
View File

@ -0,0 +1,37 @@
waybar-cffi(5)
# NAME
waybar - cffi module
# DESCRIPTION
The *cffi* module gives full control of a GTK widget to a third-party dynamic library, to create more complex modules using different programming languages.
# CONFIGURATION
Addressed by *cffi/<name>*
*module_path*: ++
typeof: string ++
The path to the dynamic library to load to control the widget.
Some additional configuration may be required depending on the cffi dynamic library being used.
# EXAMPLES
## C example:
An example module written in C can be found at https://github.com/Alexays/Waybar/resources/custom_modules/cffi_example/
Waybar config to enable the module:
```
"cffi/c_example": {
"module_path": ".config/waybar/cffi/wb_cffi_example.so"
}
```
# STYLE
The classes and IDs are managed by the cffi dynamic library.

View File

@ -63,7 +63,7 @@ $XDG_CONFIG_HOME/waybar/config ++
|[ *on-click-right* |[ *on-click-right*
:[ string :[ string
:[ :[
:[ Command to execute when you right clicked on the module :[ Command to execute when you right-click on the module
|[ *on-scroll-up* |[ *on-scroll-up*
:[ string :[ string
:[ :[
@ -85,7 +85,7 @@ $XDG_CONFIG_HOME/waybar/config ++
:[ same as format :[ same as format
:[ Tooltip on hover :[ Tooltip on hover
View all valid format options in *strftime(3)* or have a look <https://fmt.dev/latest/syntax.html#chrono-specs> View all valid format options in *strftime(3)* or have a look https://en.cppreference.com/w/cpp/chrono/duration/formatter
2. Addressed by *clock: calendar* 2. Addressed by *clock: calendar*
[- *Option* [- *Option*
@ -147,7 +147,7 @@ View all valid format options in *strftime(3)* or have a look <https://fmt.dev/l
|[ *tz_up* |[ *tz_up*
:[ Switch to the next provided time zone :[ Switch to the next provided time zone
|[ *tz_down* |[ *tz_down*
:[ Switch to the previous provided time zone :[ Switch to the previously provided time zone
|[ *shift_up* |[ *shift_up*
:[ Switch to the next calendar month/year :[ Switch to the next calendar month/year
|[ *shift_down* |[ *shift_down*
@ -156,7 +156,8 @@ View all valid format options in *strftime(3)* or have a look <https://fmt.dev/l
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
- *{calendar}*: Current month calendar - *{calendar}*: Current month calendar
- *{timezoned_time_list}*: List of time in the rest timezones, if more than one timezone is set in the config - *{tz_list}*: List of time in the rest timezones, if more than one timezone is set in the config
- *{ordinal_date}*: The current day in (English) ordinal form, e.g. 21st
# EXAMPLES # EXAMPLES
@ -219,7 +220,7 @@ View all valid format options in *strftime(3)* or have a look <https://fmt.dev/l
# Troubleshooting # Troubleshooting
If clock module is disabled at startup with locale::facet::\_S\_create\_c\_locale ++ If clock module is disabled at startup with locale::facet::\_S\_create\_c\_locale ++
name not valid error message try one of the followings: name not valid error message try one of the following:
- check if LC_TIME is set properly (glibc) - check if LC_TIME is set properly (glibc)
- set locale to C in the config file (musl) - set locale to C in the config file (musl)

View File

@ -6,7 +6,7 @@ waybar - cpu module
# DESCRIPTION # DESCRIPTION
The *cpu* module displays the current cpu utilization. The *cpu* module displays the current CPU utilization.
# CONFIGURATION # CONFIGURATION
@ -31,11 +31,15 @@ The *cpu* module displays the current cpu utilization.
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*rotate*: ++ *rotate*: ++
typeof: integer ++ typeof: integer ++
@ -43,7 +47,7 @@ The *cpu* module displays the current cpu utilization.
*states*: ++ *states*: ++
typeof: object ++ typeof: object ++
A number of cpu usage states which get activated on certain usage levels. See *waybar-states(5)*. A number of CPU usage states which get activated on certain usage levels. See *waybar-states(5)*.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -55,7 +59,7 @@ The *cpu* module displays the current cpu utilization.
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++
@ -80,21 +84,21 @@ The *cpu* module displays the current cpu utilization.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{load}*: Current cpu load. *{load}*: Current CPU load.
*{usage}*: Current overall cpu usage. *{usage}*: Current overall CPU usage.
*{usage*{n}*}*: Current cpu core n usage. Cores are numbered from zero, so first core will be {usage0} and 4th will be {usage3}. *{usage*{n}*}*: Current CPU core n usage. Cores are numbered from zero, so first core will be {usage0} and 4th will be {usage3}.
*{avg_frequency}*: Current cpu average frequency (based on all cores) in GHz. *{avg_frequency}*: Current CPU average frequency (based on all cores) in GHz.
*{max_frequency}*: Current cpu max frequency (based on the core with the highest frequency) in GHz. *{max_frequency}*: Current CPU max frequency (based on the core with the highest frequency) in GHz.
*{min_frequency}*: Current cpu min frequency (based on the core with the lowest frequency) in GHz. *{min_frequency}*: Current CPU min frequency (based on the core with the lowest frequency) in GHz.
*{icon}*: Icon for overall cpu usage. *{icon}*: Icon for overall CPU usage.
*{icon*{n}*}*: Icon for cpu core n usage. Use like {icon0}. *{icon*{n}*}*: Icon for CPU core n usage. Use like {icon0}.
# EXAMPLES # EXAMPLES
@ -108,7 +112,7 @@ Basic configuration:
} }
``` ```
Cpu usage per core rendered as icons: CPU usage per core rendered as icons:
``` ```
"cpu": { "cpu": {

View File

@ -34,18 +34,20 @@ Addressed by *custom/<name>*
typeof: integer ++ typeof: integer ++
The interval (in seconds) in which the information gets polled. ++ The interval (in seconds) in which the information gets polled. ++
Use *once* if you want to execute the module only on startup. ++ Use *once* if you want to execute the module only on startup. ++
You can update it manually with a signal. If no *interval* is defined, it is assumed that the out script loops it self. You can update it manually with a signal. If no *interval* or *signal* is defined, it is assumed that the out script loops itself. ++
If a *signal* is defined then the script will run once on startup and will only update with a signal.
*restart-interval*: ++ *restart-interval*: ++
typeof: integer ++ typeof: integer ++
The restart interval (in seconds). ++ The restart interval (in seconds). ++
Can't be used with the *interval* option, so only with continuous scripts. ++ Can't be used with the *interval* option, so only with continuous scripts. ++
Once the script exit, it'll be re-executed after the *restart-interval*. Once the script exits, it'll be re-executed after the *restart-interval*.
*signal*: ++ *signal*: ++
typeof: integer ++ typeof: integer ++
The signal number used to update the module. ++ The signal number used to update the module. ++
The number is valid between 1 and N, where *SIGRTMIN+N* = *SIGRTMAX*. The number is valid between 1 and N, where *SIGRTMIN+N* = *SIGRTMAX*. ++
If no interval is defined then a signal will be the only way to update the module.
*format*: ++ *format*: ++
typeof: string ++ typeof: string ++
@ -66,11 +68,15 @@ Addressed by *custom/<name>*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -82,7 +88,7 @@ Addressed by *custom/<name>*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++
@ -105,6 +111,11 @@ Addressed by *custom/<name>*
default: true ++ default: true ++
Option to disable tooltip on hover. Option to disable tooltip on hover.
*tooltip-format*: ++
typeof: string ++
The tooltip format. If specified, overrides any tooltip output from the script in *exec*. ++
Uses the same format replacements as *format*.
*escape*: ++ *escape*: ++
typeof: bool ++ typeof: bool ++
default: false ++ default: false ++
@ -134,7 +145,7 @@ $text\\n$tooltip\\n$class*
*{}*: Output of the script. *{}*: Output of the script.
*{percentage}* Percentage which can be set via a json return-type. *{percentage}* Percentage which can be set via a json return type.
*{icon}*: An icon from 'format-icons' according to percentage. *{icon}*: An icon from 'format-icons' according to percentage.

View File

@ -33,7 +33,7 @@ Addressed by *disk*
*states*: ++ *states*: ++
typeof: object ++ typeof: object ++
A number of disk utilization states which get activated on certain percentage thresholds (percentage_used). See *waybar-states(5)*. A number of disk utilization states that get activated on certain percentage thresholds (percentage_used). See *waybar-states(5)*.
*max-length*: ++ *max-length*: ++
typeof: integer ++ typeof: integer ++
@ -41,11 +41,15 @@ Addressed by *disk*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -57,7 +61,7 @@ Addressed by *disk*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++
@ -85,20 +89,30 @@ Addressed by *disk*
default: "{used} out of {total} used ({percentage_used}%)" ++ default: "{used} out of {total} used ({percentage_used}%)" ++
The format of the information displayed in the tooltip. The format of the information displayed in the tooltip.
*unit*: ++
typeof: string ++
Use with specific_free, specific_used, and specific_total to force calculation to always be in a certain unit. Accepts kB, kiB, MB, Mib, GB, GiB, TB, TiB.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{percentage_used}*: Percentage of disk in use. *{percentage_used}*: Percentage of disk in use.
*{percentage_free}*: Percentage of free disk space *{percentage_free}*: Percentage of free disk space
*{total}*: Total amount of space on the disk, partition or mountpoint. *{total}*: Total amount of space on the disk, partition, or mountpoint. Automatically selects unit based on size remaining.
*{used}*: Amount of used disk space. *{used}*: Amount of used disk space. Automatically selects unit based on size remaining.
*{free}*: Amount of available disk space for normal users. *{free}*: Amount of available disk space for normal users. Automatically selects unit based on size remaining.
*{path}*: The path specified in the configuration. *{path}*: The path specified in the configuration.
*{specific_total}*: Total amount of space on the disk, partition, or mountpoint in a specific unit. Defaults to bytes.
*{specific_used}*: Amount of used disk space in a specific unit. Defaults to bytes.
*{specific_free}*: Amount of available disk space for normal users in a specific unit. Defaults to bytes.
# EXAMPLES # EXAMPLES
``` ```
@ -108,6 +122,15 @@ Addressed by *disk*
} }
``` ```
```
"disk": {
"interval": 30,
"format": "{specific_free:0.2f} GB out of {specific_total:0.2f} GB available. Alternatively {free} out of {total} available",
"unit": "GB"
// 1434.25 GB out of 2000.00 GB available. Alternatively 1.4TiB out of 1.9TiB available.
}
```
# STYLE # STYLE
- *#disk* - *#disk*

View File

@ -24,7 +24,7 @@ Addressed by *dwl/tags*
*disable-click*: ++ *disable-click*: ++
typeof: bool ++ typeof: bool ++
default: false ++ default: false ++
If set to false, you can left click to set focused tag. Right click to toggle tag focus. If set to true this behaviour is disabled. If set to false, you can left-click to set focused tag. Right-click to toggle tag focus. If set to true this behaviour is disabled.
# EXAMPLE # EXAMPLE

118
man/waybar-dwl-window.5.scd Normal file
View File

@ -0,0 +1,118 @@
waybar-dwl-window(5)
# NAME
waybar - dwl window module
# DESCRIPTION
The *window* module displays the title of the currently focused window in DWL
# CONFIGURATION
Addressed by *dwl/window*
*format*: ++
typeof: string ++
default: {title} ++
The format, how information should be displayed.
*rotate*: ++
typeof: integer ++
Positive value to rotate the text label.
*max-length*: ++
typeof: integer ++
The maximum length in character the module should display.
*min-length*: ++
typeof: integer ++
The minimum length in characters the module should accept.
*align*: ++
typeof: float ++
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++
typeof: string ++
Command to execute when clicked on the module.
*on-click-middle*: ++
typeof: string ++
Command to execute when middle-clicked on the module using mousewheel.
*on-click-right*: ++
typeof: string ++
Command to execute when you right-click on the module.
*on-update*: ++
typeof: string ++
Command to execute when the module is updated.
*on-scroll-up*: ++
typeof: string ++
Command to execute when scrolling up on the module.
*on-scroll-down*: ++
typeof: string ++
Command to execute when scrolling down on the module.
*smooth-scrolling-threshold*: ++
typeof: double ++
Threshold to be used when scrolling.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
*rewrite*: ++
typeof: object ++
Rules to rewrite the module format output. See *rewrite rules*.
*icon*: ++
typeof: bool ++
default: false ++
Option to hide the application icon.
*icon-size*: ++
typeof: integer ++
default: 24 ++
Option to change the size of the application icon.
# FORMAT REPLACEMENTS
*{title}*: The title of the focused window.
*{app_id}*: The app_id of the focused window.
*{layout}*: The layout of the focused window.
# REWRITE RULES
*rewrite* is an object where keys are regular expressions and values are
rewrite rules if the expression matches. Rules may contain references to
captures of the expression.
Regular expression and replacement follow ECMA-script rules.
If no expression matches, the format output is left unchanged.
Invalid expressions (e.g., mismatched parentheses) are skipped.
# EXAMPLES
```
"dwl/window": {
"format": "{}",
"max-length": 50,
"rewrite": {
"(.*) - Mozilla Firefox": "🌎 $1",
"(.*) - zsh": "> [$1]"
}
}
```

View File

@ -65,11 +65,11 @@ Feral Gamemode optimizations.
*{glyph}*: The string icon glyph to use instead. *{glyph}*: The string icon glyph to use instead.
*{count}*: The amount of games running with gamemode optimizations. *{count}*: The number of games running with gamemode optimizations.
# TOOLTIP FORMAT REPLACEMENTS # TOOLTIP FORMAT REPLACEMENTS
*{count}*: The amount of games running with gamemode optimizations. *{count}*: The number of games running with gamemode optimizations.
# EXAMPLES # EXAMPLES

View File

@ -27,11 +27,15 @@ Addressed by *hyprland/submap*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -43,7 +47,7 @@ Addressed by *hyprland/submap*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++
@ -66,6 +70,16 @@ Addressed by *hyprland/submap*
default: true ++ default: true ++
Option to disable tooltip on hover. Option to disable tooltip on hover.
*always-on*: ++
typeof: bool ++
default: false ++
Option to display the widget even when there's no active submap.
*default-submap* ++
typeof: string ++
default: Default ++
Option to set the submap name to display when not in an active submap.
# EXAMPLES # EXAMPLES
@ -80,3 +94,4 @@ Addressed by *hyprland/submap*
# STYLE # STYLE
- *#submap* - *#submap*
- *#submap.<name>*

View File

@ -19,17 +19,58 @@ Addressed by *hyprland/workspaces*
*format-icons*: ++ *format-icons*: ++
typeof: array ++ typeof: array ++
Based on the workspace id and state, the corresponding icon gets selected. See *icons*. Based on the workspace ID and state, the corresponding icon gets selected. See *icons*.
*window-rewrite*: ++
typeof: object ++
Regex rules to map window class to an icon or preferred method of representation for a workspace's window.
Keys are the rules, while the values are the methods of representation. Values may use the placeholders {class} and {title} to use the window's original class and/or title respectively.
Rules may specify `class<...>`, `title<...>`, or both in order to fine-tune the matching.
*window-rewrite-default*:
typeof: string ++
default: "?" ++
The default method of representation for a workspace's window. This will be used for windows whose classes do not match any of the rules in *window-rewrite*.
*format-window-separator*: ++
typeof: string ++
default: " " ++
The separator to be used between windows in a workspace.
*show-special*: ++ *show-special*: ++
typeof: bool ++ typeof: bool ++
default: false ++ default: false ++
If set to true special workspaces will be shown. If set to true, special workspaces will be shown.
*all-outputs*: ++ *all-outputs*: ++
typeof: bool ++ typeof: bool ++
default: false ++ default: false ++
If set to false workspaces group will be shown only in assigned output. Otherwise all workspace groups are shown. If set to false workspaces group will be shown only in assigned output. Otherwise, all workspace groups are shown.
*active-only*: ++
typeof: bool ++
default: false ++
If set to true, only the active workspace will be shown.
*move-to-monitor*: ++
typeof: bool ++
default: false ++
If set to true, open the workspace on the current monitor when clicking on a workspace button.
Otherwise, the workspace will open on the monitor where it was previously assigned.
Analog to using `focusworkspaceoncurrentmonitor` dispatcher instead of `workspace` in Hyprland.
*ignore-workspaces*: ++
typeof: array ++
default: [] ++
Regexes to match against workspaces names. If there's a match, the workspace will not be shown. This takes precedence over *show-special*, *all-outputs*, and *active-only*.
*sort-by*: ++
typeof: string ++
default: "default" ++
If set to number, workspaces will sort by number.
If set to name, workspaces will sort by name.
If set to id, workspaces will sort by id.
If none of those, workspaces will sort with default behavior.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
@ -43,10 +84,12 @@ Addressed by *hyprland/workspaces*
Additional to workspace name matching, the following *format-icons* can be set. Additional to workspace name matching, the following *format-icons* can be set.
- *default*: Will be shown, when no string match is found. - *default*: Will be shown, when no string match is found and none of the below conditions have defined icons.
- *active*: Will be shown, when workspace is active - *active*: Will be shown, when workspace is active
- *special*: Will be shown on non-active special workspaces - *special*: Will be shown on non-active special workspaces
- *persistent*: Will be shown on non-active persistent workspaces - *empty*: Will be shown on non-active, non-special empty persistent workspaces
- *visible*: Will be shown on workspaces that are visible but not active. For example: this is useful if you want your visible workspaces on other monitors to have the same look as active.
- *persistent*: Will be shown on non-empty persistent workspaces
# EXAMPLES # EXAMPLES
@ -62,18 +105,64 @@ Additional to workspace name matching, the following *format-icons* can be set.
"active": "", "active": "",
"default": "" "default": ""
}, },
"persistent_workspaces": { "persistent-workspaces": {
"*": 5, // 5 workspaces by default on every monitor "*": 5, // 5 workspaces by default on every monitor
"HDMI-A-1": 3 // but only three on HDMI-A-1 "HDMI-A-1": 3 // but only three on HDMI-A-1
} }
} }
``` ```
```
"hyprland/workspaces": {
"format": "{name}: {icon}",
"format-icons": {
"1": "",
"2": "",
"3": "",
"4": "",
"5": "",
"active": "",
"default": ""
},
"persistent-workspaces": {
"*": [ 2,3,4,5 ], // 2-5 on every monitor
"HDMI-A-1": [ 1 ] // but only workspace 1 on HDMI-A-1
}
}
```
```
"hyprland/workspaces": {
"format": "{name}\n{windows}",
"format-window-separator": "\n",
"window-rewrite-default": "",
"window-rewrite": {
"title<.*youtube.*>": "", // Windows whose titles contain "youtube"
"class<firefox>": "", // Windows whose classes are "firefox"
"class<firefox> title<.*github.*>": "", // Windows whose class is "firefox" and title contains "github". Note that "class" always comes first.
"foot": "", // Windows that contain "foot" in either class or title. For optimization reasons, it will only match against a title if at least one other window explicitly matches against a title.
"code": "󰨞",
}
}
```
```
"hyprland/workspaces": {
// Formatting omitted for brevity
"ignore-workspaces": [
"(special:)?chrome-sharing-indicator"
]
}
```
# Style # Style
- *#workspaces* - *#workspaces*
- *#workspaces button* - *#workspaces button*
- *#workspaces button.active* - *#workspaces button.active*
- *#workspaces button.empty*
- *#workspaces button.visible*
- *#workspaces button.persistent* - *#workspaces button.persistent*
- *#workspaces button.special* - *#workspaces button.special*
- *#workspaces button.urgent* - *#workspaces button.urgent*
- *#workspaces button.hosting-monitor* (gets applied if workspace-monitor == waybar-monitor)

View File

@ -6,8 +6,8 @@ waybar - idle_inhibitor module
# DESCRIPTION # DESCRIPTION
The *idle_inhibitor* module can inhibiting the idle behavior such as screen blanking, locking, and The *idle_inhibitor* module can inhibit the idle behavior such as screen blanking, locking, and
screensaving, also known as "presentation mode". screensaver, also known as "presentation mode".
# CONFIGURATION # CONFIGURATION
@ -29,11 +29,15 @@ screensaving, also known as "presentation mode".
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -45,7 +49,7 @@ screensaving, also known as "presentation mode".
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++
@ -70,7 +74,7 @@ screensaving, also known as "presentation mode".
*timeout*: ++ *timeout*: ++
typeof: double ++ typeof: double ++
The number of minutes the inhibit should last. The number of minutes the inhibition should last.
*tooltip*: ++ *tooltip*: ++
typeof: bool ++ typeof: bool ++

View File

@ -66,7 +66,7 @@ The *image* module displays an image from a path.
# SCRIPT OUTPUT # SCRIPT OUTPUT
Similar to the *custom* module, output values of the script is *newline* separated. Similar to the *custom* module, output values of the script are *newline* separated.
The following is the output format: The following is the output format:
``` ```
@ -87,3 +87,4 @@ $path\\n$tooltip
# STYLE # STYLE
- *#image* - *#image*
- *#image.empty*

View File

@ -33,11 +33,15 @@ See *systemd-inhibit*(1) for more information.
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -49,7 +53,7 @@ See *systemd-inhibit*(1) for more information.
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++

View File

@ -27,7 +27,7 @@ Addressed by *jack*
*format-xrun*: ++ *format-xrun*: ++
typeof: string ++ typeof: string ++
This format is used for one polling interval, when the JACK server reports an xrun. This format is used for one polling interval when the JACK server reports an xrun.
*realtime*: ++ *realtime*: ++
typeof: bool ++ typeof: bool ++
@ -59,11 +59,15 @@ Addressed by *jack*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -75,7 +79,7 @@ Addressed by *jack*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++

View File

@ -13,7 +13,7 @@ You must be a member of the input group to use this module.
# CONFIGURATION # CONFIGURATION
*interval*: ++ *interval*: ++
Deprecated, this module use event loop now, the interval has no effect. Deprecated, this module uses event loop now, the interval has no effect.
typeof: integer ++ typeof: integer ++
default: 1 ++ default: 1 ++
The interval, in seconds, to poll the keyboard state. The interval, in seconds, to poll the keyboard state.
@ -51,7 +51,7 @@ You must be a member of the input group to use this module.
*binding-keys*: ++ *binding-keys*: ++
typeof: array ++ typeof: array ++
default: [58, 69, 70] ++ default: [58, 69, 70] ++
Customize the key to trigger this module, the key number can be find in /usr/include/linux/input-event-codes.h or running sudo libinput debug-events --show-keycodes. Customize the key to trigger this module, the key number can be found in /usr/include/linux/input-event-codes.h or running sudo libinput debug-events --show-keycodes.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS

View File

@ -41,11 +41,15 @@ Addressed by *memory*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -57,7 +61,7 @@ Addressed by *memory*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++

View File

@ -99,11 +99,15 @@ Addressed by *mpd*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -115,7 +119,7 @@ Addressed by *mpd*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++
@ -182,7 +186,7 @@ Addressed by *mpd*
*{queueLength}*: The length of the current queue. *{queueLength}*: The length of the current queue.
*{stateIcon}*: The icon corresponding the playing or paused status of the player (see *state-icons* option) *{stateIcon}*: The icon corresponding to the playing or paused status of the player (see *state-icons* option)
*{consumeIcon}*: The icon corresponding the "consume" option (see *consume-icons* option) *{consumeIcon}*: The icon corresponding the "consume" option (see *consume-icons* option)

View File

@ -13,7 +13,7 @@ The *mpris* module displays currently playing media via libplayerctl.
*player*: ++ *player*: ++
typeof: string ++ typeof: string ++
default: playerctld ++ default: playerctld ++
Name of the MPRIS player to attach to. Using the default value always follows the currenly active player. Name of the MPRIS player to attach to. Using the default value always follows the currently active player.
*ignored-players*: ++ *ignored-players*: ++
typeof: []string ++ typeof: []string ++
@ -21,6 +21,7 @@ The *mpris* module displays currently playing media via libplayerctl.
*interval*: ++ *interval*: ++
typeof: integer ++ typeof: integer ++
default: 0 ++
Refresh MPRIS information on a timer. Refresh MPRIS information on a timer.
*format*: ++ *format*: ++
@ -97,7 +98,7 @@ The *mpris* module displays currently playing media via libplayerctl.
*enable-tooltip-len-limits*: ++ *enable-tooltip-len-limits*: ++
typeof: bool ++ typeof: bool ++
default: false ++ default: false ++
Option to enable the length limits for the tooltip as well. By default the tooltip ignores all length limits. Option to enable the length limits for the tooltip as well. By default, the tooltip ignores all length limits.
*ellipsis*: ++ *ellipsis*: ++
typeof: string ++ typeof: string ++
@ -114,24 +115,27 @@ The *mpris* module displays currently playing media via libplayerctl.
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. ++ The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
default: play-pause ++ default: play-pause ++
Overwrite default action toggles. Overwrite default action toggles.
*on-middle-click*: ++ *on-click-middle*: ++
typeof: string ++ typeof: string ++
default: previous track ++ default: previous track ++
Overwrite default action toggles. Overwrite default action toggles.
*on-right-click*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
default: next track ++ default: next track ++
Overwrite default action toggles. Overwrite default action toggles.

View File

@ -14,7 +14,7 @@ Addressed by *network*
*interface*: ++ *interface*: ++
typeof: string ++ typeof: string ++
Use the defined interface instead of auto detection. Accepts wildcard. Use the defined interface instead of auto-detection. Accepts wildcard.
*interval*: ++ *interval*: ++
typeof: integer ++ typeof: integer ++
@ -41,7 +41,7 @@ Addressed by *network*
*format-linked*: ++ *format-linked*: ++
typeof: string ++ typeof: string ++
This format is used when a linked interface with no ip address is displayed. This format is used when a linked interface with no IP address is displayed.
*format-disconnected*: ++ *format-disconnected*: ++
typeof: string ++ typeof: string ++
@ -66,11 +66,15 @@ Addressed by *network*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -82,7 +86,7 @@ Addressed by *network*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++

View File

@ -0,0 +1,72 @@
waybar-power-profiles-daemon(5)
# NAME
waybar - power-profiles-daemon module
# DESCRIPTION
The *power-profiles-daemon* module displays the active power-profiles-daemon profile and cycle through the available profiles on click.
# FILES
$XDG_CONFIG_HOME/waybar/config
# CONFIGURATION
[- *Option*
:- *Typeof*
:- *Default*
:= *Description*
|[ *format*
:[ string
:[ "{icon}"
:[ Message displayed on the bar. {icon} and {profile} are respectively substituted with the icon representing the active profile and its full name.
|[ *tooltip-format*
:[ string
:[ "Power profile: {profile}\\nDriver: {driver}"
:[ Messaged displayed in the module tooltip. {icon} and {profile} are respectively substituted with the icon representing the active profile and its full name.
|[ *tooltip*
:[ bool
:[ true
:[ Display the tooltip.
|[ *format-icons*
:[ object
:[ See default value in the example below.
:[ Icons used to represent the various power-profile. *Note*: the default configuration uses the font-awesome icons. You may want to override it if you don't have this font installed on your system.
# CONFIGURATION EXAMPLES
Compact display (default config):
```
"power-profiles-daemon": {
"format": "{icon}",
"tooltip-format": "Power profile: {profile}\nDriver: {driver}",
"tooltip": true,
"format-icons": {
"default": "",
"performance": "",
"balanced": "",
"power-saver": ""
}
}
```
Display the full profile name:
```
"power-profiles-daemon": {
"format": "{icon} {profile}",
"tooltip-format": "Power profile: {profile}\nDriver: {driver}",
"tooltip": true,
"format-icons": {
"default": "",
"performance": "",
"balanced": "",
"power-saver": ""
}
}
```

85
man/waybar-privacy.5.scd Normal file
View File

@ -0,0 +1,85 @@
waybar-privacy(5)
# NAME
waybar - privacy module
# DESCRIPTION
The *privacy* module displays if any application is capturing audio, sharing ++
the screen or playing audio.
# CONFIGURATION
*icon-spacing*: ++
typeof: integer ++
default: 4 ++
The spacing between each privacy icon.
*icon-size*: ++
typeof: integer ++
default: 20 ++
The size of each privacy icon.
*transition-duration*: ++
typeof: integer ++
default: 250 ++
Option to disable tooltip on hover.
*modules* ++
typeof: array of objects ++
default: [{"type": "screenshare"}, {"type": "audio-in"}] ++
Which privacy modules to monitor. See *MODULES CONFIGURATION* for++
more information.
# MODULES CONFIGURATION
*type*: ++
typeof: string ++
values: "screenshare", "audio-in", "audio-out" ++
Specifies which module to use and configure.
*tooltip*: ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
*tooltip-icon-size*: ++
typeof: integer ++
default: 24 ++
The size of each icon in the tooltip.
# EXAMPLES
```
"privacy": {
"icon-spacing": 4,
"icon-size": 18,
"transition-duration": 250,
"modules": [
{
"type": "screenshare",
"tooltip": true,
"tooltip-icon-size": 24
},
{
"type": "audio-out",
"tooltip": true,
"tooltip-icon-size": 24
},
{
"type": "audio-in",
"tooltip": true,
"tooltip-icon-size": 24
}
]
},
```
# STYLE
- *#privacy*
- *#privacy-item*
- *#privacy-item.screenshare*
- *#privacy-item.audio-in*
- *#privacy-item.audio-out*

View File

@ -0,0 +1,83 @@
waybar-pulseaudio-slider(5)
# NAME
waybar - pulseaudio slider module
# DESCRIPTION
The *pulseaudio slider* module displays and controls the current volume of the default sink or source as a bar.
The volume can be controlled by dragging the slider across the bar or clicking on a specific position.
# CONFIGURATION
*min*: ++
typeof: int ++
default: 0 ++
The minimum volume value the slider should display and set.
*max*: ++
typeof: int ++
default: 100 ++
The maximum volume value the slider should display and set.
*orientation*: ++
typeof: string ++
default: horizontal ++
The orientation of the slider. Can be either `horizontal` or `vertical`.
# EXAMPLES
```
"modules-right": [
"pulseaudio-slider",
],
"pulseaudio/slider": {
"min": 0,
"max": 100,
"orientation": "horizontal"
}
```
# STYLE
The slider is a component with multiple CSS Nodes, of which the following are exposed:
*#pulseaudio-slider*: ++
Controls the style of the box *around* the slider and bar.
*#pulseaudio-slider slider*: ++
Controls the style of the slider handle.
*#pulseaudio-slider trough*: ++
Controls the style of the part of the bar that has not been filled.
*#pulseaudio-slider highlight*: ++
Controls the style of the part of the bar that has been filled.
## STYLE EXAMPLE
```
#pulseaudio-slider slider {
min-height: 0px;
min-width: 0px;
opacity: 0;
background-image: none;
border: none;
box-shadow: none;
}
#pulseaudio-slider trough {
min-height: 80px;
min-width: 10px;
border-radius: 5px;
background-color: black;
}
#pulseaudio-slider highlight {
min-width: 10px;
border-radius: 5px;
background-color: green;
}
```

View File

@ -8,7 +8,7 @@ waybar - pulseaudio module
The *pulseaudio* module displays the current volume reported by PulseAudio. The *pulseaudio* module displays the current volume reported by PulseAudio.
Additionally you can control the volume by scrolling *up* or *down* while the cursor is over the module. Additionally, you can control the volume by scrolling *up* or *down* while the cursor is over the module.
# CONFIGURATION # CONFIGURATION
@ -36,7 +36,7 @@ Additionally you can control the volume by scrolling *up* or *down* while the cu
*format-icons*: ++ *format-icons*: ++
typeof: array ++ typeof: array ++
Based on the current port-name and volume, the corresponding icon gets selected. The order is *low* to *high*. See *Icons*. Based on the current port name and volume, the corresponding icon gets selected. The order is *low* to *high*. See *Icons*.
*rotate*: ++ *rotate*: ++
typeof: integer ++ typeof: integer ++
@ -52,16 +52,20 @@ Additionally you can control the volume by scrolling *up* or *down* while the cu
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*scroll-step*: ++ *scroll-step*: ++
typeof: float ++ typeof: float ++
default: 1.0 ++ default: 1.0 ++
The speed in which to change the volume when scrolling. The speed at which to change the volume when scrolling.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -73,7 +77,7 @@ Additionally you can control the volume by scrolling *up* or *down* while the cu
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++
@ -107,7 +111,7 @@ Additionally you can control the volume by scrolling *up* or *down* while the cu
*ignored-sinks*: ++ *ignored-sinks*: ++
typeof: array ++ typeof: array ++
Sinks in this list will not be shown as the active sink by Waybar. Entries should be the sink's description field. Sinks in this list will not be shown as active sink by Waybar. Entries should be the sink's description field.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS

View File

@ -29,11 +29,15 @@ Addressed by *river/layout*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -45,7 +49,7 @@ Addressed by *river/layout*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
# EXAMPLE # EXAMPLE

View File

@ -27,11 +27,15 @@ Addressed by *river/mode*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -43,7 +47,7 @@ Addressed by *river/mode*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
*on-update*: ++ *on-update*: ++
typeof: string ++ typeof: string ++

View File

@ -24,7 +24,7 @@ Addressed by *river/tags*
*disable-click*: ++ *disable-click*: ++
typeof: bool ++ typeof: bool ++
default: false ++ default: false ++
If set to false, you can left click to set focused tag. Right click to toggle tag focus. If set to true this behaviour is disabled. If set to false, you can left-click to set focused tag. Right-click to toggle tag focus. If set to true this behaviour is disabled.
# EXAMPLE # EXAMPLE

View File

@ -27,11 +27,15 @@ Addressed by *river/window*
*min-length*: ++ *min-length*: ++
typeof: integer ++ typeof: integer ++
The minimum length in characters the module should take up. The minimum length in characters the module should accept.
*align*: ++ *align*: ++
typeof: float ++ typeof: float ++
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
*justify*: ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
*on-click*: ++ *on-click*: ++
typeof: string ++ typeof: string ++
@ -43,7 +47,7 @@ Addressed by *river/window*
*on-click-right*: ++ *on-click-right*: ++
typeof: string ++ typeof: string ++
Command to execute when you right clicked on the module. Command to execute when you right-click on the module.
# EXAMPLES # EXAMPLES

Some files were not shown because too many files have changed in this diff Show More