SwayOSD
SwayOSD copied to clipboard
Add config file and implement config file parsing
This PR adds a TOML config file for the server, client, and libinput backend.
There are two config files
<SYSTEM_CONFIG_DIRS>/swayosd/backend.tomlfor the backend components that run with elevated privileges. This file should never be read from a user configuration folder.<SYSTEM_CONFIG_DIRS>/swayosd/config.tomlor<USER_CONFIG_DIR>/swayosd/config.tomlfor the server and client that run as the user. This file should be read from the user configuration folder if it exists and fall back to the system configuration directories otherwise
The config files are structured like this:
Backend configuration
[input]
# libinput backend configuration options (none so far)
# ... sections for future backend components that need elevated privileges ...
# [foo]
# bar = "baz"
Server and Client configuration
[server]
style = "/path/to/my/style.css"
top_margin = 0.85
# show_percentage = true (once #69 is merged)
[client]
# client configuration options (none so far)
Implementation Design
The parsing uses serde and toml to parse the TOML file directly into a struct.
Sections and options in the config file are optional, but misspelling them is an error.
Fixes #42.
Thanks a ton for working on this! I'll have time to review early next week. If I forget, don't be afraid to ping me here :)
Any updates on this?
I understand if you don't have much time due to other commitments, but just wanted to check in.
Any updates on this?
I understand if you don't have much time due to other commitments, but just wanted to check in.
I'll get to this next week after my finals :)
Good luck on your finals then!
(fixed rustfmt difference in latest push)
Hi, any updates on this PR?
The next step would be to clean out some of the cmdline args and move them into the config
The next step would be to clean out some of the cmdline args and move them into the config
--top-margin, --style, and max volume already have config settings, so those options could potentially be removed, but some people might have scripts that depend on them.
The "show percentage" PR could also remove its CLI option if you want to move away from settings via CLI options.