hyprland-community / pyprland

Scratchpads & many goodies for Hyprland [maintainer=@fdev31]
MIT License
345 stars 15 forks source link

[FEAT] [layout_center] tagging or similar to identify a window or workspace in center layout #109

Closed clotodex closed 3 months ago

clotodex commented 3 months ago

Is your feature request related to a problem? Please describe. I am facing two problems:

Describe the solution you'd like A method to identify that the workspace or ideally the window is currently in center layout. E.g. by tagging it.

Describe alternatives you've considered The first problem could also be solved if the center layout would have any other identifier (e.g. a special workspace, etc) The second problem can also be solved by a "force off" or just a workspace level info.

fdev31 commented 3 months ago

About the style, if you find a way to apply a style to a specific window with hyprland I'll try to implement it.

About the behavior, I can think about 3 different behaviors one may want:

so it will probably be a flag taking an enum-like string... for instance:

new_window_action = "background" | "front" | "stop"

Feel free to suggest alternatives.

clotodex commented 3 months ago

Looks good to me - I would also not mind switching to that window as the main, that would probably cover more people in the beginning. All three options make sense though. To think further, ff I stay with my qtile-mindset, then I would expect it to open "in front" of the other program, like a stack. So "both" are effectively in the center layout. This is not necessary for me personally though. So all in all i think those three options are fine.

To the first point. With the new windowrulev2 of hyprland it seems to me that you can apply style to any tag now. And you can set tags even down to the individual window level. https://wiki.hyprland.org/Configuring/Window-Rules/#tags So you can override opacity etc (my usecase)

fdev31 commented 3 months ago

Hm, you are right, I already had this thought, maybe the most expected behavior is to raise it as the main one... then there is no need to configure it. If I make it configurable this should probably be the default. I believe I didn't implement it because it would cost frequent IPC calls (each time a new window opens), but maybe that's worth it.

About the style, that's great, indeed tags can make it, I never used it but it fits perfectly. Ideally, it would not only manage the tag but also the style...

style = ["opacity 1.0", "bordercolor rgb(FFFF00)"]

would set the windowrulev2 for the tag... (to have everything in one place), any better idea or alternative ?

fdev31 commented 3 months ago

I was surprised it didn't work, it's not released yet... I didn't test, but pushed some code adding support for style in the latest git commit.

fdev31 commented 3 months ago

so you should be able to use style (a list of strings) and on_new_client = "foreground" with the latest git version... Tell me how it works for you, especially the style which is untested!

EDIT: foreground is the default, alternatives are "close" and "background"

clotodex commented 3 months ago

did not test the style yet, but the on_new_client behavior is really clean and works exactly as expected THANK YOU! :D

fdev31 commented 3 months ago

Any news on the style ?

clotodex commented 3 months ago

Is there a way to print out tags a window has? If so I cannot find it.

Otherwise I am actually getting an error "invalid dispatcher" when adding the style field

clotodex commented 3 months ago
layout_center - Logger "layout_center" initialized // common.py:205
            layout_center - dispatch windowrulev2 unset, tag:layout_center // ipc.py:144
            layout_center - FAILED b'Invalid dispatcher' // ipc.py:165
            layout_center - dispatch ['windowrulev2 opacity 1.0, tag:layout_center', 'windowrulev2 bordercolor rgb(FFFFFF), tag:layout_center', 'windowrulev2 borderwidth 10, tag:layout_center', 'windowrulev2 noanim, tag:layout_center'] // ipc.py:144
            layout_center - FAILED b'Invalid dispatcherInvalid dispatcherInvalid dispatcherInvalid dispatcher' // ipc.py:165
            layout_center - configured // command.py:154
                     pypr - ================================[ initialized ]================================= // command.py:355

This is the log I would love to check tags but dont know any command - but the tagging seems fine.

Could it be that windowrulev2 cannot be dispatched? Does it work for you?

fdev31 commented 3 months ago

Sorry for the late response, I have been traveling. As mentioned, I don't have hyprland git and it's not tested. So tagging works (eg: you can use some style for layout_center) but you can only do that with windowrule and not windowrulev2 ?

You can test everything "manually" (using the hyprland.conf & hyprctl), pypr is just using the same commands...

clotodex commented 3 months ago

I could not get around testing this yet (switching distros to nix at this point and having different troubles) However what I saw (you can try it out) is that you CANNOT dispatch a windowrule. Not v1 and also not v2!

fdev31 commented 3 months ago

Aaaaah, my mistake then indeed I overlooked that... it's a trivial fix I will do later today and would appreciatie your feedback. In short the "keyword" parameter is missing in the hyprctl call....

clotodex commented 3 months ago

Ah true you need to call it different - and sure I will test it out, let me know when you pushed the changes

fdev31 commented 3 months ago

It should be in 2.3.7-4, if you take the latest git you will have it (but still untested....)

fdev31 commented 3 months ago

I made few mistakes in the previous two releases which are fixed in git, would be good to know if this one has been fixed quite quickly to avoid yet-another bugfix release... I'll wait a bit to get your feedback, I would really appreciate if you have the time to evaluate the git version to provide some feedback soon...

fdev31 commented 3 months ago

I'm a bit tight time-wise but managed to do a quick test with the latest Hyprland release & fixed the remaining issues, hope it works for you too!