Compare commits

..

375 Commits
gtk4 ... master

Author SHA1 Message Date
Jonas Letzbor 2df0e7cf9e
Add scratchpad mode for sway with icons 2024-06-09 19:25:19 +02:00
Alexis Rouillard f4da203915
Merge pull request #3336 from pjones/pjones/current-only 2024-06-07 08:35:02 +02:00
Peter Jones 637b220f82
sway/workspaces: Correct behavior when "current-only" is set
The `current-only` workspace setting should display only the active
workspace name as determined by its `focused` attribute.  However,
according to the `get_tree` output, workspaces that contain a focused
window will report `"focused": false` and the window will report
`"focused": true.` In this case, Waybar will not display a workspace
name at all.

This change updates the logic for determining if a workspace is
focused by also looking for a focused window.
2024-06-06 15:29:33 -07:00
Alexis Rouillard 365e77af58
Merge pull request #3332 from zspher/patch-wlr-taskbar 2024-06-05 22:07:55 +02:00
zspher 1b1442e3ba
fix: taskbar not applying empty class on empty 2024-06-06 03:23:47 +08:00
Alexis Rouillard 7163752aa0
Merge pull request #3317 from jackwilsdon/patch-1
Fix format replacement names
2024-05-31 17:59:21 +02:00
Jack Wilsdon e9350cf25f
Fix format replacement names 2024-05-31 14:31:29 +00:00
Alexis Rouillard 1a1a61e917
Merge pull request #3313 from zjeffer/fix/zjeffer/dockerfiles 2024-05-30 20:28:55 +02:00
zjeffer 532a90259b Dont fail docker image builds when another build fails 2024-05-30 20:18:33 +02:00
zjeffer cf66604f85 fix fedora image 2024-05-30 19:35:32 +02:00
Alexis Rouillard 9332697ec1
Merge pull request #3064 from alttabber/master
Hyprland/Workspaces: Added option to hide non-visible special workspaces
2024-05-29 10:23:26 +02:00
Alexis Rouillard ab735f723c
Merge pull request #3309 from khaneliman/workflows 2024-05-29 08:07:05 +02:00
Austin Horstman c5b5b64dfa
modules/temperature: remove unused import 2024-05-28 15:41:10 -05:00
Austin Horstman 381fe83008
Makefile: fix meson deprecations 2024-05-28 15:41:10 -05:00
Austin Horstman 8adb0a5644
.github/workflows: fix meson deprecations 2024-05-28 15:41:10 -05:00
Alexis Rouillard 0d518cb5a3
Merge pull request #3308 from khaneliman/bugfix/3280
modules/hyprland/backend: use /tmp
2024-05-28 18:00:53 +02:00
Austin Horstman 24e8766aaa
hyprland/backend: use /tmp
Was hardcoded to /tmp in previous versions
2024-05-28 11:00:20 -05:00
alttabber 29e3d8c371
Hide non-visible special workspaces 2024-05-28 17:45:01 +02:00
Alexis Rouillard 57f2a57dac
Merge pull request #3306 from JohnRTitor/workflows-patch
workflows: add nix workflows
2024-05-28 10:21:39 +02:00
John Titor b6ca3ea4d9
worflows: add update-flake-lock action
automatically updates the nix flake lock file

runs once a month
2024-05-28 13:29:25 +05:30
John Titor 1a9952d0c0
workflows: add nix-test workflow
Checks the flake
Builds and tests the package
2024-05-28 13:29:25 +05:30
Alex a4a4be3381 fix: lint 2024-05-28 09:19:21 +02:00
Alexis Rouillard b7ce0b05b1
Merge pull request #3281 from VlctM/master
fix(#3211) change layer for mode invisible to nullopt
2024-05-28 09:18:36 +02:00
Alexis Rouillard af87388eb4
Update docker.yml 2024-05-28 09:13:11 +02:00
Alexis Rouillard 2aa8008ae2
Merge pull request #3259 from zjeffer/docker-images-action
Add GitHub action for nightly Docker image building
2024-05-28 09:11:07 +02:00
Alexis Rouillard d4413f5fa6
Merge pull request #3255 from LukashonakV/ISSUE#2240
Fix Clock. Tooltip calendar text overflows(#2240)
2024-05-28 09:08:31 +02:00
Alexis Rouillard af7945197e
Merge pull request #3260 from zjeffer/clang-tidy
clang-tidy fixes in the privacy module
2024-05-28 09:07:57 +02:00
Alexis Rouillard ac2fa9870f
Merge pull request #3241 from rtgiskard/master
temperature: allow hwmon-path-abs as array
2024-05-27 09:03:08 +02:00
Alexis Rouillard a3ac6cb099
Merge pull request #3258 from zjeffer/master
Fix debian dockerfile
2024-05-27 08:47:33 +02:00
Alexis Rouillard dc203b8439
Merge pull request #3299 from khaneliman/cleanup
hyprland: refactor and cleanup
2024-05-27 08:47:09 +02:00
Austin Horstman f5bb086460
hyprland/workspaces: sort methods 2024-05-24 14:41:59 -05:00
Austin Horstman 9ba9d57c8c
hyprland/windowcreationpayload: sort methods 2024-05-24 14:30:31 -05:00
Austin Horstman 82ae474002
hyprland/workspace: sort methods 2024-05-24 14:29:03 -05:00
Austin Horstman 56319a4705
hyprland/workspaces: break up implementations 2024-05-24 14:21:31 -05:00
Austin Horstman 07c91c200a
hyprland/workspaces: break up headers 2024-05-24 14:21:31 -05:00
Austin Horstman d73051e980
hyprland/workspaces: break up doUpdate 2024-05-24 14:21:31 -05:00
Austin Horstman 9fe51af6b0
hyprland/workspaces: break up parseConfig 2024-05-24 14:21:31 -05:00
Austin Horstman e4353e548a
.gitignore: add .ccls-cache 2024-05-24 14:21:31 -05:00
Alexis Rouillard 63bb338343
Merge pull request #3296 from unrealhoang/nix_cava_bump 2024-05-24 06:16:41 +02:00
Unreal Hoang d012124c03
cava bump: 0.10.2 for nix 2024-05-24 09:18:25 +09:00
Alexis Rouillard 10664922c9
Merge pull request #3294 from LukashonakV/cava_bump 2024-05-23 23:03:49 +02:00
Viktar Lukashonak 60a613ae51
cava bump: 0.10.2
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2024-05-23 16:15:48 +03:00
Alexis Rouillard 35a9ca476d
Merge pull request #3289 from yangyingchao/yc-hacking 2024-05-22 09:17:07 +02:00
yangyingchao b8e68b0e63 (hyprland) fix crash when failed to parse IPC message
IPC messages are parsed in a dedicated thread, and the thread terminates when
an exception is not caught, which causes the waybar process to crash with
SIGABORT.

While this issue might be related to Hyprland, it is really annoying to see
waybar crash. It would be better to catch those exceptions and report errors
instead of crashing.
2024-05-22 12:52:01 +08:00
wmlhwl b61ea62732 change layer for mode invisible to nullopt 2024-05-19 13:53:09 +02:00
Alexis Rouillard 8ad7c75d79
Merge pull request #3278 from LukashonakV/ISSUE#3276_cava 2024-05-18 11:42:14 +02:00
Viktar Lukashonak 5a1454ab31
Cava. $XDG_CONFIG_HOME validation
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2024-05-18 11:28:10 +03:00
Viktar Lukashonak b288fdf8c1
ISSUE#2240. Clock Gtk::Label as a calendar tooltip
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2024-05-17 20:17:33 +03:00
Alexis Rouillard 912d0e83f3
Merge pull request #3266 from luttermann/master 2024-05-14 09:37:11 +02:00
Lasse Luttermann 3c075bcc53 Fixed formatting 2024-05-14 08:26:44 +02:00
Lasse Luttermann ba8a88acfb Do not try to compare a string that may be a null-pointer 2024-05-14 08:16:10 +02:00
zjeffer e27488b48c clang-tidy improvements in privacy module 2024-05-11 16:19:46 +02:00
zjeffer 1828a94b6c clang-tidy: comment case styling options 2024-05-11 16:19:46 +02:00
zjeffer 49afcdf715 Add GitHub action for nightly Dockerfiles building 2024-05-11 16:16:02 +02:00
zjeffer ff84c6dbaf fix debian dockerfile 2024-05-11 15:59:20 +02:00
Alexis Rouillard cb2d54a237
Merge pull request #3248 from LukashonakV/ISSUE3223_upower 2024-05-10 06:50:40 +02:00
Viktar Lukashonak 5fe99ea0e1
Upower. Fix segmentation fault
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2024-05-10 00:00:47 +03:00
giskard b980dab6df doc: update waybar-temperature manual page 2024-05-08 23:56:44 +08:00
giskard e298bf922f temperature: allow hwmon-path-abs as array 2024-05-08 23:55:51 +08:00
ViktarL 2ead1bbf84
Upower refactoring (#3220)
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2024-05-07 10:29:52 +02:00
Tuur Vanhoutte 29917fb073
Fix hyprland/language events not working with keyboard names with commas in them (#3224) 2024-05-07 08:26:05 +02:00
Alex e627879b16 chore: 0.10.3 2024-05-06 10:54:52 +02:00
Alex 0572e02d7e fix: lint 2024-05-06 10:51:30 +02:00
Eldar Yusupov df1a9c5509
Remove listener when window is destroyed (#3215) 2024-05-06 10:51:14 +02:00
Lars-Ragnar A. Haugen e7779b5458
feat(#3174): hover for whole group (#3201)
* feat(#3174): hover for whole group

* fix: target eventbox for class also

* fix: actually no reason to add handler, just override AModule

* fix: actually remove existing handler as well

drawer functionality still works from my testing. anything else to think
abotu?

* revert: keep id and class on original box

* refactor: clang-format group.hpp

* dev: try stop workflow
2024-05-06 10:51:03 +02:00
Alex fc6d708fb6 chore: disable cland-tidy for now 2024-05-06 10:50:55 +02:00
Lars-Ragnar A. Haugen a453ea3c70
fix(#3210): tooltip-format on custom modules not working in some cases (#3213) 2024-05-06 10:47:52 +02:00
Lars-Ragnar A. Haugen 8e8ce0c6bc
feat(#3182): style tray icon on hover (#3203) 2024-05-06 10:47:25 +02:00
Bintang c4e0c569aa
flake: fix overlay not actually being applied (#3208) 2024-05-06 10:46:10 +02:00
柳芭老爹 231d6972d7
fix: custom module mediaplayer doesn't respect argument (#3198)
fix custom module mediaplayer which doesn't consider  --exclude argument on player appear
2024-05-03 08:47:41 +02:00
Jacob Birkett 50476edc98
Nix Flake: Fix overlay (again) (#3196) 2024-05-03 08:31:39 +02:00
Lars-Ragnar A. Haugen 0b6476da32
fix: set cursor appropriately on user event hover (#3195) 2024-05-02 22:09:21 +02:00
Jan Beich 79ae530bd2
pipewire: unbreak build on FreeBSD (#3193) 2024-05-02 08:31:40 +02:00
Tuur Vanhoutte f41458ea24
Fix Hyprland socketpath changed to XDG_RUNTIME_DIR (#3183) 2024-04-29 19:46:28 +02:00
clayton craft 2481f7a292
upower: fix segfault by initializing lastWarningLevel (#3171)
fixes bd8b215416
2024-04-25 10:36:43 +02:00
Alex 61ac7e4e10 fix: lint 2024-04-25 00:16:15 +02:00
Milo Mordaunt 9a3044a54f
Cursor change to indicate module clickability (#3108)
* Indicate clickability on mouse hover

* Avoid messy overrides situation

* Update AModule.cpp

* Update AModule.cpp

* Update AModule.cpp

* Update AModule.cpp

---------

Co-authored-by: Alexis Rouillard <alexisr245@gmail.com>
2024-04-25 00:15:40 +02:00
Alexis Rouillard a597a994d2
Merge pull request #3167 from kiriDevs/battery-health-fix
fix(battery): Fix `{health}` format replacement
2024-04-24 23:16:18 +02:00
Kiri a2c5a8215b
style(battery): Capitalize float 'F' suffix 2024-04-24 15:07:26 +02:00
Kiri 57197b8e01
feat(battery): Also support energy_full (instead of charge_full) 2024-04-24 14:57:11 +02:00
Kiri 5c4e368819
style(battery): Indent level
It's now *inconsistent* in the file, but clang-tidy should be happy, sooo...
2024-04-24 09:05:11 +00:00
Kiri 8d962430dd
fix(battery): Remove duplicate line
This is what happens when you copy-paste from GitHub actions
2024-04-24 09:02:03 +00:00
Kiri 54a85ea15f
style: Apply clang-format change
At least I hope I copy-pased it correctly
2024-04-24 08:56:24 +00:00
Kiri efa7dc7ba4
fix(battery): Register health replacement for main format 2024-04-24 10:34:35 +02:00
Alex a04016e0b6 chore: 0.10.2 2024-04-23 17:59:08 +02:00
Alexis Rouillard 08b0ed1b79
Merge pull request #3165 from haug1/fix/group-drawer-hover
fix(#3162): hover event did not propagate causing issues
2024-04-23 16:23:05 +02:00
Lars-Ragnar A. Haugen 5b7d0a2810
fix(#3162): hover event did not propagate causing issues 2024-04-23 16:18:54 +02:00
Alex 501e63fba6 chore: 0.10.1 2024-04-23 07:53:22 +02:00
Alexis Rouillard 5ce5ceba62
Merge pull request #3155 from drendog/master 2024-04-21 18:47:42 +02:00
drendog 2123995b03 fix: update clock tooltip without placeholders scenario 2024-04-21 18:02:26 +02:00
Alexis Rouillard 87cc40e6e2
Merge pull request #3145 from haug1/feat/hover-for-all-modules-by-class
feat(#2989): (optional) hover for all modules
2024-04-20 23:39:41 +02:00
Lars-Ragnar A. Haugen 6c1125c1fe
feat(#2989): (optional) hover for all modules 2024-04-19 19:16:39 +02:00
Alex 937bf2ba5d fix: lint 2024-04-19 06:21:10 +02:00
Alexis Rouillard 77df0c3e3b
Merge pull request #3147 from joesri/joesri-patch-1-custom
Escape tooltip in custom module
2024-04-19 06:20:45 +02:00
Alexis Rouillard 95788e8081
Merge pull request #3148 from VAWVAW/sway-scroll
sway/workspaces: Fix scroll on unfocused monitor
2024-04-19 06:20:28 +02:00
vawvaw f75b2ae91f
sway/workspaces: Fix scroll on unfocused monitor 2024-04-18 22:56:49 +02:00
joesri 2673a5a4f1
Escape tooltip in custom module 2024-04-18 14:17:30 +00:00
Alex 8ef4ddd7ef fix: lint 2024-04-18 08:34:02 +02:00
Alexis Rouillard f26efae569
Merge pull request #3130 from kiriDevs/kiridevs/battery-cycles
battery: Add {cycles}, {health} format replacements
2024-04-18 08:33:17 +02:00
Kiri 67bf98a93e
style: Change more var names to camelCase 2024-04-17 14:46:35 +02:00
Alexis Rouillard dd092a5fc1
Merge pull request #3143 from tomben13/fix_workspaces
Fixes for hyprland/workspaces
2024-04-17 08:28:00 +02:00
Alexis Rouillard 3efebc2822
Merge pull request #3142 from janpeterd/master
calendar: add shift_reset action
2024-04-15 22:18:17 +02:00
Alexis Rouillard fbcd7ebbfa
Merge pull request #3141 from rnestler/remove-unused-variable
Remove unused variable in Workspaces::updateWindows
2024-04-15 22:18:07 +02:00
Jan-Peter Dhallé fb88c06d78 calendar: add shift_reset action 2024-04-15 21:59:35 +02:00
Raphael Nestler 133dfc2e85 Remove unused variable in Workspaces::updateWindows 2024-04-15 13:50:41 +02:00
Alexis Rouillard ddacb111a9
Merge pull request #3136 from hrdl-github/fix-pipewire-locking
Pipewire backend: use pipewire thread lock
2024-04-14 10:33:22 +02:00
hrdl 74773885c6 Pipewire backend: use pipewire thread lock
Fixes #3047.
2024-04-13 14:25:28 +02:00
Kiri 3d54a6002d
style: Remove superfluous 'const' on getInfo()
was here before, but is an easy fix for a clang-tidy warning
2024-04-13 13:19:54 +02:00
Kiri da47c94480
fix: Also use camelCase for usages of new vars 2024-04-13 13:18:50 +02:00
Kiri 986b348bc7
style: Change new variables to camelCase 2024-04-13 13:11:14 +02:00
Kiri 421ba6e31a
fix: Add dummy information for battery cycles,health on FreeBSD 2024-04-12 18:48:54 +02:00
Tom Benham 084b561d5b [hyprland/workspaces] Update window count and sort workspaces AFTER their creation 2024-04-12 11:40:05 +02:00
Tom Benham cd3d588abd [hyprland/workspaces] Fix active workspace not getting updated on multi monitor setups 2024-04-12 11:33:29 +02:00
Kiri 24690248db
fix: Calculate battery health the right way around
I even did this originally, then got confused when my battery in particular showed 102% and, instead of checking the values I calculate with, just decided to do the stupid thing and do maths the wrong around
2024-04-11 02:40:04 +02:00
Kiri 805faa47e6
style: Remove debug output
Oops
2024-04-10 18:48:03 +02:00
Kiri a59593fde1
feat(battery): Add {health} format replacement 2024-04-10 18:19:55 +02:00
Kiri 7f1e623f77
style: Refactor battery cycle count choosing 2024-04-10 17:30:47 +02:00
Kiri 43511992d9
feat(battery): Add {cycles} format replacement 2024-04-10 17:00:50 +02:00
Alexis Rouillard e8038ef9f3
Merge pull request #3127 from dkg/man-waybar-styles
Add waybar-styles(5) manual page
2024-04-10 11:00:32 +02:00
Alex a9088c7e7d fix: lint 2024-04-10 10:20:21 +02:00
Alexis Rouillard 896c578c0e
Merge pull request #3128 from hvenev/master
Fix #3125
2024-04-10 10:19:47 +02:00
Hristo Venev f68ac9119a Use $TZ for local time if it is set
libstdc++ doesn't.
2024-04-09 23:27:36 +03:00
Daniel Kahn Gillmor 3d15b96429 Add waybar-styles(5) manual page
waybar(5) describes the configuration syntax but doesn't mention how
the stylesheets are handled.

This documentation would have been helpful to me as i figured out how
to configure waybar.
2024-04-09 10:02:33 -04:00
Alexis Rouillard 42dc9cb85f
Merge pull request #3102 from dep4/taskbar-directories
taskbar: search user directories first for desktop files
2024-04-03 08:58:49 +02:00
Bruce Mills 245043f9e7 taskbar: search user directories first for desktop files 2024-04-01 14:30:31 -04:00
Alexis Rouillard 3de9e0cbd3
Merge pull request #3099 from kkvark/master 2024-04-01 07:53:23 +02:00
kvark 9b4fc6d16b fix(sway/workspaces): floating_nodes and focused icon
Floating nodes are not taken into account for visible and empty workspaces

And fix focused icon (#3095)
2024-03-31 21:53:56 +07:00
Alexis Rouillard ddc767cd81
Merge pull request #3082 from Kuruyia/refactor/privacy-module
refactor(privacy): clean up the module
2024-03-28 13:15:24 +01:00
Kuruyia fe15530f34 refactor(privacy): clean up the module 2024-03-25 20:16:47 +01: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
Arnesh Roychowdhury f1f3442e38
Merge branch 'Alexays:master' into master 2024-01-08 22:54:08 +05:30
ArneshRC 3390c16f52
added support for battery state-based classes on the entire waybar 2024-01-07 17:22:34 +05:30
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
154 changed files with 5536 additions and 2586 deletions

View File

@ -15,15 +15,15 @@ Checks: >
-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.PrivateMemberPrefix, value: m_ }
- { 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 }
# 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 100644
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)"

View File

@ -2,14 +2,18 @@ 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
- 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

View File

@ -2,6 +2,10 @@ 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
@ -13,7 +17,11 @@ jobs:
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: cpp-linter/cpp-linter-action@v2.7.5
- 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:

32
.github/workflows/docker.yml vendored 100644
View File

@ -0,0 +1,32 @@
name: Build and Push Docker Image
on:
schedule:
# run every night at midnight
- cron: '0 0 * * *'
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false # don't fail the other jobs if one of the images fails to build
matrix:
os: [ 'alpine', 'archlinux', 'debian', 'fedora', 'gentoo', 'opensuse' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfiles/${{ matrix.os }}
push: true
tags: alexays/waybar:${{ matrix.os }}

View File

@ -2,28 +2,35 @@ name: freebsd
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-freebsd-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
clang:
# Run actions in a FreeBSD VM on the 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/virtual-environments/issues/4060 - for lack of VirtualBox on MacOS 11 runners
runs-on: macos-12
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Test in FreeBSD VM
uses: cross-platform-actions/action@v0.21.1
uses: cross-platform-actions/action@v0.23.0
timeout-minutes: 180
env:
CPPFLAGS: '-isystem/usr/local/include'
LDFLAGS: '-L/usr/local/lib'
with:
operating_system: freebsd
version: "13.2"
environment_variables: CPPFLAGS=-isystem/usr/local/include LDFLAGS=-L/usr/local/lib
environment_variables: CPPFLAGS LDFLAGS
sync_files: runner-to-vm
run: |
sudo sed -i '' 's/quarterly/latest/' /etc/pkg/FreeBSD.conf
sudo pkg install -y git # subprojects/date
sudo pkg install -y catch evdev-proto gtk-layer-shell gtkmm30 jsoncpp \
libdbusmenu libevdev libfmt libmpdclient libudev-devd meson \
pkgconf pulseaudio scdoc sndio spdlog wayland-protocols upower \
pkgconf pipewire pulseaudio scdoc sndio spdlog wayland-protocols upower \
libinotify
meson build -Dman-pages=enabled
meson setup build -Dman-pages=enabled
ninja -C build
meson test -C build --no-rebuild --print-errorlogs --suite waybar

19
.github/workflows/labeler.yml vendored 100644
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

@ -2,6 +2,10 @@ name: linux
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
@ -14,9 +18,6 @@ jobs:
- opensuse
- gentoo
cpp_std: [c++20]
include:
- distro: fedora
cpp_std: c++20
runs-on: ubuntu-latest
container:
@ -25,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: configure
run: meson -Dman-pages=enabled -Dcpp_std=${{matrix.cpp_std}} build
run: meson setup -Dman-pages=enabled -Dcpp_std=${{matrix.cpp_std}} build
- name: build
run: ninja -C build
- name: test

17
.github/workflows/nix-tests.yml vendored 100644
View File

@ -0,0 +1,17 @@
name: "Nix-Tests"
on:
pull_request:
push:
jobs:
nix-flake-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- run: nix flake show
- run: nix flake check --print-build-logs
- run: nix build --print-build-logs

View File

@ -0,0 +1,21 @@
name: update-flake-lock
on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 1 * *' # Run monthly
push:
paths:
- 'flake.nix'
jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v21

2
.gitignore vendored
View File

@ -48,3 +48,5 @@ packagecache
# Nix
result
result-*
.ccls-cache

View File

@ -3,11 +3,47 @@
FROM debian:sid
RUN apt update && \
apt 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 sudo python3-venv python3-pip && \
apt clean
apt install --no-install-recommends --no-install-suggests -y \
build-essential \
catch2 \
cmake \
git \
gobject-introspection \
libdbusmenu-gtk3-dev \
libegl1-mesa-dev \
libfmt-dev \
libgbm-dev \
libgirepository1.0-dev \
libgles2-mesa-dev \
libgtk-layer-shell-dev \
libgtkmm-3.0-dev \
libhowardhinnant-date-dev \
libiniparser-dev \
libinput-dev \
libjack-jackd2-dev \
libjsoncpp-dev \
libmpdclient-dev \
libnl-3-dev \
libnl-genl-3-dev \
libpixman-1-dev \
libplayerctl-dev \
libpugixml-dev \
libpulse-dev \
libsndio-dev \
libspdlog-dev \
libudev-dev \
libupower-glib-dev \
libwayland-dev \
libwireplumber-0.5-dev \
libxkbcommon-dev \
libxkbregistry-dev \
locales \
meson \
ninja-build \
pkg-config \
python3-pip \
python3-venv \
scdoc \
sudo \
wayland-protocols \
&& apt clean

View File

@ -29,6 +29,6 @@ RUN dnf install -y @c-development \
'pkgconfig(wayland-client)' \
'pkgconfig(wayland-cursor)' \
'pkgconfig(wayland-protocols)' \
'pkgconfig(wireplumber-0.4)' \
'pkgconfig(wireplumber-0.5)' \
'pkgconfig(xkbregistry)' && \
dnf clean all -y

View File

@ -3,11 +3,11 @@
default: build
build:
meson build
meson setup build
ninja -C build
build-debug:
meson build --buildtype=debug
meson setup build --buildtype=debug
ninja -C build
install: build

View File

@ -8,11 +8,12 @@
- Sway (Workspaces, Binding mode, Focused window name)
- River (Mapping mode, Tags, 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)
- Local time
- Battery
- UPower
- Power profiles daemon
- Network
- Bluetooth
- Pulseaudio
@ -36,7 +37,7 @@
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
[here](https://launchpad.net/~nschloe/+archive/ubuntu/waybar).

View File

@ -18,11 +18,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1704538339,
"narHash": "sha256-1734d3mQuux9ySvwf6axRWZRBhtcZA9Q8eftD6EZg6U=",
"lastModified": 1711163522,
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "46ae0210ce163b3cba6c7da08840c1d63de9c701",
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github"
},
"original": {

View File

@ -16,7 +16,12 @@
"x86_64-linux"
"aarch64-linux"
]
(system: func (import nixpkgs { inherit system; }));
(system: func (import nixpkgs {
inherit system;
overlays = with self.overlays; [
waybar
];
}));
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
@ -46,22 +51,25 @@
};
});
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");
overlays = {
default = self.overlays.waybar;
waybar = final: prev: {
waybar = final.callPackage ./nix/default.nix {
waybar = prev.waybar;
# take the first "version: '...'" from meson.build
version =
(builtins.head (builtins.split "'"
(builtins.elemAt
(builtins.split " version: '" (builtins.readFile ./meson.build))
2)))
+ "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
};
};
packages = genSystems (pkgs:
let packages = self.overlays.default pkgs pkgs;
in packages // {
default = packages.waybar;
});
packages = genSystems (pkgs: {
default = self.packages.${pkgs.stdenv.hostPlatform.system}.waybar;
inherit (pkgs) waybar;
});
};
}

View File

@ -25,7 +25,7 @@ class ALabel : public AModule {
bool alt_ = false;
std::string default_format_;
//todo bool handleToggle(GdkEventButton *const &e) override;
bool handleToggle(GdkEventButton *const &e) override;
virtual std::string getState(uint8_t value, bool lesser = false);
};

View File

@ -2,7 +2,7 @@
#include <glibmm/dispatcher.h>
#include <glibmm/markup.h>
//#include <gtkmm/eventbox.h>
#include <gtkmm/eventbox.h>
#include <json/json.h>
#include "IModule.hpp"
@ -30,25 +30,30 @@ class AModule : public IModule {
enum SCROLL_DIR { NONE, UP, DOWN, LEFT, RIGHT };
// SCROLL_DIR getScrollDir(GdkEventScroll *e);
SCROLL_DIR getScrollDir(GdkEventScroll *e);
bool tooltipEnabled();
const std::string name_;
const Json::Value &config_;
// Gtk::EventBox event_box_;
Gtk::EventBox event_box_;
// virtual bool handleToggle(GdkEventButton *const &ev);
// virtual bool handleScroll(GdkEventScroll *);
// virtual bool handleRelease(GdkEventButton *const &ev);
virtual void setCursor(Gdk::CursorType const c);
virtual bool handleToggle(GdkEventButton *const &ev);
virtual bool handleMouseEnter(GdkEventCrossing *const &ev);
virtual bool handleMouseLeave(GdkEventCrossing *const &ev);
virtual bool handleScroll(GdkEventScroll *);
virtual bool handleRelease(GdkEventButton *const &ev);
private:
// bool handleUserEvent(GdkEventButton *const &ev);
bool handleUserEvent(GdkEventButton *const &ev);
const bool isTooltip;
bool hasUserEvents_;
std::vector<int> pid_;
gdouble distance_scrolled_y_;
gdouble distance_scrolled_x_;
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_RELEASE), "on-click-release"},
{std::make_pair(1, GdkEventType::GDK_2BUTTON_PRESS), "on-double-click"},
@ -68,7 +73,7 @@ class AModule : public IModule {
{std::make_pair(9, GdkEventType::GDK_BUTTON_PRESS), "on-click-forward"},
{std::make_pair(9, GdkEventType::GDK_BUTTON_RELEASE), "on-click-forward-release"},
{std::make_pair(9, GdkEventType::GDK_2BUTTON_PRESS), "on-double-click-forward"},
{std::make_pair(9, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click-forward"}};*/
{std::make_pair(9, GdkEventType::GDK_3BUTTON_PRESS), "on-triple-click-forward"}};
};
} // namespace waybar

View File

@ -1,13 +1,19 @@
#pragma once
#include <gdkmm/monitor.h>
#include <glibmm/refptr.h>
#include <gtkmm/box.h>
#include <gtkmm/centerbox.h>
#include <gtkmm/cssprovider.h>
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <json/json.h>
#include <memory>
#include <optional>
#include <vector>
#include "AModule.hpp"
//#include "group.hpp"
#include "group.hpp"
#include "xdg-output-unstable-v1-client-protocol.h"
namespace waybar {
@ -36,7 +42,7 @@ struct bar_margins {
};
struct bar_mode {
bar_layer layer;
std::optional<bar_layer> layer;
bool exclusive;
bool passthrough;
bool visible;
@ -69,9 +75,8 @@ class Bar {
struct wl_surface *surface;
bool visible = true;
Gtk::Window window;
Glib::RefPtr<Gdk::Surface> gdk_surface_;
Gtk::Orientation orientation = Gtk::Orientation::HORIZONTAL;
Gtk::PositionType position = Gtk::PositionType::TOP;
Gtk::Orientation orientation = Gtk::ORIENTATION_HORIZONTAL;
Gtk::PositionType position = Gtk::POS_TOP;
int x_global;
int y_global;
@ -81,15 +86,15 @@ class Bar {
#endif
private:
void onMap();
void onMap(GdkEventAny *);
auto setupWidgets() -> void;
// void getModules(const Factory &, const std::string &, waybar::Group *);
void getModules(const Factory &, const std::string &, waybar::Group *);
void setupAltFormatKeyForModule(const std::string &module_name);
void setupAltFormatKeyForModuleList(const char *module_list_name);
void setMode(const bar_mode &);
void setPassThrough(bool passthrough);
void setPosition(Gtk::PositionType position);
void onConfigure(int width, int height);
void onConfigure(GdkEventConfigure *ev);
void configureGlobalOffset(int width, int height);
void onOutputGeometryChanged();
@ -104,7 +109,7 @@ class Bar {
Gtk::Box left_;
Gtk::Box center_;
Gtk::Box right_;
Gtk::CenterBox box_;
Gtk::Box box_;
std::vector<std::shared_ptr<waybar::AModule>> modules_left_;
std::vector<std::shared_ptr<waybar::AModule>> modules_center_;
std::vector<std::shared_ptr<waybar::AModule>> modules_right_;

View File

@ -1,9 +1,13 @@
#pragma once
#include <gdk/wayland/gdkwayland.h>
#include <fmt/format.h>
#include <gdk/gdk.h>
#include <gdk/gdkwayland.h>
#include <wayland-client.h>
#include "bar.hpp"
#include "config.hpp"
#include "util/css_reload_helper.hpp"
#include "util/portal.hpp"
struct zwp_idle_inhibitor_v1;
@ -29,7 +33,6 @@ class Client {
private:
Client() = default;
Glib::RefPtr<Gio::ListModel> monitors_;
const std::string getStyle(const std::string &style, std::optional<Appearance> appearance);
void bindInterfaces();
void handleOutput(struct waybar_output &output);
@ -47,9 +50,12 @@ class Client {
void handleMonitorRemoved(Glib::RefPtr<Gdk::Monitor> monitor);
void handleDeferredMonitorRemoval(Glib::RefPtr<Gdk::Monitor> monitor);
Glib::RefPtr<Gtk::StyleContext> style_context_;
Glib::RefPtr<Gtk::CssProvider> css_provider_;
std::unique_ptr<Portal> portal;
std::list<struct waybar_output> outputs_;
std::unique_ptr<CssReloadHelper> m_cssReloadHelper;
std::string m_cssFile;
};
} // namespace waybar

View File

@ -1,110 +1,13 @@
#pragma once
#include <json/json.h>
#if defined(HAVE_CHRONO_TIMEZONES) || defined(HAVE_LIBDATE)
#include "modules/clock.hpp"
#else
#include "modules/simpleclock.hpp"
#endif
#ifdef HAVE_SWAY
#include "modules/sway/language.hpp"
#include "modules/sway/mode.hpp"
#include "modules/sway/scratchpad.hpp"
#include "modules/sway/window.hpp"
#include "modules/sway/workspaces.hpp"
#endif
#ifdef HAVE_WLR
#include "modules/wlr/taskbar.hpp"
#include "modules/wlr/workspace_manager.hpp"
#endif
#ifdef HAVE_RIVER
#include "modules/river/layout.hpp"
#include "modules/river/mode.hpp"
#include "modules/river/tags.hpp"
#include "modules/river/window.hpp"
#endif
#ifdef HAVE_DWL
#include "modules/dwl/tags.hpp"
#endif
#ifdef HAVE_HYPRLAND
#include "modules/hyprland/backend.hpp"
#include "modules/hyprland/language.hpp"
#include "modules/hyprland/submap.hpp"
#include "modules/hyprland/window.hpp"
#include "modules/hyprland/workspaces.hpp"
#endif
#if defined(__FreeBSD__) || (defined(__linux__) && !defined(NO_FILESYSTEM))
#include "modules/battery.hpp"
#endif
#if defined(HAVE_CPU_LINUX) || defined(HAVE_CPU_BSD)
#include "modules/cpu.hpp"
#include "modules/cpu_frequency.hpp"
#include "modules/cpu_usage.hpp"
#include "modules/load.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_PIPEWIRE
#include "modules/privacy/privacy.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
#ifdef HAVE_SYSTEMD_MONITOR
#include "modules/systemd_failed_units.hpp"
#endif
#include "bar.hpp"
#include "modules/cffi.hpp"
#include "modules/custom.hpp"
#include "modules/image.hpp"
#include "modules/temperature.hpp"
#include "modules/user.hpp"
#include <AModule.hpp>
namespace waybar {
class Bar;
class Factory {
public:
Factory(const Bar& bar, const Json::Value& config);

View File

@ -11,15 +11,13 @@ namespace waybar {
class Group : public AModule {
public:
Group(const std::string&, const std::string&, const Json::Value&, bool);
Group(const std::string &, const std::string &, const Json::Value &, bool);
virtual ~Group() = default;
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);
virtual Gtk::Box &getBox();
void addWidget(Gtk::Widget &widget);
protected:
Gtk::Box box;
@ -28,8 +26,8 @@ class Group : public AModule {
bool is_first_widget = true;
bool is_drawer = false;
std::string add_class_to_drawer_children;
void addHoverHandlerTo(Gtk::Widget& widget);
bool handleMouseEnter(GdkEventCrossing *const &ev) override;
bool handleMouseLeave(GdkEventCrossing *const &ev) override;
};
} // namespace waybar

View File

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

View File

@ -16,7 +16,7 @@ typedef struct wbcffi_module wbcffi_module;
typedef struct {
wbcffi_module* obj;
const char* waybar_version;
//todo GtkContainer* (*get_root_widget)(wbcffi_module*);
GtkContainer* (*get_root_widget)(wbcffi_module*);
void (*queue_update)(wbcffi_module*);
} wbcffi_init_info;

View File

@ -8,6 +8,7 @@ namespace waybar::modules {
const std::string kCldPlaceholder{"calendar"};
const std::string kTZPlaceholder{"tz_list"};
const std::string kOrdPlaceholder{"ordinal_date"};
enum class CldMode { MONTH, YEAR };
enum class WS { LEFT, RIGHT, HIDDEN };
@ -20,10 +21,12 @@ class Clock final : public ALabel {
auto doAction(const std::string&) -> void override;
private:
const std::locale locale_;
const std::locale m_locale_;
// tooltip
const std::string tlpFmt_;
std::string tlpText_{""}; // tooltip text to print
const std::string m_tlpFmt_;
std::string m_tlpText_{""}; // tooltip text to print
const Glib::RefPtr<Gtk::Label> m_tooltip_; // tooltip as a separate Gtk::Label
bool query_tlp_cb(int, int, bool, const Glib::RefPtr<Gtk::Tooltip>& tooltip);
// Calendar
const bool cldInTooltip_; // calendar in tooltip
/*
@ -40,6 +43,7 @@ class Clock final : public ALabel {
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
@ -50,6 +54,9 @@ class Clock final : public ALabel {
auto get_calendar(const year_month_day& today, const year_month_day& ymd, const time_zone* tz)
-> const std::string;
// get local time zone
auto local_zone() -> const time_zone*;
// time zoned time in tooltip
const bool tzInTooltip_; // if need to print time zones text
std::vector<const time_zone*> tzList_; // time zones list
@ -57,12 +64,18 @@ class Clock final : public ALabel {
std::string tzText_{""}; // time zones text to print
util::SleeperThread thread_;
// ordinal date in tooltip
const bool ordInTooltip_;
std::string ordText_{""};
auto get_ordinal_date(const year_month_day& today) -> std::string;
auto getTZtext(sys_seconds now) -> std::string;
auto first_day_of_week() -> weekday;
// Module actions
void cldModeSwitch();
void cldShift_up();
void cldShift_down();
void cldShift_reset();
void tz_up();
void tz_down();
// Module Action Map
@ -70,6 +83,7 @@ class Clock final : public ALabel {
{"mode", &waybar::modules::Clock::cldModeSwitch},
{"shift_up", &waybar::modules::Clock::cldShift_up},
{"shift_down", &waybar::modules::Clock::cldShift_down},
{"shift_reset", &waybar::modules::Clock::cldShift_reset},
{"tz_up", &waybar::modules::Clock::tz_up},
{"tz_down", &waybar::modules::Clock::tz_down}};
};

View File

@ -26,8 +26,8 @@ class Custom : public ALabel {
void parseOutputRaw();
void parseOutputJson();
void handleEvent();
//todo bool handleScroll(GdkEventScroll* e) override;
//todo bool handleToggle(GdkEventButton* const& e) override;
bool handleScroll(GdkEventScroll* e) override;
bool handleToggle(GdkEventButton* const& e) override;
const std::string name_;
const std::string output_name_;
@ -35,6 +35,7 @@ class Custom : public ALabel {
std::string id_;
std::string alt_;
std::string tooltip_;
const bool tooltip_format_enabled_;
std::vector<std::string> class_;
int percentage_;
FILE* fp_;

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 &);
~Window();
void handle_layout(const uint32_t layout);
void handle_title(const char *title);
void handle_appid(const char *ppid);
void handle_layout_symbol(const char *layout_symbol);
void handle_frame();
struct zdwl_ipc_manager_v2 *status_manager_;
private:
const Bar &bar_;
std::string title_;
std::string appid_;
std::string layout_symbol_;
uint32_t layout_;
struct zdwl_ipc_output_v2 *output_status_;
};
} // namespace waybar::modules::dwl

View File

@ -20,8 +20,8 @@ class IPC {
public:
IPC() { startIPC(); }
void registerForIPC(const std::string&, EventHandler*);
void unregisterForIPC(EventHandler*);
void registerForIPC(const std::string& ev, EventHandler* ev_handler);
void unregisterForIPC(EventHandler* handler);
static std::string getSocket1Reply(const std::string& rq);
Json::Value getSocket1JsonReply(const std::string& rq);
@ -30,9 +30,9 @@ class IPC {
void startIPC();
void parseIPC(const std::string&);
std::mutex m_callbackMutex;
util::JsonParser m_parser;
std::list<std::pair<std::string, EventHandler*>> m_callbacks;
std::mutex callbackMutex_;
util::JsonParser parser_;
std::list<std::pair<std::string, EventHandler*>> callbacks_;
};
inline std::unique_ptr<IPC> gIPC;

View File

@ -30,7 +30,7 @@ class Language : public waybar::ALabel, public EventHandler {
std::string short_description;
};
auto getLayout(const std::string&) -> Layout;
static auto getLayout(const std::string&) -> Layout;
std::mutex mutex_;
const Bar& bar_;

View File

@ -14,17 +14,20 @@ namespace waybar::modules::hyprland {
class Submap : public waybar::ALabel, public EventHandler {
public:
Submap(const std::string&, const waybar::Bar&, const Json::Value&);
virtual ~Submap();
~Submap() override;
auto update() -> void override;
private:
void onEvent(const std::string&) override;
auto parseConfig(const Json::Value&) -> void;
void onEvent(const std::string& ev) override;
std::mutex mutex_;
const Bar& bar_;
util::JsonParser parser_;
std::string submap_;
bool always_on_ = false;
std::string default_submap_ = "Default";
};
} // namespace waybar::modules::hyprland

View File

@ -25,7 +25,7 @@ class Window : public waybar::AAppIconLabel, public EventHandler {
std::string last_window;
std::string last_window_title;
static auto parse(const Json::Value&) -> Workspace;
static auto parse(const Json::Value& value) -> Workspace;
};
struct WindowData {
@ -41,24 +41,25 @@ class Window : public waybar::AAppIconLabel, public EventHandler {
static auto parse(const Json::Value&) -> WindowData;
};
auto getActiveWorkspace(const std::string&) -> Workspace;
auto getActiveWorkspace() -> Workspace;
void onEvent(const std::string&) override;
static auto getActiveWorkspace(const std::string&) -> Workspace;
static auto getActiveWorkspace() -> Workspace;
void onEvent(const std::string& ev) override;
void queryActiveWorkspace();
void setClass(const std::string&, bool enable);
bool separate_outputs;
bool separateOutputs_;
std::mutex mutex_;
const Bar& bar_;
util::JsonParser parser_;
WindowData window_data_;
WindowData windowData_;
Workspace workspace_;
std::string solo_class_;
std::string last_solo_class_;
std::string soloClass_;
std::string lastSoloClass_;
bool solo_;
bool all_floating_;
bool allFloating_;
bool swallowing_;
bool fullscreen_;
bool focused_;
};
} // namespace waybar::modules::hyprland

View File

@ -0,0 +1,61 @@
#pragma once
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <json/value.h>
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <regex>
#include <string>
#include <variant>
#include <vector>
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "util/enum.hpp"
#include "util/regex_collection.hpp"
using WindowAddress = std::string;
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;
};
} // namespace waybar::modules::hyprland

View File

@ -0,0 +1,88 @@
#pragma once
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <json/value.h>
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <regex>
#include <string>
#include <variant>
#include <vector>
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "modules/hyprland/windowcreationpayload.hpp"
#include "util/enum.hpp"
#include "util/regex_collection.hpp"
using WindowAddress = std::string;
namespace waybar::modules::hyprland {
class Workspaces;
class Workspace {
public:
explicit Workspace(const Json::Value& workspace_data, Workspaces& workspace_manager,
const Json::Value& clients_data = Json::Value::nullRef);
std::string& selectIcon(std::map<std::string, std::string>& icons_map);
Gtk::Button& button() { return m_button; };
int id() const { return m_id; };
std::string name() const { return m_name; };
std::string output() const { return m_output; };
bool isActive() const { return m_isActive; };
bool isSpecial() const { return m_isSpecial; };
bool isPersistent() const { return m_isPersistentRule || m_isPersistentConfig; };
bool isPersistentConfig() const { return m_isPersistentConfig; };
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; };
bool handleClicked(GdkEventButton* bt) const;
void setActive(bool value = true) { m_isActive = value; };
void setPersistentRule(bool value = true) { m_isPersistentRule = value; };
void setPersistentConfig(bool value = true) { m_isPersistentConfig = 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);
private:
Workspaces& m_workspaceManager;
int m_id;
std::string m_name;
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;
};
} // namespace waybar::modules::hyprland

View File

@ -17,6 +17,8 @@
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "modules/hyprland/windowcreationpayload.hpp"
#include "modules/hyprland/workspace.hpp"
#include "util/enum.hpp"
#include "util/regex_collection.hpp"
@ -26,92 +28,6 @@ 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 {
public:
explicit Workspace(const Json::Value& workspace_data, Workspaces& workspace_manager,
const Json::Value& clients_data = Json::Value::nullRef);
std::string& selectIcon(std::map<std::string, std::string>& icons_map);
Gtk::Button& button() { return m_button; };
int id() const { return m_id; };
std::string name() const { return m_name; };
std::string output() const { return m_output; };
bool isActive() const { return m_active; };
bool isSpecial() const { return m_isSpecial; };
bool isPersistent() const { return m_isPersistent; };
bool isVisible() const { return m_isVisible; };
bool isEmpty() const { return m_windows == 0; };
bool isUrgent() const { return m_isUrgent; };
bool handleClicked(GdkEventButton* bt) const;
void setActive(bool value = true) { m_active = value; };
void setPersistent(bool value = true) { m_isPersistent = 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; };
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);
private:
Workspaces& m_workspaceManager;
int m_id;
std::string m_name;
std::string m_output;
uint m_windows;
bool m_active = false;
bool m_isSpecial = false;
bool m_isPersistent = false;
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 {
public:
Workspaces(const std::string&, const waybar::Bar&, const Json::Value&);
@ -122,6 +38,8 @@ class Workspaces : public AModule, public EventHandler {
auto allOutputs() const -> bool { return m_allOutputs; }
auto showSpecial() const -> bool { return m_showSpecial; }
auto activeOnly() const -> bool { return m_activeOnly; }
auto specialVisibleOnly() const -> bool { return m_specialVisibleOnly; }
auto moveToMonitor() const -> bool { return m_moveToMonitor; }
auto getBarOutput() const -> std::string { return m_bar.output->name; }
@ -135,15 +53,28 @@ class Workspaces : public AModule, public EventHandler {
void onEvent(const std::string& e) override;
void updateWindowCount();
void sortWorkspaces();
void createWorkspace(Json::Value const& workspace_data,
Json::Value const& clients_data = Json::Value::nullRef);
void createWorkspace(Json::Value const& workspaceData,
Json::Value const& clientsData = Json::Value::nullRef);
Json::Value createMonitorWorkspaceData(std::string const& name, std::string const& monitor);
void removeWorkspace(std::string const& name);
void setUrgentWorkspace(std::string const& windowaddress);
// Config
void parseConfig(const Json::Value& config);
auto populateIconsMap(const Json::Value& formatIcons) -> void;
auto populateBoolConfig(const Json::Value& config, const std::string& key, bool& member) -> void;
auto populateSortByConfig(const Json::Value& config) -> void;
auto populateIgnoreWorkspacesConfig(const Json::Value& config) -> void;
auto populatePersistentWorkspacesConfig(const Json::Value& config) -> void;
auto populateFormatWindowSeparatorConfig(const Json::Value& config) -> void;
auto populateWindowRewriteConfig(const Json::Value& config) -> void;
void registerIpc();
// workspace events
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);
@ -160,16 +91,32 @@ class Workspaces : public AModule, public EventHandler {
void onWindowTitleEvent(std::string const& payload);
void onConfigReloaded();
int windowRewritePriorityFunction(std::string const& window_rule);
// Update methods
void doUpdate();
void removeWorkspacesToRemove();
void createWorkspacesToCreate();
std::vector<std::string> getVisibleWorkspaces();
void updateWorkspaceStates(const std::vector<std::string>& visibleWorkspaces);
bool updateWindowsToCreate();
void extendOrphans(int workspaceId, Json::Value const& clientsJson);
void registerOrphanWindow(WindowCreationPayload create_window_paylod);
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_specialVisibleOnly = 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)
@ -184,11 +131,6 @@ class Workspaces : public AModule, public EventHandler {
{"NUMBER", SortMethod::NUMBER},
{"DEFAULT", SortMethod::DEFAULT}};
void fillPersistentWorkspaces();
void createPersistentWorkspaces();
std::vector<std::string> m_persistentWorkspacesToCreate;
bool m_persistentCreated = false;
std::string m_format;
std::map<std::string, std::string> m_iconsMap;
@ -199,6 +141,7 @@ class Workspaces : public AModule, public EventHandler {
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;

View File

@ -19,7 +19,7 @@ class IdleInhibitor : public ALabel {
static bool status;
private:
//todo bool handleToggle(GdkEventButton* const& e) override;
bool handleToggle(GdkEventButton* const& e) override;
void toggleStatus();
const Bar& bar_;

View File

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

@ -1,10 +1,7 @@
#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"

View File

@ -2,9 +2,6 @@
#include <json/value.h>
#include <iostream>
#include <map>
#include <mutex>
#include <string>
#include "gtkmm/box.h"

View File

@ -76,6 +76,8 @@ class Item : public sigc::trackable {
void makeMenu();
bool handleClick(GdkEventButton* const& /*ev*/);
bool handleScroll(GdkEventScroll* const&);
bool handleMouseEnter(GdkEventCrossing* const&);
bool handleMouseLeave(GdkEventCrossing* const&);
// smooth scrolling threshold
gdouble scroll_threshold_ = 0;

View File

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

View File

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

View File

@ -1,15 +1,16 @@
#pragma once
#include <string>
#include <giomm/dbusproxy.h>
#include <string>
#include "ALabel.hpp"
namespace waybar::modules {
class SystemdFailedUnits : public ALabel {
public:
SystemdFailedUnits(const std::string&, const Json::Value&);
SystemdFailedUnits(const std::string &, const Json::Value &);
virtual ~SystemdFailedUnits();
auto update() -> void override;
@ -18,8 +19,8 @@ class SystemdFailedUnits : public ALabel {
std::string format_ok;
bool update_pending;
std::string last_status;
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,

View File

@ -0,0 +1,93 @@
#pragma once
#include <giomm/dbusconnection.h>
#include <gtkmm/icontheme.h>
#include <libupower-glib/upower.h>
#include <unordered_map>
#include "AIconLabel.hpp"
namespace waybar::modules {
class UPower final : public AIconLabel {
public:
UPower(const std::string &, const Json::Value &);
virtual ~UPower();
auto update() -> void override;
private:
const std::string NO_BATTERY{"battery-missing-symbolic"};
// Config
bool showIcon_{true};
bool hideIfEmpty_{true};
int iconSize_{20};
int tooltip_spacing_{4};
int tooltip_padding_{4};
Gtk::Box contentBox_; // tooltip box
std::string tooltipFormat_;
// UPower device info
struct upDevice_output {
UpDevice *upDevice{NULL};
double percentage{0.0};
double temperature{0.0};
guint64 time_full{0u};
guint64 time_empty{0u};
gchar *icon_name{(char *)'\0'};
bool upDeviceValid{false};
UpDeviceState state;
UpDeviceKind kind;
char *nativePath{(char *)'\0'};
char *model{(char *)'\0'};
};
// Technical variables
std::string nativePath_;
std::string lastStatus_;
Glib::ustring label_markup_;
std::mutex mutex_;
Glib::RefPtr<Gtk::IconTheme> gtkTheme_;
bool sleeping_;
// Technical functions
void addDevice(UpDevice *);
void removeDevice(const gchar *);
void removeDevices();
void resetDevices();
void setDisplayDevice();
const Glib::ustring getText(const upDevice_output &upDevice_, const std::string &format);
bool queryTooltipCb(int, int, bool, const Glib::RefPtr<Gtk::Tooltip> &);
// DBUS variables
guint watcherID_;
Glib::RefPtr<Gio::DBus::Connection> conn_;
guint subscrID_{0u};
// UPower variables
UpClient *upClient_;
upDevice_output upDevice_; // Device to display
typedef std::unordered_map<std::string, upDevice_output> Devices;
Devices devices_;
bool upRunning_{true};
// DBus callbacks
void getConn_cb(Glib::RefPtr<Gio::AsyncResult> &result);
void onAppear(const Glib::RefPtr<Gio::DBus::Connection> &, const Glib::ustring &,
const Glib::ustring &);
void onVanished(const Glib::RefPtr<Gio::DBus::Connection> &, const Glib::ustring &);
void prepareForSleep_cb(const Glib::RefPtr<Gio::DBus::Connection> &connection,
const Glib::ustring &sender_name, const Glib::ustring &object_path,
const Glib::ustring &interface_name, const Glib::ustring &signal_name,
const Glib::VariantContainerBase &parameters);
// UPower callbacks
static void deviceAdded_cb(UpClient *client, UpDevice *device, gpointer data);
static void deviceRemoved_cb(UpClient *client, const gchar *objectPath, gpointer data);
static void deviceNotify_cb(UpDevice *device, GParamSpec *pspec, gpointer user_data);
// UPower secondary functions
void getUpDeviceInfo(upDevice_output &upDevice_);
};
} // namespace waybar::modules

View File

@ -1,81 +0,0 @@
#pragma once
#include <libupower-glib/upower.h>
#include <iostream>
#include <map>
#include <string>
#include <unordered_map>
#include "ALabel.hpp"
#include "glibconfig.h"
#include "gtkmm/box.h"
#include "gtkmm/image.h"
#include "gtkmm/label.h"
#include "modules/upower/upower_tooltip.hpp"
namespace waybar::modules::upower {
class UPower : public AModule {
public:
UPower(const std::string &, const Json::Value &);
virtual ~UPower();
auto update() -> void override;
private:
typedef std::unordered_map<std::string, UpDevice *> Devices;
const std::string DEFAULT_FORMAT = "{percentage}";
const std::string DEFAULT_FORMAT_ALT = "{percentage} {time}";
static void deviceAdded_cb(UpClient *client, UpDevice *device, gpointer data);
static void deviceRemoved_cb(UpClient *client, const gchar *objectPath, gpointer data);
static void deviceNotify_cb(UpDevice *device, GParamSpec *pspec, gpointer user_data);
static void prepareForSleep_cb(GDBusConnection *system_bus, const gchar *sender_name,
const gchar *object_path, const gchar *interface_name,
const gchar *signal_name, GVariant *parameters,
gpointer user_data);
static void upowerAppear(GDBusConnection *conn, const gchar *name, const gchar *name_owner,
gpointer data);
static void upowerDisappear(GDBusConnection *connection, const gchar *name, gpointer user_data);
void removeDevice(const gchar *objectPath);
void addDevice(UpDevice *device);
void setDisplayDevice();
void resetDevices();
void removeDevices();
bool show_tooltip_callback(int, int, bool, const Glib::RefPtr<Gtk::Tooltip> &tooltip);
bool handleToggle(GdkEventButton *const &) override;
std::string timeToString(gint64 time);
const std::string getDeviceStatus(UpDeviceState &state);
Gtk::Box box_;
Gtk::Image icon_;
Gtk::Label label_;
// Config
bool hideIfEmpty = true;
bool tooltip_enabled = true;
uint tooltip_spacing = 4;
uint tooltip_padding = 4;
uint iconSize = 20;
std::string format = DEFAULT_FORMAT;
std::string format_alt = DEFAULT_FORMAT_ALT;
Devices devices;
std::mutex m_Mutex;
UpClient *client;
UpDevice *displayDevice;
guint login1_id;
GDBusConnection *login1_connection;
std::unique_ptr<UPowerTooltip> upower_tooltip;
std::string lastStatus;
bool showAltText;
bool showIcon = true;
bool upowerRunning;
guint upowerWatcher_id;
std::string nativePath_;
};
} // namespace waybar::modules::upower

View File

@ -1,33 +0,0 @@
#pragma once
#include <libupower-glib/upower.h>
#include <memory>
#include <unordered_map>
#include "gtkmm/box.h"
#include "gtkmm/label.h"
#include "gtkmm/window.h"
namespace waybar::modules::upower {
class UPowerTooltip : public Gtk::Window {
private:
typedef std::unordered_map<std::string, UpDevice*> Devices;
const std::string getDeviceIcon(UpDeviceKind& kind);
std::unique_ptr<Gtk::Box> contentBox;
uint iconSize;
uint tooltipSpacing;
uint tooltipPadding;
public:
UPowerTooltip(uint iconSize, uint tooltipSpacing, uint tooltipPadding);
virtual ~UPowerTooltip();
uint updateTooltip(Devices& devices);
};
} // namespace waybar::modules::upower

View File

@ -14,7 +14,7 @@ class User : public AIconLabel {
virtual ~User() = default;
auto update() -> void override;
//todo bool handleToggle(GdkEventButton* const& e) override;
bool handleToggle(GdkEventButton* const& e) override;
private:
util::SleeperThread thread_;

View File

@ -17,12 +17,15 @@ class Wireplumber : public ALabel {
auto update() -> void override;
private:
void loadRequiredApiModules();
void asyncLoadRequiredApiModules();
void prepare();
void activatePlugins();
static void updateVolume(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 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 onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self);

View File

@ -21,11 +21,19 @@
#include "giomm/desktopappinfo.h"
#include "util/json.hpp"
#include "wlr-foreign-toplevel-management-unstable-v1-client-protocol.h"
#include "modules/sway/ipc/client.hpp"
namespace waybar::modules::wlr {
class Taskbar;
class SwayScratchpad {
public:
int id;
std::string app_id;
std::string title;
};
class Task {
public:
Task(const waybar::Bar &, const Json::Value &, Taskbar *,
@ -54,6 +62,7 @@ class Task {
struct wl_seat *seat_;
uint32_t id_;
uint32_t swayId_;
Gtk::Box content_;
Gtk::Image icon_;
@ -62,6 +71,8 @@ class Task {
Glib::RefPtr<Gio::DesktopAppInfo> app_info_;
bool button_visible_ = false;
bool ignored_ = false;
bool only_scratchpad_ = false;
bool isScratchpadMode_ = false;
bool with_icon_ = false;
bool with_name_ = false;
@ -86,12 +97,15 @@ class Task {
bool image_load_icon(Gtk::Image &image, const Glib::RefPtr<Gtk::IconTheme> &icon_theme,
Glib::RefPtr<Gio::DesktopAppInfo> app_info, int size);
void hide_if_ignored();
bool hideNoScratchpad();
public:
/* Getter functions */
uint32_t id() const { return id_; }
uint32_t swayId() const { return swayId_; }
std::string title() const { return title_; }
std::string app_id() const { return app_id_; }
bool isScratchpadMode() const { return isScratchpadMode_; }
uint32_t state() const { return state_; }
bool maximized() const { return state_ & MAXIMIZED; }
bool minimized() const { return state_ & MINIMIZED; }
@ -117,6 +131,8 @@ class Task {
void handle_drag_data_received(const Glib::RefPtr<Gdk::DragContext> &context, int x, int y,
Gtk::SelectionData selection_data, guint info, guint time);
void setManualForSway(const int id, const std::string app_id, const std::string title);
public:
bool operator==(const Task &) const;
bool operator!=(const Task &) const;
@ -153,6 +169,15 @@ class Taskbar : public waybar::AModule {
struct zwlr_foreign_toplevel_manager_v1 *manager_;
struct wl_seat *seat_;
/* Sway scratchpad indicator */
std::mutex mutex_;
waybar::modules::sway::Ipc ipc_;
auto getSwayTree() -> void;
auto onSwayCmd(const struct waybar::modules::sway::Ipc::ipc_response&) -> void;
auto onSwayEvent(const struct waybar::modules::sway::Ipc::ipc_response&) -> void;
util::JsonParser parser_;
std::map<std::string, Task> swayWorkspaceMap;
public:
/* Callbacks for global registration */
void register_manager(struct wl_registry *, uint32_t name, uint32_t version);

View File

@ -52,7 +52,7 @@ struct SafeSignal : sigc::signal<void(std::decay_t<Args>...)> {
using slot_t = decltype(std::declval<signal_t>().make_slot());
using arg_tuple_t = std::tuple<std::decay_t<Args>...>;
// ensure that unwrapped methods are not accessible
using signal_t::emit;
using signal_t::emit_reverse;
using signal_t::make_slot;
void handle_event() {

View File

@ -22,6 +22,7 @@ class AudioBackend {
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_;

View File

@ -20,7 +20,7 @@
std::scoped_lock<std::mutex> lock((backend).udev_thread_mutex_); \
__devices = (backend).devices_; \
} \
auto varname = (backend).best_device(__devices.cbegin(), __devices.cend(), preferred_device);
auto varname = (backend).best_device(__devices, preferred_device);
namespace waybar::util {
@ -61,16 +61,10 @@ class BacklightBackend {
void set_scaled_brightness(std::string preferred_device, int brightness);
int get_scaled_brightness(std::string preferred_device);
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 is_login_proxy_initialized() const { return static_cast<bool>(login_proxy_); }
template <class ForwardIt>
static const BacklightDevice *best_device(ForwardIt first, ForwardIt last, std::string_view);
static const BacklightDevice *best_device(const std::vector<BacklightDevice> &devices,
std::string_view);
std::vector<BacklightDevice> devices_;
std::mutex udev_thread_mutex_;
@ -90,4 +84,4 @@ class BacklightBackend {
static constexpr int EPOLL_MAX_EVENTS = 16;
};
} // namespace waybar::util
} // namespace waybar::util

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

@ -30,10 +30,6 @@ 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);
}
constexpr decltype(auto) operator""d(unsigned long long d) noexcept {
return date::operator""_d(d); // very verbose, but it works
}
#endif
} // namespace date

View File

@ -3,6 +3,12 @@
#include <fmt/ostream.h>
#include <json/json.h>
#include <algorithm>
#include <codecvt>
#include <iostream>
#include <locale>
#include <regex>
#if (FMT_VERSION >= 90000)
template <>
@ -12,25 +18,30 @@ struct fmt::formatter<Json::Value> : ostream_formatter {};
namespace waybar::util {
struct JsonParser {
JsonParser() {}
class JsonParser {
public:
JsonParser() = default;
const Json::Value parse(const std::string& data) const {
Json::Value root(Json::objectValue);
if (data.empty()) {
return root;
Json::Value parse(const std::string& jsonStr) {
Json::Value root;
// 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);
}
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:
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

View File

@ -2,6 +2,8 @@
#include <pipewire/pipewire.h>
#include <unordered_map>
#include "util/backend_common.hpp"
#include "util/pipewire/privacy_node_info.hpp"
@ -13,7 +15,8 @@ class PipewireBackend {
pw_context* context_;
pw_core* core_;
spa_hook registry_listener;
pw_registry* registry_;
spa_hook registryListener_;
/* Hack to keep constructor inaccessible but still public.
* This is required to be able to use std::make_shared.
@ -21,20 +24,22 @@ class PipewireBackend {
* 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 {};
struct PrivateConstructorTag {};
public:
std::mutex mutex_;
pw_registry* registry;
sigc::signal<void> privacy_nodes_changed_signal_event;
std::unordered_map<uint32_t, PrivacyNodeInfo*> privacy_nodes;
std::mutex mutex_;
static std::shared_ptr<PipewireBackend> getInstance();
PipewireBackend(private_constructor_tag tag);
// Handlers for PipeWire events
void handleRegistryEventGlobal(uint32_t id, uint32_t permissions, const char* type,
uint32_t version, const struct spa_dict* props);
void handleRegistryEventGlobalRemove(uint32_t id);
PipewireBackend(PrivateConstructorTag tag);
~PipewireBackend();
};
} // namespace waybar::util::PipewireBackend

View File

@ -34,29 +34,12 @@ class PrivacyNodeInfo {
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 getName();
std::string getIconName();
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;
}
// Handlers for PipeWire events
void handleProxyEventDestroy();
void handleNodeEventInfo(const struct pw_node_info *info);
};
} // namespace waybar::util::PipewireBackend

View File

@ -19,7 +19,7 @@ class Portal : private DBus::Proxy {
void refreshAppearance();
Appearance getAppearance();
typedef sigc::signal<void(Appearance)> type_signal_appearance_changed;
typedef sigc::signal<void, Appearance> type_signal_appearance_changed;
type_signal_appearance_changed signal_appearance_changed() { return m_signal_appearance_changed; }
private:

View File

@ -30,7 +30,11 @@ The *backlight* module displays the current backlight level.
*align*: ++
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*: ++
typeof: integer ++

View File

@ -61,7 +61,11 @@ The *battery* module displays the current capacity and state (eg. charging) of y
*align*: ++
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*: ++
typeof: integer++
@ -115,6 +119,10 @@ The *battery* module displays the current capacity and state (eg. charging) of y
*{time}*: Estimate of time until full or empty. Note that this is based on the power draw at the last refresh time, not an average.
*{cycles}*: Amount of charge cycles the highest-capacity battery has seen. *(Linux only)*
*{health}*: The percentage of the highest-capacity battery's original maximum charge it can still hold.
# TIME FORMAT
The *battery* module allows you to define how time should be formatted via *format-time*.
@ -167,3 +175,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*.
- *#battery.<status>.<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

@ -66,7 +66,11 @@ Addressed by *bluetooth*
*align*: ++
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*: ++
typeof: string ++

View File

@ -157,6 +157,7 @@ View all valid format options in *strftime(3)* or have a look https://en.cpprefe
- *{calendar}*: Current month calendar
- *{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

View File

@ -35,7 +35,11 @@ The *cpu* module displays the current CPU utilization.
*align*: ++
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*: ++
typeof: integer ++

View File

@ -72,7 +72,11 @@ Addressed by *custom/<name>*
*align*: ++
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*: ++
typeof: string ++
@ -107,6 +111,11 @@ Addressed by *custom/<name>*
default: true ++
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*: ++
typeof: bool ++
default: false ++

View File

@ -45,7 +45,11 @@ Addressed by *disk*
*align*: ++
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*: ++
typeof: string ++

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

@ -31,7 +31,11 @@ Addressed by *hyprland/submap*
*align*: ++
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*: ++
typeof: string ++
@ -66,6 +70,16 @@ Addressed by *hyprland/submap*
default: true ++
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
@ -80,3 +94,4 @@ Addressed by *hyprland/submap*
# STYLE
- *#submap*
- *#submap.<name>*

View File

@ -42,6 +42,11 @@ Addressed by *hyprland/workspaces*
default: false ++
If set to true, special workspaces will be shown.
*special-visible-only*: ++
typeof: bool ++
default: false ++
If this and show-special are to true, special workspaces will be shown only if visible.
*all-outputs*: ++
typeof: bool ++
default: false ++
@ -52,6 +57,13 @@ Addressed by *hyprland/workspaces*
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: [] ++
@ -139,6 +151,7 @@ Additional to workspace name matching, the following *format-icons* can be set.
}
```
```
"hyprland/workspaces": {
// Formatting omitted for brevity
"ignore-workspaces": [
@ -157,3 +170,4 @@ Additional to workspace name matching, the following *format-icons* can be set.
- *#workspaces button.persistent*
- *#workspaces button.special*
- *#workspaces button.urgent*
- *#workspaces button.hosting-monitor* (gets applied if workspace-monitor == waybar-monitor)

View File

@ -33,7 +33,11 @@ screensaver, also known as "presentation mode".
*align*: ++
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*: ++
typeof: string ++

View File

@ -87,3 +87,4 @@ $path\\n$tooltip
# STYLE
- *#image*
- *#image.empty*

View File

@ -37,7 +37,11 @@ See *systemd-inhibit*(1) for more information.
*align*: ++
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*: ++
typeof: string ++

View File

@ -63,7 +63,11 @@ Addressed by *jack*
*align*: ++
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*: ++
typeof: string ++

View File

@ -45,7 +45,11 @@ Addressed by *memory*
*align*: ++
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*: ++
typeof: string ++

View File

@ -103,7 +103,11 @@ Addressed by *mpd*
*align*: ++
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*: ++
typeof: string ++

View File

@ -119,8 +119,11 @@ The *mpris* module displays currently playing media via libplayerctl.
*align*: ++
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*: ++
typeof: string ++
@ -139,11 +142,11 @@ The *mpris* module displays currently playing media via libplayerctl.
*player-icons*: ++
typeof: map[string]string ++
Allows setting _{player-icon}_ based on player-name property.
Allows setting _{player_icon}_ based on player-name property.
*status-icons*: ++
typeof: map[string]string ++
Allows setting _{status-icon}_ based on player status (playing, paused, stopped).
Allows setting _{status_icon}_ based on player status (playing, paused, stopped).
# FORMAT REPLACEMENTS

View File

@ -70,7 +70,11 @@ Addressed by *network*
*align*: ++
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*: ++
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": ""
}
}
```

View File

@ -56,7 +56,11 @@ Additionally, you can control the volume by scrolling *up* or *down* while the c
*align*: ++
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*: ++
typeof: float ++

View File

@ -33,7 +33,11 @@ Addressed by *river/layout*
*align*: ++
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*: ++
typeof: string ++

View File

@ -31,7 +31,11 @@ Addressed by *river/mode*
*align*: ++
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*: ++
typeof: string ++

View File

@ -31,7 +31,11 @@ Addressed by *river/window*
*align*: ++
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*: ++
typeof: string ++

View File

@ -32,7 +32,11 @@ cursor is over the module, and clicking on the module toggles mute.
*align*: ++
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*: ++
typeof: int ++

View File

@ -0,0 +1,44 @@
waybar-styles(5)
# NAME
waybar-styles - using stylesheets for waybar
# DESCRIPTION
Waybar uses Cascading Style Sheets (CSS) to configure its appearance.
It uses the first file found in this search order:
- *$XDG_CONFIG_HOME/waybar/style.css*
- *~/.config/waybar/style.css*
- *~/waybar/style.css*
- */etc/xdg/waybar/style.css*
- *@sysconfdir@/xdg/waybar/style.css*
# EXAMPLE
An example user-controlled stylesheet that just changes the color of the clock to be green on black, while keeping the rest of the system config the same would be:
```
@import url("file:///etc/xdg/waybar/style.css")
#clock {
background: #000000;
color: #00ff00;
}
```
## Hover-effect
You can apply special styling to any module for when the cursor hovers it.
```
#clock:hover {
background-color: #ffffff;
}
```
# SEE ALSO
- *waybar(5)*

View File

@ -17,6 +17,11 @@ Addressed by *sway/language*
default: {} ++
The format, how layout should be displayed.
*hide-single-layout*: ++
typeof: bool ++
default: false ++
Defines visibility of the module if a single layout is configured
*tooltip-format*: ++
typeof: string ++
default: {} ++

View File

@ -31,7 +31,11 @@ Addressed by *sway/mode*
*align*: ++
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*: ++
typeof: string ++

View File

@ -31,7 +31,11 @@ Addressed by *sway/window*
*align*: ++
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*: ++
typeof: string ++

View File

@ -82,6 +82,23 @@ warp-on-scroll: ++
default: true ++
If set to false, you can scroll to cycle through workspaces without mouse warping being enabled. If set to true this behaviour is disabled.
*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.
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.
# FORMAT REPLACEMENTS
*{value}*: Name of the workspace, as defined by sway.
@ -94,6 +111,8 @@ warp-on-scroll: ++
*{output}*: Output where the workspace is located.
*{windows}*: Result from window-rewrite
# ICONS
Additional to workspace name matching, the following *format-icons* can be set.
@ -143,6 +162,19 @@ n.b.: the list of outputs can be obtained from command line using *swaymsg -t ge
}
```
```
"sway/workspaces": {
"format": "<span size='larger'>{name}</span> {windows}",
"format-window-separator": " | ",
"window-rewrite-default": "{name}",
"window-format": "<span color='#e0e0e0'>{name}</span>",
"window-rewrite": {
"class<firefox>": "",
"class<kitty>": "k",
}
}
```
# Style
- *#workspaces button*
@ -150,5 +182,6 @@ n.b.: the list of outputs can be obtained from command line using *swaymsg -t ge
- *#workspaces button.focused*
- *#workspaces button.urgent*
- *#workspaces button.persistent*
- *#workspaces button.empty*
- *#workspaces button.current_output*
- *#workspaces button#sway-workspace-${name}*

View File

@ -25,6 +25,7 @@ Addressed by *temperature*
*hwmon-path-abs*: ++
typeof: string ++
The path of the hwmon-directory of the device, e.g. */sys/devices/pci0000:00/0000:00:18.3/hwmon*. (Note that the subdirectory *hwmon/hwmon#*, where *#* is a number is not part of the path!) Has to be used together with *input-filename*.
This can also be an array of strings, for which, it just works like *hwmon-path*.
*input-filename*: ++
typeof: string ++
@ -71,7 +72,11 @@ Addressed by *temperature*
*align*: ++
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*: ++
typeof: string ++

View File

@ -47,7 +47,11 @@ The *wireplumber* module displays the current volume reported by WirePlumber.
*align*: ++
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*: ++
typeof: float ++

View File

@ -16,9 +16,11 @@ Valid locations for this file are:
- */etc/xdg/waybar/*
- *@sysconfdir@/xdg/waybar/*
A good starting point is the default configuration found at https://github.com/Alexays/Waybar/blob/master/resources/config
A good starting point is the default configuration found at https://github.com/Alexays/Waybar/blob/master/resources/config.jsonc
Also, a minimal example configuration can be found at the bottom of this man page.
The visual display elements for waybar use a CSS stylesheet, see *waybar-styles(5)* for details.
# BAR CONFIGURATION
*layer* ++
@ -124,6 +126,11 @@ Also, a minimal example configuration can be found at the bottom of this man pag
Each file can contain a single object with any of the bar configuration options. In case of duplicate options, the first defined value takes precedence, i.e. including file -> first included file -> etc. Nested includes are permitted, but make sure to avoid circular imports.
For a multi-bar config, the include directive affects only current bar configuration object.
*reload_style_on_change* ++
typeof: bool ++
default: *false* ++
Option to enable reloading the css style if a modification is detected on the style sheet file or any imported css files.
# MODULE FORMAT
You can use PangoMarkupFormat (See https://developer.gnome.org/pango/stable/PangoMarkupFormat.html#PangoMarkupFormat).
@ -305,6 +312,7 @@ A group may hide all but one element, showing them only on mouse hover. In order
- *waybar-custom(5)*
- *waybar-disk(5)*
- *waybar-dwl-tags(5)*
- *waybar-dwl-window(5)*
- *waybar-gamemode(5)*
- *waybar-hyprland-language(5)*
- *waybar-hyprland-submap(5)*
@ -341,3 +349,4 @@ A group may hide all but one element, showing them only on mouse hover. In order
# SEE ALSO
*sway-output(5)*
*waybar-styles(5)"

View File

@ -1,10 +1,10 @@
project(
'waybar', 'cpp', 'c',
version: '4.1.0',
version: '0.10.3',
license: 'MIT',
meson_version: '>= 1.3.0',
meson_version: '>= 0.59.0',
default_options : [
'cpp_std=c++23',
'cpp_std=c++20',
'buildtype=release',
'default_library=static'
],
@ -22,8 +22,6 @@ endif
if compiler.has_link_argument('-lc++fs')
cpp_link_args += ['-lc++fs']
elif compiler.has_link_argument('-lc++experimental')
cpp_link_args += ['-lc++experimental']
elif compiler.has_link_argument('-lstdc++fs')
cpp_link_args += ['-lstdc++fs']
endif
@ -33,10 +31,10 @@ git = find_program('git', native: true, required: false)
if not git.found()
add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp')
else
git_path = run_command([git.path(), 'rev-parse', '--show-toplevel']).stdout().strip()
if meson.source_root() == git_path
git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip()
git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip()
git_path = run_command(git, 'rev-parse', '--show-toplevel', check: false).stdout().strip()
if meson.project_source_root() == git_path
git_commit_hash = run_command(git, 'describe', '--always', '--tags', check: false).stdout().strip()
git_branch = run_command(git, 'rev-parse', '--abbrev-ref', 'HEAD', check: false).stdout().strip()
version = '"@0@ (branch \'@1@\')"'.format(git_commit_hash, git_branch)
add_project_arguments('-DVERSION=@0@'.format(version), language: 'cpp')
else
@ -44,15 +42,6 @@ else
endif
endif
if not compiler.has_header('filesystem')
if compiler.has_header('experimental/filesystem')
add_project_arguments('-DFILESYSTEM_EXPERIMENTAL', language: 'cpp')
else
add_project_arguments('-DNO_FILESYSTEM', language: 'cpp')
warning('No filesystem header found, some modules may not work')
endif
endif
code = '''
#include <langinfo.h>
#include <locale.h>
@ -78,60 +67,525 @@ is_freebsd = host_machine.system() == 'freebsd'
is_netbsd = host_machine.system() == 'netbsd'
is_openbsd = host_machine.system() == 'openbsd'
jsoncpp = dependency('jsoncpp', version : ['>=1.9.4'], fallback : ['jsoncpp', 'jsoncpp_dep'])
thread_dep = dependency('threads')
fmt = dependency('fmt', version : ['>=8.1.1'], fallback : ['fmt', 'fmt_dep'])
spdlog = dependency('spdlog', version : ['>=1.10.0'], fallback : ['spdlog', 'spdlog_dep'], default_options : ['external_fmt=enabled'])
wayland_client = dependency('wayland-client')
wayland_cursor = dependency('wayland-cursor')
wayland_protos = dependency('wayland-protocols')
sigcpp = dependency('sigc++-3.0', version: ['>=3.4.0'])
gtkmm = dependency('gtkmm-4.0', version : ['>=4.12.0'])
giounix = dependency('gio-unix-2.0', version: ['>=2.76.4'])
spdlog = dependency('spdlog', version : ['>=1.10.0'], fallback : ['spdlog', 'spdlog_dep'], default_options : ['external_fmt=enabled'])
gtkmm = dependency('gtkmm-3.0', version : ['>=3.22.0'])
dbusmenu_gtk = dependency('dbusmenu-gtk3-0.4', required: get_option('dbusmenu-gtk'))
giounix = dependency('gio-unix-2.0')
jsoncpp = dependency('jsoncpp', version : ['>=1.9.2'], fallback : ['jsoncpp', 'jsoncpp_dep'])
sigcpp = dependency('sigc++-2.0')
libinotify = dependency('libinotify', required: false)
libepoll = dependency('epoll-shim', required: false)
libinput = dependency('libinput', required: get_option('libinput'))
libnl = dependency('libnl-3.0', required: get_option('libnl'))
libnlgen = dependency('libnl-genl-3.0', required: get_option('libnl'))
upower_glib = dependency('upower-glib', required: get_option('upower_glib'))
pipewire = dependency('libpipewire-0.3', required: get_option('pipewire'))
playerctl = dependency('playerctl', version : ['>=2.0.0'], required: get_option('mpris'))
libpulse = dependency('libpulse', required: get_option('pulseaudio'))
libudev = dependency('libudev', required: get_option('libudev'))
libevdev = dependency('libevdev', required: get_option('libevdev'))
libmpdclient = dependency('libmpdclient', required: get_option('mpd'))
xkbregistry = dependency('xkbregistry')
libjack = dependency('jack', required: get_option('jack'))
libwireplumber = dependency('wireplumber-0.5', required: get_option('wireplumber'))
gtk_layer_shell = dependency('gtk4-layer-shell-0',
version : ['>=1.0.2'],
fallback : ['gtk4-layer-shell', 'gtk_layer_shell'],
default_options : ['introspection=false', 'vapi=false'])
libsndio = compiler.find_library('sndio', required: get_option('sndio'))
if libsndio.found()
if not compiler.has_function('sioctl_open', prefix: '#include <sndio.h>', dependencies: libsndio)
if get_option('sndio').enabled()
error('libsndio is too old, required >=1.7.0')
else
warning('libsndio is too old, required >=1.7.0')
libsndio = dependency('', required: false)
endif
endif
endif
gtk_layer_shell = dependency('gtk-layer-shell-0', version: ['>=0.6.0'],
default_options: ['introspection=false', 'vapi=false'],
fallback: ['gtk-layer-shell', 'gtk_layer_shell'])
systemd = dependency('systemd', required: get_option('systemd'))
cpp_lib_chrono = compiler.compute_int('__cpp_lib_chrono', prefix : '#include <chrono>')
have_chrono_timezones = cpp_lib_chrono >= 201611
if have_chrono_timezones
code = '''
#include <chrono>
using namespace std::chrono;
int main(int argc, char** argv) {
const time_zone* tz;
return 0;
}
'''
if not compiler.links(code)
have_chrono_timezones = false
endif
endif
if have_chrono_timezones
tz_dep = declare_dependency()
else
tz_dep = dependency('date',
required: false,
default_options : [ 'use_system_tzdb=true' ],
modules : [ 'date::date', 'date::date-tz' ],
fallback: [ 'date', 'tz_dep' ])
endif
prefix = get_option('prefix')
sysconfdir = get_option('sysconfdir')
conf_data = configuration_data()
conf_data.set('prefix', prefix)
add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'cpp')
add_project_arguments('-DSYSCONFDIR="@0@"'.format(prefix / sysconfdir), language : 'cpp')
if systemd.found()
user_units_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir')
configure_file(
configuration: conf_data,
input: './resources/waybar.service.in',
output: '@BASENAME@',
install_dir: user_units_dir
)
endif
src_files = files(
'src/main.cpp',
'src/client.cpp',
'src/bar.cpp',
'src/config.cpp',
'src/util/portal.cpp',
'src/util/prepare_for_sleep.cpp',
# 'src/AModule.cpp',
'src/factory.cpp',
'src/AModule.cpp',
'src/ALabel.cpp',
'src/AIconLabel.cpp',
'src/AAppIconLabel.cpp',
'src/modules/custom.cpp',
'src/modules/disk.cpp',
'src/modules/idle_inhibitor.cpp',
'src/modules/image.cpp',
'src/modules/load.cpp',
'src/modules/temperature.cpp',
'src/modules/user.cpp',
'src/ASlider.cpp',
'src/main.cpp',
'src/bar.cpp',
'src/client.cpp',
'src/config.cpp',
'src/group.cpp',
'src/util/portal.cpp',
'src/util/enum.cpp',
'src/util/prepare_for_sleep.cpp',
'src/util/ustring_clen.cpp',
'src/util/sanitize_str.cpp',
'src/util/rewrite_string.cpp',
'src/util/gtk_icon.cpp',
'src/util/regex_collection.cpp',
'src/util/css_reload_helper.cpp'
)
man_files = files(
'man/waybar-custom.5.scd',
'man/waybar-disk.5.scd',
'man/waybar-idle-inhibitor.5.scd',
'man/waybar-image.5.scd',
'man/waybar-states.5.scd',
'man/waybar-temperature.5.scd',
)
inc_dirs = ['include']
if is_linux
add_project_arguments('-DHAVE_CPU_LINUX', language: 'cpp')
add_project_arguments('-DHAVE_MEMORY_LINUX', language: 'cpp')
add_project_arguments('-DHAVE_SYSTEMD_MONITOR', language: 'cpp')
src_files += files(
'src/modules/battery.cpp',
'src/modules/bluetooth.cpp',
'src/modules/cffi.cpp',
'src/modules/cpu.cpp',
'src/modules/cpu_frequency/common.cpp',
'src/modules/cpu_frequency/linux.cpp',
'src/modules/cpu_usage/common.cpp',
'src/modules/cpu_usage/linux.cpp',
'src/modules/memory/common.cpp',
'src/modules/memory/linux.cpp',
'src/modules/power_profiles_daemon.cpp',
'src/modules/systemd_failed_units.cpp',
)
man_files += files(
'man/waybar-battery.5.scd',
'man/waybar-bluetooth.5.scd',
'man/waybar-cffi.5.scd',
'man/waybar-cpu.5.scd',
'man/waybar-memory.5.scd',
'man/waybar-systemd-failed-units.5.scd',
'man/waybar-power-profiles-daemon.5.scd',
)
elif is_dragonfly or is_freebsd or is_netbsd or is_openbsd
add_project_arguments('-DHAVE_CPU_BSD', language: 'cpp')
add_project_arguments('-DHAVE_MEMORY_BSD', language: 'cpp')
src_files += files(
'src/modules/cffi.cpp',
'src/modules/cpu.cpp',
'src/modules/cpu_frequency/bsd.cpp',
'src/modules/cpu_frequency/common.cpp',
'src/modules/cpu_usage/bsd.cpp',
'src/modules/cpu_usage/common.cpp',
'src/modules/memory/bsd.cpp',
'src/modules/memory/common.cpp',
)
man_files += files(
'man/waybar-cffi.5.scd',
'man/waybar-cpu.5.scd',
'man/waybar-memory.5.scd',
)
if is_freebsd
src_files += files('src/modules/battery.cpp')
man_files += files('man/waybar-battery.5.scd')
endif
endif
if true
add_project_arguments('-DHAVE_SWAY', language: 'cpp')
src_files += files(
'src/modules/sway/ipc/client.cpp',
'src/modules/sway/bar.cpp',
'src/modules/sway/mode.cpp',
'src/modules/sway/language.cpp',
'src/modules/sway/window.cpp',
'src/modules/sway/workspaces.cpp',
'src/modules/sway/scratchpad.cpp'
)
man_files += files(
'man/waybar-sway-language.5.scd',
'man/waybar-sway-mode.5.scd',
'man/waybar-sway-scratchpad.5.scd',
'man/waybar-sway-window.5.scd',
'man/waybar-sway-workspaces.5.scd',
)
endif
if true
add_project_arguments('-DHAVE_WLR_TASKBAR', language: 'cpp')
src_files += files('src/modules/wlr/taskbar.cpp')
man_files += files('man/waybar-wlr-taskbar.5.scd')
endif
if true
add_project_arguments('-DHAVE_RIVER', language: 'cpp')
src_files += files(
'src/modules/river/layout.cpp',
'src/modules/river/mode.cpp',
'src/modules/river/tags.cpp',
'src/modules/river/window.cpp',
)
man_files += files(
'man/waybar-river-layout.5.scd',
'man/waybar-river-mode.5.scd',
'man/waybar-river-tags.5.scd',
'man/waybar-river-window.5.scd',
)
endif
if true
add_project_arguments('-DHAVE_DWL', language: 'cpp')
src_files += files('src/modules/dwl/tags.cpp')
src_files += files('src/modules/dwl/window.cpp')
man_files += files('man/waybar-dwl-tags.5.scd')
man_files += files('man/waybar-dwl-window.5.scd')
endif
if true
add_project_arguments('-DHAVE_HYPRLAND', language: 'cpp')
src_files += files(
'src/modules/hyprland/backend.cpp',
'src/modules/hyprland/language.cpp',
'src/modules/hyprland/submap.cpp',
'src/modules/hyprland/window.cpp',
'src/modules/hyprland/workspace.cpp',
'src/modules/hyprland/workspaces.cpp',
'src/modules/hyprland/windowcreationpayload.cpp',
)
man_files += files(
'man/waybar-hyprland-language.5.scd',
'man/waybar-hyprland-submap.5.scd',
'man/waybar-hyprland-window.5.scd',
'man/waybar-hyprland-workspaces.5.scd',
)
endif
if libnl.found() and libnlgen.found()
add_project_arguments('-DHAVE_LIBNL', language: 'cpp')
src_files += files('src/modules/network.cpp')
man_files += files('man/waybar-network.5.scd')
endif
if not get_option('logind').disabled()
add_project_arguments('-DHAVE_GAMEMODE', '-DHAVE_LOGIND_INHIBITOR', language: 'cpp')
src_files += files(
'src/modules/gamemode.cpp',
'src/modules/inhibitor.cpp',
)
man_files += files(
'man/waybar-gamemode.5.scd',
'man/waybar-inhibitor.5.scd',
)
endif
if (upower_glib.found() and not get_option('logind').disabled())
add_project_arguments('-DHAVE_UPOWER', language: 'cpp')
src_files += files('src/modules/upower.cpp')
man_files += files('man/waybar-upower.5.scd')
endif
if pipewire.found()
add_project_arguments('-DHAVE_PIPEWIRE', language: 'cpp')
src_files += files(
'src/modules/privacy/privacy.cpp',
'src/modules/privacy/privacy_item.cpp',
'src/util/pipewire/pipewire_backend.cpp',
'src/util/pipewire/privacy_node_info.cpp',
)
man_files += files('man/waybar-privacy.5.scd')
endif
if playerctl.found()
add_project_arguments('-DHAVE_MPRIS', language: 'cpp')
src_files += files('src/modules/mpris/mpris.cpp')
man_files += files('man/waybar-mpris.5.scd')
endif
if libpulse.found()
add_project_arguments('-DHAVE_LIBPULSE', language: 'cpp')
src_files += files(
'src/modules/pulseaudio.cpp',
'src/modules/pulseaudio_slider.cpp',
'src/util/audio_backend.cpp',
)
man_files += files(
'man/waybar-pulseaudio.5.scd',
'man/waybar-pulseaudio-slider.5.scd',
)
endif
if libjack.found()
add_project_arguments('-DHAVE_LIBJACK', language: 'cpp')
src_files += files('src/modules/jack.cpp')
man_files += files('man/waybar-jack.5.scd')
endif
if libwireplumber.found()
add_project_arguments('-DHAVE_LIBWIREPLUMBER', language: 'cpp')
src_files += files('src/modules/wireplumber.cpp')
man_files += files('man/waybar-wireplumber.5.scd')
endif
if dbusmenu_gtk.found()
add_project_arguments('-DHAVE_DBUSMENU', language: 'cpp')
src_files += files(
'src/modules/sni/tray.cpp',
'src/modules/sni/watcher.cpp',
'src/modules/sni/host.cpp',
'src/modules/sni/item.cpp'
)
man_files += files(
'man/waybar-tray.5.scd',
)
endif
if libudev.found() and (is_linux or libepoll.found())
add_project_arguments('-DHAVE_LIBUDEV', language: 'cpp')
src_files += files(
'src/modules/backlight.cpp',
'src/modules/backlight_slider.cpp',
'src/util/backlight_backend.cpp',
)
man_files += files(
'man/waybar-backlight.5.scd',
'man/waybar-backlight-slider.5.scd',
)
endif
if libevdev.found() and (is_linux or libepoll.found()) and libinput.found() and (is_linux or libinotify.found())
add_project_arguments('-DHAVE_LIBEVDEV', language: 'cpp')
add_project_arguments('-DHAVE_LIBINPUT', language: 'cpp')
src_files += files('src/modules/keyboard_state.cpp')
man_files += files('man/waybar-keyboard-state.5.scd')
endif
if libmpdclient.found()
add_project_arguments('-DHAVE_LIBMPDCLIENT', language: 'cpp')
src_files += files(
'src/modules/mpd/mpd.cpp',
'src/modules/mpd/state.cpp',
)
man_files += files(
'man/waybar-mpd.5.scd',
)
endif
if libsndio.found()
add_project_arguments('-DHAVE_LIBSNDIO', language: 'cpp')
src_files += files('src/modules/sndio.cpp')
man_files += files('man/waybar-sndio.5.scd')
endif
if get_option('rfkill').enabled() and is_linux
add_project_arguments('-DWANT_RFKILL', language: 'cpp')
src_files += files(
'src/util/rfkill.cpp'
)
endif
if have_chrono_timezones
add_project_arguments('-DHAVE_CHRONO_TIMEZONES', language: 'cpp')
src_files += files('src/modules/clock.cpp')
man_files += files('man/waybar-clock.5.scd')
elif tz_dep.found()
add_project_arguments('-DHAVE_LIBDATE', language: 'cpp')
src_files += files('src/modules/clock.cpp')
man_files += files('man/waybar-clock.5.scd')
else
src_files += files('src/modules/simpleclock.cpp')
man_files += files('man/waybar-clock.5.scd')
endif
if get_option('experimental')
add_project_arguments('-DHAVE_WLR_WORKSPACES', language: 'cpp')
src_files += files(
'src/modules/wlr/workspace_manager.cpp',
'src/modules/wlr/workspace_manager_binding.cpp',
)
man_files += files(
'man/waybar-wlr-workspaces.5.scd',
)
endif
cava = dependency('cava',
version : '>=0.10.2',
required: get_option('cava'),
fallback : ['cava', 'cava_dep'],
not_found_message: 'cava is not found. Building waybar without cava')
if cava.found()
add_project_arguments('-DHAVE_LIBCAVA', language: 'cpp')
src_files += files('src/modules/cava.cpp')
man_files += files('man/waybar-cava.5.scd')
endif
subdir('protocol')
app_resources = []
subdir('resources/icons')
executable(
'waybar',
[src_files],
[src_files, app_resources],
dependencies: [
gtk_layer_shell,
gtkmm,
giounix,
thread_dep,
client_protos,
wayland_client,
fmt,
spdlog,
sigcpp,
jsoncpp,
wayland_client,
wayland_cursor,
client_protos,
spdlog
gtkmm,
dbusmenu_gtk,
giounix,
libinput,
libnl,
libnlgen,
upower_glib,
pipewire,
playerctl,
libpulse,
libjack,
libwireplumber,
libudev,
libinotify,
libepoll,
libmpdclient,
libevdev,
gtk_layer_shell,
libsndio,
tz_dep,
xkbregistry,
cava
],
include_directories: inc_dirs,
install: true,
)
install_data(
'./resources/config',
'./resources/style.css',
install_dir: sysconfdir + '/xdg/waybar'
'resources/config.jsonc',
'resources/style.css',
install_dir: sysconfdir / 'xdg/waybar'
)
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
if scdoc.found()
man_files += configure_file(
input: 'man/waybar.5.scd.in',
output: 'waybar.5.scd',
configuration: {
'sysconfdir': prefix / sysconfdir
}
)
man_files += configure_file(
input: 'man/waybar-styles.5.scd.in',
output: 'waybar-styles.5.scd',
configuration: {
'sysconfdir': prefix / sysconfdir
}
)
fs = import('fs')
mandir = get_option('mandir')
foreach file : man_files
basename = fs.name(file)
topic = basename.split('.')[-3]
section = basename.split('.')[-2]
output = '@0@.@1@'.format(topic, section)
custom_target(
output,
input: file,
output: output,
command: scdoc.get_variable('scdoc'),
feed: true,
capture: true,
install: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
endif
catch2 = dependency(
'catch2',
default_options: [ 'tests=false' ],
fallback: ['catch2', 'catch2_dep'],
required: get_option('tests'),
)
if catch2.found()
subdir('test')
endif
clangtidy = find_program('clang-tidy', required: false)
if clangtidy.found()
run_target(
'tidy',
command: [
clangtidy,
'-checks=*,-fuchsia-default-arguments',
'-p', meson.project_build_root()
] + src_files)
endif

View File

@ -4,27 +4,36 @@
, version
}:
let
catch2_3 = {
src = pkgs.fetchFromGitHub
{
owner = "catchorg";
repo = "Catch2";
rev = "v3.5.1";
hash = "sha256-OyYNUfnu6h1+MfCF8O+awQ4Usad0qrdCtdZhYgOY+Vw=";
};
libcava = rec {
version = "0.10.2";
src = pkgs.fetchFromGitHub {
owner = "LukashonakV";
repo = "cava";
rev = version;
hash = "sha256-jU7RQV2txruu/nUUl0TzjK4nai7G38J1rcTjO7UXumY=";
};
};
in
(waybar.overrideAttrs (oldAttrs: rec {
inherit version;
(waybar.overrideAttrs (
oldAttrs: {
inherit version;
src = lib.cleanSourceWith {
filter = name: type: type != "regular" || !lib.hasSuffix ".nix" name;
src = lib.cleanSource ../.;
};
})
).override {
catch2_3 = pkgs.catch2_3.overrideAttrs (oldAttrs: {
version = "3.5.1";
src = catch2_3.src;
});
}
src = lib.cleanSourceWith {
filter = name: type: type != "regular" || !lib.hasSuffix ".nix" name;
src = lib.cleanSource ../.;
};
mesonFlags = lib.remove "-Dgtk-layer-shell=enabled" oldAttrs.mesonFlags;
buildInputs = (builtins.filter (p: p.pname != "wireplumber") oldAttrs.buildInputs) ++ [
pkgs.wireplumber
];
postUnpack = ''
pushd "$sourceRoot"
cp -R --no-preserve=mode,ownership ${libcava.src} subprojects/cava-${libcava.version}
patchShebangs .
popd
'';
}
))

View File

@ -1,4 +1,4 @@
wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')
wl_protocol_dir = wayland_protos.get_variable(pkgconfig: 'pkgdatadir')
wayland_scanner = find_program('wayland-scanner')
@ -43,7 +43,7 @@ endforeach
gdbus_codegen = find_program('gdbus-codegen')
r = run_command(gdbus_codegen, '--body', '--output', '/dev/null')
r = run_command(gdbus_codegen, '--body', '--output', '/dev/null', check: false)
if r.returncode() != 0
gdbus_code_dsnw = custom_target(
'dbus-status-notifier-watcher.[ch]',

View File

@ -1,3 +1,4 @@
// -*- mode: jsonc -*-
{
// "layer": "top", // Waybar at top layer
// "position": "bottom", // Waybar position (top|bottom|left|right)
@ -5,9 +6,32 @@
// "width": 1280, // Waybar width
"spacing": 4, // Gaps between modules (4px)
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad", "custom/media"],
"modules-center": ["sway/window"],
"modules-right": ["mpd", "idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "keyboard-state", "sway/language", "battery", "battery#bat2", "clock", "tray"],
"modules-left": [
"sway/workspaces",
"sway/mode",
"sway/scratchpad",
"custom/media"
],
"modules-center": [
"sway/window"
],
"modules-right": [
"mpd",
"idle_inhibitor",
"pulseaudio",
"network",
"power-profiles-daemon",
"cpu",
"memory",
"temperature",
"backlight",
"keyboard-state",
"sway/language",
"battery",
"battery#bat2",
"clock",
"tray"
],
// Modules configuration
// "sway/workspaces": {
// "disable-scroll": true,
@ -49,7 +73,7 @@
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
"interval": 2,
"interval": 5,
"consume-icons": {
"on": " "
},
@ -113,6 +137,7 @@
"critical": 15
},
"format": "{capacity}% {icon}",
"format-full": "{capacity}% {icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
@ -123,6 +148,17 @@
"battery#bat2": {
"bat": "BAT2"
},
"power-profiles-daemon": {
"format": "{icon}",
"tooltip-format": "Power profile: {profile}\nDriver: {driver}",
"tooltip": true,
"format-icons": {
"default": "",
"performance": "",
"balanced": "",
"power-saver": ""
}
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}%) ",
@ -164,4 +200,3 @@
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
}
}

View File

@ -23,7 +23,7 @@ def signal_handler(sig, frame):
class PlayerManager:
def __init__(self, selected_player=None):
def __init__(self, selected_player=None, excluded_player=[]):
self.manager = Playerctl.PlayerManager()
self.loop = GLib.MainLoop()
self.manager.connect(
@ -35,11 +35,14 @@ class PlayerManager:
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
self.selected_player = selected_player
self.excluded_player = excluded_player.split(',') if excluded_player else []
self.init_players()
def init_players(self):
for player in self.manager.props.player_names:
if player.name in self.excluded_player:
continue
if self.selected_player is not None and self.selected_player != player.name:
logger.debug(f"{player.name} is not the filtered player, skipping it")
continue
@ -133,6 +136,10 @@ class PlayerManager:
def on_player_appeared(self, _, player):
logger.info(f"Player has appeared: {player.name}")
if player.name in self.excluded_player:
logger.debug(
"New player appeared, but it's in exclude player list, skipping")
return
if player is not None and (self.selected_player is None or player.name == self.selected_player):
self.init_player(player)
else:
@ -149,6 +156,8 @@ def parse_arguments():
# Increase verbosity with every occurrence of -v
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-x", "--exclude", "- Comma-separated list of excluded player")
# Define for which player we"re listening
parser.add_argument("--player")
@ -174,7 +183,10 @@ def main():
logger.info("Creating player manager")
if arguments.player:
logger.info(f"Filtering for player: {arguments.player}")
player = PlayerManager(arguments.player)
if arguments.exclude:
logger.info(f"Exclude player {arguments.exclude}")
player = PlayerManager(arguments.player, arguments.exclude)
player.run()

View File

@ -48,6 +48,11 @@ button:hover {
box-shadow: inset 0 -3px #ffffff;
}
/* you can set a style on hover for any module like this */
#pulseaudio:hover {
background-color: #a37800;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
@ -69,7 +74,7 @@ button:hover {
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
box-shadow: inset 0 -3px #ffffff;
}
#clock,
@ -87,6 +92,7 @@ button:hover {
#mode,
#idle_inhibitor,
#scratchpad,
#power-profiles-daemon,
#mpd {
padding: 0 10px;
color: #ffffff;
@ -128,16 +134,36 @@ button:hover {
}
}
/* Using steps() instead of linear as a timing function to limit cpu usage */
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-timing-function: steps(12);
animation-iteration-count: infinite;
animation-direction: alternate;
}
#power-profiles-daemon {
padding-right: 15px;
}
#power-profiles-daemon.performance {
background-color: #f53c3c;
color: #ffffff;
}
#power-profiles-daemon.balanced {
background-color: #2980b9;
color: #ffffff;
}
#power-profiles-daemon.power-saver {
background-color: #2ecc71;
color: #000000;
}
label:focus {
background-color: #000000;
}

View File

@ -24,18 +24,61 @@ AAppIconLabel::AAppIconLabel(const Json::Value& config, const std::string& name,
image_.set_pixel_size(app_icon_size_);
}
std::string toLowerCase(const std::string& input) {
std::string result = input;
std::transform(result.begin(), result.end(), result.begin(),
[](unsigned char c) { return std::tolower(c); });
return result;
}
std::optional<std::string> getFileBySuffix(const std::string& dir, const std::string& suffix,
bool check_lower_case) {
if (!std::filesystem::exists(dir)) {
return {};
}
for (const auto& entry : std::filesystem::recursive_directory_iterator(dir)) {
if (entry.is_regular_file()) {
std::string filename = entry.path().filename().string();
if (filename.size() < suffix.size()) {
continue;
}
if ((filename.compare(filename.size() - suffix.size(), suffix.size(), suffix) == 0) ||
(check_lower_case && filename.compare(filename.size() - suffix.size(), suffix.size(),
toLowerCase(suffix)) == 0)) {
return entry.path().string();
}
}
}
return {};
}
std::optional<std::string> getFileBySuffix(const std::string& dir, const std::string& suffix) {
return getFileBySuffix(dir, suffix, false);
}
std::optional<std::string> getDesktopFilePath(const std::string& app_identifier,
const std::string& alternative_app_identifier) {
if (app_identifier.empty()) {
return {};
}
const auto data_dirs = Glib::get_system_data_dirs();
for (const auto& data_dir : data_dirs) {
const auto data_app_dir = data_dir + "applications/";
auto desktop_file_path = data_app_dir + app_identifier + ".desktop";
if (std::filesystem::exists(desktop_file_path)) {
const auto data_app_dir = data_dir + "/applications/";
auto desktop_file_suffix = app_identifier + ".desktop";
// searching for file by suffix catches cases like terminal emulator "foot" where class is
// "footclient" and desktop file is named "org.codeberg.dnkl.footclient.desktop"
auto desktop_file_path = getFileBySuffix(data_app_dir, desktop_file_suffix, true);
// "true" argument allows checking for lowercase - this catches cases where class name is
// "LibreWolf" and desktop file is named "librewolf.desktop"
if (desktop_file_path.has_value()) {
return desktop_file_path;
}
if (!alternative_app_identifier.empty()) {
desktop_file_path = data_app_dir + alternative_app_identifier + ".desktop";
if (std::filesystem::exists(desktop_file_path)) {
desktop_file_suffix = alternative_app_identifier + ".desktop";
desktop_file_path = getFileBySuffix(data_app_dir, desktop_file_suffix, true);
if (desktop_file_path.has_value()) {
return desktop_file_path;
}
}
@ -58,16 +101,9 @@ std::optional<Glib::ustring> getIconName(const std::string& app_identifier,
return app_identifier_desktop;
}
const auto to_lower = [](const std::string& str) {
auto str_cpy = str;
std::transform(str_cpy.begin(), str_cpy.end(), str_cpy.begin(),
[](unsigned char c) { return std::tolower(c); });
return str;
};
const auto first_space = app_identifier.find_first_of(' ');
if (first_space != std::string::npos) {
const auto first_word = to_lower(app_identifier.substr(0, first_space));
const auto first_word = toLowerCase(app_identifier.substr(0, first_space));
if (DefaultGtkIconThemeWrapper::has_icon(first_word)) {
return first_word;
}
@ -75,7 +111,7 @@ std::optional<Glib::ustring> getIconName(const std::string& app_identifier,
const auto first_dash = app_identifier.find_first_of('-');
if (first_dash != std::string::npos) {
const auto first_word = to_lower(app_identifier.substr(0, first_dash));
const auto first_word = toLowerCase(app_identifier.substr(0, first_dash));
if (DefaultGtkIconThemeWrapper::has_icon(first_word)) {
return first_word;
}

View File

@ -9,10 +9,23 @@ AIconLabel::AIconLabel(const Json::Value &config, const std::string &name, const
bool enable_click, bool enable_scroll)
: ALabel(config, name, id, format, interval, ellipsize, enable_click, enable_scroll) {
event_box_.remove();
label_.unset_name();
label_.get_style_context()->remove_class(MODULE_CLASS);
box_.get_style_context()->add_class(MODULE_CLASS);
if (!id.empty()) {
label_.get_style_context()->remove_class(id);
box_.get_style_context()->add_class(id);
}
box_.set_orientation(Gtk::Orientation::ORIENTATION_HORIZONTAL);
box_.set_spacing(8);
box_.set_name(name);
int spacing = config_["icon-spacing"].isInt() ? config_["icon-spacing"].asInt() : 8;
box_.set_spacing(spacing);
box_.add(image_);
box_.add(label_);
event_box_.add(box_);
}

View File

@ -50,6 +50,17 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st
label_.set_xalign(align);
}
}
if (config_["justify"].isString()) {
auto justify_str = config_["justify"].asString();
if (justify_str == "left") {
label_.set_justify(Gtk::Justification::JUSTIFY_LEFT);
} else if (justify_str == "right") {
label_.set_justify(Gtk::Justification::JUSTIFY_RIGHT);
} else if (justify_str == "center") {
label_.set_justify(Gtk::Justification::JUSTIFY_CENTER);
}
}
}
auto ALabel::update() -> void { AModule::update(); }

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