-
-
Notifications
You must be signed in to change notification settings - Fork 934
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
Use glaze to parse hyprctl json output, other improvements #8812
base: main
Are you sure you want to change the base?
Conversation
27cf1f6
to
0d52d6c
Compare
can you use something that doesn't suck as horrendously as nlohmann's json |
What would you prefer? Here you said nlohmann::json is ok, and I'd get banned for using boost::json, and you said you don't know jsoncpp. rapidjson? see latest commit for how that would look (I prefer nlohmann::json for its simplicity in this case, though) |
yeh I was a bit quick on that one back then. Nlohmann's json is ungodly slow. Check out https://github.com/stephenberry/glaze |
done, let me know if you want me to use git submodules instead of cmake's fetchcontent |
5ed2134
to
f4ff963
Compare
I'm not sure whether the arch package for glaze contains a .pc file, but the Nixpkgs one only includes cmake files, so I had to modify the lookup method in meson.build. |
Thanks! Ready to merge now. |
* Use std::filesystem::path in hyprpm DataState to avoid concatenating strings with (folder + "/" + file) * Added getPluginStates helper method in DataState * Small clang-tidy improvements
f884eca
to
55607e0
Compare
if (!entry.is_directory() || entry.path().stem() == "headersRoot") | ||
continue; | ||
|
||
if (!std::filesystem::exists(entry.path().string() + "/state.toml")) |
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.
why did you remove all these safeguards?
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.
I didn't, I extracted them into the method getPluginStates()
because these safeguards were duplicated 4 times.
Describe your PR, what does it fix/add?
hyprctl plugin list | grep Plugin
, by replacing it with a simple glaze parse of the json output ofhyprctl plugin list -j
in PluginManager.cppfolder + "/" + filename
andfolder + "/filename.ext"
came up a lot. I really dislike this so I replaced it with the std::filesystem/
operator (in a separate commit)find
was being called with a single-character string"x"
instead of just a character'x'
.Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
I'm planning on replacing more of these hyprctl calls with json parsing, like we discussed in this PR: #7152 (comment)
Is it ready for merging, or does it need work?
Ready to merge