mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 05:53:22 -07:00
* usr/bin/byobu-config:
- migrate to toggling on/off the list of status items
This commit is contained in:
parent
e6277a3ba3
commit
18b0a02402
2 changed files with 47 additions and 59 deletions
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -34,6 +34,8 @@ byobu (4.30) unreleased; urgency=low
|
||||||
usr/share/byobu/profiles/tmux, usr/share/man/man1/byobu-status.1:
|
usr/share/byobu/profiles/tmux, usr/share/man/man1/byobu-status.1:
|
||||||
- transition to the new, faster, less-resource intensive status
|
- transition to the new, faster, less-resource intensive status
|
||||||
gathering method
|
gathering method
|
||||||
|
* usr/bin/byobu-config:
|
||||||
|
- migrate to toggling on/off the list of status items
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 11 Aug 2011 10:31:31 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 11 Aug 2011 10:31:31 -0500
|
||||||
|
|
||||||
|
|
|
@ -289,54 +289,24 @@ def readwindows():
|
||||||
|
|
||||||
def readstatus():
|
def readstatus():
|
||||||
status={}
|
status={}
|
||||||
status["apport"]=0
|
glo = {}
|
||||||
status["arch"]=0
|
loc = {}
|
||||||
status["battery"]=1
|
for f in [SHARE+'/status/status', BYOBU_CONFIG_DIR+'/status']:
|
||||||
status["cpu_count"]=1
|
if os.path.exists(f):
|
||||||
status["cpu_freq"]=1
|
try:
|
||||||
status["cpu_temp"]=0
|
execfile(f, glo, loc)
|
||||||
status["custom"]=1
|
except:
|
||||||
status["date"]=1
|
error("Invalid configuration [%s]" % f)
|
||||||
status["disk"]=0
|
if BYOBU_BACKEND == "tmux":
|
||||||
status["disk_io"]=0
|
items = "%s %s" % (loc["tmux_left"], loc["tmux_right"])
|
||||||
status["ec2_cost"]=0
|
else:
|
||||||
status["fan_speed"]=0
|
items = "%s %s %s %s" % (loc["screen_upper_left"], loc["screen_upper_right"], loc["screen_lower_left"], loc["screen_lower_right"])
|
||||||
status["hostname"]=1
|
for i in items.split():
|
||||||
status["ip_address"]=1
|
if i.startswith("#"):
|
||||||
status["load_average"]=1
|
i = i.replace("#", "")
|
||||||
status["logo"]=1
|
status[i] = "0"
|
||||||
status["mail"]=0
|
else:
|
||||||
status["mem_available"]=1
|
status[i] = "1"
|
||||||
status["mem_used"]=1
|
|
||||||
status["menu"]=1
|
|
||||||
status["network"]=1
|
|
||||||
status["notify_osd"]=0
|
|
||||||
status["processes"]=0
|
|
||||||
status["raid"]=1
|
|
||||||
status["rcs_cost"]=0
|
|
||||||
status["reboot_required"]=1
|
|
||||||
status["release"]=1
|
|
||||||
status["services"]=1
|
|
||||||
status["swap"]=0
|
|
||||||
status["time"]=1
|
|
||||||
status["time_binary"]=0
|
|
||||||
status["time_utc"]=0
|
|
||||||
status["users"]=1
|
|
||||||
status["updates_available"]=1
|
|
||||||
status["uptime"]=1
|
|
||||||
status["whoami"]=1
|
|
||||||
status["wifi_quality"]=1
|
|
||||||
if os.path.exists(BYOBU_CONFIG_DIR+'/status'):
|
|
||||||
f=open(BYOBU_CONFIG_DIR+'/status', 'r')
|
|
||||||
for line in f.readlines():
|
|
||||||
try:
|
|
||||||
line = line.rstrip()
|
|
||||||
(key, val) = line.split("=", 2)
|
|
||||||
if status.has_key(key) and (val == "1" or val == "0"):
|
|
||||||
status[key] = val
|
|
||||||
except:
|
|
||||||
continue
|
|
||||||
f.close()
|
|
||||||
li=[]
|
li=[]
|
||||||
keys = status.keys()
|
keys = status.keys()
|
||||||
keys.sort()
|
keys.sort()
|
||||||
|
@ -345,18 +315,34 @@ def readstatus():
|
||||||
li.append(window)
|
li.append(window)
|
||||||
return li
|
return li
|
||||||
|
|
||||||
|
def genstatusstring(s, status):
|
||||||
|
new = ""
|
||||||
|
glo = {}
|
||||||
|
loc = {}
|
||||||
|
execfile(SHARE+'/status/status', glo, loc)
|
||||||
|
for i in loc[s].split():
|
||||||
|
if i.startswith("#"):
|
||||||
|
i = i.replace("#", "")
|
||||||
|
if status[i] == 1:
|
||||||
|
new += " " + i
|
||||||
|
else:
|
||||||
|
new += " #" + i
|
||||||
|
return new
|
||||||
|
|
||||||
def writestatus(items):
|
def writestatus(items):
|
||||||
f=open(BYOBU_CONFIG_DIR+'/status', 'w')
|
status={}
|
||||||
try:
|
path = BYOBU_CONFIG_DIR+'/status'
|
||||||
for i in items:
|
for i in items:
|
||||||
if i[0] == 1:
|
status[i[1]] = i[0]
|
||||||
f.write(i[1]+"=1\n")
|
# SED is hacky here, but damn effective
|
||||||
elif i[0] == 0:
|
if BYOBU_BACKEND == "tmux":
|
||||||
f.write(i[1]+"=0\n")
|
for key in ["tmux_left", "tmux_right"]:
|
||||||
except IOError:
|
val = genstatusstring(key, status)
|
||||||
f.close()
|
commands.getoutput("%s -i -e 's/^%s=.*$/%s=\"%s\"/' %s" % (SED, key, key, val, path))
|
||||||
return None
|
else:
|
||||||
f.close()
|
for key in ["screen_upper_left", "screen_upper_right", "screen_lower_left", "screen_lower_right"]:
|
||||||
|
val = genstatusstring(key, status)
|
||||||
|
commands.getoutput("%s -i -e 's/^%s=.*$/%s=\"%s\"/' %s" % (SED, key, key, val, path))
|
||||||
|
|
||||||
def togglestatus(snackScreen, size):
|
def togglestatus(snackScreen, size):
|
||||||
itemlist=readstatus()
|
itemlist=readstatus()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue