Skip to content

Conversation

ItsOhen
Copy link
Contributor

@ItsOhen ItsOhen commented Sep 19, 2025

Describe your PR, what does it fix/add?

Addresses: #10659
But not quite a good solution yet.
What i really wanted was a syntax like this:

submap = someSub {
  oneshot = true
  bind ,x,exec ...
  submap = Layer2 {
    oneshot = false
    bind ,x,exec ...
   }
}

Then a stack of submaps to keep track of where we are.
Hyprlang doesn't really allow for this though. So this is what i ended up with.
Using the syntax:

bind = $mainMod, a, submap, someSub
submap = someSub oneshot
bind = ,q,submap, reset
bind = ,e,exec,...
bind = ,w,submap,Layer2

submap = Layer2 oneshot
bind = ,q,submap, reset
bind = ,e,exec,...
bind = ,w,submap, Layer3

submap = Layer3 oneshot
bind = ,e,exec,...
bind = ,q,submap, reset
submap = reset

With it being just strings floating around it's really hard to cascade parents.
So for now if a submap is oneshot, it just resets submap to default.
I made a version using containers instead which made it trivial to go to nearest none oneshot, but felt heavy and unnecessary without a different way to nest submaps. Like, how many layers are people really going to put in?

Is it ready for merging, or does it need work?

Probably not. Some suggestions on how to make this look better would be nice.

@vaxerski
Copy link
Member

I don't see the point. Why not just use the current submaps to move to and from? It doesn't address the issue to me?

@ItsOhen
Copy link
Contributor Author

ItsOhen commented Sep 19, 2025

? Wasn't the issue that there should be a way to go back to default submap when a keybind is triggered?
Which is what this does.
If submap is oneshot, go back to default after a dispatcher is called.
If not, stay in w/e submap you are in until a reset or some other submap is called.

And the reason i moved it to a struct was so that hopefully in the future there is a better way to parse { }, and then it would be easy to make a neat push pop stack structure for submaps.
Maybe something like:
while(p->parent && p->oneshot) { m_submap.pop(); p = p->parent; }

@vaxerski
Copy link
Member

oh yeah sorry got confused there with your description

@ItsOhen
Copy link
Contributor Author

ItsOhen commented Sep 20, 2025

Fucking cf.. I don't even know anymore. I auto run it on save. Complains. Manually run it before squash, still complains. Stage, run, commit, still complains. Like come on. Explain this to me:
image

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

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

rest lgtm, needs a wiki mr

vaxerski
vaxerski previously approved these changes Sep 24, 2025
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

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

tests needed, code OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants