Example #1
0
    def mail(self):
        # Thanks to
        # crunchbanglinux.org/forums/topic/16430/make-conky-check-gmail-using-https/
        # for easy way to get unread mails.
        ret = "unread: %s    "
        cmd = "\
		wget -q -O - https://mail.google.com/a/gmail.com/feed/atom \
		[email protected] --http-password=\"SECRET!!\" \
		--no-check-certificate | grep fullcount | sed \"s/<[^0-9]*>//g\""

        num = o([cmd], shell=True).strip()

        # Display # of messages in red if  there's a new mail
        color = self.color_normal if num == '0' else self.color_attn

        self.final.append({
            "name": "mail_str",
            "full_text": '᚜ unread:',
            "color": self.color_normal
        })

        self.final.append({
            "name": "mail_val",
            "full_text": num + self.spacer,
            "color": color
        })
Example #2
0
	def mail(self):
		# Thanks to
		# crunchbanglinux.org/forums/topic/16430/make-conky-check-gmail-using-https/
		# for easy way to get unread mails.
		try:
			ret = "unread: %s    "
			cmd = "\
			wget -q -O - https://mail.google.com/a/gmail.com/feed/atom \
			[email protected] --http-password=\"SECRET\" \
			--no-check-certificate | grep fullcount | sed \"s/<[^0-9]*>//g\""
			num = o([cmd], shell=True).strip()

			# Display # of messages in red if  there's a new mail
			color = self.color_normal if num == '0' else self.color_attn

			self.final.append({
				"name" : "mail_str",
				"full_text" : 'unread: ',
				"color" : self.color_normal
			})

			self.final.append({
				"name" : "mail_val",
				"full_text" : num + self.spacer,
				"color" : color
			})
		except:
			pass
Example #3
0
    def volume(self):
        # Alsa, since i use Alsa. Feel free to change.
        try:
            s = o(["amixer get Master | grep %"], shell=True).split()
            if s[5][1:3] == "on":
                volume = s[3][1:-1]
            else:
                volume = "[mute]"
        except:
            # Alsa not loaded, or loaded wrong device
            volume = "[volume error]"

        color = self.color_attn if volume == "[mute]" else self.color_normal

        self.final.append({
            "name": "volume_str",
            "full_text": "v:",
            "color": self.color_normal
        })

        self.final.append({
            "name": "volume_val",
            "full_text": volume + self.spacer,
            "color": color
        })
Example #4
0
	def volume(self):
		# Alsa, since i use Alsa. Feel free to change.
		try:
			s = o(["amixer get Master | grep %"], shell=True).split()
			if s[5][1:3] == "on":
				volume = s[3][1:-1]
			else:
				volume =  "[mute]"
		except:
			# Alsa not loaded, or loaded wrong device
			volume = "[volume error]"

		color = self.color_attn if volume == "[mute]" else self.color_normal

		self.final.append( {
			"name" : "volume_str",
			"full_text" : "v:",
			"color" : self.color_normal
		})

		self.final.append( {
			"name" : "volume_val",
			"full_text" : volume + self.spacer,
			"color" : color
			})
Example #5
0
	def date(self):
		date = o(["date", "+%b %e %% %I:%M "])

		self.final.append({
			"name" : "date",
			"full_text" : date,
			"color" : self.color_normal
		})
Example #6
0
    def date(self):
        date = o(["date", "+%b %e %% %I:%M "])

        self.final.append({
            "name": "date",
            "full_text": date,
            "color": self.color_normal
        })
Example #7
0
    def mem(self):
        str = o(["free -mt | grep buffers/cache"], shell=True).split(" ")
        str = filter(None, str)

        self.final.append({
            "name": "mem_str",
            "full_text": "mem: ",
            "color": self.color_normal
        })

        self.final.append({
            "name": "mem_val",
            "full_text": str[2] + self.spacer,
            "color": self.color_normal
        })
Example #8
0
	def mem(self):
		str = o(["free -mt | grep buffers/cache"], shell=True).split(" ")
		str = filter(None,str);

		self.final.append( {
			"name" : "mem_str",
			"full_text" : "mem: ",
			"color" : self.color_normal
		})

		self.final.append( {
			"name" : "mem_val",
			"full_text" : str[2] + self.spacer,
			"color" : self.color_normal
		})
Example #9
0
    def leds(self):
        # Scroll-lock will not work. If anyone knows a fix, tell me =)
        output = '['
        l = o(["xset q | awk -F '[[:space:]]+[0-9][0-9]:[[:space:]]' \
		'NF>1{for(i=2;i<=NF;i++) print $i}'"                                            ], \
        shell=True).split()
        output += '-' if l[2] == 'off' else 'c'
        output += '-' if l[8] == 'off' else 's'
        output += '-' if l[5] == 'off' else 'n'
        output += ']'

        self.final.append({
            "name": "leds",
            "full_text": output + self.spacer,
            "color": self.color_normal
        })
Example #10
0
	def leds(self):
		# Scroll-lock will not work. If anyone knows a fix, tell me =)
		output = '['
		l = o(["xset q | awk -F '[[:space:]]+[0-9][0-9]:[[:space:]]' \
		'NF>1{for(i=2;i<=NF;i++) print $i}'"], \
		shell=True).split()
		output += '-' if l[2] == 'off' else 'c'
		output += '-' if l[8] == 'off' else 's'
		output += '-' if l[5] == 'off' else 'n'
		output += ']'

		self.final.append( {
			"name" : "leds",
			"full_text" : output + self.spacer,
			"color" : self.color_normal
		})
Example #11
0
    def Wireless(self):
        w = o(["iwconfig wlan0 | grep Quality"], shell=True)
        s = w.split("/")[0][-2:]
        r = "signal: "
        s = int(s)
        if s == 0:
            r += "offline"
        if 0 < s <= 20:
            r += "bad"
        if 20 < s <= 46:
            r += "ok"
        if 46 < s < 60:
            r += "good"
        if s >= 60:
            r += "excellent"

        self.final.append({
            "name": "wireless_str",
            "full_text": r + self.spacer,
            "color": self.color_normal
        })
Example #12
0
	def Wireless(self):
		w = o(["iwconfig wlan0 | grep Quality"], shell=True)
		s =  w.split("/")[0][-2:]
		r = "signal: "
		s = int(s)
		if s == 0:
			r += "offline"
		if 0 < s <= 20:
			r += "bad"
		if 20 < s <= 46:
			r += "ok"
		if 46 < s < 60:
			r += "good"
		if s >= 60:
			r += "excellent"

		self.final.append({
			"name" : "wireless_str",
			"full_text" : r + self.spacer,
			"color" : self.color_normal
		})
Example #13
0
	def ssh(self):
		try:
			w = o("lsof -i tcp -n | grep ssh | cut -d '>' -f 2 | cut -d ':' -f 1", shell=True).strip()

			array = w.split()
			size = len(array)
			if len(w) ==  0:
				self.final.append({
					"name" : "ssh",
					"full_text": "[ no ssh connections ]" + self.spacer,
					"color": self.color_inactive
				})
			else:
				for i in list(set(array)): # remove duplicates
					spacer = ' ' if i == size else self.spacer
					self.final.append({
						"name" : "ssh",
						"full_text": self.conns[i] + ' ᚜   ',
						"color": self.ssh_colors[self.conns[i]]
					})
		except:
			pass