示例#1
0
 def run(self):
     global RAM,RAM_SLEEP
     while 1:
         used=bytes_to_mb(used_phymem()-cached_mem()-buffers())
         percentage=(100*used)/TOTAL_RAM_MB
         RAM="^i("+ICON_PATH+"/mem.xbm) "+set_gradient_color(percentage)+str(used)+set_normal_color()+"M"
         sleep(int(RAM_SLEEP))
示例#2
0
 def run(self):
     global HDDTEMP,HDDTEMP_SLEEP
     while 1:
         s = socket(AF_INET, SOCK_STREAM)
         s.connect(("localhost",7634))
         buf = s.recv(4096)
         s.close()
         temp=buf[-5:-3]
         try:
             percentage=100*(int(temp)-25)/60
         except ValueError:
             continue
         HDDTEMP="^i("+ICON_PATH+"/temp.xbm) "+set_gradient_color(percentage)+temp+set_normal_color()+"C"
         sleep(int(HDDTEMP_SLEEP))
示例#3
0
    def run(self):
        global CPU,CPU_SLEEP
        MAX_FREQ=0
        MIN_FREQ=999999
        while 1:
            f = open('/proc/cpuinfo', 'r')
##              cpu_frequencies=""
            freqs=[]
            for line in f:
                if line.startswith('cpu MHz'):
                    freqs.append(int(round(float(line.split()[3]),0)))
            f.close()
##              for i in range (len(freqs)):
##                  cpu_frequencies+=" Core"+str(i)+"@ "+str(freqs[i])
            freq=max(freqs)
            if MAX_FREQ<freq:
                MAX_FREQ=freq
            if MIN_FREQ>freq:
                MIN_FREQ=freq-1
            fpercentage=100*(freq-MIN_FREQ)/(MAX_FREQ-MIN_FREQ)
            cpu_frequencies=" @ "+set_gradient_color(fpercentage)+str(round(freq/1000.,1))+set_normal_color()+"GHz"
            percentage=round(cpu_percent(), 1)
            CPU="^i("+ICON_PATH+"/cpu.xbm) "+set_gradient_color(percentage)+"^r("+str(ceil(float(percentage/2)))+"x8)"+set_color(CPU_BAR_COLOR)+"^r("+str(50-ceil(float(percentage/2)))+"x8)"+set_normal_color()+cpu_frequencies
            sleep(int(CPU_SLEEP))
示例#4
0
 def run(self):
     global CPUTEMP
     while True:
         try:
             f1 = open('/sys/devices/platform/coretemp.0/temp2_input','r')
             f2 = open('/sys/devices/platform/coretemp.0/temp3_input','r')
             TC1 = int(f1.readline())/1000
             TC2 = int(f2.readline())/1000
             C1ritical = int(open('/sys/devices/platform/coretemp.0/temp2_crit','r').readline())/1000
             C2ritical = int(open('/sys/devices/platform/coretemp.0/temp3_crit','r').readline())/1000
             percent1 = int(TC1*100/C1ritical)
             percent2 = int(TC2*100/C2ritical)
             if percent1 > 100:
                 percent1 = 100
             if percent2 > 100:
                 percent2 = 100
             CPUTEMP = "^i("+ICON_PATH+"/temp.xbm) "+ set_gradient_color(100-percent1)+str(TC1)+set_normal_color()+" | "+set_gradient_color(100-percent2)+str(TC2)+set_normal_color()
             f1.close()
             f2.close()
         except IOError:
             CPUTEMP = "N/A"
         sleep(60);