Commit Graph

72 Commits

Author SHA1 Message Date
drkhsh 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
drkhsh c46c1487a9 separator: kill that useless thing
Just use the format strings dude. :)
2022-10-28 01:00:40 +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
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
Ryan Kes 2b0f50d1aa Add separator module 2020-11-30 21:15:13 +01:00
Michael Buch ec306623df Add FreeBSD support for temperature and battery components 2019-02-05 09:30:21 +01:00
Aaron Marcher 96ddf4e1de Consistency with 80 char limit and breaks 2018-07-08 17:42:58 +02:00
Ian Remmler 32e0a2bfcc Add flexible formatting to keyboard_indicators.
Updated for style.
2018-06-04 14:06:11 +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
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
David Demelier 37724ac2c3 Add basic backlight percentage support
At the moment linux only, but will add support for OpenBSD as well.
2018-05-22 12:40:31 +02:00
Aaron Marcher fc0dde5a60 Remove fmt from load_avgs for consistency
In a later commit something like that will be enabled for every
component
2018-05-21 14:14:45 +02:00
Tobias Tschinkowitz 22175f0d57 implemented openbsd netspeed functions
implemented the netspeed functionality for openbsd.
furthermore the static keyword was removed of the interval variable in
config.def.h for usage as extern variable.
2018-05-19 01:44:36 +02:00
Aaron Marcher 176d8ff874 Add netspeeds to config.def.h 2018-05-19 00:40:59 +02:00
Aaron Marcher 2604f25b16 Fix indentation
Tabs for indentation, spaces for alignment
2018-05-18 15:32:15 +02:00
Tobias Tschinkowitz 8c8326f793 Add battery_remaining function on OpenBSD
Implementation of a battery_remaining function which returns the
remaining battery time in HH:MM format. Linux function still needs
implementation.
Move common code to load_apm_power_info
2018-05-18 15:25:42 +02:00
Aaron Marcher 11ce8ed013 Change interval to unsigned int 2018-05-17 17:25:31 +02:00
Aaron Marcher 0892a93dbd Add comments for battery_* functions on OpenBSD 2018-05-17 17:24:47 +02:00
Tobias Tschinkowitz 1cb5af98e5 added comment for temp function (openbsd) 2018-05-17 17:13:28 +02:00
Aaron Marcher 66a7fb16fc Remove cpu_iowait
The third value from load_avg (idle) gives us almost the same
information as cpu_iowait. Plus OpenBSD does not offer an iowait value
as Linux and thus the corresponding function would not be portable.
2018-05-06 21:11:50 +02:00
Aaron Marcher af3cdfbbc8 Add examples to config.def.h 2018-05-02 12:30:16 +02:00
Aaron Marcher 4f5ac5d9fe Remove battery_power for various reasons
- Battery power cannot be easily gatherable via apm(4)
- IMHO it does not represent essential information
2018-05-01 21:01:25 +02:00
Aaron Marcher 97ef7c2a1d Remove non-portable functions from config.def.h 2018-04-16 19:09:07 +02:00
Kurt Van Dijck 72a5e52a35
slstatus: add cpu_iowait
This commit introduces the cpu_iowait item, this is the percentage
of cpu time spent waiting on disks. High numbers typically indicate
that your system is not responsive due to disk IO.
This commit also avoid sleeping inside the cpu_perc and cpu_iowait
functions: waiting in either one implies lost info for the other.

Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
2017-09-16 13:46:40 +02:00
Kamil Cholewiński b7d7ce9c5f
slstatus load_avg format string 2017-09-10 14:08:20 +02:00
Aaron Marcher 8f5219b6da
Added IPv6 address function
- Renamed "ip" function to "ipv4"
- Added "ipv6" function
- Adjusted README and config.def.h accordingly
2017-08-14 18:00:46 +02:00
Aaron Marcher fcc5c683a6
sexy config.def.h table 2017-08-14 14:04:21 +02:00
Laslo Hunhold 796b661284
Refactor main()
We remove the hack with the sleep and global "delay"-variable and use a
monotonic clock to derive the desired monotonic properties of the tool.
Inside each function that demands a personal delay we can then just do a
nanosleep() and be done with it.
It's a shame that timespec is so ugly to work with, but there's really
no way to make it more beautiful. However, at this cost though we
finally can set the interval times in milliseconds and not only just
seconds.

We remove setlocale(), because nothing good ever came out of this
function.

Besides that we have some more code refactoring, especially in the
argument loop which saves us a bit of complexity.
2017-08-13 23:45:16 +02:00
Aaron Marcher c4779c9b15
Removed #define for unknown_str
Debugging #define is very difficult. The performance overhead of static const
char is negligible.
2017-08-12 13:27:30 +02:00
Aaron Marcher be12b6b350
Removed #define for update interval
Debugging #define, especially in mathematical constructs is very
difficult. The performance overhead of static const int is negligible.
2017-08-12 13:16:12 +02:00
aaron marcher 4b4b2ac079
add num_files() function for maildirs ;) 2017-08-06 15:02:16 +02:00
Aaron Marcher 597cdc6b5c
use a static buffer instead of dynamic memory 2017-06-13 00:06:04 +02:00
Aaron Marcher abbaa7af44
remove format characters from stat functions 2017-06-12 23:59:21 +02:00
Aaron Marcher 832b21ca4b
add cpu_freq function 2017-06-12 23:56:21 +02:00
Aaron Marcher 259e967cbf
add battery_power function 2017-06-12 23:55:27 +02:00
Aaron Marcher 823f2d047f
Added keyboard_indicators (Fixes #31) 2017-01-16 12:10:56 +01:00
parazyd 62f4016430
add vol_perc notes, add braces to singleline statements 2016-12-30 12:16:07 +01:00
parazyd c2808b6d99
refactor vol_perc to not depend on alsa libraries 2016-12-28 00:41:51 +01:00
Mike Coddington c3eb0c4012 Add "uname -r" functionality 2016-11-16 13:03:15 -06:00
Jody Leonard 46fb6abdc0 Edit config.def.h function descriptions 2016-10-15 06:45:33 -04:00
Aaron Marcher 3a3a3e4101 better default config.h 2016-10-05 11:40:36 +02:00
Aaron Marcher f13104156f battery_state() function added 2016-09-13 22:03:36 +02:00
Aaron Marcher 87c1377b08 simplified vol_perc() (and with that config.def.h is super clean) 2016-09-13 21:08:44 +02:00
Aaron Marcher 2d1bbf0d35 simplified battery_perc() a lot and removed useless options from config.def.h 2016-09-13 20:54:45 +02:00
Aaron Marcher 217da011dd brought back update interval 2016-09-09 19:26:06 +02:00
Aaron Marcher 3bfa5fe60d coding style fixes 2016-09-09 19:15:43 +02:00
Ali H. Fardan de4f20ace3 removed UPDATE_INTERVAL, it is neat to have it but removing it is a tradeoff worth making, because the clock would act weird if this used to work with cpu_perc(). 2016-09-03 21:43:05 +03:00
Ali H. Fardan b800eb21a3 removed vol function from the default config file 2016-08-31 02:17:42 +03:00
Ali H. Fardan 24c4134df6 removed a misplaced ';' 2016-08-28 16:24:19 +03:00
Ali H. Fardan 47ddf9382e used constant string literals && remote initialization to in battery_perc() && trying to fix possible buffer overflow 2016-08-28 16:20:50 +03:00