feat(config): Try to load config.ini (#2324)

* Added .ini extension check to default config

* Added change to changelog and man page

* Added change to changelog and man page

* removed .vscode folder

* removed new lines in changelog
This commit is contained in:
Kamui 2020-12-23 08:52:30 -08:00 committed by GitHub
parent 218911c463
commit 89a723a4d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View File

@ -24,8 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[`#956`](https://github.com/polybar/polybar/issues/956), [`#956`](https://github.com/polybar/polybar/issues/956),
[`#1871`](https://github.com/polybar/polybar/issues/1871), [`#1871`](https://github.com/polybar/polybar/issues/1871),
[`#2141`](https://github.com/polybar/polybar/issues/2141)) [`#2141`](https://github.com/polybar/polybar/issues/2141))
- `internal/battery`: `format-low`, `label-low`, `animation-low`, `low-at = - `internal/battery`: `format-low`, `label-low`, `animation-low`, `low-at = 10`.
10`.
- `internal/cpu`: `format-warn`, `label-warn`, `warn-percentage = 80` - `internal/cpu`: `format-warn`, `label-warn`, `warn-percentage = 80`
- `internal/fs`: `format-warn`, `label-warn`, `warn-percentage = 90` - `internal/fs`: `format-warn`, `label-warn`, `warn-percentage = 90`
- `internal/memory`: `format-warn`, `label-warn`, `warn-percentage = 90` - `internal/memory`: `format-warn`, `label-warn`, `warn-percentage = 90`
@ -35,6 +34,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
speeds are displayed. speeds are displayed.
- `internal/xkeyboard`: `%variant%` can be used to parse the layout variant - `internal/xkeyboard`: `%variant%` can be used to parse the layout variant
([`#316`](https://github.com/polybar/polybar/issues/316)) ([`#316`](https://github.com/polybar/polybar/issues/316))
- Added .ini extension check to the default config search.
([`#2323`](https://github.com/polybar/polybar/issues/2323))
### Changed ### Changed
- Slight changes to the value ranges the different ramp levels are responsible - Slight changes to the value ranges the different ramp levels are responsible
@ -62,4 +63,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Empty color values are no longer treated as invalid and no longer produce an error. - Empty color values are no longer treated as invalid and no longer produce an error.
[Unreleased]: https://github.com/polybar/polybar/compare/3.5.3...HEAD [Unreleased]: https://github.com/polybar/polybar/compare/3.5.3...HEAD
[3.5.3]: https://github.com/polybar/polybar/releases/tag/3.5.3 [3.5.3]: https://github.com/polybar/polybar/releases/tag/3.5.3

View File

@ -32,7 +32,9 @@ places in the following order:
* If the ``-c`` or ``--config`` command line argument is specified, it will use * If the ``-c`` or ``--config`` command line argument is specified, it will use
the path given there. the path given there.
* ``$XDG_CONFIG_HOME/polybar/config`` * ``$XDG_CONFIG_HOME/polybar/config``
* ``$XDG_CONFIG_HOME/polybar/config.ini``
* ``$HOME/.config/polybar/config`` * ``$HOME/.config/polybar/config``
* ``$HOME/.config/polybar/config.ini``
Syntax Syntax
------ ------

View File

@ -303,12 +303,23 @@ namespace file_util {
if (exists(confpath)) { if (exists(confpath)) {
return confpath; return confpath;
} }
string iniConfPath = confpath.append(".ini");
if (exists(iniConfPath)) {
return iniConfPath;
}
} }
if (env_util::has("HOME")) { if (env_util::has("HOME")) {
confpath = env_util::get("HOME") + "/.config/polybar/config"; confpath = env_util::get("HOME") + "/.config/polybar/config";
if (exists(confpath)) { if (exists(confpath)) {
return confpath; return confpath;
} }
string iniConfPath = confpath.append(".ini");
if (exists(iniConfPath)) {
return iniConfPath;
}
} }
return ""; return "";
} }