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

Feature request: base layer in bool expr #1247

Open
GrewHair opened this issue Sep 20, 2024 · 4 comments · May be fixed by #1250
Open

Feature request: base layer in bool expr #1247

GrewHair opened this issue Sep 20, 2024 · 4 comments · May be fixed by #1250
Labels
enhancement New feature or request

Comments

@GrewHair
Copy link

Is your feature request related to a problem? Please describe.

My use case is rather complex, so I hope you'll excuse me for not going into gory details right away.

I'd rather just say that while Kanata now provides various handy devices/hacks that allow to store and reuse "state" for complex scenarios, like key-history, noop keys, virtual keys, etc, I feel like sometimes it would just make more sense to piggyback on Kanata's own wonderful layer model, keeping config cleaner and saner. Also just for completeness' sake.

So we already have a predicate that checks the current layer in switch statements, thanks to #1060. How hard would it be to also make one for the current base layer (the one Kanata goes back to when you release layer-while-held)?

Describe the solution you'd like.

a check for current base layer, like this:

(defalias
  sw (switch
    ((base-layer base-layer-1)) a break
    ((base-layer base-layer-2)) b fallthrough
    () c break
  )
)

Describe alternatives you've considered.

Defining dummy virtual keys and using them as flags that other bool expressions can query.

Additional context

No response

@GrewHair GrewHair added the enhancement New feature or request label Sep 20, 2024
@jtroo
Copy link
Owner

jtroo commented Sep 20, 2024

Seems reasonable enough :)

@jtroo jtroo linked a pull request Sep 21, 2024 that will close this issue
4 tasks
@jtroo
Copy link
Owner

jtroo commented Sep 21, 2024

Does this work for the use case?
#1250

@GrewHair
Copy link
Author

Wow that was quick, thanks!

Haven't tested it yet, as I'm using the wintercept version, and apparently it doesn't build now. Filed #1253 for that.

@GrewHair
Copy link
Author

GrewHair commented Sep 22, 2024

Commented out a bunch of lines in parser/src/cfg/mod.rs for now, haha :) And yeah, it does work! Will come back after more testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants