Change some conf
This commit is contained in:
		
							
								
								
									
										47
									
								
								dwmbar
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								dwmbar
									
									
									
									
									
								
							| @ -12,13 +12,12 @@ from datetime import datetime | |||||||
|  |  | ||||||
| DD = ';' | DD = ';' | ||||||
| DELIM = '  ' | DELIM = '  ' | ||||||
| COLOR = False | COLOR = True | ||||||
|  |  | ||||||
|  |  | ||||||
| def shutdown(): | def shutdown(): | ||||||
| 	for task in asyncio.Task.all_tasks(): | 	print("Shutting down...") | ||||||
| 		if task is not asyncio.tasks.Task.current_task(): | 	loop.stop() | ||||||
| 			task.cancel() |  | ||||||
|  |  | ||||||
|  |  | ||||||
| async def dwmbar(): | async def dwmbar(): | ||||||
| @ -63,24 +62,9 @@ async def bl(): | |||||||
|  |  | ||||||
| 	while True: | 	while True: | ||||||
| 		curs = [] | 		curs = [] | ||||||
| 		curs.append(['', f"${float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=XMRUSDT').json()['lastPrice']):.2f}"]) |  | ||||||
| 		curs.append(['', f"${float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=BTCUSDT').json()['lastPrice']):.2f}"]) | 		curs.append(['', f"${float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=BTCUSDT').json()['lastPrice']):.2f}"]) | ||||||
| 		curs.append(['', f"${float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=LTCUSDT').json()['lastPrice']):.2f}"]) | 		curs.append(['', f"${float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=LTCUSDT').json()['lastPrice']):.2f}"]) | ||||||
| 		curs.append(['Ð', f"${float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=DOGEUSDT').json()['lastPrice']):.2f}"]) | 		curs.append(['Ð', f"${float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=DOGEUSDT').json()['lastPrice']):.2f}"]) | ||||||
| 		curs.append(['$', f"{float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=USDTRUB').json()['lastPrice']):.2f} RUB"]) |  | ||||||
|  |  | ||||||
| 		curs.append(['', |  | ||||||
| 			f"""{ |  | ||||||
| 				float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=USDTRUB').json()['lastPrice']) / |  | ||||||
| 				float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=USDTTRY').json()['lastPrice']) |  | ||||||
| 			:.2f} RUB""" |  | ||||||
| 		]) |  | ||||||
| 		curs.append(['₴', |  | ||||||
| 			f"""{ |  | ||||||
| 				float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=USDTRUB').json()['lastPrice']) / |  | ||||||
| 				float(requests.get('https://api.binance.com/api/v3/ticker/24hr?symbol=USDTUAH').json()['lastPrice']) |  | ||||||
| 			:.2f} RUB""" |  | ||||||
| 		]) |  | ||||||
|  |  | ||||||
| 		if COLOR: | 		if COLOR: | ||||||
| 			row = list(map(lambda x: f'^b{COLOR1}^^c{COLOR2}^ {x[0]} ^c{COLOR1}^^b{COLOR2}^ {x[1]} ^d^', curs)) | 			row = list(map(lambda x: f'^b{COLOR1}^^c{COLOR2}^ {x[0]} ^c{COLOR1}^^b{COLOR2}^ {x[1]} ^d^', curs)) | ||||||
| @ -182,7 +166,7 @@ async def gpu(): | |||||||
| 	COLOR2='#FF00B2' | 	COLOR2='#FF00B2' | ||||||
|  |  | ||||||
| 	while True: | 	while True: | ||||||
| 		load = open('/sys/class/drm/card0/device/gpu_busy_percent').read().strip() | 		load = open('/sys/class/drm/card1/device/gpu_busy_percent').read().strip() | ||||||
|  |  | ||||||
| 		if COLOR: | 		if COLOR: | ||||||
| 			gpu = f'^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {load}% ^d^' | 			gpu = f'^b{COLOR1}^^c{COLOR2}^  ^c{COLOR1}^^b{COLOR2}^ {load}% ^d^' | ||||||
| @ -307,11 +291,8 @@ async def dat(): | |||||||
| 		await asyncio.sleep(1) | 		await asyncio.sleep(1) | ||||||
|  |  | ||||||
|  |  | ||||||
| if __name__ == '__main__': | async def main(): | ||||||
| 	signal.signal(signal.SIGINT, lambda n, f: shutdown()) | 	await asyncio.gather( | ||||||
|  |  | ||||||
| 	loop = asyncio.get_event_loop() |  | ||||||
| 	main_task = asyncio.wait([ |  | ||||||
| 		dwmbar(), | 		dwmbar(), | ||||||
| 		net(), | 		net(), | ||||||
| 		ram(), | 		ram(), | ||||||
| @ -324,10 +305,18 @@ if __name__ == '__main__': | |||||||
| 		tim(), | 		tim(), | ||||||
| 		bl(), | 		bl(), | ||||||
| 		br() | 		br() | ||||||
| 	]) | 	) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | if __name__ == '__main__': | ||||||
|  | 	signal.signal(signal.SIGINT, lambda n, f: shutdown()) | ||||||
|  |  | ||||||
|  | 	loop = asyncio.get_event_loop() | ||||||
|  | 	main_task = asyncio.ensure_future(main()) | ||||||
|  |  | ||||||
| 	try: | 	try: | ||||||
| 		loop.run_until_complete(main_task) | 		loop.run_until_complete(main_task) | ||||||
| 	except asyncio.CancelledError: | 	except KeyboardInterrupt: | ||||||
| 		loop.run_until_complete(main_task) | 		print("KeyboardInterrupt: Stopping the event loop...") | ||||||
| 	loop.close() | 	finally: | ||||||
|  | 		loop.close() | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user