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' _values Presets 'off' 'random'
ret=$? ret=$?
fi fi
if [[ "$XDG_CONFIG_DIR" ]]; then if [[ "$XDG_CONFIG_HOME" ]]; then
c4ctrl_cfg_dir="$XDG_CONFIG_DIR/c4ctrl" c4ctrl_cfg_dir="$XDG_CONFIG_HOME/c4ctrl"
else else
c4ctrl_cfg_dir="$HOME/.config/c4ctrl" c4ctrl_cfg_dir="$HOME/.config/c4ctrl"
fi fi

View file

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

View file

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

View file

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

View file

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

View file

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