Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Large refactor and some todo list items completed #4

Merged
merged 35 commits into from
Jan 11, 2023

Conversation

abs3ntdev
Copy link
Contributor

I spent some time refactoring this for personal use.

JSON output has been added
output to passable file
command line argument improvements (getopt)
handles and displays comments in JSON and markdown output
handles pipes in markdown output
updated markdown output to not have the "bind* =" part
added Makefile for install
config file parsing to read all variable categories and subcategories
proper go tests and removed the --test flag, outputs all test results to test/ directory
and probably something i cant remember

if you want anything done differently let me know I am happy to work on it.

@abs3ntdev abs3ntdev temporarily deployed to production January 4, 2023 19:10 — with GitHub Actions Inactive
@NotAShelf
Copy link
Member

Thanks for your interest! I currently do not have the time, but I'll review this as soon as possible.

@flickowoa
Copy link
Member

theres an empty main file at root, otherwise lgtm

and about the util/parser/parser.go and util/properties/properties.go files, as far as i can see you arent using them anywhere so you shud be good to delete them, the parser.go file is very messy anyway and theres a better alternative to just use hyprland socket instead of reading config file and parsing manually. what do you think @NotAShelf

@flickowoa
Copy link
Member

flickowoa commented Jan 5, 2023

as for using the socket is there a way to get all options without batch running a getopt for everything? i might have missed it or its undocumented.

iirc the socket allows you to send a batch of cmnds at once using --batch

@abs3ntdev
Copy link
Contributor Author

yeah but i mean like how would you get all the settings via socket without knowing the names of every single specified setting before hand? reading from the file you just need to scan for the category names but via socket (unless im missing someting) you have to manually call every genera:thing general:thing2 general:thing3 right?

@flickowoa
Copy link
Member

flickowoa commented Jan 5, 2023

i dont think there is anything to get all the settings at once without knowing each option thru socket, i had to do something like this for hyprland-py and i ended up scraping hyprland wiki to get all the config options then run getoption for all of them

@abs3ntdev
Copy link
Contributor Author

Yeah but even then you miss any device:name custom config options set by the user. I think just parsing the file is fine unless they eventually let you query for all settings from the socket. Up to you guys though. The new reader is pretty easy to add new categories/subcategories to tho.

@abs3ntdev abs3ntdev temporarily deployed to production January 5, 2023 05:37 — with GitHub Actions Inactive
@NotAShelf
Copy link
Member

I prefer reading from a static config file (i.e. ~/.config/hypr/hyprland.conf). We can attempt to use the socket1 for receiving config values, but I think it's easier to alter the codebase to accommodate newly added config options.

@NotAShelf
Copy link
Member

With the addition of hyprctl binds, we can probably streamline the code even further. Should be as simple as parsing the output of hyprctl binds -j and reading the json output. The downside is, however, that we cannot cherry pick comments and add them to the markdown.

@abs3ntdev
Copy link
Contributor Author

if you want to have the config file conversion eventually then i would leave the file reader writer and build on it. but we can use hyprctl binds to get binds set during runtime

@abs3ntdev
Copy link
Contributor Author

i added the hyprctl reading and converting the modmask number. if your bindings have double quotes in it hyprctl doesnt validate the json before returning it so you get errors. i just changed all my double quotes to single and it works fine.

@NotAShelf
Copy link
Member

Could you try if it works after the fix vaxry implemented? I am inclined to believe this is ready for merging (although I was intending to make parsing comments a command line flag) if it works on the latest version of Hyprland.

Side note, if you could record a quick demo gif (using a tool such as vhs, perhaps) to put in the readme I would appreciate that.

@abs3ntdev abs3ntdev temporarily deployed to production January 11, 2023 18:40 — with GitHub Actions Inactive
@abs3ntdev
Copy link
Contributor Author

yeah it works after the recent fix. i can make comments a command line argument rq and record a video sure.

@NotAShelf
Copy link
Member

Thanks!

@abs3ntdev
Copy link
Contributor Author

okay i added the flag and video and picture to readme

@abs3ntdev abs3ntdev temporarily deployed to production January 11, 2023 19:38 — with GitHub Actions Inactive
@NotAShelf
Copy link
Member

The --auto-start flag seems to be outputting the entire config, could you see if it occurs on your end too

@abs3ntdev
Copy link
Contributor Author

so right now the behavior is binds are always output then you can add additional things by adding flags. so --auto-start prints binds + execs --variables prints binds + variables. would you rather default output nothing and have a --binds flag to print the binds.

@abs3ntdev
Copy link
Contributor Author

i added a --binds flag it should work more how you were expecting now

@NotAShelf
Copy link
Member

Ah, I wasn't trying to tell you to change the behaviour as I was only confused, but thanks regardless.

LGTM! I will be merging this unless there is anything else you would like to add?

@abs3ntdev
Copy link
Contributor Author

nah seems fine for me. and it makes more sense to work with flags so idm.

@abs3ntdev abs3ntdev temporarily deployed to production January 11, 2023 20:30 — with GitHub Actions Inactive
@NotAShelf NotAShelf merged commit 47172e8 into hyprland-community:main Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants