Commit Graph

36 Commits

Author SHA1 Message Date
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
Nicola Revelant 2d12236726 Use the correct thermal zone in FreeBSD 2024-03-15 16:09:18 +01:00
Alex bd0bf836c7 fix: lint 2024-02-19 23:07:50 +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
yangyingchao e403c3b71b support multiple items in hwmon-path of temperature module
So user can share configuration file among different machines with different hardware
configurations.
2023-06-17 11:33:14 +08: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
Simon Plakolb 5e9bbe5c76 modules: Revert button to label 2022-11-24 13:08:16 +01:00
Loïc Bartoletti 27c6c96b37
Merge branch 'master' into freebsd_temperature_use_thermal-zone_config 2022-10-17 09:34:06 +02:00
Simon Plakolb 2b735f44bc modules: Set tooltip on button
Mouse-over tooltips set on the label only appear once the mouse hovers
over exactly the label. Other apps (e.g. firefox) show the tooltip once
the pointer hovers the button. Not solely its label. With this commit we
get the same behaviour.
2022-10-12 10:25:30 +02:00
Simon Plakolb 8fa5d9b838 modules: Set style-context on button
Fixes issue where the class parameters in style.css would have no
effect.

The CSS now references the GtkButton instead of the GtkLabel. Removing
all style-classes from the custom module GtkButton however removes
any properties set via style.css. Thus, the default classes 'flat' and
'text-button' are added on every update of these modules.
2022-10-12 10:25:30 +02: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
Loïc Bartoletti ddf3e11240 remove clang-format lines 2022-10-04 11:28:32 +02:00
Loïc Bartoletti 1ca660460a apply clang-format 2022-10-04 08:03:54 +02:00
Loïc Bartoletti 0898236586 remove useless include <sys/types.h> 2022-10-04 07:37:05 +02:00
Loïc Bartoletti c3e91cd228 [FreeBSD] Use thermal-zone
The zone was hardcoded in #1702.
This commit allows to use the "thermal-zone"
variable.

Follow up #1702
2022-10-04 07:29:16 +02:00
Loïc Bartoletti 024777a5bc FreeBSD: Add support to temperature
This commit aims to propose a FreeBSD to gain temperature support using
sysctl on hw.acpi.thermal.tz0.temperature.
2022-09-30 21:12:28 +02:00
Alex f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Viktar Lukashonak 6946288053
PR #1485 review 2022-03-17 11:31:06 +03:00
Viktar Lukashonak 9f337db2d2
Hide/Unhide module when "format*" is empty. 2022-03-16 15:50:00 +03:00
Daniel De Graaf 3b576ae12d Add "tooltip-format" to temperature module 2020-11-26 20:23:19 -05:00
Alex e96a0bf799 refactor(custom): tooltip markup 2020-05-30 11:59:22 +02:00
phosit 6e946bf872 Add kelvin-scale 2020-04-25 18:44:48 +02:00
Alex 4a7dd400fe
Merge branch 'master' into on-update 2020-04-12 18:32:19 +02:00
Alex b40cdcb5bd refactor: call parent update 2020-04-12 18:30:21 +02:00
BoostCookie d405f28622
Indent now uses spaces. 2020-03-13 16:42:05 +01:00
BoostCookie 2f975f870a Added support for absolute device paths for the temperature module. 2020-03-12 22:04:00 +01: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
Alex fcb23d3104 feat(temperature): format-icons 2019-05-13 11:31:05 +02:00
Alex 80e9ea746b fix(battery): use path for the / operator 2019-05-12 19:53:22 +02:00
Alex 6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Alex 5870421f84 refactor(temperature): check if file exist on init 2019-04-11 15:08:23 +02:00
Alex 6d2dcd8ac7 fix(temperature): default thermal zone 2019-03-14 14:01:10 +01:00
Groggy 7ae549dc9e
Add temperature module 2019-03-13 13:35:43 +01:00