In a switch you get on/off, but a button returns to the original setting.

  • Vinny_93@lemmy.world
    link
    fedilink
    arrow-up
    21
    ·
    3 days ago

    A switch, or, more accurately, a toggle, moves an entity from one state to another until it is triggered again.

    A button, or, more specifically, a gate, triggers something just once.

    The original keyboard switch, the buckling spring, can be explained as a button, but what actually happens is you press a button, or a key, which compresses a spring, toggling a switch. It is in the release of the key that the distinction arrives.

    Once you press the key and hold it, the system will register continuous input of that switch (toggle on). Once you release it, the toggle goes off again.

    If the key were to function as a button, holding it would only register as one hit until it is pressed again.

  • Apytele@sh.itjust.works
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    2 days ago

    I have no idea but I strongly admire your spirit of inquiry. I’ve always felt it was an odd name but was never able to fully articulate why.

  • BaconIsAVeg@lemmy.ml
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 days ago

    Like you mention, button’s have one state while switches have two. Keys have a KEYPRESS_DOWN and KEYPRESS_UP state, the latter firing when you release the key.

    A button only has a down state.

  • static09@lemmy.world
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    2 days ago

    There are many types of switches. The inner workings of a mechanical keyboard switch are just one example of them.

    Here are some links to help understand what’s happening in a keyboard switch and the different types of switches.

    Types of switches (general):
    https://www.electronicshub.org/switches/

    Difference in keyboard switches (with animations):
    https://www.thekeyboardco.com/blog/index.php/2012/12/an-introduction-to-cherry-mx-mechanical-switches/

    A (maybe) over-comprehensive guide to keyboard switches:
    https://switchandclick.com/mechanical-keyboard-switch-guide/