How can I detect whether the user’s keyboard has a Break key?

Some time ago, a customer wanted to know whether there was a way to detect whether or not the user's keyboard has a Break key. "Our program has a hotkey that involves the Break key. Nowadays, the trend in laptop keyboards is to remove the Break key, which leaves users no way to invoke the hotkey. We want to offer an alternate hotkey, but only if the user's keyboard doesn't have a Break key."

The device driver people explained that the driver has no idea what physical keys are present on the keyboard. So there's no way to know whether a Break key exists, except by inferring the presence of such a key if you ever see a report that says "Hey, the user hit the Break key."

That answers the technical problem: No, there is no way to know whether the keyboard has a physical Break key, or at least no way at the driver level to know.

But even if it were possible, from a user experience point of view, you don't want to change the hotkey based on whether the keyboard has a Break key. For one thing, it forces the user to remember additional state: They have to use one hotkey when at their desktop PC, and another hotkey when using their laptop.

The user may have a Bluetooth keyboard paired to the laptop, even though they are actively using the integrated keyboard. If the Bluetooth keyboard has a Break key, the program would require the user to use the Break hotkey, even though the laptop keyboard doesn't have a Break key.

If the user is on the edge of Bluetooth range, that Bluetooth keyboard may come and go randomly, at which point the application hotkey changes randomly.

And changing the hotkey based on the keyboard the user typed on most recently is even more crazy.

The customer accepted our explanation that there is no way at the driver level to detect what types of keys are available on the current keyboard, and that even if you knew, you probably shouldn't act on it. Best would be to leave both sets of hotkeys active at all times.

Comments (43)
  1. pc says:

    And in addition to defaulting to both sets of hotkeys, all keyboard shortcuts should be configurable in all programs.

    1. Antonio Rodríguez says:

      I disagree. It’s a complex feature that starts with -100 points and is needed/asked by very few users. Also, it can turn into a support nightmare when you tell the user to press the default shortcut and it doesn’t work (or even worse, it does something completely different) because his/her administrator decided it would be a good idea to change it.

      With a fraction of the effort needed to implement and support the customization of shortcuts, you can do some [informal] user testing and determine an optimal layout.

      1. Dave says:

        Antonio beat me to it. There are situations where configurable hotkeys are nice, especially for nerd-level apps. But for most apps, configurable hotkeys are a disaster. Support. Maintenance. Documentation. These are real costs in a consumer app and configurable hotkeys drive these way up.

      2. 12BitSlab says:

        Antonio, with all due respect, I disagree. For those, like me, who have challenges like arthritis in both hands, being able to configure shortcuts and the like is a God send. This is an area where Microsoft has traditionally outshined most other software vendors.

        1. All three of you have good points. Shortcut configuration is a game changer with significant implementation cost.

          Actually, keyboard layout configuration is a game changer in video games. I remember having given myself a huge edge in Onimusha 3 (Capcom) and The Lord of the Rings 3 (EA) by reconfiguring their keyboard shortcuts.

        2. Antonio Rodríguez says:

          Well, you have made a good point for keyboard customization. And one that we developers should take into account, too. The combinations that are hard for you are also difficult for people without arthritis (Shift+Alt+F6 is hard for everybody – and in most keyboards, it requires both hands; Alt+Shift+Tab seems “easier”, until you realize you almost have to be a pianist or finger contortionist). Software should use combinations that can be typed with just one hand when possible. That’s why the four basic edit shortcuts (Ctrl+Z, X, C, V) are the Ctrl key plus the four nearest letters.

          And the current fashion of requiring Fn to access the function keys only makes things worse: Alt+Shift+F6 suddenly becomes Alt+Shift+Fn+F6, which requires a pianist and a half! :-(

          1. Engywuck says:

            > That’s why the four basic edit shortcuts (Ctrl+Z, X, C, V) are the Ctrl key plus the four nearest letters.

            Only on english keyboards :-(
            On german ones the Z is in the middle of top row (QWERTZ keyboard), on french ones the second key in top row (AZERTY). (Dvorak has X and C in “wide-finger-mode” if used with Ctrl)
            So now there’s another problem: do you localize shortcuts?

        3. Tim says:

          Accessibility features like this I think are way better handled at an OS level instead of counting on third party software developers to implement them in all the programs that you use. If you have problems chording certain keys, wouldn’t it be preferable to globally remap the keyboard so that modifier keys are mapped to be easier to reach?

          I avoid tweaking settings in any program that I use because in my experience most software is garbage and changing any defaults puts you on an less-tested (or most likely completely untested) code path where you’ll encounter even more bugs than normal. From my perspective, additional settings are a big negative because it means that the developer wasted time adding features that I’ll never use instead of working on testing and fixing bugs.

        4. Entegy says:

          @12BitSlab This is why Sticky Keys are a thing, to help do keyboard shortcuts.

      3. morlamweb says:

        @Antonio: I can see some value in making the most-common keyboard shortcuts invariant (cut-copy-paste, for example). Custom actions should allow for some degree of customizability. And, speaking as a support person, I do not rely on shortcuts when working with customers. The instructions that I send out assume that the person can click around in the UI, which is the most common case.

        On the subject of the break key: I have three laptops in front of me at my desk, of different ages, and the placement of that key (and it’s neighbors, sysrq and scroll lock) so quite a difference over time. My circa-2005 laptop has separate keys for printscreen/sysrq, scroll lock, and pause/break; by 2009, they had been merged into the Fx row, though their placement in that row varies.

      4. Anon says:

        Configurable shortcut keys are an ADA-compliance legal issue. You can decide not to include them, but woe be to you if a disabled user decides to sue you over it.

        1. Antonio Rodríguez says:

          I have all the respect for disabled people, but not everyone can afford that. Small development houses, often dedicated to niche software or even custom, made-to-order solutions, just don’t have the resources to implement accessibility features (or many other expensive taxes). You just can’t go to management and tell the product is going to be six month late and a hundred thousand over budget just to reach an additional 2% user target.

          1. 12BitSlab says:

            Antonio, you are absolutely correct. Smaller firms do not have the resources to accommodate everyone and it is patently unfair to ask every developer to fit my needs. That is why I liked it when Microsoft added stuff to the early .Net framework to make it easier for all developers to accommodate special needs.

        2. guest says:

          “Configurable keyboard shortcuts” is not the only way to solve the accessibility issue though. There are other ways to make the program accessible to people with difficulty typing, and at the same time do not create customer support issues. Windows for example already has “sticky keys” that let you type keyboard shortcuts with one finger. General system utilities for mapping keys (e.g. Fn keys) to custom shortcuts would also work.

          Requiring all developers to re-implement a complex feature is the worst way to solve the problem.

          1. Antonio Rodríguez says:

            In this case, there is an even easier way. Just remember that keyboard shortcuts are a convenience for advanced users, and everything should be doable through commands placed in menus and toolbars. True, this would create a problem with disabled people who can’t handle mice, but at least that has already been solved in Windows with Mouse Keys and in hardware with mouth-operated pointing devices.

      5. Dave Bacher says:

        The -100 depends entirely on what you’re writing.

        Microsoft Office has to support a lot of locales — and the shortcut keys may need to vary. When someone is computing the optimal solution, having to go through a change request, compile, and deploy each time might slow things down a bit. When new features are added, they might collide with keys people’s plug-ins have grabbed, and two plug-ins might want the same hot key.

        And so you need some way to deal with all that — if I can give the people working usability, localization and accessibility the ability to change the hot keys themselves, and save / restore that to some standardized format — then I can avoid having to do any code changes while they’re tweaking the UI.

        In addition, third party devices might have additional input features or keys — and having a direct, in-app facility to configure might make a lot of sense.

        On games, the easy way to see why using an input mapper and letting the user define inputs is to just look at the game controller category in Amazon for a while, and look at all the different controllers there. A layout on one controller isn’t necessarily what another wants. And that’s ignoring the 20+ button mice, etc.

        I’d say generally if you’re using a table driven approach, having the ability to easily tweak the table is never a bad thing.

        1. Simon says:

          You don’t want keyboard shortcuts to change with the locale… that just makes support a nightmare. Many of them are only loosely connected to their English meanings anyway, and when you’re forced to use a system in in a different locale (or trying to help a user in a different locale), changing the keyboard shortcuts just makes things that little bit harder – often those shortcuts may be the only way you can identify the items in a menu…

        2. Antonio Rodríguez says:

          Shortcuts should not be localized. It’s not inly a support nightmare, it’s an *ussability* nightmare. Here you have some examples:

          In Spanish, the shortcut for Select All uses to be Ctrl+E (from Seleccionar todo)… except for the applications that keep the English one (Ctrl+A). In Firefox and Chrome, for example, Ctrl+E shows the default search engine in the current tab… imagine the joy if you press Ctrl+E to copy the three paragraph comment you just wrote and you lose it. In Internet Explorer, Ctrl+A selects all text, while Ctrl+E does nothing. And in both Notepad, WordPad and Microsoft Word, Ctrl+E selects all text, and Ctrl+A (from Abrir) opens the Open File dialog. So much for coherence.

          Also, the Spanish shortcut from Save is Ctrl+G (from Guardar), where Ctrl+S is used for Underline (from Subrayar). Except for the non-localized apps, which use Ctrl+S for Save and can use Ctrl+G for something else. If I had a cent for every word I have underlined in Word and Excel…

          I use keyboard more than mouse, but because of this nightmare, I end using accelerators only in the three or four applications I use most. For the rest, I execute the commands via the old and boring menu bar, pressing Alt.

  2. There really has not been a break key (I am not talking about what is written on the keycap) since the virtual disappearance of RS-232 (or Current Loop (20mA, 60mA) dumb keyboards connected to “Distant” computers. “Break” was a specific electrical condition.

    1. smf says:

      telnet “SYNCH” is sort of equivalent to RS232 break. I’ve seen RS232 terminals where the break key was configurable between sending a line break and sending a character (like Ctrl-C). So it’s quite difficult to say what is a real break key.

  3. DWalker says:

    I disagree with “Also, it can turn into a support nightmare when you tell the user to press the default shortcut and it doesn’t work (or even worse, it does something completely different) because his/her administrator decided it would be a good idea to change it.”

    Due to the physical layout of my keyboard, and the way I hold my left hand, I often press the left CTRL key unintentionally. I am trying to break myself of that habit.

    However, I have discovered that lots of different programs have lots of shortcut keys defined. And when I’m in Excel, if I hold the CTRL key down a microsecond too long while I’m copying and pasting, I find myself at the very bottom of the spreadsheet (line 1 million). I would like to turn off whatever combo (I think it’s CTRL-End) goes to the end of a workbook.

    I never want to do that. And there are lots of things I never want to do but an accidental CTRL-something will do that for me. I wish programs WOULD let me turn off keyboard shortcuts except for the ones I use.

    I generally would like to turn them all off.

    1. Joshua says:

      And I happen to use Control-End all the time.

      1. DWalker says:

        Which is why these things should be customizable — different users have different preferences. Yes, customization adds complexity, but I should be able to turn OFF keyboard shortcuts. In Excel. And I can’t.

    2. Max says:

      Input difficulties like that are best handled at the OS level, not the application level – and indeed, they already are. Windows already has plenty of functionality for detecting and filtering keypresses that might be unintended: check out the keyboard settings, as well as Filter Keys in the accessibility options.

      1. DWalker says:

        The settings in Windows Control Panel do not allow me to turn OFF keyboard shortcuts that programs (like Excel) have defined.

    3. Jistuce says:

      I’d use the butter-knife function in your case. Take a butter knife and pop the key cap off left-ctrl. Problem solved.

  4. wawb says:

    Adding to the debate, I think the likes of Emacs has got things right. Each command has a name, and is executable by its name: M-x command-name. Users get to assign any variety of hotkeys to a command. Finding a command name is simple enough (M-x apropos) or the hotkey assigned to a command (M-x describe-function). From a support view, hot keys could be ignored in place of the name of a command. Of course, coming from an Emacs background makes me extremely biased in the discussion. I don’t remember when Microsoft started allowing complete freedom in remapping hotkeys, menus, toolbars and commands but I still appreciate it every time I type C-x f in my Visual Studio.

  5. Ah, the joys of software development.

    Where it’s never “this then that”, it’s always “this” and then “well, have you thought about case Q, X, R, T, U, V, X, Y, and Z?”.

    I’m still blown away by the patch that Microsoft got out in 7 hours. I am not even sure how that’s possible given the system complexity.

    Love your blog by the way, Raymond. Keep ’em coming.

  6. Brian_EE says:

    Obvious answer to the customer’s problem: Dialog Box “Does your keyboard have a key? [Yes] [No] [Cancel]”

    1. Brian_EE says:

      Argh… “… have a BREAK key….”

      Apparently you can’t use < > characters in comments.

      1. Erik F says:

        If you don’t have a Break key, just use the Any key. That’s always a popular choice (or at least it was in DOS days!) :-)

  7. RP says:

    It truly is appalling that some keyboards lack a break key, but I guess it must be admitted that many users won’t need it. Still, such laptops should be boycotted where possible.

  8. BZ says:

    I’ve been using computers for 23 years as a user and 17 years as a programmer and I don’t recall ever needing the break key since I discovered that Ctrl+C does the same thing very early on. For that matter, back when “pause” did something useful, I only used it to confirm that it did what I think it did. Scroll Lock has been useful to read boot-time messages before they zoomed by very early on. And SysRq? I never had any idea what that was even supposed to do. Honestly, I see no reason to keep those keys. Only Print Screen has withstood the test of time, and I still use it regularly (but less so since I’ve discovered the snipping tool). So I thing using them as hot keys is a really bad idea. In general, using non-universally available keys is a bad idea.

    1. skSdnW says:

      Ctrl+Break is “more break” than Ctrl+C, they are not the same. Ctrl+C is also sometimes fully disabled in the console (Start /B …). WinDbg also uses it…

      1. BZ says:

        Yeah, forgot about that. Also used in IDEs to break execution. Haven’t done such very often lately since breaking at a random time tends not to be very useful in multithreaded code.

        1. Ivan K says:

          I use break with ctrl shift or alt (can never remember which so just do both) to cancel an unintended build sometimes – usually on VS 2010 which is a lot slower than 2016. Good old F5 that means refresh in a lot of contexts and build/run in the ide… I’m happy with that but amd won’t remap the keys.

          1. Ivan K says:

            * 2015 i mean haha.

    2. 12BitSlab says:

      SysReq is used extensively in terminals for mainframe (3270) and AS/400 (5250). Most TN5250 and TN3270 programs provide extensive key mapping for things such as SysReq, F13-F24, etc.

    3. JanH says:

      Some games have repurposed it to function as a literal “pause” key.

    4. Dave says:

      I use the Pause/Break key all the time with the key combination WinKey-Break, which opens the System control panel window. Thankfully I have yet to encounter a keyboard without that key, even on tablets and laptops, but googling I do see that there are some without it.

  9. Azarien says:

    Who cares about Break. The real problem is lack of Insert on many keyboards!

  10. Richard says:

    Does Microsoft have a list anywhere of which keys are commonly missing from keyboards?
    Or the relative frequency of the keys.

    Those of us creating CAD and similar applications need to create physical keyboard shortcuts for most actions, and it’d be great to know which buttons to avoid putting the more useful/common actions on, or that need a chorded version as well.

    We ran out of actual keys on the 101/102 key layout a while ago…

  11. AsmGuru62 says:

    I think ALL application commands should be contained within the application menu.
    So, if client is on support call – the menu item is easy to refer to, instead of calling out (possibly re-mapped) shortcut key.

Comments are closed.

Skip to main content