Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Vendored Configuration File #2588

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ xbps-install -S wayfire

## Configuration

Copy [`wayfire.ini`] to `~/.config/wayfire.ini`.
Copy [`wayfire.ini`] to `~/.config/wayfire.ini` or `~/.config/wayfire/wayfire.ini`.
Before running Wayfire, you may want to change the command to start a terminal.
See the [Configuration] document for information on the options.

Expand Down
2 changes: 2 additions & 0 deletions man/wayfire.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ with an alternative configuration file.
The default configuration file is searched first in the
.Ev ${WAYFIRE_CONFIG_FILE}
environment variable, or paths
.Pa ${XDG_CONFIG_HOME}/wayfire/wayfire.ini ,
.Pa ${HOME}/.config/wayfire/wayfire.ini ,
.Pa ${XDG_CONFIG_HOME}/wayfire.ini ,
.Pa ${HOME}/.config/wayfire.ini .
.Pp
Expand Down
13 changes: 10 additions & 3 deletions src/default-config-backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,16 @@ class dynamic_ini_config_t : public wf::config_backend_t
return env_cfg_file;
}

return (getenv("XDG_CONFIG_HOME") ?:
(std::string(nonull(getenv("HOME"))) + "/.config")) +
"/wayfire.ini";
std::string env_cfg_home = getenv("XDG_CONFIG_HOME") ?:
(std::string(nonull(getenv("HOME"))) + "/.config");

std::string vendored_cfg_file = env_cfg_home + "/wayfire/wayfire.ini";
if (std::filesystem::exists(vendored_cfg_file))
{
return vendored_cfg_file;
}

return env_cfg_home + "/wayfire.ini";
}
};
}
Expand Down