diff options
-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) | |||
2 | 2 | ||
3 | project(sway C) | 3 | project(sway C) |
4 | 4 | ||
5 | set(FALLBACK_CONFIG_DIR "/etc/sway/") | ||
6 | add_definitions('-DFALLBACK_CONFIG_DIR=\"${FALLBACK_CONFIG_DIR}\"') | ||
7 | |||
5 | set(CMAKE_C_FLAGS "-g") | 8 | set(CMAKE_C_FLAGS "-g") |
6 | set(CMAKE_C_STANDARD 99) | 9 | set(CMAKE_C_STANDARD 99) |
7 | SET(CMAKE_C_EXTENSIONS OFF) | 10 | SET(CMAKE_C_EXTENSIONS OFF) |
@@ -80,7 +83,7 @@ install( | |||
80 | COMPONENT runtime) | 83 | COMPONENT runtime) |
81 | install( | 84 | install( |
82 | FILES "${CMAKE_CURRENT_SOURCE_DIR}/config" | 85 | FILES "${CMAKE_CURRENT_SOURCE_DIR}/config" |
83 | DESTINATION /etc/sway/ | 86 | DESTINATION "${FALLBACK_CONFIG_DIR}" |
84 | COMPONENT configuration) | 87 | COMPONENT configuration) |
85 | 88 | ||
86 | add_custom_target(man ALL) | 89 | add_custom_target(man ALL) |
@@ -57,8 +57,10 @@ On systems without logind, you need to suid the sway binary: | |||
57 | ## Configuration | 57 | ## Configuration |
58 | 58 | ||
59 | If you already use i3, then copy your i3 config to `~/.config/sway/config` and | 59 | If you already use i3, then copy your i3 config to `~/.config/sway/config` and |
60 | it'll work out of the box. Otherwise, copy `/etc/sway/config` to | 60 | it'll work out of the box. Otherwise, copy the sample configuration file to |
61 | `~/.config/sway/config`. Run `man 5 sway` for information on the configuration. | 61 | `~/.config/sway/config`. It is located at `/etc/sway/config`, unless the |
62 | `DFALLBACK_CONFIG_DIR` flag has been set. Run `man 5 sway` for information on | ||
63 | the configuration. | ||
62 | 64 | ||
63 | ## Running | 65 | ## Running |
64 | 66 | ||
@@ -66,11 +66,13 @@ Configuration | |||
66 | ------------- | 66 | ------------- |
67 | 67 | ||
68 | If _-c_ is not specified, sway will look in several locations for your config | 68 | If _-c_ is not specified, sway will look in several locations for your config |
69 | file. The default one is provided at /etc/sway/config. The suggested location for | 69 | file. The suggested location for your config file is ~/.config/sway/config. |
70 | your config file is ~/.config/sway/config. ~/.sway/config will also work, and the | 70 | ~/.sway/config will also work, and the rest of the usual XDG config locations |
71 | rest of the usual XDG config locations are supported. If no sway config is found, | 71 | are supported. At last, sway looks for a config file in a fallback directory, |
72 | sway will attempt to load an i3 config from all the config locations i3 supports. | 72 | which is /etc/sway/ by default. A standard configuration file is installed at |
73 | If still nothing is found, you will receive an error. | 73 | this location. If no sway config is found, sway will attempt to load an i3 |
74 | config from all the config locations i3 supports. If still nothing is found, | ||
75 | you will receive an error. | ||
74 | 76 | ||
75 | For information on the config file format, see **sway**(5). | 77 | For information on the config file format, see **sway**(5). |
76 | 78 | ||
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) { | |||
136 | "$XDG_CONFIG_HOME/sway/config", | 136 | "$XDG_CONFIG_HOME/sway/config", |
137 | "$HOME/.i3/config", | 137 | "$HOME/.i3/config", |
138 | "$XDG_CONFIG_HOME/i3/config", | 138 | "$XDG_CONFIG_HOME/i3/config", |
139 | "/etc/sway/config", | 139 | FALLBACK_CONFIG_DIR "config", |
140 | "/etc/i3/config", | 140 | "/etc/i3/config", |
141 | }; | 141 | }; |
142 | 142 | ||