Commit Graph

173 Commits

Author SHA1 Message Date
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
Spenser Truex 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
Ingo Feinerer 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
michaelbuch12@gmail.com 798809ce02 Make volume component work on FreeBSD
- Edit compile instructions
- Reuse OpenBSD sndio implementation
2022-10-26 21:24:14 +02:00
michaelbuch12@gmail.com 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
Ingo Feinerer 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
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
Cem Keylan 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
Ryan Kes 2b0f50d1aa Add separator module 2020-11-30 21:15:13 +01:00
Michael Buch a1ac203d16 Add ram and swap components on FreeBSD 2019-02-16 16:58:34 +01:00
Ingo Feinerer 10bdf01b71 cpu_perc: Check for division by zero 2019-02-16 16:56:55 +01:00
Ingo Feinerer d518472e62 Fix CPU frequency on OpenBSD 2019-02-13 18:04:14 +01:00
Michael Buch a9193a757a close file descriptors and fix return values 2019-02-13 15:23:04 +01:00
Ingo Feinerer c1dc896c80 Add native OpenBSD support for mute/volume
Based on functionality in dstat by Joerg Jung.
2019-02-13 13:35:44 +01:00
Michael Buch e724907cc3 wifi component on FreeBSD 2019-02-13 13:10:20 +01:00
Michael Buch 86849d295b Add FreeBSD support for netspeeds, entropy and ip components 2019-02-07 12:23:01 +01:00
Michael Buch 120d150594 Add support for cpu and uptime components on FreeBSD 2019-02-05 09:31:06 +01:00
Michael Buch ec306623df Add FreeBSD support for temperature and battery components 2019-02-05 09:30:21 +01:00
Aaron Marcher dd7f1896aa ram: Consistency with line breaks 2018-07-08 17:45:32 +02:00
Aaron Marcher e213b48122 Fix whitespace 2018-07-08 17:44:53 +02:00
Aaron Marcher 96ddf4e1de Consistency with 80 char limit and breaks 2018-07-08 17:42:58 +02:00
Aaron Marcher c93971748c wifi_perc: Simplify on Linux
Remove unnecessary variable
2018-07-07 14:05:53 +02:00
Aaron Marcher acfa1f50c2 Simplify format specifiers for uintmax_t 2018-07-07 11:08:26 +02:00
Aaron Marcher c2492c3f99 cpu_freq: Simplify with E-notation
Thanks to the FRIGN
2018-07-07 10:56:10 +02:00
Aaron Marcher e20b50112e cpu_freq: Change to 64 bit integers
Remove unnecessary cast to size_t
2018-07-07 10:54:12 +02:00
Aaron Marcher 43a12832a3 Change uint64_t to uintmax_t 2018-07-07 10:50:25 +02:00
Aaron Marcher d76b1a21fc battery: 64 bit ints on Linux 2018-07-07 10:31:57 +02:00
Aaron Marcher b792b7ab69 cpu: Use uint64_t on OpenBSD 2018-07-07 00:24:36 +02:00
Aaron Marcher 609ef3aa1f battery: Remove unnecessary defines for paths 2018-07-06 23:55:18 +02:00
Aaron Marcher 16e15217c6 uptime: Improve typing and sort headers 2018-07-06 23:47:52 +02:00
Aaron Marcher d1e3398822 temperature: Improve types 2018-07-06 23:41:02 +02:00
Aaron Marcher ab4f24a612 ram: Check for theoretical division by zero 2018-07-06 23:38:12 +02:00
Aaron Marcher fa7c266e2b ram: Use POSIX types 2018-07-06 23:37:05 +02:00
Aaron Marcher b65c058598 entropy: Use POSIX types for format specifiers 2018-07-06 23:26:12 +02:00
Aaron Marcher c59b64e643 entropy: Improve types 2018-07-06 23:17:08 +02:00
Aaron Marcher 51ff7ce2b9 Consistent paramter naming for components 2018-07-06 08:08:48 +02:00
Ian Remmler 32e0a2bfcc Add flexible formatting to keyboard_indicators.
Updated for style.
2018-06-04 14:06:11 +02:00
Tobias Tschinkowitz 005b541717 uptime: unification of the uptime function for linux/openbsd 2018-06-01 20:17:25 +02:00
Tobias Tschinkowitz 8c8091f4f1 wifi: fixed disconnected wifi status on openbsd 2018-05-31 15:10:04 +02:00
Aaron Marcher b0401b13bb Clean up header includes
- Remove <errno.h> because related functions are in util.c now
 - Remove corresponding <string.h> if not used otherwise
2018-05-30 19:35:37 +02:00
Tobias Tschinkowitz 0c29fc56f9 swap: removed unused include 2018-05-29 14:43:14 +02:00
Laslo Hunhold a18439af11 Refactor swap.c to use getline() instead of buf-filling
This drops a lot of code and even though we are using a common function,
the specification of only the needed things keeps it very efficient and
even more efficient in memory and time than the previous solution.
2018-05-28 22:21:34 +02:00
Laslo Hunhold 682c0fedde Use E-notation for large powers of 10 2018-05-27 19:53:36 +02:00
Aaron Marcher c28643ce5b Revert "Add basic backlight percentage support"
On OpenBSD the backlight percentage cannot be retrieved in a simple way.
The only two solutions we are aware of for now are:

 - reading from /dev/ttyC0: which isn't possible without changing
 permissions or running slstatus as root
 - linking against xcb-xrandr: which is bloat and does not work in every
 case appearently

This reverts commit 37724ac2c3 for now.
2018-05-27 16:46:03 +02:00
Tobias Tschinkowitz 5db729fedb ram: fixed int overflow on pagetok macro 2018-05-24 14:51:30 +02:00
Laslo Hunhold f17f39d0a2 Refactor keymap.c
- Get rid of camel-casing
 - Don't use all-caps for variable names
 - use LEN()-macro
 - use strncmp() rather than strstr() for prefix-checking
 - clean up the tokenizer-loop and don't use copies
 - make the loop more readable by separating different breaking
   conditions
 - stricter error-checking and cleanup
 - store the layout directly with bprintf rather than having
   a separate buffer
2018-05-23 19:56:16 +02:00
Aaron Marcher d6ad87ce06 keymap: Add braces for for loop 2018-05-23 13:30:45 +02:00
Michael Buch 943b42de05 Add keymap component
Adding a new keymap component that will
indicate the current keyboard layout (language)
and variant if any was set. I use the
standard X11 XKB APIs to retrieve and parse
the xkb_symbols set with setxkbmap.
2018-05-23 10:09:13 +02:00
Aaron Marcher 825f637e20 netspeeds: Fix indentation 2018-05-22 12:42:31 +02:00