added a very basic frequency module
This commit is contained in:
parent
19e6abc8ca
commit
367bd57e1a
5 changed files with 38 additions and 0 deletions
31
bumblebee/modules/frequency.py
Normal file
31
bumblebee/modules/frequency.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
# pylint: disable=C0111,R0903
|
||||
|
||||
"""Displays CPU frequency.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import bumblebee.input
|
||||
import bumblebee.output
|
||||
import bumblebee.engine
|
||||
|
||||
|
||||
class Module(bumblebee.engine.Module):
|
||||
def __init__(self, engine, config):
|
||||
super(Module, self).__init__(engine, config,
|
||||
bumblebee.output.Widget(full_text=self.frequency)
|
||||
)
|
||||
self._frequency = 0
|
||||
|
||||
def frequency(self, widget):
|
||||
return self._frequency
|
||||
|
||||
def getFrequency(self):
|
||||
cmd = "cpupower frequency-info | grep \"Hz\" | grep \"current CPU\" | xargs | cut -d ' ' -f 4-5"
|
||||
return subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode("utf-8").rstrip()
|
||||
|
||||
def update(self, widgets):
|
||||
self._frequency = self.getFrequency()
|
||||
|
||||
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
|
@ -28,6 +28,10 @@
|
|||
}
|
||||
},
|
||||
"battery": {
|
||||
"unknown":{
|
||||
"bg": "#4f4f4f",
|
||||
"fg": "#e9e9e9"
|
||||
},
|
||||
"charged": {
|
||||
"fg": "#002b36",
|
||||
"bg": "#859900"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
},
|
||||
"memory": { "prefix": "ram" },
|
||||
"cpu": { "prefix": "cpu" },
|
||||
"frequency": { "prefix": "frequency" },
|
||||
"disk": { "prefix": "hdd" },
|
||||
"dnf": { "prefix": "dnf" },
|
||||
"brightness": { "prefix": "o" },
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"datetime": { "prefix": "" },
|
||||
"memory": { "prefix": "" },
|
||||
"cpu": { "prefix": "" },
|
||||
"frequency": { "prefix": "" },
|
||||
"disk": { "prefix": "" },
|
||||
"dnf": { "prefix": "" },
|
||||
"pacman": { "prefix": "" },
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"datetime": { "prefix": "\uf3b3" },
|
||||
"memory": { "prefix": "\uf389" },
|
||||
"cpu": { "prefix": "\uf4b0" },
|
||||
"frequency": { "prefix": "\uf4b0" },
|
||||
"disk": { "prefix": "\u26c1" },
|
||||
"dnf": { "prefix": "\uf2be" },
|
||||
"pacman": { "prefix": "\uf2be" },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue