Skip to content

Commit

Permalink
Fix various checks for availability
Browse files Browse the repository at this point in the history
  • Loading branch information
l0drex committed Sep 25, 2022
1 parent 7e43706 commit b236e81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/plugins/gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class _Gnome(PluginCommandline):
def __init__(self):
super().__init__(['gsettings', 'set', 'org.gnome.desktop.interface', 'gtk-theme', '{theme}'])

@property
def available(self) -> bool:
return test_gnome_availability(self.command)

Expand Down
13 changes: 6 additions & 7 deletions src/plugins/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
def test_gnome_availability(command) -> bool:
# Runs the first entry in the command list with --help
try:
out = subprocess.run(
# if not available, you might want to run https://gist.github.com/atiensivu/fcc3183e9a6fd74ec1a283e3b9ad05f0
# or you have to install that extension
process = subprocess.run(
[command[0], 'get', command[2], command[3]],
stdout=subprocess.DEVNULL
).stdout
if out == f'No such schema \"{command[2]}\"':
# in this case, you might want to run https://gist.github.com/atiensivu/fcc3183e9a6fd74ec1a283e3b9ad05f0
# or you have to install that extension
return False
)
return process.stdout == 0
except FileNotFoundError:
# if no such command is available, the plugin is not available
return False
Expand Down Expand Up @@ -88,7 +87,7 @@ def __init__(self):
self.theme_light = 'org.kde.breeze.desktop'
self.theme_dark = 'org.kde.breezedark.desktop'

def set_theme(self, theme: str) -> bool:
def set_theme(self, theme: str) -> None:
# TODO remove this once https://bugs.kde.org/show_bug.cgi?id=446074 is fixed
super().set_theme(theme)
super().set_theme(theme)
Expand Down
1 change: 1 addition & 0 deletions src/plugins/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,4 @@ def available(self) -> bool:
for path in EXTENSION_PATHS:
if isdir(path):
return True
return False

0 comments on commit b236e81

Please sign in to comment.