31 lines
940 B
Python
31 lines
940 B
Python
import json
|
|
from openrgb import OpenRGBClient
|
|
from openrgb.utils import RGBColor
|
|
|
|
# Path to Pywal's colors.json
|
|
colors_file = '/home/Nicholai/.cache/wal/colors.json'
|
|
|
|
# Load Pywal colors
|
|
with open(colors_file, 'r') as f:
|
|
colors = json.load(f)
|
|
|
|
# Extract the first color from Pywal's palette
|
|
primary_color_hex = colors['colors']['color3']
|
|
|
|
import subprocess
|
|
|
|
# Remove the '#' prefix from the hex color
|
|
primary_color_hex_no_prefix = primary_color_hex.lstrip('#')
|
|
|
|
# Construct the command with the modified hex color
|
|
command = ["openrgb", "--color", primary_color_hex_no_prefix]
|
|
|
|
# Execute the command
|
|
try:
|
|
subprocess.run(command, check=True)
|
|
print(f"Successfully set OpenRGB color to {primary_color_hex_no_prefix}")
|
|
except subprocess.CalledProcessError as e:
|
|
print(f"Error setting OpenRGB color: {e}")
|
|
except FileNotFoundError:
|
|
print("Error: 'openrgb' command not found. Make sure OpenRGB is installed and in your PATH.")
|