Commit Graph
52 Commits
Author SHA1 Message Date
Guilherme Daher ab08e22494 fix: fix module backlight format using clang 2026-08-13 08:50:04 -03:00
Alexis Rouillard 7ceb61a64d Merge pull request #5210 from gitmpr/fix/backlight-min-brightness-step-clamp
fix(backlight): clamp scroll step to min-brightness
2026-08-03 23:05:40 +02:00
gitmpr 7409ff6976 backlight: clamp scroll step to min-brightness
When min-brightness is set, a scroll step that would cross it was not
clamped — only scrolling while already at or below min was blocked.
With scroll-step: 5 and min-brightness: 1, scrolling from 5% would
pass the guard (5 > 1) and set brightness to 0%.

Fix by computing the post-step value before applying it: if it would
fall below min-brightness, set exactly to min-brightness instead.
2026-07-18 20:41:40 +02:00
yubo 5b8c98729f refactor: rm direct dp.emit() call in constructor. 2026-07-18 21:14:08 +08:00
Alex 86b8dd6b1b refactor: migrate backlight/battery/bluetooth/gps to updateLabelAndTooltip 2026-07-04 00:01:17 +02:00
Alex a6821e428c Merge remote-tracking branch 'origin/master' into feat/brightness-percent-exp
# Conflicts:
#	src/modules/backlight.cpp
2026-07-03 22:39:10 +02:00
Prakhar Chhalotre 3e7976c8eb fix: use pango markup for consistent formatting in format and tooltip-format 2026-02-13 02:23:16 +05:30
Alex 47fb21a2c1 chore: upgrade to clang-format@21 2026-02-04 09:24:14 +01:00
Henrique Oliveira 90f2490407 Fix: Backlight same issue with states 2025-07-23 20:26:17 +02:00
Lars Niesen d684a6de21 Backlight: Set default to 0 to prevent breaking existing setups 2024-09-25 16:37:21 +02:00
Lars Niesen 04bda9f443 Backlight: Add minimum brightness
As currently it is possible to turn the brightness to zero which may not
be desirable, this patch add a configurable brightness check.
2024-09-25 06:24:03 +02:00
Brenno Lemos fd3710d869 chore: suppress compiler warning 2023-10-15 17:52:12 -03:00
Brenno Lemos c3779dd16e refactor: move backlight backend out of backlight module 2023-10-15 17:52:12 -03:00
Brenno Lemos 1b98a04c93 chore: lint unrelated files so the CI passes 2023-10-02 12:33:28 -03:00
idm1tryandAlexis Rouillard 81ffeebfb1 fix: style
Co-authored-by: Alexis Rouillard <alexisr245@gmail.com>
2023-09-21 09:03:13 +05:00
idm1try 388c024298 fix(backlight): wrong percentage numbers for device apple-panel-bl 2023-09-19 18:50:39 +05:00
Alex 841a004acd fix: lint 2023-07-18 08:28:19 +02:00
may facb53e81f backlight: do not convert percent to string in fmt 2023-07-16 04:14:43 +02:00
Alexis Rouillard bfa5c43313 Merge branch 'master' into feat/brightness-percent-exp 2023-07-04 23:02:18 +02:00
Robert Günzler 0f8c156f24 Lift reverse-scrolling option into AModule
The option is generally useful when scrolling is used, when configuring
input devices to use "natural scroll direction".
Both backlight and pulseaudio were using different implementations, this
unifies and documents them.

Signed-off-by: Robert Günzler <r@gnzler.io>
2023-06-12 14:08:18 +09:00
Alex ede1d25440 fix: lint 2023-04-17 09:01:14 +02:00
yeheng282 022c9abad4 backlight: support tooltip 2023-04-11 21:01:02 +08:00
Kuruyia 973aa09f8b refactor(backlight): fix linter 2023-02-03 18:18:44 +01:00
Kuruyia e8c4b85328 feat(backlight): use dbus to set the brightness 2023-02-03 12:58:52 +01:00
Kuruyia a78f0124d2 feat(backlight): add brightness control 2023-02-01 14:46:55 +01:00
Aleksei Bavshin ea17a66dfc fix: compilation errors with cpp_std=c++20
There were two main issues with fmtlib and C++20 mode:

 - `fmt::format` defaults to compile-time argument checking and requires
   using `fmt::runtime(format_string)` to bypass that.
 - `std::format` implementation introduces conflicting declarations and
   we have to specify the namespace for all `format`/`format_to` calls.
2023-01-20 22:50:02 -08:00
Narice dbb8a881be feat(backlight): Added icon_exp and changed syntax
changed syntax of percentexp to percent_exp for readability
2022-12-06 19:22:21 +01:00
Narice 0fdc4c11f3 feat(backlight): added percentexp as format option
Humans don't perceive light linearly and so an exponential curve is more
appropriate to gauge the perceived brightness of the screen.
2022-12-06 18:40:38 +01:00
Simon Plakolb 5e9bbe5c76 modules: Revert button to label 2022-11-24 13:08:16 +01:00
Jef Steelant 9f0a14c22b make linter happy 2022-11-10 09:19:49 +01:00
Baltazár Radics d02e23c759 feat(backlight): hide if the display is powered off 2022-11-07 13:57:21 +01:00
Kelsey Judson 253222d31c Make backlight module respect format-<state> config 2022-11-07 21:06:16 +13:00
Simon Plakolb b8322c4b4b button: Add AButton class
The AButton class is designed as full a substitute to ALabel. The
GtkButton attribute 'button_' is initialized with a label. This
label can the be referenced by the subsequent inheritors of AButton
instead of the GtkLabel attribute 'label_' of ALabel.
For convenience a GtkLabel* 'label_' attribute is added to AButton.

If the button cannot be clicked it is disabled, effectively acting
like its label predecessor.

GtkButton seems to catch one-click mouse events regardless of the
flags set on it. Therefore, 'signal_pressed' is connected to a
function creating a fake GdkEventButton* and calling 'handleToggle'
(for details on this possible bug in GTK see:
https://stackoverflow.com/questions/45334911 )

In accordance with other GtkButtons (i.e. the sway/workspace ones)
set_relief(Gtk::RELIEF_NONE) is called on the 'button_' instance.
2022-10-12 10:25:29 +02:00
Bao Trinh 96746142d2 Backlight: don't reset value when failing to read
Avoids the brightness percentage resetting to 0 on intermittent failures
2022-04-21 22:19:05 -05:00
Bao Trinh 1af7191740 Backlight: avoid crash on getting brightness fails
Reading brightness value for backlight device can fail intermittently
(particularly when using ddcci-driver-linux). Handle this more
gracefully rather than crashing
2022-04-21 22:02:45 -05:00
Alex f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Matan1x aacd0fcc65 round brightness 2021-09-08 17:12:30 +03:00
Alex e01a081f2f fix(brightness): amd brightness 2020-04-21 09:11:56 +02:00
Alex 687c50dc13 refactor: remove old stuff 2020-04-12 18:31:07 +02:00
Alex b40cdcb5bd refactor: call parent update 2020-04-12 18:30:21 +02:00
Jordi Pakey-Rodriguez 0f0765e517 feat(modules): call user on-update if configured 2019-12-05 14:42:36 -08:00
Alex d24d85bebf refactor: move label name and id to label contructor 2019-05-22 12:06:24 +02:00
Ilia Sheshukov 9fa0eb7068 more elegant amd fix 2019-05-17 22:30:45 +03:00
Dan 5f0a3063d1 feat(states): add getState to other percent based modules 2019-05-02 22:24:29 -04:00
Dan 3bac96945c Revert "feat(percent): adds a percent class to numeric modules"
This reverts commit 82302e58f3b611f7ff6d686d1783b1c32914f7c9.
2019-05-02 22:24:29 -04:00
Dan 472363a623 feat(percent): adds a percent class to numeric modules 2019-05-02 22:24:29 -04:00
Alex 311c34ecbc feat(Bar): handle widget size changes 2019-04-24 12:37:24 +02:00
Alex 6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Ian Hattendorf 39de8e544c Disable backlight module if no backlight found 2019-02-28 19:50:57 -07:00
Ian Hattendorf c1295c8fd6 Fix crash when monitor unplugged
`Backlight#devices_` was being destructed before
`Backlight#udev_thread_`. Also check if thread is still running after
`epoll_wait`
2019-02-25 20:05:44 -07:00