Use $XDG_CONFIG_HOME

This commit is contained in:
Shy 2017-04-17 22:20:45 +02:00
parent 0e73ef772f
commit f475e6c3a3
6 changed files with 16 additions and 16 deletions

View file

@ -41,8 +41,8 @@ case "$state" in
_values Presets 'off' 'random'
ret=$?
fi
if [[ "$XDG_CONFIG_DIR" ]]; then
c4ctrl_cfg_dir="$XDG_CONFIG_DIR/c4ctrl"
if [[ "$XDG_CONFIG_HOME" ]]; then
c4ctrl_cfg_dir="$XDG_CONFIG_HOME/c4ctrl"
else
c4ctrl_cfg_dir="$HOME/.config/c4ctrl"
fi

View file

@ -788,16 +788,16 @@ class ColorScheme:
import os
# The name of our config directory.
XDG_NAME = "c4ctrl"
_NAME = "c4ctrl"
# Get XDG_CONFIG_DIR from environment or set default.
if "XDG_CONFIG_DIR" in os.environ:
XDG_CONFIG_DIR = os.environ["XDG_CONFIG_DIR"]
# Get XDG_CONFIG_HOME from environment or set default.
if "XDG_CONFIG_HOME" in os.environ:
XDG_CONFIG_HOME = os.environ["XDG_CONFIG_HOME"]
else:
XDG_CONFIG_DIR = os.path.expanduser(os.path.join("~", ".config"))
XDG_CONFIG_HOME = os.path.expanduser(os.path.join("~", ".config"))
# Does our config dir exist?
config_dir = os.path.join(XDG_CONFIG_DIR, XDG_NAME)
config_dir = os.path.join(XDG_CONFIG_HOME, _NAME)
if not os.path.isdir(config_dir):
if create:
print("Creating config directory \"{}\"".format(config_dir))

View file

@ -25,8 +25,8 @@ function s:FindConfigDir() " {{{1
return s:config_dir
endif
if expand("$XDG_CONFIG_DIR") != "$XDG_CONFIG_DIR"
let s:config_dir = expand("$XDG_CONFIG_DIR/c4ctrl/")
if expand("$XDG_CONFIG_HOME") != "$XDG_CONFIG_HOME"
let s:config_dir = expand("$XDG_CONFIG_HOME/c4ctrl/")
else
let s:config_dir = expand("$HOME/.config/c4ctrl/")
endif

View file

@ -1,7 +1,7 @@
# "Beach" colorscheme for c4ctrl
# Put this file into "$XDG_CONFIG_DIR/c4ctrl/" (likely "~/.config/c4ctrl/") to
# make it available to c4ctrl.py.
# Put this file into "$XDG_CONFIG_HOME/c4ctrl/" (defaults to
# "~/.config/c4ctrl/") to make it available to c4ctrl.py.
# Wohnzimmer + Küche
#dmx/wohnzimmer/master = 3300ff

View file

@ -1,7 +1,7 @@
# "Emergency" colorscheme for c4ctrl
# Put this file into "$XDG_CONFIG_DIR/c4ctrl/" (likely "~/.config/c4ctrl/") to
# make it available to c4ctrl.py.
# Put this file into "$XDG_CONFIG_HOME/c4ctrl/" (defaults to
# "~/.config/c4ctrl/") to make it available to c4ctrl.py.
# This preset uses some more advanced features of the LED cans in the club.
# The following table lists their options.
#

View file

@ -1,7 +1,7 @@
# "Neon" colorscheme for c4ctrl
# Put this file into "$XDG_CONFIG_DIR/c4ctrl/" (likely "~/.config/c4ctrl/") to
# make it available to c4ctrl.py.
# Put this file into "$XDG_CONFIG_HOME/c4ctrl/" (defaults to
# "~/.config/c4ctrl/") to make it available to c4ctrl.py.
# Wohnzimmer + Küche
#dmx/wohnzimmer/master = 0033ff