Commit Graph

900 Commits

Author SHA1 Message Date
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 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
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
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é 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 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
Félix Baylac Jacqué 162b41c4d0 modules/power-profiles-daemon: apply clang-tidy suggestions 2024-02-29 21:46:27 +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
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 c59bb509bd fix: hide icon if window is unfocused 2024-02-26 21:00:16 +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
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
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
zjeffer 42f4386e2e fix clang-tidy errors in hyprland module 2024-02-25 12:11:22 +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
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
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 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 ee2407496f
Revert "Implement windows formating in sway/workspaces" 2024-02-19 23:28:08 +01:00
Alexis Rouillard 742cd7f371
Revert "Add style class for CPU state" 2024-02-19 23:10:10 +01:00
Aleksei Bavshin a95b6a39c9
build: mark bluetooth as Linux-specific 2024-02-19 14:08:22 -08: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
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
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 f3063e86aa
build: install man pages only for enabled modules 2024-02-17 21:43:08 -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 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
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
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
zjeffer dd8d6fbe6c Fix build warnings 2024-02-12 20:09:22 +01:00
Jannik 3bfcd5e086
Add 'active' css class to special workspaces 2024-02-07 16:33:19 +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
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