mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-06-26 12:31:32 +02:00
config: Read/write from .config
This commit is contained in:
parent
49ca108ead
commit
a057497d13
13
pywal/config/config.ini
Normal file
13
pywal/config/config.ini
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[general]
|
||||||
|
# External command to run after pywal.
|
||||||
|
cmd_hook =
|
||||||
|
|
||||||
|
[colors]
|
||||||
|
# Color backend to use.
|
||||||
|
# Possible values, see: wal --backend
|
||||||
|
backend = random
|
||||||
|
|
||||||
|
[wallpaper]
|
||||||
|
# Which wallpaper setter to use.
|
||||||
|
# Example: feh --bg-fill
|
||||||
|
setter =
|
@ -12,6 +12,9 @@ Created by Dylan Araps.
|
|||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
from . import util
|
||||||
|
|
||||||
|
|
||||||
__version__ = "1.3.3"
|
__version__ = "1.3.3"
|
||||||
@ -22,8 +25,15 @@ HOME = os.getenv("HOME", os.getenv("USERPROFILE"))
|
|||||||
CACHE_DIR = os.path.join(HOME, ".cache", "wal")
|
CACHE_DIR = os.path.join(HOME, ".cache", "wal")
|
||||||
MODULE_DIR = os.path.dirname(__file__)
|
MODULE_DIR = os.path.dirname(__file__)
|
||||||
CONF_DIR = os.path.join(HOME, ".config", "wal")
|
CONF_DIR = os.path.join(HOME, ".config", "wal")
|
||||||
|
CONF_FILE = os.path.join(CONF_DIR, "config.ini")
|
||||||
|
DEFAULT_CONF_FILE = os.path.join(MODULE_DIR, "config", "config.ini")
|
||||||
OS = platform.uname()[0]
|
OS = platform.uname()[0]
|
||||||
|
|
||||||
|
|
||||||
|
if not os.path.isfile(CONF_FILE):
|
||||||
|
util.create_dir(CONF_DIR)
|
||||||
|
shutil.copy2(DEFAULT_CONF_FILE, CONF_DIR)
|
||||||
|
|
||||||
|
|
||||||
CONFIG = configparser.ConfigParser()
|
CONFIG = configparser.ConfigParser()
|
||||||
CONFIG.read("/home/black/.config/wal/config.ini")
|
CONFIG.read(CONF_FILE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user