Skip to content

Commit

Permalink
Merge pull request #31 from LoLei/fix-invalid-literal
Browse files Browse the repository at this point in the history
Fix xrdb color retrieval if no colors exist
  • Loading branch information
LoLei authored Sep 25, 2020
2 parents 5a66397 + e2c9721 commit eb7230c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions razer_cli/razer_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

__author__ = "Lorenz Leitner"
__version__ = "1.3.1"
__version__ = "1.3.2"
__license__ = "GPL-3.0"

# Libraries
Expand Down Expand Up @@ -46,7 +46,11 @@ def get_x_color():
# doesn't depend on pywal, in case the X colors are set from a different origin
output = subprocess.check_output(
"xrdb -query | grep \"*color1:\" | awk -F '#' '{print $2}'",
shell=True)
shell=True).strip()

if not output:
return 0, 0, 0

rgb = output.decode()
r, g, b = util.hex_to_decimal(rgb)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="razer-cli",
version="1.3.1",
version="1.3.2",
author="Lorenz Leitner",
author_email="lrnz.ltnr@gmail.com",
description="Control Razer devices from the command line",
Expand Down

0 comments on commit eb7230c

Please sign in to comment.