]> git.sur5r.net Git - i3/i3status/blobdiff - i3status.c
Implement option to use the last full capacity instead of the design capacity
[i3/i3status] / i3status.c
index 141a98477747af7467d979cd825a4e2fae9ba5fd..c9ded2f9b2043df71cb9a37bd5778a26fe352fb1 100644 (file)
@@ -3,36 +3,10 @@
  *
  * i3status – Generates a status line for dzen2 or xmobar
  *
- *
  * Copyright © 2008-2009 Michael Stapelberg and contributors
  * Copyright © 2009 Thorsten Toepper <atsutane at freethoughts dot de>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- *
- * * Neither the name of Michael Stapelberg nor the names of contributors
- *   may be used to endorse or promote products derived from this software
- *   without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * See file LICENSE for license information.
  *
  */
 #include <string.h>
@@ -85,7 +59,8 @@ int main(int argc, char *argv[]) {
         };
 
         cfg_opt_t ethernet_opts[] = {
-                CFG_STR("format", "E: %ip (%speed)", CFGF_NONE),
+                CFG_STR("format_up", "E: %ip (%speed)", CFGF_NONE),
+                CFG_STR("format_down", "E: down", CFGF_NONE),
                 CFG_END()
         };
 
@@ -96,6 +71,7 @@ int main(int argc, char *argv[]) {
 
         cfg_opt_t battery_opts[] = {
                 CFG_STR("format", "%status %remaining", CFGF_NONE),
+                CFG_BOOL("last_full_capacity", false, CFGF_NONE),
                 CFG_END()
         };
 
@@ -114,6 +90,11 @@ int main(int argc, char *argv[]) {
                 CFG_END()
         };
 
+        cfg_opt_t disk_opts[] = {
+                CFG_STR("format", "%free", CFGF_NONE),
+                CFG_END()
+        };
+
         cfg_opt_t opts[] = {
                 CFG_STR_LIST("order", "{ipv6,\"run_watch DHCP\",\"wireless wlan0\",\"ethernet eth0\",\"battery 0\",\"cpu_temperature 0\",load,time}", CFGF_NONE),
                 CFG_SEC("general", general_opts, CFGF_NONE),
@@ -122,6 +103,7 @@ int main(int argc, char *argv[]) {
                 CFG_SEC("ethernet", ethernet_opts, CFGF_TITLE | CFGF_MULTI),
                 CFG_SEC("battery", battery_opts, CFGF_TITLE | CFGF_MULTI),
                 CFG_SEC("cpu_temperature", temp_opts, CFGF_TITLE | CFGF_MULTI),
+                CFG_SEC("disk", disk_opts, CFGF_TITLE | CFGF_MULTI),
                 CFG_SEC("ipv6", ipv6_opts, CFGF_TITLE),
                 CFG_SEC("time", time_opts, CFGF_NONE),
                 CFG_SEC("load", load_opts, CFGF_NONE),
@@ -173,14 +155,17 @@ int main(int argc, char *argv[]) {
                                 print_wireless_info(title, cfg_getstr(sec, "format_up"), cfg_getstr(sec, "format_down"));
 
                         CASE_SEC_TITLE("ethernet")
-                                print_eth_info(title, cfg_getstr(sec, "format"));
+                                print_eth_info(title, cfg_getstr(sec, "format_up"), cfg_getstr(sec, "format_down"));
 
                         CASE_SEC_TITLE("battery")
-                                print_battery_info(atoi(title), cfg_getstr(sec, "format"));
+                                print_battery_info(atoi(title), cfg_getstr(sec, "format"), cfg_getbool(sec, "last_full_capacity"));
 
                         CASE_SEC_TITLE("run_watch")
                                 print_run_watch(title, cfg_getstr(sec, "pidfile"), cfg_getstr(sec, "format"));
 
+                        CASE_SEC_TITLE("disk")
+                                print_disk_info(title, cfg_getstr(sec, "format"));
+
                         CASE_SEC("load")
                                 print_load(cfg_getstr(sec, "format"));