diff options
author | Yacine Hmito <yacine.hmito@gmail.com> | 2015-12-01 00:38:23 +0100 |
---|---|---|
committer | Yacine Hmito <yacine.hmito@gmail.com> | 2015-12-01 01:07:48 +0100 |
commit | 09feef89eea03527c9c81b8d15fe8c1474942209 (patch) | |
tree | 4a9ecf5416f6e109f60aa6834eec43cba5267d5d | |
parent | 44d0f731c36661a192d0fb9d65822eebef7d0092 (diff) | |
download | sway-09feef89eea03527c9c81b8d15fe8c1474942209.tar.xz |
Can customize config fallback directory
CMake takes a `FALLBACK_CONFIG_DIR` flag which is the directory where the
standard configuration file `config` is copied at installation.
If loading from typical configuration directories fails, sway loads
FALLBACK_CONFIG_DIR/config (/etc/sway/config by default).
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | sway.1.txt | 12 | ||||
-rw-r--r-- | sway/config.c | 2 |
4 files changed, 16 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1298a2ce..9e1e1dde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.1.0) project(sway C) +set(FALLBACK_CONFIG_DIR "/etc/sway/") +add_definitions('-DFALLBACK_CONFIG_DIR=\"${FALLBACK_CONFIG_DIR}\"') + set(CMAKE_C_FLAGS "-g") set(CMAKE_C_STANDARD 99) SET(CMAKE_C_EXTENSIONS OFF) @@ -80,7 +83,7 @@ install( COMPONENT runtime) install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/config" - DESTINATION /etc/sway/ + DESTINATION "${FALLBACK_CONFIG_DIR}" COMPONENT configuration) add_custom_target(man ALL) @@ -57,8 +57,10 @@ On systems without logind, you need to suid the sway binary: ## Configuration If you already use i3, then copy your i3 config to `~/.config/sway/config` and -it'll work out of the box. Otherwise, copy `/etc/sway/config` to -`~/.config/sway/config`. Run `man 5 sway` for information on the configuration. +it'll work out of the box. Otherwise, copy the sample configuration file to +`~/.config/sway/config`. It is located at `/etc/sway/config`, unless the +`DFALLBACK_CONFIG_DIR` flag has been set. Run `man 5 sway` for information on +the configuration. ## Running @@ -66,11 +66,13 @@ Configuration ------------- If _-c_ is not specified, sway will look in several locations for your config -file. The default one is provided at /etc/sway/config. The suggested location for -your config file is ~/.config/sway/config. ~/.sway/config will also work, and the -rest of the usual XDG config locations are supported. If no sway config is found, -sway will attempt to load an i3 config from all the config locations i3 supports. -If still nothing is found, you will receive an error. +file. The suggested location for your config file is ~/.config/sway/config. +~/.sway/config will also work, and the rest of the usual XDG config locations +are supported. At last, sway looks for a config file in a fallback directory, +which is /etc/sway/ by default. A standard configuration file is installed at +this location. If no sway config is found, sway will attempt to load an i3 +config from all the config locations i3 supports. If still nothing is found, +you will receive an error. For information on the config file format, see **sway**(5). diff --git a/sway/config.c b/sway/config.c index 21507c59..dac3e8f8 100644 --- a/sway/config.c +++ b/sway/config.c @@ -136,7 +136,7 @@ static char *get_config_path(void) { "$XDG_CONFIG_HOME/sway/config", "$HOME/.i3/config", "$XDG_CONFIG_HOME/i3/config", - "/etc/sway/config", + FALLBACK_CONFIG_DIR "config", "/etc/i3/config", }; |