Add defolt layout (no color)
This commit is contained in:
		
							
								
								
									
										73
									
								
								dwmbar
									
									
									
									
									
								
							
							
						
						
									
										73
									
								
								dwmbar
									
									
									
									
									
								
							| @ -12,6 +12,7 @@ from datetime import datetime | ||||
|  | ||||
| DD = ';' | ||||
| DELIM = '  ' | ||||
| COLOR = False | ||||
|  | ||||
|  | ||||
| def shutdown(): | ||||
| @ -27,8 +28,7 @@ async def dwmbar(): | ||||
| 	while True: | ||||
| 		bar = f"{status()}{DD}{bl}{DD}{br}" | ||||
|  | ||||
| #		print(bar.encode('utf-8')) | ||||
| #		print(br) | ||||
| #		print(bar) | ||||
| 		run(["xprop", "-root", "-set", "WM_NAME", bar], check=True) | ||||
|  | ||||
| 		await asyncio.sleep(0.1) | ||||
| @ -56,7 +56,7 @@ def status(): | ||||
|  | ||||
|  | ||||
| async def bl(): | ||||
| 	global bl | ||||
| 	global bl, COLOR | ||||
|  | ||||
| 	COLOR1='#AAAAAA' | ||||
| 	COLOR2='#444444' | ||||
| @ -82,7 +82,10 @@ async def bl(): | ||||
| 			:.2f} RUB""" | ||||
| 		]) | ||||
|  | ||||
| 		if COLOR: | ||||
| 			row = list(map(lambda x: f'^b{COLOR1}^^c{COLOR2}^ {x[0]} ^c{COLOR1}^^b{COLOR2}^ {x[1]} ^d^', curs)) | ||||
| 		else: | ||||
| 			row = list(map(lambda x: f'[{x[0]} | {x[1]}]', curs)) | ||||
|  | ||||
| 		bl = DELIM.join(row) | ||||
|  | ||||
| @ -90,7 +93,7 @@ async def bl(): | ||||
|  | ||||
|  | ||||
| async def br(): | ||||
| 	global br | ||||
| 	global br, COLOR | ||||
|  | ||||
| 	COLOR1='#AAAAAA' | ||||
| 	COLOR2='#444444' | ||||
| @ -102,13 +105,16 @@ async def br(): | ||||
| 		t = requests.get(f"https://wttr.in/{CITY}?format=%t").text.strip() | ||||
| 		w = requests.get(f"https://wttr.in/{CITY}?format=j2").json()['current_condition'][0]['windspeedKmph'].strip() | ||||
|  | ||||
| 		if COLOR: | ||||
| 			br = f"^b{COLOR2}^^c{COLOR1}^ {w} km/h ^b{COLOR1}^^c{COLOR2}^ {i} ^c{COLOR1}^^b{COLOR2}^ {t} ^d^" | ||||
| 		else: | ||||
| 			br = f"[{w} km/h | {i} | {t}]" | ||||
|  | ||||
| 		await asyncio.sleep(60 * 30) | ||||
|  | ||||
|  | ||||
| async def net(): | ||||
| 	global net | ||||
| 	global net, COLOR | ||||
|  | ||||
| 	COLOR1='#FF9B00' | ||||
| 	COLOR2='#A16200' | ||||
| @ -126,12 +132,16 @@ async def net(): | ||||
| 		orecv = recv | ||||
| 		osent = sent | ||||
|  | ||||
| 		if COLOR: | ||||
| 			net = f'^c{COLOR1}^^b{COLOR2}^ {inb} ^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {outb} ^d^' | ||||
| 		else: | ||||
| 			net = f'[{inb} |  | {outb}]' | ||||
|  | ||||
| 		await asyncio.sleep(1) | ||||
|  | ||||
|  | ||||
| async def ram(): | ||||
| 	global ram | ||||
| 	global ram, COLOR | ||||
|  | ||||
| 	COLOR1='#C700FF' | ||||
| 	COLOR2='#590073' | ||||
| @ -140,12 +150,16 @@ async def ram(): | ||||
| 		ramt = psutil.virtual_memory().total / 1024 / 1024 / 1024 | ||||
| 		ramu = psutil.virtual_memory().used / 1024 / 1024 / 1024 | ||||
|  | ||||
| 		if COLOR: | ||||
| 			ram = f'^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {ramu:0.1f}/{ramt:0.1f}G ^d^' | ||||
| 		else: | ||||
| 			ram = f'[ | {ramu:0.1f}/{ramt:0.1f}G]' | ||||
|  | ||||
| 		await asyncio.sleep(1) | ||||
|  | ||||
|  | ||||
| async def cpu(): | ||||
| 	global cpu | ||||
| 	global cpu, COLOR | ||||
|  | ||||
| 	COLOR1='#990057' | ||||
| 	COLOR2='#FF00B2' | ||||
| @ -153,12 +167,16 @@ async def cpu(): | ||||
| 	while True: | ||||
| 		load = psutil.cpu_percent() | ||||
|  | ||||
| 		if COLOR: | ||||
| 			cpu = f'^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {load:0.0f}% ^d^' | ||||
| 		else: | ||||
| 			cpu = f'[ | {load:0.0f}%]' | ||||
|  | ||||
| 		await asyncio.sleep(1) | ||||
|  | ||||
|  | ||||
| async def gpu(): | ||||
| 	global gpu | ||||
| 	global gpu, COLOR | ||||
|  | ||||
| 	COLOR1='#990057' | ||||
| 	COLOR2='#FF00B2' | ||||
| @ -166,12 +184,16 @@ async def gpu(): | ||||
| 	while True: | ||||
| 		load = open('/sys/class/drm/card0/device/gpu_busy_percent').read().strip() | ||||
|  | ||||
| 		if COLOR: | ||||
| 			gpu = f'^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {load}% ^d^' | ||||
| 		else: | ||||
| 			gpu = f'[ | {load}%]' | ||||
|  | ||||
| 		await asyncio.sleep(1) | ||||
|  | ||||
|  | ||||
| async def wlan(): | ||||
| 	global cpu | ||||
| 	global cpu, COLOR | ||||
|  | ||||
| 	COLOR1='#009CFF' | ||||
| 	COLOR2='#005083' | ||||
| @ -180,12 +202,16 @@ async def wlan(): | ||||
| 		c = psutil.cpu_percent() | ||||
| 		i = '' | ||||
|  | ||||
| 		if COLOR: | ||||
| 			cpu = f'^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {c:0.0f}% ^d^' | ||||
| 		else: | ||||
| 			cpu = f'[ | {c:0.0f}%]' | ||||
|  | ||||
| 		await asyncio.sleep(1) | ||||
|  | ||||
|  | ||||
| async def disk(): | ||||
| 	global disk | ||||
| 	global disk, COLOR | ||||
|  | ||||
| 	COLOR1='#00FF90' | ||||
| 	COLOR2='#00A45D' | ||||
| @ -194,12 +220,16 @@ async def disk(): | ||||
| 		f = psutil.disk_usage('/').free / 1024 / 1024 / 1024 | ||||
| 		t = psutil.disk_usage('/').total / 1024 / 1024 / 1024 | ||||
|  | ||||
| 		if COLOR: | ||||
| 			disk = f'^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {f:0.0f}/{t:0.0f}G ^d^' | ||||
| 		else: | ||||
| 			disk = f'[ | {f:0.0f}/{t:0.0f}G]' | ||||
|  | ||||
| 		await asyncio.sleep(3) | ||||
|  | ||||
|  | ||||
| async def vol(): | ||||
| 	global vol | ||||
| 	global vol, COLOR | ||||
|  | ||||
| 	COLOR1='#FF0000' | ||||
| 	COLOR2='#700000' | ||||
| @ -219,12 +249,16 @@ async def vol(): | ||||
| 		if alsaaudio.Mixer().getmute()[0]: | ||||
| 			i = '' | ||||
|  | ||||
| 		if COLOR: | ||||
| 			vol = f'^b{COLOR1}^^c{COLOR2}^ {i} ^c{COLOR1}^^b{COLOR2}^ {v}% ^d^' | ||||
| 		else: | ||||
| 			vol = f'[{i} | {v}%]' | ||||
|  | ||||
| 		await asyncio.sleep(1) | ||||
|  | ||||
|  | ||||
| async def lang(): | ||||
| 	global lang | ||||
| 	global lang, COLOR | ||||
|  | ||||
| 	COLOR1='#FF5800' | ||||
| 	COLOR2='#973400' | ||||
| @ -232,12 +266,16 @@ async def lang(): | ||||
| 	while True: | ||||
| 		l = run(["xkblayout-state", "print", "%s"], check=True, capture_output=True, text=True).stdout | ||||
|  | ||||
| 		if COLOR: | ||||
| 			lang = f'^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {l} ^d^' | ||||
| 		else: | ||||
| 			lang = f'[ | {l}]' | ||||
|  | ||||
| 		await asyncio.sleep(0.1) | ||||
|  | ||||
|  | ||||
| async def tim(): | ||||
| 	global tim | ||||
| 	global tim, COLOR | ||||
|  | ||||
| 	COLOR1='#00E9FF' | ||||
| 	COLOR2='#008592' | ||||
| @ -245,12 +283,16 @@ async def tim(): | ||||
| 	while True: | ||||
| 		t = datetime.now().strftime("%H:%M:%S") | ||||
|  | ||||
| 		if COLOR: | ||||
| 			tim = f'^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {t} ^d^' | ||||
| 		else: | ||||
| 			tim = f'[ | {t}]' | ||||
|  | ||||
| 		await asyncio.sleep(1) | ||||
|  | ||||
|  | ||||
| async def dat(): | ||||
| 	global dat | ||||
| 	global dat, COLOR | ||||
|  | ||||
| 	COLOR1='#17FF00' | ||||
| 	COLOR2='#0EA100' | ||||
| @ -258,7 +300,10 @@ async def dat(): | ||||
| 	while True: | ||||
| 		d = datetime.now().strftime("%d.%m.%y") | ||||
|  | ||||
| 		if COLOR: | ||||
| 			dat = f'^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {d} ^d^' | ||||
| 		else: | ||||
| 			dat = f'[ | {d}]' | ||||
| 		await asyncio.sleep(1) | ||||
|  | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user