[wiki] [sites] New function procs, v0.7 || levi0x0

From: <git_AT_suckless.org>
Date: Fri, 08 Aug 2014 12:44:40 +0200

commit bef3d991169eb758511f5ac85b053e59d2704707
Author: levi0x0 <levi0x0x_AT_gmail.com>
Date: Fri Aug 8 13:44:45 2014 +0300

    New function procs, v0.7

diff --git a/dwm.suckless.org/dwmstatus/bar_monitor.c b/dwm.suckless.org/dwmstatus/bar_monitor.c
index c254052..1a6c703 100644
--- a/dwm.suckless.org/dwmstatus/bar_monitor.c
+++ b/dwm.suckless.org/dwmstatus/bar_monitor.c
_AT_@ -3,7 +3,7 @@
  *
  * Written by: levi0x0 (levi0x0x[AT]gmail[DOT]com) for dwm.
  * Date: 08/08/2014, 19/07/2014, 02/07/2014
- * Version: 0.6
+ * Version: 0.7
  * License: GPL 3
  *
  * What it's Displays::
_AT_@ -13,7 +13,7 @@
  * 4. battery status.
  * 5. Uptime (Optional)
  * 6. Kernel Options.
- *
+ * 7. proc number
  * the bar_monitor.c Written Under Archlinux (x86_64) and Works for me.
  *
  * if you are not using laptop, please define: LAPTOP 0
_AT_@ -49,7 +49,7 @@
 #define net_file "/proc/net/wireless"
 #define temp_file "/sys/class/hwmon/hwmon0/temp1_input"
 #define STR_SIZE 30
-#define TIME_FORMAT "%H:%M %d-%m-%y"
+#define TIME_FORMAT "%H:%M | %d-%m-%y"
 #define date read_date()
 #define status open_status()
 #define pcapacity open_capacity()
_AT_@ -61,12 +61,18 @@
 0 - False
 */
 #define LAPTOP 1
-#define DISPLAY_UPTIME 1 //display uptime
-#define DISPLAY_KERNEL 1 //display kernel bar
+#define DISPLAY_SYS 1
+/*SECTION: You can enable only one of the options!*/
+/*sys section uptime, procs*/
+#define DISPLAY_PROC 1 // display proc number
+#define DISPLAY_UPTIME 0 //display uptime
+/*kernel section*/
+#define DISPLAY_KERNEL 1
 #define DISPLAY_KVER 0 //display kernel version
 #define DISPLAY_SYSNAME 0 //display system name
 #define DISPLAY_NODENAME 0
 #define DISPLAY_ARCH 1 //display Machine
+/*system*/
 #define SLEEP 1 //contain sleep(1) fucntion by default
 #define battery 1 //Display battery level
 
_AT_@ -88,38 +94,45 @@ int main(int argc, char **argv) {
                 if (!strcmp(status, "Discharging")) {
                         //printf("[%d%], Discharging
", pcapacity);
                         if ( pcapacity < 10 ) {
- printf("%d%% **Low Battery**", pcapacity);
+ printf(" %d%% **Low Battery**", pcapacity);
                         }
                         else {
- printf("%d%%", pcapacity);
+ printf(" %d%%", pcapacity);
                         }
                 }
 
                 else if (!strcmp(status, "Charging")) {
                         //printf("[%d%], Charging
", pcapacity);
- printf("%d%%", pcapacity);
+ printf(" %d%%", pcapacity);
                 }
                 else if (!strcmp(status, "Full")) {
- printf("[Full]");
+ printf(" [Full]");
 
                 }
                 else {
                         //What?! the program can't read the battery status
- printf("w00t?
");
+ printf(" w00t?
");
 
                 }
         #endif
 
- #if DISPLAY_UPTIME
+ #if DISPLAY_SYS
                 struct sysinfo sys;
                 int h = 0;
                 int m = 0;
 
                 sysinfo(&sys);
+
+
+ #if DISPLAY_UPTIME
+ h = sys.uptime / 3600;
+ m = ( sys.uptime - h * 3600) / 60;
+ printf(" | (%dh, %dm) |", h, m);
+ #elif DISPLAY_PROC
+ int procs = 0;
 
- h = sys.uptime / 3600;
- m = ( sys.uptime - h * 3600) / 60;
- printf(" (%dh, %dm)", h, m);
+ printf("| %dP | ", sys.procs);
+ #endif
         #endif
 
         
_AT_@ -143,9 +156,9 @@ int main(int argc, char **argv) {
         #endif
 
         #if LAPTOP
- printf(" %s %dC %s", nett,temp, date);
+ printf(" | %s | %dC | %s", nett,temp, date);
         #else
- printf(" %dC %s", temp, date);
+ printf(" | %dC | %s", temp, date);
         #endif
 
         #if SLEEP
Received on Fri Aug 08 2014 - 12:44:40 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:39:32 CEST