-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add config file and implement config file parsing #79
Conversation
35a2fc9
to
bcf52d3
Compare
bcf52d3
to
a34287e
Compare
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. |
I'll get to this next week after my finals :) |
Good luck on your finals then! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than the single comment. The implementation is really clean and works like a charm!
Thanks for your much appreciated patience! :)
@@ -30,6 +30,11 @@ pub fn get_proxy() -> zbus::Result<ServerProxyBlocking<'static>> { | |||
} | |||
|
|||
fn main() -> Result<(), glib::Error> { | |||
// Parse Config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some config dir information in the client, server, and backends --help
print information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good idea.
Though, I can't find a way to add text to --help
without adding another option with gtk-rs
. 😅
I think one way to workaround that would be to add a --config
option that allows specifying a custom config path, and explain the config stuff in the help text for that option.
I'll look at this at some point in the next few days, when I have a bit more time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good idea.
Though, I can't find a way to add text to
--help
without adding another option withgtk-rs
. 😅I think one way to workaround that would be to add a
--config
option that allows specifying a custom config path, and explain the config stuff in the help text for that option.I'll look at this at some point in the next few days, when I have a bit more time.
Oh yeah, true. Sounds like a good idea 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented the --config
option today. Sorry it took so long. The libinput backend doesn't have any command line parsing at the moment, so I left it out there, but I can add similar parsing to it as with client/server.
The help message isn't final yet, I still need to think about how to best communicate the location without hardcoding paths or making the message too long.
Let me know if you like the basic implementation outline or if you'd like it done differently.
a34287e
to
78d9910
Compare
(fixed rustfmt difference in latest push) |
Hi, any updates on this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Again, thanks for your immense patience :)
The next step would be to clean out some of the cmdline args and move them into the config |
The "show percentage" PR could also remove its CLI option if you want to move away from settings via CLI options. |
This PR adds a TOML config file for the server, client, and libinput backend.
There are two config files
<SYSTEM_CONFIG_DIRS>/swayosd/backend.toml
for the backend components that run with elevated privileges. This file should never be read from a user configuration folder.<SYSTEM_CONFIG_DIRS>/swayosd/config.toml
or<USER_CONFIG_DIR>/swayosd/config.toml
for 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 otherwiseThe config files are structured like this:
Backend configuration
Server and Client configuration
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.