Skip to content

Commit

Permalink
Added support for XDG config paths
Browse files Browse the repository at this point in the history
  • Loading branch information
GuardKenzie committed Nov 22, 2022
1 parent 8366d84 commit 2d8d5eb
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions bin/miniplayer
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,27 @@ import ueberzug.lib.v0 as ueberzug
from PIL import Image, ImageDraw
from colorthief import ColorThief
import math
from pathlib import Path


# Get config
# Get config directory
config_dir = Path(
os.environ.get(
"XDG_CONFIG_HOME",
default = "~/.config"
)
)

config_dir = config_dir.expanduser()

# Check if config dir exists
if not config_dir.is_dir():
config_dir = Path("~/.config").expanduser()

# Init config
config = configparser.ConfigParser()
config.optionxform = str
config.read(os.path.expanduser("~/.config/miniplayer/config"))
config.read(config_dir / "miniplayer" / "config")

if "player" not in config.sections():
config["player"] = {"font_width": 11,
Expand Down

0 comments on commit 2d8d5eb

Please sign in to comment.