properly call notify-send
This commit is contained in:
parent
3015a6478e
commit
c8ced9eca4
|
@ -52,6 +52,7 @@ def take_screenshot(edit=False) -> None:
|
||||||
tempname = generate_filename(config.length, 'png')
|
tempname = generate_filename(config.length, 'png')
|
||||||
file = os.path.join(config.local_directory, tempname)
|
file = os.path.join(config.local_directory, tempname)
|
||||||
call(['maim', '-sk', file])
|
call(['maim', '-sk', file])
|
||||||
|
Image.open(file).convert('RGB').save(file)
|
||||||
if edit:
|
if edit:
|
||||||
call(['gimp', file])
|
call(['gimp', file])
|
||||||
ftp_upload(ext='png', sourcefile=file, mode='screenshot')
|
ftp_upload(ext='png', sourcefile=file, mode='screenshot')
|
||||||
|
@ -91,7 +92,7 @@ def ftp_upload(sourcefile, *, mode=None, ext=None) -> tuple:
|
||||||
|
|
||||||
fullpath = os.path.join(config.local_directory, filename)
|
fullpath = os.path.join(config.local_directory, filename)
|
||||||
|
|
||||||
notify_user(config.url_template.format(filename))
|
notify_user(config.url_template.format(filename), fullpath if mode=='screenshot' else None)
|
||||||
|
|
||||||
return fullpath, filename
|
return fullpath, filename
|
||||||
|
|
||||||
|
@ -108,10 +109,10 @@ def notify_user(url, image=None):
|
||||||
img.thumbnail((384, 384), Image.ANTIALIAS)
|
img.thumbnail((384, 384), Image.ANTIALIAS)
|
||||||
thumbnail = os.path.join(config.local_directory, 'thumb.jpg')
|
thumbnail = os.path.join(config.local_directory, 'thumb.jpg')
|
||||||
img.save(thumbnail)
|
img.save(thumbnail)
|
||||||
call(['notify-send', '-a pyshare', url, f'-i {thumbnail}', '-t 3000'])
|
call(['notify-send', '-a', 'pyshare', url, '-i', thumbnail, '-t', '3000'])
|
||||||
os.remove(thumbnail)
|
os.remove(thumbnail)
|
||||||
else:
|
else:
|
||||||
call(['notify-send', '-a pyshare', url, '-t 3000'])
|
call(['notify-send', '-a', 'pyshare', url, '-t', '3000'])
|
||||||
|
|
||||||
|
|
||||||
def parse_text(args):
|
def parse_text(args):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user