Commit Graph

427 Commits

Author SHA1 Message Date
Watcom Hecht
dd75c260f8 revert back to using nanosleep
Fixes #93
2016-01-12 11:46:42 -02:00
Michael Stapelberg
fad9c8237c Bugfix: check that format_not_mounted is not NULL before using it
This issue was introduced with commit 75a83574.

fixes #92
2016-01-12 09:50:44 +01:00
David
b54623a56d format detection: recognise swaybar 2015-12-27 15:59:32 +11:00
Kenneth Lyons
dcd0518e25 Added support for Pango markup. 2015-12-04 10:27:18 -08:00
Michael Stapelberg
876c1cef8d fix compilation on FreeBSD
fixes #83
2015-11-24 19:26:07 +01:00
Michael Stapelberg
3e14e6e5f3 first_eth_interface: ignore MAC addresses, look for IPv4/IPv6 addresses 2015-11-16 22:41:18 +01:00
Stefan Bader
9e6e0d4f8f Correctly calculate Wireless link quality
Wireless quality was stuck at 100% due to
a signed with unsigned integer division.
2015-10-12 20:46:22 +02:00
Jakub Klinkovský
611e863ace Volume percentage should be obtained by float division and rounded to int.
Fixes #75
2015-10-12 09:44:13 +02:00
Michael Stapelberg
1935110ef3 Merge pull request #71 from bsdjhb/freebsd_wifi_buildfix
Fix build under FreeBSD after recent changes for Linux.
2015-10-09 09:11:16 -07:00
John Baldwin
9ebde24df1 Fix build under FreeBSD after recent changes for Linux. 2015-10-08 13:20:02 -07:00
John Baldwin
5e33d9fe74 Properly detect the battery charging status under FreeBSD.
The hw.acpi.battery.state sysctl returns a bitmask of flags as
defined in <dev/acpica/acpiio.h>.  Use constants from this header
to examine the state and check for the charging flag to determine
if the battery is charging.
2015-10-08 13:15:38 -07:00
Brendan Van Hook
a13b2e7288 Added support for lemonbar 2015-10-04 14:52:32 -04:00
Michael Stapelberg
f3125fdfde document code origins
fixes #65
2015-09-25 11:40:07 +02:00
Michael Stapelberg
06a133135f Fix comparison between signed/unsigned warning for real 2015-09-25 11:05:51 +02:00
Michael Stapelberg
b8b07511b1 use proper unsigned type for ESSID length 2015-09-25 10:49:14 +02:00
Michael Stapelberg
45ccd84309 use nlmsg_data instead of the too-new genlmsg_hdr 2015-09-25 10:49:01 +02:00
Michael Stapelberg
e1203ca62a use NL80211_RATE_INFO_BITRATE (16-bit)
NL80211_RATE_INFO_BITRATE32 is not available widely enough yet (the libc
used by travis doesn’t have it yet, for example).
2015-09-25 10:42:30 +02:00
Michael Stapelberg
668bf2079f wireless (linux): switch from libiw to libnl
Based on http://cr.i3wm.org/patch/692/ by Alexander Monakov

fixes #32
fixes #52
2015-09-24 21:47:02 +02:00
Michael Stapelberg
fb57fca5c2 Merge pull request #59 from bsdjhb/freebsd_wifi
Fix various issues with wireless information under FreeBSD:
2015-09-16 14:06:48 +02:00
John Baldwin
85618dc8e8 Fix various issues with wireless information under FreeBSD:
- Instead of hoping that the currently associated AP will show up as
  the first AP in the list of scan results, fetch the BSSID of the
  currently associated AP and use that to fetch station info for the
  AP.  This provides more frequently updated signal strength
  information than scan results and reliably provides information when
  multiple APs are in range.
- Do not treat the RSSI value as a raw signal value in dBm.  Instead, use
  the same formula as ifconfig(8) to compute a signal value.
- Do not report the beacon interval value as a signal quality level.
2015-09-15 13:39:01 -07:00
John Baldwin
dee6d52720 Fix some issues with displaying Ethernet media status on recent FreeBSD kernels.
- Don't apply IFM_SUBTYPE to the raw subtype in the description table.
  IFM_SUBTYPE() requires a fully populated word and was truncating values
  in the table when comparing resulting in false matches (notably
  "10GBase-KX4" for the no media case) after recent changes to add extended
  Ethernet media states in FreeBSD.
- Explicitly check for IFM_ETHER.
- Use SIOCGIFXMEDIA when present to obtain extended media states on newer
  kernels.
- Explicitly handle "no carrier".
2015-09-15 10:48:16 -07:00
Dmitrij D. Czarkoff
9b238a8d65 Use "color_degraded" when interface has no IP
On laptops one may want to have all interfaces up in order to let network
prioritization manage switching between wired and wireless connection.  In such
cases lack of IP address is a useful hint about currently used interface, and
color-coding makes it stand out more.
2015-08-06 17:20:29 +02:00
Dmitrij D. Czarkoff
15f2279592 Use SndIO for volume module on OpenBSD
* add audio(4) code by Robert Nagy
 * disable PulseAudio

While at OpenBSD support, add "-pthread" to LIBS.
2015-08-01 17:35:09 +02:00
Alexis Hildebrandt
80e7b83d54 Add ifdef to compile print_disk_info on Mac 2015-07-06 15:48:39 +02:00
Alexis Hildebrandt
d1cec2632d Fix undeclared identifier thermal_zone error
when THERMAL_ZONE is not defined.
2015-07-06 15:47:44 +02:00
Viktor Stanchev
a2b8529043 add apostrophe to error message to fix grammar 2015-06-12 23:08:46 -04:00
Ingo Bürk
75a835742e Use format_not_mounted if the directory for a disk_info block does not exist.
This is useful for dynamically mounted devices like thumb drives that get mounted into a directory such as
'/media/$UID/$NAME'.

fixes #33
2015-05-29 08:43:29 +02:00
Michael Stapelberg
d1aa135d28 Clamp the percentage at 100% when last_full_capacity is enabled. 2015-05-20 19:17:23 +02:00
Nicholas Helke
d7f0d64c40 Changed battery info output to HH:MM for consistency accross all platforms 2015-05-05 10:51:57 +01:00
Watcom Hecht
f779da1a59 PulseAudio muted volume support (fixes #27) 2015-04-19 13:28:26 -03:00
Jasper Lievisse Adriaanse
e91891729e Use the maximum rssi, not the scaled percentage for the signal level.
This makes the value for %signal match ifconfig(8) in all cases.
2015-04-04 10:56:58 +02:00
Michael Stapelberg
9abe0a9d59 Merge pull request #7 from Watcom/master
PulseAudio support for volume input
2015-04-03 14:45:40 -07:00
Watcom Hecht
1710c206cf PulseAudio support for volume input 2015-04-03 17:57:40 -03:00
Michael Stapelberg
d00a0e087c Merge pull request #17 from chrko/format_down
Adding format_down option to path_exists and run_watch
2015-04-02 13:42:47 -07:00
Christian Kohlstedde
5c094a5493 Adding the option "format_down" to path_exists and run_watch.
This fixes #1.
2015-04-02 22:31:06 +02:00
Jasper Lievisse Adriaanse
ae50bbe257 sys/dkstat.h has been removed from OpenBSD and it's functionality actually lived/lives in sys/sched.h 2015-04-02 20:31:17 +02:00
Watcom Hecht
b12e11237b refactoring to avoid code duplication 2015-03-29 17:05:26 -03:00
Baptiste Daroussin
c9dc67e054 print_cpu_usage: Fix warnings on non linux
Move linux variable under LINUX boundaries
2015-03-25 08:19:13 +01:00
Baptiste Daroussin
0b882f36b5 print_eth_info: fix warnings on FreeBSD 2015-03-25 08:18:23 +01:00
Baptiste Daroussin
eaf5d6bf80 print_volume: don’t return, complete the buffer first
Follow the changed done for Linux on f0cd726b
2015-03-25 08:13:47 +01:00
Baptiste Daroussin
e9fc4c1c06 Fix build on FreeBSD 2015-03-25 08:03:23 +01:00
Ingo Bürk
0a84bcb74a Pass the "instance" JSON property key for tztime blocks
fixes #10
2015-03-23 21:42:52 +01:00
Michael Stapelberg
d74e904bf4 clang-format-3.5 -i **/*.[ch], update modeline
From here on, we’ll use clang-format to automatically format the source.

This has worked well in i3, so we are introducing it for i3status.
2015-03-16 10:01:07 +01:00
Christian Kohlstedde
562a879f7c removing Yoda-Style
adding some words in the manpage
2015-02-22 18:25:12 +01:00
Christian Kohlstedde
85bb373095 Adding optional configuration option to "print_disk_info". 2015-02-18 23:43:25 +01:00
Christian Kohlstedde
f7b25a15dd Excluding the code on BSD systems. 2015-02-18 22:11:57 +01:00
Christian Kohlstedde
014e66563f Make the code more readable. 2015-02-18 22:11:16 +01:00
Christian Kohlstedde
e70ea4247f Modify print_disk_info. Now there is no output if the path is no mountpoint. 2015-02-18 16:53:24 +01:00
Alexander Monakov
05273b03fd Avoid use of uninitialized variable in print_battery_info
The boolean flag 'watt_as_unit' may be used without being initialized if the
configured battery path does not contain expected statistics (for example if
it is misconfigured and points to AC adapter info or simply an unrelated file).

Even though it does not cause ill effects, it causes a warning (true positive)
when running i3status under Valgrind.  Initialize the variable to make code
well-defined.
2014-12-22 09:19:40 +01:00
Michael Stapelberg
b219f47f39 support the special interface name _first_ for ethernet/wireless
Since we have deterministic device names in Linux, these strings are a
much better default in the i3status config than "eth0" and "wlan0" (what
we used before).
2014-12-07 15:17:31 +01:00
Tuomas Tynkkynen
7bdfb5b72e i3status: Support %frequency for wireless interfaces
In many public WiFis, the 2.4 GHz wireless band is slow due to
congestion, while there is still plenty of bandwidth available on the
5 GHz area. So when debugging wireless issues it's convenient to have
i3status display the frequency of the access point that the interface is
connected to.

This patch adds support for the %frequency tag for wireless interfaces,
so for example:
    format_up = "WLAN: %essid - %quality / %frequency"
would result in:
    "WLAN: eduroam - 074% / 2.4 GHz"
2014-12-03 08:14:21 +01:00
Cyril Andreatta
8e22f3839d Created three individual Strings for each battery status (charging, dicharching, full)
Replaced hard coded status strings (CHR, BAT, FULL) in
print_battery_info.c with user defined strings. The new strings are
'status_chr', 'status_bat' and 'status_full' and can be set in i3status.conf.
e.g.
status_chr = " CHR"

If any of the new status strings is omitted the standard strings (CHR,
BAT, FULL) are used.
2014-10-07 18:52:01 +02:00
Michael Stapelberg
8a57208b1d Bugfix: fix wrong color tags with xmobar
fixes #1353
2014-08-26 20:54:04 +02:00
Klemen Košir
fcd95c2408 Fix battery indicator on systems without POWER_SUPPLY_VOLTAGE_NOW.
In my case, the voltage variable would stay initialized as -1,
which caused the calculation of battery charge percentage to be
incorrect (I would get the message that there is no battery present
or even -0% charge).

I have no idea how this would affect other systems, since I don't
have a chance to test this.
2014-08-25 19:36:02 +02:00
Robin Hahling
d73ca2fa82 Fix Dragonfly BSD CPU temperature gauge
This patch fixes CPU temperature gauge for DragonFly BSD.
Commit 0eeded8 assumed that fetching CPU temperature for DragonFly
BSD was similar to that of FreeBSD but this assumption is false.
2014-08-08 11:57:01 +02:00
Michael Stapelberg
2158128ea0 Use the absolute values for (dis)charging rates
Apparently some notebooks report a negative current, whereas most don’t.

fixes #1249
2014-05-31 14:01:18 +02:00
Michael Stapelberg
653505a3bb run_watch: check all matching pid files (until first valid one) (Thanks brotbart)
fixes #1245
2014-05-15 21:51:01 +02:00
Alexander Vasarab
b26b118d76 Fix NetBSD CPU temp gauge bug
This patch fixes a bug in which multiple (conflicting) CPU temps may be
included in the output for the "cpu temperature" module.

The bug is due to the way that the code parsed the envsys(4)-returned data,
and would manifest itself on x86-based NetBSD machines, since those use
cputemp(4) as well as acpitz(4), thereby creating multiple envsys(4) entries
with identical descriptions but which refer to different physical sensors.

Instead of matching the description attribute of each device returned by
envsys(4) against the target format, this patch throws away non-matching keys
in the first instruction inside the dict walk. This has the benefit of sparing
unnecessary CPU cycles, and preventing other sensors from being included
erroneously.

Additionally, the THERMAL_ZONE format is now joined with OpenBSD in that it
uses acpitz(4) explicitly. This is prefered since it is much older (dating
back to NetBSD 2.0), and does not exclude x86-based users (as with cputemp(4)).
2014-04-30 09:28:09 +02:00
Alexander Vasarab
628149b227 Implement battery functionality for NetBSD users
This patch takes a similar approach as the NetBSD CPU temperature
code in that it uses proplib(3) to walk dictionaries supplied by
envsys(4).

In addition to providing the basic functionality, it:

* Provides all existing format specifiers (%emptytime %consumption
  %status %percentage %remaining)
* Respects all existing config options (hide_seconds, low_threshold,
  integer_battery_capacity, last_full_capacity)
* Projects "time until full" when battery status is CS_CHARGING
2014-04-30 09:23:17 +02:00
Mats
4f7da73885 Unify use of string comparisons
* strncmp(s1, s2, strlen(s2)) → BEGINS_WITH(s1, s2)
* strncmp(s1, s2, strlen(s1)) → strcmp(s1, s2)
* Prefer case-insensitive comparison for options
2014-03-12 08:28:16 +01:00
Jasper Lievisse Adriaanse
52814295a0 For the %percentage display of batteries, drop the leading '0' for values < 10. 2014-03-12 08:27:00 +01:00
Mats
bc0bd8c9e0 disk: Colorize output when below given threshold
New disk module options:
* threshold_type: ^(percentage|[kmgt]?bytes)_(free|avail)$
* low_threshold: <double>

fixes #912
2014-03-09 22:57:19 +01:00
Marco Hunsicker
0c2b518b8a Typo in function name
Fixes the typo in print_seperator()
2014-03-01 22:35:37 +01:00
Marco Hunsicker
7b021d3eb2 i3status: Allow customization of module separator
This patch adds the ability to customize the separator that is placed
between modules.

Specifically this patch:

* adds the "separator" general directive
* moves the definition of the default separator for the different
  output formats (excluding color formatting) to src/i3status.c
* updates the SEC_CLOSE_MAP macro to disable the separator for the
  i3bar output format if the separator directive dictates so
* changes print_seperator() in src/output.c to take a separator
  parameter in order to disable the output of the separator if
  the separator is empty and to use the provided separator
  otherwise
* updates the manpage to explain the new directive
2014-03-01 10:21:11 +01:00
Marco Hunsicker
26faed4c2f i3status: Bugfix: Reading multiple temperature sensors not possible
This patch inlines the creation of the thermal zone string in order
to force computation on each invocation. This is necessary to be able
to read the values of several temperature sensors.
2014-02-26 22:32:32 +01:00
Iakov Davydov
c01a8110a4 Add hide_seconds option
fixes: #1134
2014-02-08 20:36:59 +01:00
Mats
596f2264f4 disk: Distinguish between IEC, SI and custom prefixes
* IEC: Ki, Mi, Gi, Ti (powers of 1024)
* SI: k, M, G, T (powers of 1000)
* custom: K, M, G, T (powers of 1024)
2013-12-10 21:18:14 +01:00
Kinware AB
717484184f Add support for path_exists directive. 2013-11-22 15:52:27 +01:00
Gereon Kremer
4bd0ba88c8 Added different format string for volume in case it is muted.
If the volume is muted, the volume level would simply be displayed as zero and the color changed to color_degraded.
This patch lets the user define a custom format string for when the volume is muted.
The default value is "♪: 0%" ("♪: %volume" being the usual format).
2013-11-18 22:31:42 +01:00
Michael Stapelberg
14b43bdec2 format detection: simplify code, handle "sh" processes in the hierarchy
i3 starts processes using /bin/sh now, not $SHELL. This increases the
likelihood with which we are started by dash, which tends to leave its
processes in the hierarchy, e.g.:

michael       1524  i3bar --bar_id=bar-0 --socket=/run/user/1000/i3/ipc-s
michael       1525   \_ /bin/sh -c i3status
michael       1526       \_ i3status

This case is now handled correctly — when the parent is “sh”, the parent
of sh will be used instead.
2013-11-09 14:37:05 +01:00
Michael Stapelberg
31509b0d56 fix slurp(), it needs to read size-1 for the trailing NUL 2013-11-09 14:37:04 +01:00
Michael Stapelberg
ebfafc5dac print_cpu_temperature: fix memory leak (Thanks kuba) 2013-10-24 19:19:21 +02:00
Arnaud Degroote
c6e9fc84c6 Add support for cpu temperature on NetBSD (using envsys(4)) 2013-10-07 19:32:50 +02:00
Arnaud Degroote
32551729e8 Allow to print cpu usage on NetBSD 2013-10-07 19:31:01 +02:00
Arnaud Degroote
cf2fb61911 Allow to print eth information on NetBSD 2013-10-07 19:30:51 +02:00
M. Kory Woods
41be50a983 allow load to be a float 2013-07-09 23:22:26 +02:00
Axel Wagner
7a372b0f46 Implement term-output-format 2013-05-19 19:51:01 +02:00
oblique
8445d6a929 print_volume(linux): Open a new mixer every time.
This fix the following bug:
    If you switch your sound card on-the-fly, print_volume continued to
    use the old sound card.
2013-05-19 19:48:07 +02:00
Jonas Cleve
6a84138251 fix #1017: i3status uses generic battery instance 2013-05-04 17:53:20 +02:00
Baptiste Daroussin
13ebebeb7a Support colored output for CPU temperature on FreeBSD 2013-03-20 11:16:53 +01:00
Michael Stapelberg
f0cd726bf0 print_volume: don’t return, complete the buffer first
Otherwise, i3bar will display “SPEC VIOLATION” because full_text is
missing in the block.
2013-03-19 19:56:44 +01:00
Baptiste Daroussin
8dbadb6d4e Enable colored output for battery on FreeBSD 2013-03-19 19:54:15 +01:00
Baptiste Daroussin
f30ec89b79 Support mixer_idx with OSS
make mixer_idx load the default mixer
2013-03-19 19:53:26 +01:00
Baptiste Daroussin
7f83d0a197 Show degraded colors in case volume is muted with OSS 2013-03-19 18:36:49 +01:00
Christoph Göttschkes
5e0b8812bf Added format_down option for battery if no battery is available. 2013-03-09 11:43:55 +01:00
Jakob Haufe
d62e10c56d Fix FTBFS on Hurd
On GNU/Hurd, THERMAL_ZONE is undefined. This makes compilation fail as
outwalk is declared inside of #ifdef THERMAL_ZONE, but it's used outside
of it (by OUTPUT_FULL_TEXT).

This moves the declaration outside the #ifdef to allow for successful
compilation on Hurd again.
2013-03-02 13:48:43 +01:00
Michael Stapelberg
b6c4d4ee46 wireless: call START_COLOR only once (Thanks XTaran) 2013-02-26 00:32:24 +01:00
Michael Stapelberg
4a282a4978 battery: initialize colorful_output to false 2013-02-23 18:05:08 +01:00
Michael Stapelberg
d52b9f82ca ipv6: properly handle colors for output_format == xmobar 2013-02-23 18:04:52 +01:00
Raphael Michel
6279964c6b Add colorized output for load avg 2013-02-22 14:09:58 +01:00
Julien Lequertier
67c2c1a7ea Added option to show battery capacity without decimals 2013-02-14 19:35:15 +01:00
Michael Stapelberg
8c273e54b8 use stdbool instead of (int)1 and (int)0 directly 2013-02-10 17:21:46 +01:00
Michael Stapelberg
78cd0e1e01 s/\<timezone\>/tz/ in order to not shadow the timezone var from time.h 2013-02-10 17:19:56 +01:00
Emil Mikulic
2ebe1f3726 Add tztime module to support multiple different timezones. 2013-02-10 17:18:32 +01:00
Michael Stapelberg
68e447d3f6 Bugfix: output auto detect: properly detect ambiguous situations (Thanks mist)
fixes #940
2013-02-04 21:36:55 +01:00
Michael Stapelberg
a5a43af186 retab! print_cpu_temperature 2013-01-28 11:37:23 +01:00
Emil Mikulic
a87b63c3e9 Make sure colorful_output variable is initialized. 2013-01-28 11:36:23 +01:00
Adrien Schildknecht
d43664235a wifi: properly display ad-hoc networks
No statistics are displayed with ad-hoc networks since none are available.
2013-01-24 15:22:00 +01:00
Gereon Kremer
6147e2b268 changing volume color from bad to degraded if muted 2013-01-05 08:37:20 +01:00
Scott Tincman
0eeded8bc0 DragonFlyBSD support added 2012-11-15 12:31:17 +01:00
Deiz
638156c8b2 Teen ordinal numbers always use a 'th' suffix. 2012-11-06 00:26:47 +01:00
Deiz
e10d38fea0 Reduce the season day to 0-9 to properly print ordinal suffixes 2012-10-19 19:36:53 +02:00
Simon Elsbrock
35f3bcb348 bugfix: colorize output even without discharge rate (thanks f8l)
On some systems, the discharge rate may be missing, although the battery
is still working. This leads to an edge case on Linux systems in which
the output may not be colorized although a threshold was defined.

This commit fixes the behavior by colorizing output if threshold_type is
set to "percentage". Since we cannot calculate remaining time without
discharge rate, output is still uncolorized in case of threshold_type
set to "time".
2012-10-16 22:49:22 +02:00
Michael Stapelberg
450424f97a implement max_threshold for linux, too 2012-10-16 10:52:57 +02:00
Jasper Lievisse Adriaanse
ae4873bac7 i3status - More temperature related fixes for OpenBSD, and a general feature
- Temperature sensors can now set a 'max_threshold' value to color the output red if exceeded.
- Allow for arbitrary temperature sensors nodes to be selected with 'path' on OpenBSD.
2012-10-16 10:51:15 +02:00
Jasper Lievisse Adriaanse
1c2517a399 i3status - Default to acpitz(4) instead of cpu(4) for OpenBSD temperature readings
The acpitz(4) values are eventually used by the kernel to determine if the machine
is getting too hot.
2012-10-16 10:48:44 +02:00
Jasper Lievisse Adriaanse
ed03d2450c i3status - Handle down wireless interfaces just like ethernet interfaces (e.g. colors) 2012-10-16 10:48:29 +02:00
Deiz
04dc34f27d Skip a day in the Discordian calendar when St. Tib's Day has passed 2012-10-16 09:25:38 +02:00
Jasper Lievisse Adriaanse
794151cfe7 Implement %essid and %signal for wireless on OpenBSD. 2012-10-10 08:24:29 +02:00
Jasper Lievisse Adriaanse
11c4ab9870 Implement %speed for Ethernet on OpenBSD. 2012-10-10 08:24:04 +02:00
Jasper Lievisse Adriaanse
8da0452d2c Various fixes for the OpenBSD section of the battery backend.
- fix the battery status printing in %status.
- fix remaining time when we're charging.
- use colors to indicate battery status.
- small cleanups.
2012-10-10 08:23:14 +02:00
Michael Stapelberg
7dcc961fa2 Bugfix: Move the pbval definition outside the ifdef (Thanks XTaran)
This fixes compilation on !linux
2012-10-03 15:12:49 +02:00
Michael Stapelberg
5c615f7074 Save the DNS lookup for K.root-servers.net (Thanks barfoos)
This avoids running into a timeout when there is no connectivity on
i3status startup.
2012-09-29 00:08:56 +02:00
Simon Elsbrock
59d52ad787 print_battery.c: do END_COLOR only if START_COLOR was used 2012-09-05 23:28:31 +02:00
Simon Elsbrock
1c4677a644 turn volume into red if muted
fixes #743
2012-09-05 23:28:27 +02:00
Michael Stapelberg
d6b8a4efc1 introduce percentages for all values, document them 2012-08-31 14:16:58 +02:00
gereon
50ad0334f6 adding percentage format string for disk info module
explicit cast to double, changed format string to percentage
2012-08-31 14:07:46 +02:00
Piotr Domagalski
fa4e9cdfb3 Eat unnecessary space from the battery format str.
If the battery is not discharging it may be not possible to give information on
remaining time or consumption. The resulting strings (%remaining, %consumption,
%emptytime) are empty then. But because they are in the format string, the
output string contains unnecessary spaces in this case.

This commit makes i3status strip these spaces.
2012-08-31 12:08:24 +02:00
Simon Elsbrock
68f438ec9e add additional battery threshold type "percentage"
The battery threshold can now be configured as type "time" or
"percentage", but defaults to "time" to prevent unexpected behavior.
Also, low_threshold was set to a more reasonable default of 30.
2012-08-28 18:05:11 +02:00
Philipp Schaefer
3baf27bf1d use correct units for battery calculation 2012-08-13 01:44:40 +02:00
Michael Stapelberg
dea8703aba Bugfix: Properly skip "consumption", not "consumptionbuf" (Thanks mloskot)
Fixes #752
2012-07-12 08:16:40 +02:00
Michael Stapelberg
141f45e792 small style fix in src/print_battery_info.c (move comment) 2012-07-11 19:11:29 +02:00
Marcel Hellwig
1271ff2aa4 Calculate the consumption if POWER_SUPPLY_POWER_NOW does not exist in uevent 2012-07-11 19:11:08 +02:00
Lars Kumbier
f5c96008b0 colorful ipv6 status message 2012-07-10 20:37:54 +02:00
Marcel Hellwig
c01e87b269 Added consumption to battery info 2012-07-09 15:13:05 +02:00
Marcel Hellwig
ccc31f0b80 Added condition, for red color, when battery-time is low, namely battery is discharging 2012-07-09 15:12:43 +02:00
Mateusz Poszwa
859a7690a6 Avoid division by zero when calculating CPU usage. 2012-06-28 12:05:01 +02:00
Mateusz Loskot
10ed9efff4 Moved translation of wireless status code to text from multiple places into single BATT_STATUS_NAME macro. It simplifies customisation of the hard-wired status text. 2012-06-11 12:00:24 +02:00
Simon Elsbrock
7c02c10b72 colorize battery output if remaining time below threshold 2012-05-25 09:53:49 +02:00
Michael Stapelberg
7a77472a81 battery info: output errors in JSON in every case
This hopefully fixes http://bugs.i3wm.org/707
2012-05-15 12:30:23 +02:00
Michael Stapelberg
296eb5e706 Error handling: Never output null as full_text (JSON), prefix messages with i3status (Thanks Artemis)
The former made i3bar crash, the latter is helpful for debugging.
2012-05-09 18:56:57 +02:00
Michael Stapelberg
4ef47541b9 Improve error message when the cpu temperature cannot be read 2012-05-09 18:39:41 +02:00
Michael Stapelberg
4ddd115af8 Use (void) instead of () for functions without args (Thanks fernandotcl)
See also:
http://article.gmane.org/gmane.linux.kernel/1268792

The C compiler will handle (void) as "no arguments" and () as "variadic
function" (equivalent to (...)) which might lead to subtle errors.
2012-05-07 08:28:04 +02:00
Jasper Lievisse Adriaanse
6b447f7f1b - Remove some superfluous #ifdef clutter - If we're compiling on !(Linux or FreeBSD), just emit a '?'. 2012-05-04 16:10:19 +02:00
Ewgenij Starostin
b5f89c83cc Handle %d with non-default CPU temperature path. 2012-05-04 12:29:02 +02:00
Michael Stapelberg
7dc10f4205 Fix harmless format string mistake (Thanks loblik) 2012-05-02 17:42:51 +02:00
Jasper Lievisse Adriaanse
2847f83402 Implement displaying battery status on OpenBSD. 2012-04-30 13:00:49 +02:00
Jasper Lievisse Adriaanse
1c3fb04fb9 Implement basic fetching of cpu temperature on OpenBSD. 2012-04-30 13:00:46 +02:00
Jasper Lievisse Adriaanse
aabac78fd0 Print the volume on OpenBSD too. Add missing library to Makefile accordingly. 2012-04-29 11:13:29 +02:00
Jasper Lievisse Adriaanse
688d300646 Fix disk usage on OpenBSD. 2012-04-29 11:13:14 +02:00
Jasper Lievisse Adriaanse
75a741484e Fix CPU usage on OpenBSD. Currently only takes the first cpu into account, but works fine otherwise. 2012-04-29 11:13:06 +02:00
Jasper Lievisse Adriaanse
6eac8bee58 Fix include order; fixes build on OpenBSD. 2012-04-28 10:08:37 +02:00
Michael Stapelberg
1b3aa40485 add yajl compat code 2012-04-08 14:05:47 +02:00
Michael Stapelberg
12b1bfa9b8 Properly output JSON with libyajl 2012-03-25 22:05:00 +02:00
Michael Stapelberg
d5b4c8e368 Implement the i3bar JSON protocol
This hardcodes all the JSON parts. Strings are not properly escaped currently.
The best/easiest way to fix this is by actually using libyajl.
2012-02-16 23:30:54 +00:00
Baptiste Daroussin
be61907ad5 FreeBSD: fix disk usage print 2011-12-09 23:39:01 +00:00
Michael Stapelberg
3471ff39f8 battery: implement "path" option for batteries with non-standard paths 2011-11-26 18:26:38 +00:00
Mateusz Poszwa
42e61c4f6e fix parentheses in cc1457c4f0 2011-08-29 16:06:40 +02:00
Michael Stapelberg
7870fdae86 initialize variables to fix compiler warning 2011-08-26 00:33:56 +02:00
Connor Lane Smith
cc1457c4f0 make modules more resilient to failure 2011-08-25 23:27:10 +02:00
Michael Stapelberg
319664ce43 only compile print_cpu_temperature if THERMAL_ZONE is available
Fixes FTBFS on hurd-i386
2011-07-24 23:17:34 +02:00
Baptiste Daroussin
d87a735be5 Add simple volume support on FreeBSD 2011-07-24 02:12:23 +02:00
Baptiste Daroussin
f288fd2e4f Add support for cpu usage on FreeBSD 2011-07-24 02:12:22 +02:00
Baptiste Daroussin
342f942f15 Support wifi on FreeBSD 2011-07-24 02:12:20 +02:00
Axel Beckert
5e276db583 Fix FTBFS on kFreeBSD 2011-07-21 22:02:34 +02:00
Michael Stapelberg
2e621680c4 slurp(): null-terminate buffer (Thanks mist) 2011-07-13 19:17:24 +02:00
Michael Stapelberg
7728c35401 correctly auto-detect the output format with zsh (Thanks mist) 2011-07-13 17:21:35 +02:00
Michael Stapelberg
e924ce2d19 fix memory leak 2011-07-13 16:09:30 +02:00
Michael Stapelberg
7ab9167536 magic: try to auto-detect output_format by default (dzen2/i3bar/xmobar) 2011-07-13 03:27:57 +02:00
Michael Stapelberg
0b299f740d Fix trailing whitespaces, document cpu_usage in manpage 2011-05-06 13:17:26 +02:00
Peter Bui
8b18e8e33c Add print_cpu_usage 2011-05-06 13:13:11 +02:00
Michael Stapelberg
0a13d30465 Also use the correct time for the ddate module 2011-04-22 01:10:40 +02:00
Michael Stapelberg
4fa8a4e0ab get time at the beginning of the loop 2011-04-21 20:50:14 +02:00
Michael Stapelberg
4ec02bea7b implement the 'path' option for cpu temperature 2011-01-06 18:22:46 +01:00
Michael Stapelberg
39feebea4d Cache the result of the DNS query also if there is no IPv6 connectivity (Thanks dothebart) 2011-01-03 15:00:42 +01:00
Michael Stapelberg
cf09102433 Use kill(pid, 0) to check if the process is alive 2010-11-28 16:45:34 +01:00
Michael Stapelberg
75670ba64a battery: use POWER_NOW if CURRENT_NOW is not available
CURRENT_NOW was deprecated for some battery types in recent linux kernels
(2.6.36)
2010-11-03 14:08:22 +01:00
Michael Stapelberg
af5fd7b77e Implement displaying the wireless connection speed (Thanks Felicitus)
Based on a patch by Felicitus.
2010-09-22 19:59:48 +02:00
Michael Stapelberg
fac05bf4e8 Bugfix: Correctly check for interface up/down-status (Thanks docsteel) 2010-07-21 11:01:37 +02:00
Michael Stapelberg
eb46963d4c Implement ALSA volume support 2010-07-20 19:33:41 +02:00
Axel Wagner
d8b6f03144 print_ddate(): Correctly seperate the St. Tibs String from the rest 2010-07-15 15:12:48 +02:00
Fernando Tarlá Cardoso Lemos
38337511e9 Support customized colors. 2010-07-04 21:52:43 +02:00
Fernando Tarlá Cardoso Lemos
570bc669b4 Don't leak skfd on errors. Don't spam stderr if the iface isn't present. 2010-06-30 10:49:40 +02:00
Fernando Tarlá Cardoso Lemos
1e0ad8d251 Evaluate wireless quality average. Fix dBm calculations. 2010-06-25 11:02:27 +02:00
Mirko Augsburger
28ba2ae892 disk_info: implement %avail 2010-06-25 01:24:26 +02:00
Michael Stapelberg
71f7166032 wireless: fix formats 2010-06-25 00:04:11 +02:00
Michael Stapelberg
506b17de6e Display wireless quality as percentage 2010-06-24 23:59:44 +02:00
Fernando Tarlá Cardoso Lemos
29e9a99f06 Take into account the wireless quality maximum. 2010-06-24 23:57:36 +02:00
Michael Stapelberg
93ea987f84 ddate: Use static memory / only allocate format copy memory once 2010-06-19 12:50:03 +02:00
Axel Wagner
6298377bd4 Implemented a ddate-module 2010-06-19 12:44:43 +02:00
Axel Wagner
da595ee9f7 Do proper error handling in print_time() 2010-06-19 12:44:19 +02:00
Michael Stapelberg
01210258d0 Treat the interface as 'down' when it cannot be found in /proc/net/wireless (Thanks to Fabio Zanini) 2010-04-19 13:29:52 +02:00
Michael Stapelberg
c645340b1d Little style fixes for the last commit 2010-04-06 14:55:22 +02:00
Christian Dietrich
8edce05764 ipv6: provide format strings for ipv6 up and ipv6 down 2010-04-06 14:54:25 +02:00
Michael Stapelberg
3eec92d504 Colorize ethernet output (patch by Peter Johnson) 2010-02-14 12:49:03 +01:00
Michael Stapelberg
9c14b7a527 wireless: display no IP instead of (null) 2010-01-26 14:25:37 +01:00
Michael Stapelberg
c166d2e2d3 get_ip_address: return NULL instead of down 2010-01-26 14:25:21 +01:00
Axel Beckert
a820cf4ce0 Fix FTBFS on kFreeBSD and Hurd: libiw is Linux-only 2010-01-11 23:07:30 +01:00
Michael Stapelberg
6823fbf055 disk: also round when printing TB (Thanks Merovius) 2010-01-10 11:07:21 +01:00
Michael Stapelberg
ced822f461 ipv6: cache the result of the DNS query only, the socket needs to be re-created every time 2010-01-04 11:16:59 +01:00
Michael Stapelberg
37882cee88 ipv6: reuse the existing socket for further lookups
This reduces network overhead if you do not run a local caching
nameserver.
2010-01-01 22:01:57 +01:00
Michael Stapelberg
998109a653 Remove trailing whitespace 2009-12-20 18:48:01 +01:00
André-Patrick Bubel
a5594ee17f Implemented showing the time when battery is empty 2009-12-20 18:48:01 +01:00
Michael Stapelberg
9307ff9d13 The load values represent 1,5,15 min, not 5,10,15 min (Thanks Chris) 2009-12-13 13:59:59 +01:00
Michael Stapelberg
013fdece8d Change output format to be a config option instead of a compile time define 2009-10-24 13:27:02 +02:00
Michael Stapelberg
e4bd4bd2a3 battery: split up %remaining into %percentage and %remaining (Thanks shatter) 2009-10-16 22:21:05 +02:00
Michael Stapelberg
5fc2a8a38e Actually use the format string for the battery (Thanks shatter) 2009-10-16 22:07:42 +02:00
Michael Stapelberg
da8cb9ebfc Implement option to use the last full capacity instead of the design capacity 2009-10-16 20:37:41 +02:00
Michael Stapelberg
8a66289702 Obey format for run_watches 2009-10-16 20:31:20 +02:00
Michael Stapelberg
b88a55ffa6 Implement format_up/format_down for ethernet 2009-10-16 20:14:40 +02:00
Michael Stapelberg
cb9bab4255 Bugfix: Cast the integers to uint64_t *before* multiplying (Thanks msi)
This fixes problems on 32-bit computers.
2009-10-16 00:25:05 +02:00
Michael Stapelberg
c4c17294ad Cleanup disk "module" 2009-10-12 00:53:47 +02:00
Michael Stapelberg
783707906c Implement disk info (%free/%used/%total) 2009-10-11 23:27:26 +02:00
Michael Stapelberg
f947d0a446 Breaks configfiles! Major refactoring of i3status, see below
We finally switched to libconfuse for a configuration file format
which does not require much work for the programmer nor for the user.
Plus, it avoids the Not-Invented-Here syndrome of yet another config
file format.

Furthermore, as a consequence of providing format strings for every
"module" (ipv6, wireless, …), we directly print the output and thus
we needed to drop support for wmii. This allowed us to get rid of
quite some complexity.

Documentation about the new configuration file and options will
follow. This commit is the beginning of what will be i3status v2.0.
2009-10-11 22:14:29 +02:00
Michael Stapelberg
c4a3d64b38 Bugfix: close the filehandle when done 2009-10-01 18:18:46 +02:00
Michael Stapelberg
b2292e770e Implement getting the wireless ESSID
This adds a dependency for libiw
2009-10-01 17:43:32 +02:00
Michael Stapelberg
cdb450376e Bugfix: Don’t show colors in wireless info if colors are disabled (Thanks shatter) 2009-09-26 13:26:13 +02:00
Michael Stapelberg
89ad3dbaa2 Don’t display an error message if getaddrinfo() fails for getting the IPv6 addr (Thanks Atsutane) 2009-09-26 13:24:36 +02:00
Atsutane
48e033598b Small improvement regarding readability if one hasn't an IPv6 address. 2009-09-11 23:05:54 +02:00
Michael Stapelberg
112512c546 Initialize order array with -1 to avoid printing duplicate lines (Thanks XTaran) 2009-09-01 23:43:31 +02:00
Axel Beckert
e565e313f7 Support for (Debian) GNU/kFreeBSD 2009-09-01 12:39:49 +02:00
Michael Stapelberg
bb52b40c8e Add support for xmobar
Use i3status-xmobar | xmobar -o -t "%StdinReader%" -c "[Run StdinReader]"
You might need to copy the default configuration to ~/.xmobarrc
2009-08-18 21:29:44 +02:00
Michael Stapelberg
f8be2d1b81 Return "no battery" instead of dying if a battery wasn’t found (Thanks Mirko) 2009-07-25 21:32:38 +02:00
Michael Stapelberg
94911d4cc3 Don’t perror("connect") when there most likely is no IPv6 connectivity 2009-07-25 21:23:39 +02:00
Michael Stapelberg
dd88448709 Bugfix: Use interface instead of eth_interface in get_ip_addr() 2009-07-23 20:47:52 +02:00
Michael Stapelberg
a86361510c Implement battery status and thermal zones for FreeBSD (patch by Baptiste Daroussin) 2009-07-23 18:40:49 +02:00
Michael Stapelberg
3de2907427 Remove unneeded struct 2009-07-22 19:01:57 +02:00
Michael Stapelberg
072cee2808 little fixes for FreeBSD 2009-07-22 18:51:55 +02:00
Michael Stapelberg
329a8994f7 Use the highest order actually used, not MAX_ORDER, for checking whether to flush (Thanks Mirko) 2009-07-22 18:39:41 +02:00
Michael Stapelberg
c9ab465cbb Implement getting the interface speed on FreeBSD, patch by Baptiste Daroussin 2009-07-22 18:36:01 +02:00
Michael Stapelberg
e56213db28 Free the addresses correctly 2009-07-22 18:30:16 +02:00
Michael Stapelberg
4a6deddf7b Obtain IP address in a portable way, patch by Baptiste Daroussin 2009-07-22 18:27:55 +02:00
Michael Stapelberg
bb50e22fd3 Use getloadavg() instead of using /proc, patch by Baptiste Daroussin 2009-07-22 00:09:32 +02:00
Michael Stapelberg
a1eda7b209 get_ipv6_addr: more documentation, use SOCK_DGRAM, reformat 2009-07-21 20:35:19 +02:00
Michael Stapelberg
230f3167b7 Add modelines and retab! all files 2009-07-21 20:26:53 +02:00
Michael Stapelberg
34ba9fa908 Correctly handle the order of items 2009-07-21 20:23:08 +02:00
Michael Stapelberg
6fda988f36 Use own files for each function, add get_ipv6_addr.c 2009-07-21 19:07:30 +02:00