Skip to content

Commit

Permalink
use playerctl metadata instead of status
Browse files Browse the repository at this point in the history
  • Loading branch information
nwg-piotr committed Oct 2, 2022
1 parent e266b59 commit 5e6e621
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions nwg_shell_config/locker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
gi.require_version('GtkLayerShell', '0.1')

from nwg_shell_config.tools import get_data_dir, temp_dir, load_json, load_text_file, save_string, gtklock_module_path, \
playerctl_status
playerctl_metadata

config_home = os.getenv('XDG_CONFIG_HOME') if os.getenv('XDG_CONFIG_HOME') else os.path.join(os.getenv("HOME"),
".config/")
Expand Down Expand Up @@ -175,9 +175,9 @@ def gtklock_command():
gtklock_cmd += " --poweroff-command '{}'".format(settings["gtklock-poweroff-command"])

# playerctl module
# Don't show if playerctl_status() == "No players found"
# Don't show if playerctl_metadata() == "No player could handle this command"
# https://github.com/jovanlanik/gtklock-playerctl-module/issues/4
if settings["gtklock-playerctl"] and playerctl_status():
if settings["gtklock-playerctl"] and playerctl_metadata():
gtklock_cmd += " -m {}".format(gtklock_module_path("playerctl"))

# optional playerctl module arguments
Expand Down
4 changes: 2 additions & 2 deletions nwg_shell_config/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ def get_shell_version():
return lines[0].split()[2]


def playerctl_status():
def playerctl_metadata():
try:
return subprocess.check_output("playerctl status 2>&1", shell=True).decode("utf-8").strip()
return subprocess.check_output("playerctl metadata 2>&1", shell=True).decode("utf-8").strip()
except subprocess.CalledProcessError:
return ""

Expand Down

0 comments on commit 5e6e621

Please sign in to comment.