Compare commits

...

4 commits

Author SHA1 Message Date
ab5cd2b3c3 Fix error in cwmrc.5 2026-01-28 16:45:10 +01:00
8e794ae50f Merge branch 'xdg' into mistress 2026-01-28 16:32:31 +01:00
e0cfa1f598 Use XDG_CONFIG_HOME for configuration file location
cwm now partially respects
https://specifications.freedesktop.org/basedir/latest/.
The default configuration file location is changed from ~/.cwmrc to
$XDG_CONFIG_HOME/cwm/cwmrc,
or, if $XDG_CONFIG_HOME is empty or unset, ~/.config/cwm/cwmrc.
2026-01-25 20:38:23 +01:00
d6219a8479 GNUmakefile: clean parse.c 2026-01-25 19:56:43 +01:00
4 changed files with 31 additions and 14 deletions

View file

@ -16,6 +16,4 @@ $(PROG): $(OBJS)
.PHONY: clean
clean:
rm -f $(OBJS)
.PRECIOUS: parse.c
rm -f $(OBJS) parse.c

7
conf.c
View file

@ -283,6 +283,7 @@ void
conf_init(struct conf *c)
{
const char *home;
char *xdg_config_home;
struct passwd *pw;
unsigned int i;
@ -326,7 +327,11 @@ conf_init(struct conf *c)
else
home = "/";
}
xasprintf(&c->conf_file, "%s/%s", home, ".cwmrc");
xdg_config_home = getenv("XDG_CONFIG_HOME");
if ((xdg_config_home == NULL) || (*xdg_config_home == '\0'))
xasprintf(&c->conf_file, "%s/%s", home, ".config/cwm/cwmrc");
else
xasprintf(&c->conf_file, "%s/%s", xdg_config_home, "cwm/cwmrc");
xasprintf(&c->known_hosts, "%s/%s", home, ".ssh/known_hosts");
}

20
cwm.1
View file

@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 20 2023 $
.Dd $Mdocdate: January 25 2026 $
.Dt CWM 1
.Os
.Sh NAME
@ -39,7 +39,7 @@ Specify an alternative configuration file.
By default,
.Nm
loads
.Pa ~/.cwmrc ,
.Pa $XDG_CONFIG_HOME/cwm/cwmrc ,
if present.
Any error messages from lines in the configuration file will be sent to
.Em stderr ;
@ -255,16 +255,21 @@ Show list of applications as defined in the configuration file.
Selecting an item will spawn that application.
.El
.Sh ENVIRONMENT
.Bl -tag -width "DISPLAYXXX" -compact
.It DISPLAY
.Bl -tag -width "XDG_CONFIG_HOME" -compact
.It Ev DISPLAY
.Nm
starts on this display unless the
.Fl d
option is given.
.It Ev XDG_CONFIG_HOME
determines the default location of the configuration file.
If unset or empty,
.Pa ~/.config/cwm/
is used as the value.
.El
.Sh FILES
.Bl -tag -width "~/.cwmrcXX" -compact
.It Pa ~/.cwmrc
.Bl -tag -width "$XDG_CONFIG_HOME/cwm/cwmrc" -compact
.It Pa $XDG_CONFIG_HOME/cwm/cwmrc
Default
.Nm
configuration file.
@ -289,6 +294,7 @@ was developed by
with contributions from
.An Andy Adamson Aq dros@monkey.org ,
.An Niels Provos Aq provos@monkey.org ,
.An Antti Nyk\(:anen Aq aon@iki.fi ,
and
.An Antti Nyk\(:anen Aq aon@iki.fi .
.An Lilianna Smólska Aq afiw@linuxposting.xyz .
Ideas, discussion with many others.

14
cwmrc.5
View file

@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: August 20 2025 $
.Dd $Mdocdate: January 25 2026 $
.Dt CWMRC 5
.Os
.Sh NAME
@ -452,9 +452,17 @@ Move pointer 10 times
.Ar moveamount
pixels left.
.El
.Sh ENVIRONMENT
.Bl -tag -width "XDG_CONFIG_HOME" -compact
.It Ev XDG_CONFIG_HOME
determines the default location of the configuration file.
If unset or empty,
.Pa ~/.config/
is used as the value.
.El
.Sh FILES
.Bl -tag -width "~/.cwmrcXXX" -compact
.It Pa ~/.cwmrc
.Bl -tag -width "$XDG_CONFIG_HOME/cwm/cwmrc" -compact
.It Pa $XDG_CONFIG_HOME/cwm/cwmrc
Default
.Xr cwm 1
configuration file.