mirror of
https://github.com/dylanaraps/pywal.git
synced 2024-11-08 00:54:07 +01:00
docs: Fixed comments
This commit is contained in:
parent
53819ed977
commit
b299f7b3fd
@ -117,7 +117,7 @@ def process_args(args):
|
||||
reload.env()
|
||||
|
||||
if args.o:
|
||||
util.disown(args.o)
|
||||
util.disown([args.o])
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -15,9 +15,9 @@ def xrdb(xrdb_file=None):
|
||||
xrdb_file = xrdb_file or CACHE_DIR / "colors.Xresources"
|
||||
|
||||
if shutil.which("xrdb"):
|
||||
subprocess.call(["xrdb", "-merge", xrdb_file],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL)
|
||||
subprocess.Popen(["xrdb", "-merge", xrdb_file],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL).wait()
|
||||
|
||||
|
||||
def gtk():
|
||||
@ -33,7 +33,8 @@ def gtk():
|
||||
# This is done because the Python 3 GTK/Gdk libraries don't
|
||||
# provide a way of doing this.
|
||||
if shutil.which("python2"):
|
||||
util.disown("python2", MODULE_DIR / "scripts" / "gtk_reload.py")
|
||||
util.disown(["python2", MODULE_DIR / "scripts" / "gtk_reload.py"])
|
||||
|
||||
else:
|
||||
print("warning: GTK2 reload support requires Python 2.")
|
||||
|
||||
@ -41,7 +42,7 @@ def gtk():
|
||||
def i3():
|
||||
"""Reload i3 colors."""
|
||||
if shutil.which("i3-msg"):
|
||||
util.disown("i3-msg", "reload")
|
||||
util.disown(["i3-msg", "reload"])
|
||||
|
||||
|
||||
def polybar():
|
||||
|
@ -10,7 +10,7 @@ Original source: https://crunchbang.org/forums/viewtopic.php?id=39646
|
||||
try:
|
||||
import gtk
|
||||
except ImportError:
|
||||
print("[!] error: GTK reload requires PyGTK.")
|
||||
print("error: GTK reload requires PyGTK.")
|
||||
exit(1)
|
||||
|
||||
|
||||
|
@ -69,4 +69,4 @@ def send(colors, vte, cache_dir=CACHE_DIR):
|
||||
util.save_file(sequences, term)
|
||||
|
||||
util.save_file(sequences, cache_dir / "sequences")
|
||||
print("colors: Set terminal colors")
|
||||
print("colors: Set terminal colors.")
|
||||
|
@ -119,10 +119,10 @@ def darken_color(color, darkness):
|
||||
return rgb_to_hex([int(col * (1 - darkness)) for col in hex_to_rgb(color)])
|
||||
|
||||
|
||||
def disown(*cmd):
|
||||
def disown(cmd):
|
||||
"""Call a system command in the background,
|
||||
disown it and hide it's output."""
|
||||
subprocess.Popen(["nohup"] + list(cmd),
|
||||
subprocess.Popen(["nohup", *cmd],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
preexec_fn=os.setpgrp)
|
||||
@ -132,6 +132,6 @@ def msg(input_msg, notify):
|
||||
"""Print to the terminal and display a libnotify
|
||||
notification."""
|
||||
if notify:
|
||||
disown("notify-send", input_msg)
|
||||
disown(["notify-send", input_msg])
|
||||
|
||||
print(input_msg)
|
||||
|
@ -28,26 +28,26 @@ def get_desktop_env():
|
||||
|
||||
def xfconf(path, img):
|
||||
"""Call xfconf to set the wallpaper on XFCE."""
|
||||
util.disown("xfconf-query", "--channel", "xfce4-desktop",
|
||||
"--property", path, "--set", img)
|
||||
util.disown(["xfconf-query", "--channel", "xfce4-desktop",
|
||||
"--property", path, "--set", img])
|
||||
|
||||
|
||||
def set_wm_wallpaper(img):
|
||||
"""Set the wallpaper for non desktop environments."""
|
||||
if shutil.which("feh"):
|
||||
subprocess.Popen(["feh", "--bg-fill", img])
|
||||
util.disown(["feh", "--bg-fill", img])
|
||||
|
||||
elif shutil.which("nitrogen"):
|
||||
subprocess.Popen(["nitrogen", "--set-zoom-fill", img])
|
||||
util.disown(["nitrogen", "--set-zoom-fill", img])
|
||||
|
||||
elif shutil.which("bgs"):
|
||||
subprocess.Popen(["bgs", img])
|
||||
util.disown(["bgs", img])
|
||||
|
||||
elif shutil.which("hsetroot"):
|
||||
subprocess.Popen(["hsetroot", "-fill", img])
|
||||
util.disown(["hsetroot", "-fill", img])
|
||||
|
||||
elif shutil.which("habak"):
|
||||
subprocess.Popen(["habak", "-mS", img])
|
||||
util.disown(["habak", "-mS", img])
|
||||
|
||||
else:
|
||||
print("error: No wallpaper setter found.")
|
||||
@ -64,18 +64,18 @@ def set_desktop_wallpaper(desktop, img):
|
||||
xfconf("/backdrop/screen0/monitor0/workspace0/last-image", img)
|
||||
|
||||
elif "muffin" in desktop or "cinnamon" in desktop:
|
||||
subprocess.Popen(["gsettings", "set",
|
||||
"org.cinnamon.desktop.background",
|
||||
"picture-uri", "file://" + img])
|
||||
util.disown(["gsettings", "set",
|
||||
"org.cinnamon.desktop.background",
|
||||
"picture-uri", "file://" + img])
|
||||
|
||||
elif "gnome" in desktop:
|
||||
subprocess.Popen(["gsettings", "set",
|
||||
"org.gnome.desktop.background",
|
||||
"picture-uri", "file://" + img])
|
||||
util.disown(["gsettings", "set",
|
||||
"org.gnome.desktop.background",
|
||||
"picture-uri", "file://" + img])
|
||||
|
||||
elif "mate" in desktop:
|
||||
subprocess.Popen(["gsettings", "set", "org.mate.background",
|
||||
"picture-filename", img])
|
||||
util.disown(["gsettings", "set", "org.mate.background",
|
||||
"picture-filename", img])
|
||||
|
||||
else:
|
||||
set_wm_wallpaper(img)
|
||||
@ -86,8 +86,11 @@ def set_mac_wallpaper(img):
|
||||
db_file = HOME / "Library/Application Support/Dock/desktoppicture.db"
|
||||
subprocess.call(["sqlite3", db_file, f"update data set value = '{img}'"])
|
||||
|
||||
# Kill the dock to fix issues with wallpapers sharing names.
|
||||
util.disown("killall", "Dock")
|
||||
# Kill the dock to fix issues with cached wallpapers.
|
||||
# macOS caches wallpapers and if a wallpaper is set that shares
|
||||
# the filename with a cached wallpaper, the cached wallpaper is
|
||||
# used instead.
|
||||
util.disown(["killall", "Dock"])
|
||||
|
||||
|
||||
def change(img):
|
||||
@ -106,7 +109,7 @@ def change(img):
|
||||
else:
|
||||
set_wm_wallpaper(img)
|
||||
|
||||
print("wallpaper: Set the new wallpaper")
|
||||
print("wallpaper: Set the new wallpaper.")
|
||||
|
||||
|
||||
def get(cache_dir=CACHE_DIR):
|
||||
|
Loading…
Reference in New Issue
Block a user