Merge branch 'master' of gitlab.com:shockrah/shell-scripts
This commit is contained in:
commit
6de646bd4d
3
bread
3
bread
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
book=`ls $HOME/Books/ | dmenu -i -l 15`
|
book=`ls $HOME/Books/ | dmenu -i -l 15`
|
||||||
if [ ! -z "$book" ]
|
if [ ! -z "$book" ]
|
||||||
then
|
then
|
||||||
|
@ -95,8 +95,8 @@ battery_percentage(void)
|
|||||||
#ifdef CPU_USAGE
|
#ifdef CPU_USAGE
|
||||||
// stat(2) ->
|
// stat(2) ->
|
||||||
#define CPU_PROC_BASE
|
#define CPU_PROC_BASE
|
||||||
#define TOTAL "head /proc/stat -n 1 | cut -c 6- | sed 's/ /\\+/g' | bc"
|
#define CPU_TOTAL "head /proc/stat -n 1 | cut -c 6- | sed 's/ /\\+/g' | bc"
|
||||||
#define IDLE "head /proc/stat -n 1 | cut -c 6- | awk '{print $4}'"
|
#define CPU_IDLE "head /proc/stat -n 1 | cut -c 6- | awk '{print $4}'"
|
||||||
static char*
|
static char*
|
||||||
cpu_usage(void)
|
cpu_usage(void)
|
||||||
{
|
{
|
||||||
@ -106,13 +106,13 @@ cpu_usage(void)
|
|||||||
static char buf[SMALL_BUF];
|
static char buf[SMALL_BUF];
|
||||||
unsigned total, idle;
|
unsigned total, idle;
|
||||||
// get the total time
|
// get the total time
|
||||||
query_p = popen(TOTAL, "r");
|
query_p = popen(CPU_TOTAL, "r");
|
||||||
fgets(buf, sizeof(buf)-1, query_p);
|
fgets(buf, sizeof(buf)-1, query_p);
|
||||||
total = atoi(buf);
|
total = atoi(buf);
|
||||||
pclose(query_p);
|
pclose(query_p);
|
||||||
|
|
||||||
// get the idle time
|
// get the idle time
|
||||||
query_p = popen(IDLE, "r");
|
query_p = popen(CPU_IDLE, "r");
|
||||||
fgets(buf, sizeof(buf)-1, query_p);
|
fgets(buf, sizeof(buf)-1, query_p);
|
||||||
idle = atoi(buf);
|
idle = atoi(buf);
|
||||||
pclose(query_p);
|
pclose(query_p);
|
||||||
@ -182,7 +182,11 @@ main(void)
|
|||||||
remainder -= written;
|
remainder -= written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("%s\n", stat_output);
|
||||||
|
#else
|
||||||
XSetRoot(stat_output);
|
XSetRoot(stat_output);
|
||||||
|
#endif
|
||||||
sleep(TIME_DELAY);
|
sleep(TIME_DELAY);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
2
wifi
2
wifi
@ -47,6 +47,8 @@ __kill_old() {
|
|||||||
__connect_config() {
|
__connect_config() {
|
||||||
if [ -z "$debug_kill" ]
|
if [ -z "$debug_kill" ]
|
||||||
then
|
then
|
||||||
|
if [ ! -f "$1" ]; then echo Config not found\
|
||||||
|
exit 0;fi
|
||||||
__kill_old
|
__kill_old
|
||||||
wpa_supplicant -B -i wlp1s0 -c "$1"
|
wpa_supplicant -B -i wlp1s0 -c "$1"
|
||||||
dhclient wlp1s0
|
dhclient wlp1s0
|
||||||
|
Loading…
Reference in New Issue
Block a user