load module
This commit is contained in:
parent
c4db62d2a4
commit
a0fc9eb492
10
README.md
10
README.md
@ -56,6 +56,16 @@ This class shows a clock
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### load
|
||||||
|
|
||||||
|
|
||||||
|
Shows system load
|
||||||
|
|
||||||
|
|
||||||
|
* format — format string used for output. {avg1}, {avg5} and {avg15} are the load average of the last one, five and fifteen minutes, respectively. {tasks} is the number of tasks (i.e. 1/285, which indiciates that one out of 285 total tasks is runnable). (default: {avg1} {avg5})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### mail
|
### mail
|
||||||
|
|
||||||
|
|
||||||
|
21
i3pystatus/load.py
Normal file
21
i3pystatus/load.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
from i3pystatus import IntervalModule
|
||||||
|
|
||||||
|
class Load(IntervalModule):
|
||||||
|
"""
|
||||||
|
Shows system load
|
||||||
|
"""
|
||||||
|
|
||||||
|
format = "{avg1} {avg5}"
|
||||||
|
settings = (
|
||||||
|
("format", "format string used for output. {avg1}, {avg5} and {avg15} are the load average of the last one, five and fifteen minutes, respectively. {tasks} is the number of tasks (i.e. 1/285, which indiciates that one out of 285 total tasks is runnable)."),
|
||||||
|
)
|
||||||
|
|
||||||
|
file = "/proc/loadavg"
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
with open(self.file, "r") as f:
|
||||||
|
avg1, avg5, avg15, tasks, lastpid = f.read().split(" ", 5)
|
||||||
|
|
||||||
|
self.output = {
|
||||||
|
"full_text" : self.format.format(avg1=avg1, avg5=avg5, avg15=avg15, tasks=tasks),
|
||||||
|
}
|
@ -23,6 +23,6 @@ class Regex(IntervalModule):
|
|||||||
def run(self):
|
def run(self):
|
||||||
with open(self.file, "r") as f:
|
with open(self.file, "r") as f:
|
||||||
match = self.re.search(f.read())
|
match = self.re.search(f.read())
|
||||||
self.output = self.output = {
|
self.output = {
|
||||||
"full_text" : self.format.format(*match.groups()),
|
"full_text" : self.format.format(*match.groups()),
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user