Git Product home page Git Product logo

Comments (4)

benblazak avatar benblazak commented on July 20, 2024

Your question isn't badly formatted :-)

On a stylistic note real quick: it'd be more consistent to say P(m_alttab), if you're going to say R(m_alttab) below it -- or alternately to use keys__press__m_alttab and keys__release__m_alttab. R(...) and P(...) are macros that expand out to the longer form during preprocessing.

To answer one question, you probably should keep all your layout specific stuff in qwerty_zorglups.c -- though, since it's your own fork of the repo, you're quite welcome to modify keys.part.h (if you're doing things the same way I did them in qwerty--ben.c it won't matter at all to the compiler, since #include is the preprocessor version of cut and paste).

Your other question is a bit harder. It depends on what you want to happen. It sounds like you'd like to press a single key to switch programs, and press the same key multiple times to switch to a less recent program. What's missing is what you want to do to signal that you're done selecting a program. You could put the release on another key if you wanted. You could use one of the timers (I don't think I have any examples of using the functionality (I don't think I was done designing it either, but I haven't touched it in a while), but see lib/timer.h) and have KEYBOARD__LeftAlt released after a specified amount of time. Or maybe, since you've thought about it more than I have, you have other ideas.

from ergodox-firmware.

hilsonp avatar hilsonp commented on July 20, 2024

Thank you for your reply (fast, as usual).

Lazy, I don't want to use another key to signal that I'm done selecting a program. Same as with the Alt-Tab, when we release the Alt, it's done.
I would like to avoid the timer too because the reason to switch programs using Alt-Tab is to be really quick.

Would there be a way to release the KEYBOARD__LeftAlt released when I leave my layer even if it is not within the qwerty_zorglups.c?

Have a nice day.

from ergodox-firmware.

benblazak avatar benblazak commented on July 20, 2024

You happened to catch me with a relatively straightforward question, at a time when I had time.

Yes, you can. You can write your own layer pop function, or you can change the one in keys.part.h. For example, if your control layer was layer 1, you currently have void P(lpo1l1) (void) { layer_stack__pop_id(1); kb__led__off(1); } changed to #define keys__press__lpo1l1 R(lpupo1l1) but you could change it to void P(lpo1l1) (void) { layer_stack__pop_id(1); usb__kb__set_key(false, KEYBOARD__LeftAlt); } instead (untested).

Or, if there will ever be a time when you're holding alt, then pressing your layer key, then pressing your alt+tab key, you may also want a variable to store the previous state of the alt key so that you can restore that state when the layer key is released rather than always releasing the alt key. In that case, you might make a variable above wherever you're defining the layer push and pop functions, called maybe bool lpupo1l1__alt_pressed;, and then inside your layer push function, add something like lpupo1l1__alt_pressed = usb__kb__read_key(KEYBOARD__LeftAlt);, and inside your layer pop function, instead of just releasing it, put something like usb__kb__set_key(!lpupo1l1__alt_pressed, KEYBOARD__LeftAlt);.

Though under certain conditions that logic might be wrong too... It might be easier to just use left alt for this purpose, and right alt for all other purposes, so that they don't conflict. Or there are probably other workarounds.

Didn't check all this very carefully, but I hope it's a good start :-)

from ergodox-firmware.

hilsonp avatar hilsonp commented on July 20, 2024

Sorry Ben. Not had time to try it yet but I'll do and report my results.

from ergodox-firmware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.