Pause media using playerctl
This commit is contained in:
parent
76244b679e
commit
267e26ee51
@ -68,7 +68,7 @@ async def open_subprocess(cmd: str):
|
|||||||
|
|
||||||
async def change_wallpaper(mode: int, cringe = False):
|
async def change_wallpaper(mode: int, cringe = False):
|
||||||
if not os.path.exists(PATH_RESC_WALLPS):
|
if not os.path.exists(PATH_RESC_WALLPS):
|
||||||
get_wallpapers():
|
get_wallpapers()
|
||||||
region = f"{mode}{1 if cringe else 0}"
|
region = f"{mode}{1 if cringe else 0}"
|
||||||
with open(PATH_RESC_WALLPS, 'r') as f:
|
with open(PATH_RESC_WALLPS, 'r') as f:
|
||||||
file = f.read()
|
file = f.read()
|
||||||
@ -78,6 +78,11 @@ async def change_wallpaper(mode: int, cringe = False):
|
|||||||
await open_subprocess(command)
|
await open_subprocess(command)
|
||||||
|
|
||||||
|
|
||||||
|
def pause_media():
|
||||||
|
if run(["playerctl", "status"], text = True, capture_output = True).stdout == "Playing":
|
||||||
|
run(["playerctl", "pause"], text = True, capture_output = True)
|
||||||
|
|
||||||
|
|
||||||
def get_wallpapers():
|
def get_wallpapers():
|
||||||
l0 = os.listdir(PATH_RESC_LIGHTW)
|
l0 = os.listdir(PATH_RESC_LIGHTW)
|
||||||
d0 = os.listdir(PATH_RESC_DARKW)
|
d0 = os.listdir(PATH_RESC_DARKW)
|
||||||
@ -181,6 +186,7 @@ def main():
|
|||||||
asyncio.run(set_volume(0, save_state = True))
|
asyncio.run(set_volume(0, save_state = True))
|
||||||
asyncio.run(set_brightness(0, 0, save_state = True))
|
asyncio.run(set_brightness(0, 0, save_state = True))
|
||||||
asyncio.run(set_brightness(1, 0, save_state = True))
|
asyncio.run(set_brightness(1, 0, save_state = True))
|
||||||
|
pause_media()
|
||||||
elif sys.argv[0] == "--unlock":
|
elif sys.argv[0] == "--unlock":
|
||||||
log("modeset2 started with \"--unlock\"")
|
log("modeset2 started with \"--unlock\"")
|
||||||
print("Unlock")
|
print("Unlock")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user