Commit Graph

591 Commits

Author SHA1 Message Date
87c3dd2c36 battery: Consistent naming for capacity percentage
https://www.kernel.org/doc/html/latest/power/power_supply_class.html

Co-authored-by: drkhsh <me@drkhsh.at>
Signed-off-by: drkhsh <me@drkhsh.at>
2022-12-19 02:44:21 +01:00
d77f216fae Sort functions by name
Co-authored-by: drkhsh <me@drkhsh.at>
Signed-off-by: drkhsh <me@drkhsh.at>
2022-12-19 02:44:21 +01:00
40f13be551 uptime: Use sizeof instead of repeating the size
Signed-off-by: drkhsh <me@drkhsh.at>
2022-12-19 02:44:21 +01:00
c75cb9ad7a keymap: Variable "layout" should be const
Signed-off-by: drkhsh <me@drkhsh.at>
2022-12-19 02:44:21 +01:00
89f8476110 disk: Cast fsblkcnt_t to double instead of float
Signed-off-by: drkhsh <me@drkhsh.at>
2022-12-19 02:44:21 +01:00
0e2ff8dc10 verr: Remove special "usage" case
In function verr, remove special case for "usage"
string

Co-authored-by: drkhsh <me@drkhsh.at>
Signed-off-by: drkhsh <me@drkhsh.at>
2022-12-19 02:44:21 +01:00
e22d447684 config.def.h: Remove stray double quote in comment
Signed-off-by: drkhsh <me@drkhsh.at>
2022-12-19 02:44:21 +01:00
173b03417d Update README 2022-12-19 02:44:21 +01:00
982eb223a0 battery: Fix remaining on Linux
The current version displays the remaining time as 'n/a'.

Fixes this regression introduced in 69b2487650782f135db76078c4a7fb841cb936ac
where current_now and power_now were incorrectly replaced with current and
power when they were moved to a macro.
2022-12-01 09:04:32 +01:00
57c6e7340d New component: cat
Generically reads an arbitrary file natively.

Saves a few layers of execution in comparison to using `run_command`
with an argument like `cat ./file`.
2022-11-24 00:01:52 +01:00
4bd78c94ba README: Add note about FreeBSD sndio dep 2022-10-28 01:03:56 +02:00
cce2e5ecb0 radical re-formatting 3/3: Error checks
Check for `< 0` instead of `== -1`.

Fixes coding style. Formatting commits suck, incoherent coding style
sucks more.
https://suckless.org/coding_style/
2022-10-28 01:03:46 +02:00
3251e91187 radical re-formatting 2/3: Fix blocks
Fixes coding style. Formatting commits suck, incoherent coding style
sucks more.
https://suckless.org/coding_style/
2022-10-28 01:03:38 +02:00
2104dc362c radical re-formatting 1/3: Fix spacing
Fixes coding style. Formatting commits suck, incoherent coding style
sucks more.
https://suckless.org/coding_style/
2022-10-28 01:03:31 +02:00
0696635bcb radical re-formatting 0/3: Alphabetic headers
Except stated otherwise in comment.

Fixes coding style. Formatting commits suck, incoherent coding style
sucks more.
https://suckless.org/coding_style/
2022-10-28 01:03:20 +02:00
826a5dc862 ram: Refactor on OpenBSD
Fixes up overly complicated lines, by splitting up logic
2022-10-28 01:03:20 +02:00
d7ea986299 ram: Refactor Linux perc/used
Fixes up overly complicated line, by splitting up logic
2022-10-28 01:03:20 +02:00
3b86e4b5ef battery: Refactor remaining on OpenBSD
Fixes up overly complicated line, by splitting up logic
2022-10-28 01:03:20 +02:00
21327e0373 temp: Put sysctl into define to avoid line wraps
Long, wrapped, multi-line if statements suck to read.
This fixes readability.
2022-10-28 01:02:58 +02:00
69b2487650 various: Put paths into defines to avoid line wraps
Long, wrapped, multi-line if statements suck to read.
This fixes readability in the worst places by packing format strings for
paths into defines.
2022-10-28 01:01:10 +02:00
c46c1487a9 separator: kill that useless thing
Just use the format strings dude. :)
2022-10-28 01:00:40 +02:00
NRK
0c2b3e5b5c do not rely on obsolete feature
function prototype with unspecified argument is obsolete since c99.

additionally some of these function which don't take any argument were
being called with a `const char *` arg, which is UB.

fix both these issues by declararing ALL the components to accept a
`const char *`, and name the arg "unused" if it's meant to be ignored.
2022-10-26 23:32:43 +02:00
NRK
28ef0b242c components/*.c: include slstatus.h
this gives the compiler a chance to check weather the prototype and
definiton matches or not, which would catch issues like 3c47701.
2022-10-26 23:32:07 +02:00
f29aa9ab06 Add 'Not charging' status support
Exists on various ThinkPads. Seems to be both a synonym for "full".

Tested on:
- ThinkPad T500 (Spenser Truex <truex@equwal.com)
- ThinkPad T420 (drkhsh <me@drkhsh.at)
2022-10-26 21:34:58 +02:00
0aacce1c52 Add comment about mixer oss module to README 2022-10-26 21:24:20 +02:00
1881569f6c Update LICENSE 2022-10-26 21:24:19 +02:00
3b699c127d Reset sndiod initialization flag on disconnects
If the connection is lost to the sndiod(8) daemon reset the
initialization to allow for a graceful restart.
2022-10-26 21:24:16 +02:00
798809ce02 Make volume component work on FreeBSD
- Edit compile instructions
- Reuse OpenBSD sndio implementation
2022-10-26 21:24:14 +02:00
77bfb76a97 Fix RAM component on FreeBSD
The current implementation uses the wrong type for
given sysctl calls leading to overflow and incorrectly
reported RAM usage. The fix is to use 'unsigned int'
which is what FreeBSD expects.
2022-10-26 21:24:11 +02:00
NRK
3c47701aea Fix keyboard_indicators() prototype
according to both the function definition and the comment in
config.def.h, keyboard_indicators() should take a format string.
2022-10-26 21:24:09 +02:00
84a2f117a3 Update README 2020-11-30 21:32:14 +01:00
ae8a658d0c Update LICENSE 2020-11-30 21:26:40 +01:00
dd5bfc3e51 Add comment for FreeBSD to config.mk
Apparently `-lkvm` is needed for swap on FreeBSD

Thanks to Micheal Buch and Jason Smith
(See thread https://lists.suckless.org/dev/1907/33594.html)
2020-11-30 21:24:34 +01:00
9ac721c23f Use the sioctl_open(3) OpenBSD API to access vol
Starting with OpenBSD 6.7 regular users cannot access raw audio devices
anymore, for improved security.

Instead use the sioctl_open(3) API to access and manipulate audio
controls exposed by sndiod(8). On the first call a permanent connection
is established with the running sndiod daemon, and call-back functions
are registered which are triggered when audio controls are changed
(e.g., a USB headset is attached) or when the volume is modified. On
subsequent calls we poll for changes; if there are no volume changes
this costs virtually nothing.

Joint work with Alexandre Ratchov
2020-11-30 21:24:33 +01:00
aaf279f6dd Add a -1 option flag
Allow slstatus to be used by programs that can grab status by calling
an external program on a periodic basis (e.g. tmux)
2020-11-30 21:23:56 +01:00
d1b23e5509 Handle SIGUSR1 for forced refreshes
At some point one might want to force a refresh for example after
checking email or changing the volume. Sending a SIGUSR1 achieves this
now
2020-11-30 21:23:49 +01:00
dsp
3fc2872d1b Fix temperature reporting on OpenBSD
On OpenBSD although the formula is correct due to integer division a
temperature of for example 54 celsius appears as 5. this patch first
treats it as a floating point op before retaining the non decimal digits
2020-11-30 21:23:48 +01:00
3ac985eb03 Full battery indicator
When you reach full charge the symbol would change
to a question mark "?" as "Full" was not defined,
now it changes to an "o" instead.
2020-11-30 21:23:26 +01:00
2b0f50d1aa Add separator module 2020-11-30 21:15:13 +01:00
b14e039639 Follow International System of Units spacing rules 2019-02-17 16:53:56 +01:00
93daf4f35e Add OS-support notice to README 2019-02-16 17:05:04 +01:00
a1ac203d16 Add ram and swap components on FreeBSD 2019-02-16 16:58:34 +01:00
10bdf01b71 cpu_perc: Check for division by zero 2019-02-16 16:56:55 +01:00
d518472e62 Fix CPU frequency on OpenBSD 2019-02-13 18:04:14 +01:00
a9193a757a close file descriptors and fix return values 2019-02-13 15:23:04 +01:00
c1dc896c80 Add native OpenBSD support for mute/volume
Based on functionality in dstat by Joerg Jung.
2019-02-13 13:35:44 +01:00
e724907cc3 wifi component on FreeBSD 2019-02-13 13:10:20 +01:00
86849d295b Add FreeBSD support for netspeeds, entropy and ip components 2019-02-07 12:23:01 +01:00
b6d0bd2fe4 Update LICENSE 2019-02-05 09:32:47 +01:00
120d150594 Add support for cpu and uptime components on FreeBSD 2019-02-05 09:31:06 +01:00