Update code for two status (third line in my dwm lost)
This commit is contained in:
		
							
								
								
									
										39
									
								
								dwmbar
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								dwmbar
									
									
									
									
									
								
							| @ -21,11 +21,11 @@ def shutdown(): | ||||
|  | ||||
|  | ||||
| async def dwmbar(): | ||||
| 	global bl, br | ||||
| 	global DD | ||||
|  | ||||
| 	await asyncio.sleep(1) | ||||
| 	while True: | ||||
| 		bar = f"{status()}{DD}{bl}{DD}{br}" | ||||
| 		bar = f"{status()}{DD}{extrabar()}" | ||||
|  | ||||
| #		print(bar) | ||||
| 		run(["xprop", "-root", "-set", "WM_NAME", bar], check=True) | ||||
| @ -54,8 +54,22 @@ def status(): | ||||
| 		return '' | ||||
|  | ||||
|  | ||||
| async def bl(): | ||||
| 	global bl, COLOR | ||||
| def extrabar(): | ||||
| 	global DELIM, currates, weather, COLOR | ||||
|  | ||||
| 	try: | ||||
| 		bar = [ | ||||
| 			weather, | ||||
| 			currates | ||||
| 		] | ||||
|  | ||||
| 		return DELIM.join(bar) | ||||
| 	except: | ||||
| 		return '' | ||||
|  | ||||
|  | ||||
| async def currates(): | ||||
| 	global DELIM, currates, COLOR | ||||
|  | ||||
| 	COLOR1='#AAAAAA' | ||||
| 	COLOR2='#444444' | ||||
| @ -71,13 +85,13 @@ async def bl(): | ||||
| 		else: | ||||
| 			row = list(map(lambda x: f'[{x[0]} | {x[1]}]', curs)) | ||||
|  | ||||
| 		bl = DELIM.join(row) | ||||
| 		currates = DELIM.join(row) | ||||
|  | ||||
| 		await asyncio.sleep(60 * 10) | ||||
|  | ||||
|  | ||||
| async def br(): | ||||
| 	global br, COLOR | ||||
| async def weather(): | ||||
| 	global weather, COLOR | ||||
|  | ||||
| 	COLOR1='#AAAAAA' | ||||
| 	COLOR2='#444444' | ||||
| @ -85,15 +99,16 @@ async def br(): | ||||
| 	CITY='Tyumen' | ||||
|  | ||||
| 	while True: | ||||
| 		print('w s') | ||||
| 		i = requests.get(f"https://wttr.in/{CITY}?format=%c").text.strip() #.encode('utf-8')[0:3].decode('utf-8') | ||||
| 		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^" | ||||
| 			weather = 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}]" | ||||
|  | ||||
| 			weather = f"[{w} km/h | {i} | {t}]" | ||||
| 		print('w e') | ||||
| 		await asyncio.sleep(60 * 30) | ||||
|  | ||||
|  | ||||
| @ -303,8 +318,8 @@ async def main(): | ||||
| 		lang(), | ||||
| 		dat(), | ||||
| 		tim(), | ||||
| 		bl(), | ||||
| 		br() | ||||
| 		currates(), | ||||
| 		weather() | ||||
| 	) | ||||
|  | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user