The palette

A small window that types the next value of a pack into the field you are in, and never takes the keyboard to do it.

What is the palette?

The palette is nkb-gui, a window that stays beside the application you are testing and is driven by shortcuts. You click into a field of the application, press AltShiftN , and the next value of the pack arrives in that field. The palette does not take the keyboard focus, so the cursor never leaves the field you are testing, and you can press the same chord a hundred times in a row.

What does it show?

  • The pack at the top, with how far through it you are. Clicking its name opens the window for finding a value.
  • The next value, the one the next press types, drawn so you can see it. A character nobody can see is drawn as a marker, a box open at the top, instead of as nothing. When the value is one half of a pair, pair 1 of 2 or pair 2 of 2 stands beside its name. Under it are two lines of what the value breaks, so you know what to look for before you type it, and the values that AltShiftP and AltShiftR would type.
  • The last value it typed, folded until you open it, with four counts: graphemes, code points, bytes and UTF-16 units. The four differ exactly for the values most likely to break a field.
  • How each value goes in: typed from the keyboard, or put on the clipboard for you to paste, and whether the line is cleared first or the value goes in at the cursor.
  • The keys of every shortcut that works, along the bottom, under a heading that folds them away.

A name or a sentence too long for its place ends in .... Rest the pointer on it and the whole text appears beside it. The windows the palette opens, such as the value window and the shortcuts window, open beside it, on the side of the screen that has room for them.

Can I type the same value into many fields?

Yes. Type it once with AltShiftN , then click into each of the other fields and press AltShiftR . It types the same value again and the counter stays where it is, so the next AltShiftN types the value that comes after it. The line under the next value says which value AltShiftR types. Before the first value of a pack there is nothing to repeat, and the palette says so.

How does a value reach the field?

By default the palette clears the current line of the field with Home, Shift+End and Delete, then types the value the way a keyboard does, one character after another, at the pace the application takes them. A long value shows its progress while it types, and Escape stops it, after which the palette says how much of it arrived.

It refuses rather than guesses. It types nothing while Ctrl, Alt, Shift or Win is held down, because the value would turn into shortcuts. It types nothing into a button, a link or a list item that has the focus. It clears nothing it cannot confirm is a text field, and it never clears a terminal, where those keys go to whatever program runs in it.

A window running with higher privileges than the palette, such as a program started as administrator, would drop the keystrokes without a word. For such a window the palette puts the value on the clipboard instead, says why, and leaves pasting to you. Clipboard mode says more.

A code editor can surprise you. Monaco, the editor inside VS Code and many web pages, wraps a selection in the bracket or quote you type instead of replacing it, so a value that starts with one comes out around the old text. The palette never reads the field, so it cannot see a selection. Do not type a value over a selection in a code editor: put the caret in a one-line body and let the palette clear the line, or delete the old text first.

How do I find a value?

Press AltShiftSpace . The window that opens shows every pack as a list you can open, and searches the values of all of them at once as you type. Choosing a value makes its pack the one in use and that value the next one, so the next press types it. The values you chose there most recently, from any pack, are at the top. A value that is one half of a pair says which beside its name, and typing the name of a pair finds both of its values.

Can it offer packs of my own or of my team?

Yes. A pack file in your own folder, packs beside the settings file, is offered beside the built-in packs, and so is a pack in a team folder, a folder your team keeps, for example in the repository of the application you test. Set the team folder in the Pack folders window, which Pack folders in the header of the value window opens. Choose folder picks the folder in your system’s folder window, or drop a folder on the window. Stop using forgets it, Open shows a folder in your file manager, and Create and open makes your own folder the first time. The window keeps the team folder as one line in settings.toml, which you can also write by hand:

[packs]
team-folder = 'C:\work\shop\qa-packs'

A pack in your own folder is used instead of a team pack of the same name, and a team pack instead of a built-in one. The window says where each pack comes from and what it is used instead of, and so does the palette when it opens such a pack. A pack that has errors is not loaded, and the pack it would replace is not loaded in its place either. The folders are read again each time the window opens, so a pack file you fixed shows without a restart. Write your own pack shows how to write one.

Can it make values for a length limit?

Yes. Length limit stands at the top of the value window, under Generators. It opens a window where you type the limit your field states: At most, At least or both, counted in graphemes, code points, UTF-16 units or bytes. The values are listed as you type: the empty value, and one under, exactly at and one over each bound, in letters, in characters of two, three and four bytes, in a family emoji and as a counterstring. Each row says how long the value is and whether that length is inside the limit. Use these values hands them to the palette, and the shortcuts walk them the way they walk a pack.

Typing a number in the search of the value window puts the row at the top with that number as the most, so 50 and Enter is the short way in. The whole window works from the keyboard: Tab moves between the two numbers, the left and right arrows change the unit, and up and down choose the value to start from.

In the palette each of these values wears inside the limit or outside the limit, and its report block names the command that makes the same values, for example nkb boundary --max-length 50 --unit bytes. The values are the ones nkb boundary prints, and that page says why there are six kinds. The palette does not keep them: after a restart it opens the pack you used last.

Can I make it smaller?

AltShiftH collapses the palette to its header and expands it again. Once you know the shortcuts, click Shortcuts at the bottom to fold their list under its heading, and click it again to open it. The shortcuts keep working while their list is folded. The palette never hides and never moves on its own. It is as tall as what it shows, and on a screen too small for that it ends at the bottom of the screen, above the taskbar or the Dock: the next value and the line at the bottom stay in view, and the last value sent, the two switches and the list of shortcuts scroll with the mouse wheel.

What does it remember?

The pack you chose, whether it is collapsed, whether the list of shortcuts is folded, where it stood on each arrangement of screens, and your shortcuts, in settings.toml. On Windows the file is %APPDATA%\Naughty Keyboard\settings.toml, on macOS ~/Library/Application Support/Naughty Keyboard/settings.toml, and on Linux ~/.config/naughty-keyboard/settings.toml. A file it cannot use is left as it is and never overwritten.