Args: Add -o

This commit is contained in:
Dylan Araps 2017-06-19 18:19:36 +10:00
parent eb1adc0e4f
commit de9f149ce8
2 changed files with 39 additions and 16 deletions

20
nohup.out Normal file
View File

@ -0,0 +1,20 @@
(thunar:774): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(thunar:774): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(thunar:774): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(thunar:774): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(thunar:774): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(thunar:774): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(thunar:774): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(thunar:774): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(thunar:774): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(thunar:774): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed

35
wal.py
View File

@ -51,8 +51,8 @@ def get_args():
# arg.add_argument('-n', action='store_true',
# help='Skip setting the wallpaper.')
# arg.add_argument('-o', metavar='script_name',
# help='External script to run after "wal".')
arg.add_argument('-o', metavar='"script_name"',
help='External script to run after "wal".')
# arg.add_argument('-q', action='store_true',
# help='Quiet mode, don\'t print anything.')
@ -70,19 +70,6 @@ def get_args():
return arg.parse_args()
def process_args(args):
"""Process the arguments."""
# -c
if args.c:
shutil.rmtree(SCHEME_DIR)
quit()
# -r
if args.r:
reload_colors(args.t)
# }}}
@ -395,8 +382,17 @@ def main():
pathlib.Path(SCHEME_DIR).mkdir(parents=True, exist_ok=True)
args = get_args()
process_args(args)
# -c
if args.c:
shutil.rmtree(SCHEME_DIR)
quit()
# -r
if args.r:
reload_colors(args.t)
# -i
if args.i:
image = str(get_image(args.i))
@ -411,6 +407,13 @@ def main():
export_plain(colors)
export_xrdb(colors)
# -o
if args.o:
subprocess.Popen(["nohup", args.o],
stdout=open('/dev/null', 'w'),
stderr=open('/dev/null', 'w'),
preexec_fn=os.setpgrp)
return 0