bin: Rewrite wallpaper-rotate in Python
This commit is contained in:
parent
3213b5a8cb
commit
86c7868180
1 changed files with 15 additions and 5 deletions
|
|
@ -1,11 +1,21 @@
|
|||
#!/usr/bin/env tako
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
|
||||
HOME = Path.home()
|
||||
image_dir = HOME / 'images/wallpapers/BitDay'
|
||||
dest = HOME / 'images/wallpaper.png'
|
||||
|
||||
image_dir = $HOME + '/images/wallpapers/BitDay/'
|
||||
hour = datetime.now().hour
|
||||
image_number = int(hour / 2)
|
||||
image_file = image_dir + '{}.png'.format(image_number)
|
||||
|
||||
ln -s -f @(image_file) @($HOME + '/images/wallpaper.png')
|
||||
nitrogen --restore
|
||||
target = image_dir / '{}.png'.format(image_number)
|
||||
|
||||
# ln -s -f
|
||||
dest.unlink(missing_ok = True)
|
||||
dest.symlink_to(target)
|
||||
|
||||
# nitrogen --restore
|
||||
subprocess.run(['nitrogen', '--restore'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue