Fast clean-up
This commit is contained in:
parent
47d639ffc3
commit
569a9d156a
14
modeset2.py
14
modeset2.py
@ -6,12 +6,10 @@ from datetime import datetime as dt
|
||||
from subprocess import run
|
||||
import shlex
|
||||
import subprocess
|
||||
import asyncio
|
||||
import random
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
START_NIGHT = "22.30"
|
||||
START_DAY = "8.20"
|
||||
PATH_SCPT_KEYBRD = "$HOME/scripts/keyboard"
|
||||
@ -61,10 +59,7 @@ def set_volume(value: int, save_state = False):
|
||||
|
||||
|
||||
def open_subprocess(cmd: str):
|
||||
p = subprocess.Popen(
|
||||
shlex.split(cmd),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
|
||||
def change_wallpaper(mode: int, cringe=False):
|
||||
@ -138,13 +133,13 @@ def log(message: str):
|
||||
|
||||
|
||||
def get_hour():
|
||||
if 0 <= dt.now().minute and dt.now().minute <= 9:
|
||||
if 0 <= dt.now().minute <= 9:
|
||||
return f"{dt.now().hour}.0{dt.now().minute}"
|
||||
return f"{dt.now().hour}.{dt.now().minute}"
|
||||
|
||||
|
||||
def get_hour_spec(hour_str=None):
|
||||
if hour_str != None:
|
||||
if hour_str is not None:
|
||||
return (int(hour_str.split('.')[0]) * 60) + int(hour_str.split('.')[0])
|
||||
else:
|
||||
return (dt.now().hour * 60) + dt.now().minute
|
||||
@ -154,7 +149,7 @@ def get_mode():
|
||||
low = get_hour_spec(START_DAY)
|
||||
now = get_hour_spec()
|
||||
hgh = get_hour_spec(START_NIGHT)
|
||||
return 0 if low <= now and now < hgh else 1
|
||||
return 0 if low <= now < hgh else 1
|
||||
|
||||
|
||||
def expand_vars():
|
||||
@ -234,4 +229,3 @@ def main():
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user