Skip to content
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 option to specify extra paths for plugins #74

Merged
merged 7 commits into from
Apr 5, 2024

Conversation

Jozhin-s-Bazhin
Copy link
Contributor

@Jozhin-s-Bazhin Jozhin-s-Bazhin commented Apr 4, 2024

Added an option in pyprland.toml that lets you specify extra paths that pypr will search in for plugin modules.

[pyprland]
plugins = [ "somebuiltinplugin", "external:customplugin" ]
plugin_paths = [ "/path/to/custom/plugin/" ]

Also fixed a bug that would prevent adding custom plugins at all, even using the more manual methods like installing the plugin using pip install -e .. At line 96 there is a statement that checks whether the plugin is specified relatively, and if it isn't, imports the plugin from pyprland.plugins.

modname = name if "." in name else f"pyprland.plugins.{name}"

I added an option to prepend external: before the plugin name to explicitly import it from outside pypland.plugins. In the case that the statement is actually working as intended this won't break any existing configurations.
I tested if it works with a single example but haven't written any tests or documentation yet because I wanted to check if this format looks good.

Edit: I also added the default Python .gitignore template so that stuff like pycache isn't tracked by git

Jozhin-s-Bazhin and others added 4 commits April 4, 2024 21:48
Added an option to specify "external:" in before a
plugin name to import it from an external path
instead of from "pyprland.plugins.my_plugin"
@fdev31
Copy link
Collaborator

fdev31 commented Apr 5, 2024

Nice !
Maybe "plugin_paths" should be "plugins_paths" ?
I'll check the code after my work day but the description sounds good :)

@Jozhin-s-Bazhin
Copy link
Contributor Author

I'm not a native english speaker so I have no idea how it's written correctly, but when I asked chatgpt it says "plugin_paths" is correct. I'm still not a native speaker, so if "plugins_paths" looks better to you I can add that :)

@fdev31
Copy link
Collaborator

fdev31 commented Apr 5, 2024

I'm not a native english speaker so I have no idea how it's written correctly, but when I asked chatgpt it says "plugin_paths" is correct. I'm still not a native speaker, so if "plugins_paths" looks better to you I can add that :)

Oh, it's not about correctness, I believe both spellings are valid...(I'm also not a native speaker): it's more that we can load (several) "plugins", so when adding paths for it we should keep the same spelling as the "plugins" array... that's my only point ^^
So in short it's to be aligned with the existing variable name...

@Jozhin-s-Bazhin
Copy link
Contributor Author

Oh, in that case case you're right. I'm gonna adjust it when I get back to my computer.

Copy link
Collaborator

@fdev31 fdev31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@fdev31 fdev31 merged commit b9145a0 into hyprland-community:main Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants