Consistency fixes

This commit is contained in:
Charles Milette 2018-07-22 19:32:38 -04:00 committed by Samuel Henrique
parent 5edce4c2d7
commit 5cdcb4391f
3 changed files with 9 additions and 9 deletions

View file

@ -6,7 +6,7 @@ from . import TerminalProvider as _TProv
class ItermProvider(_TProv): class ItermProvider(_TProv):
# OSA script that will change the terminal background image # OSA script that will change the terminal background image
osa_script_fmt = """tell application "iTerm" __osa_script_fmt = """tell application "iTerm"
\ttell current session of current window \ttell current session of current window
\t\tset background image to "{}" \t\tset background image to "{}"
\tend tell \tend tell
@ -23,11 +23,11 @@ class ItermProvider(_TProv):
p.stdin.close() p.stdin.close()
def change_terminal(path: str): def change_terminal(path: str):
stdin = ItermProvider.osa_script_fmt.format(path) stdin = ItermProvider.__osa_script_fmt.format(path)
ItermProvider.__run_osascript(str.encode(stdin)) ItermProvider.__run_osascript(str.encode(stdin))
def clear(): def clear():
stdin = ItermProvider.osa_script_fmt.format("") stdin = ItermProvider.__osa_script_fmt.format("")
ItermProvider.__run_osascript(str.encode(stdin)) ItermProvider.__run_osascript(str.encode(stdin))
def __str__(): def __str__():

View file

@ -5,18 +5,18 @@ from . import TerminalProvider as _TProv
class TilixProvider(_TProv): class TilixProvider(_TProv):
setting_key = "com.gexperts.Tilix.Settings" __setting_key = "com.gexperts.Tilix.Settings"
setting_field = "background-image" __setting_field = "background-image"
def is_compatible() -> bool: def is_compatible() -> bool:
return "TILIX_ID" in environ return "TILIX_ID" in environ
def change_terminal(path: str): def change_terminal(path: str):
command = f'gsettings set {TilixProvider.setting_key} {TilixProvider.setting_field} "{path}"' command = f'gsettings set {TilixProvider.setting_key} {TilixProvider.__setting_field} "{path}"'
run(command, check=True) run(command, check=True)
def clear(): def clear():
command = f'gsettings reset {TilixProvider.setting_key} {TilixProvider.setting_field}' command = f'gsettings reset {TilixProvider.setting_key} {TilixProvider.__setting_field}'
run(command, check=True) run(command, check=True)
def __str__(): def __str__():

View file

@ -7,7 +7,7 @@ from . import WallpaperProvider as _WProv
class FehProvider(_WProv): class FehProvider(_WProv):
compatible_wm = ['I3_PID', '_OPENBOX_PID'] __compatible_wm = ['I3_PID', '_OPENBOX_PID']
def change_wallpaper(path: str): def change_wallpaper(path: str):
if (Path.home() / '.fehbg').is_file(): if (Path.home() / '.fehbg').is_file():
@ -22,7 +22,7 @@ class FehProvider(_WProv):
def is_compatible() -> bool: def is_compatible() -> bool:
return (which("feh") is not None return (which("feh") is not None
and which("xprop") is not None and which("xprop") is not None
and any(wm_signature in FehProvider.__get_root_props() for wm_signature in FehProvider.compatible_wm)) and any(wm_signature in FehProvider.__get_root_props() for wm_signature in FehProvider.__compatible_wm))
def __str__(): def __str__():
return "feh wallpaper tool" return "feh wallpaper tool"