frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Why do Macs ask you to press random keys when connecting a new keyboard?

https://unsung.aresluna.org/why-do-macs-ask-you-to-press-random-keys-when-connecting-a-new-keyboard/
17•zdw•2h ago

Comments

alsetmusic•1h ago
Mapping to ensure that it has the correct layout applied.
Our_Benefactors•1h ago
Yes, but this doesn’t answer why I only have to do this on Mac and not windows/linux, where I have literally never run into an issue as a result of not doing it.
QuercusMax•1h ago
I assume for some nonzero percentage of folks it doesn't work right and they have to manually go and set their keyboard layout.

Of course, when you're setting up your OS initially, it will ask you questions about language and keyboard layout. I suspect most people don't switch keyboards after install, and of those who do, the most common case is another keyboard with a compatible layout.

HPsquared•1h ago
I assume you have a standard US keyboard.
jasonjayr•1h ago
Most non-Apple branded keyboards are NOT tested with mac; so it doesn't trust any electronic tags/labels, nor does it keep a database. Easiest thing to make it work 100% without asking the user to identify their layout, is to press random keys so the mac knows where things are mapped.
masfuerte•1h ago
Windows and Linux both ask for your language and locale during setup and default to the typical matching keyboard. I'm nearly sure Debian also asks you to confirm the keyboard it picked, but it's always the right one so I just hit enter.
thebruce87m•1h ago
Do you live in a country where the default always maps correctly? My UK keyboards will always have specific keys wrong.
dlcarrier•1h ago
If you're using a US English keyboard layout, it's the default and you won't have to deal with changing it.

The most likely reason it would be a problem then would be that some Raspberry Pi images have defaulted to British English keyboard layouts. Otherwise you may be sailing through life unburdened by what can be a major pain to anyone anywhere else in the world, like a resident of Arizona wondering why the rest of the world keeps messing with their clocks.

altairprime•1h ago
See also the layout identifier manual-elsif/elsif/elsif workflow here, last updated November 2023:

https://support.apple.com/en-us/102743

throwaway27448•1h ago
Random ≠ arbitrary
chimeracoder•1h ago
> Random ≠ arbitrary

Sure, though if you're looking to be pedantic, the keys they're asking you to press are neither random nor arbitrary

throwaway27448•1h ago
How are they not arbitrary? Apple tells you a specific key to press, which is a choice. It is by definition arbitrary.

Edit: perhaps you're making the case that the user doesn't choose which key. This is true—but the important point is that one of the two parties did choose the specific key to press.

emeraldd•1h ago
Honestly, the mac approach makes much more sense from an ease of use perspective for non-experts. On other platforms, you have to know the layout to choose and hope things work until you do or have a second keyboard that's close enough tl the default to get by. On Mac, it just figures it out based on the information you tell it when the keyboard is connected. Much less error prone in the majority of cases.
srean•1h ago
Ah! Thanks for the stimulation. That's an interesting problem that I had not thought of before. In fact a few related problems.

What's the minimum set of requested key presses that will uniquely identify a keyboard layout from a set of known types.

Given a budget of k key strokes what's the most informative subset that will reduce the ambiguity about layout.

Given the measurement from the requested key strokes find the posterior over the set of known keyboard layouts.

Given that the user is typing some free form text in his language how soon can one nail the layout when the user's language, the layout and the text are unknown. Will make a good practice exercise for hobbyist codebreaking.

dirasieb•1h ago
they don't ask you to press random keys
ginko•1h ago
I guess the moment has passed by now but I wish there were a USB HID protocol for keyboards to identify their layout, or even better yet make the keyboard protocol layout agnostic so that keyboards send the high-level unicode character / modifier instead of a physical key code.
weinzierl•1h ago
I think every OS should ask you to press a freshly generated sequence of keys when connecting a keyboard to prevent BadUSB attacks. Does any system do this?
avidiax•1h ago
That would break credit card readers, barcode scanners, and special purpose keyboards (like video workstations).

I suppose you could rely on a binary code, where the user is instructed to press any two keys to repeat the code, or if there is only one key (or it's a barcode scanner), to enter the same input multiple times, separated by long and short pauses.

Still seems like it would be difficult for the average user.

vinni2•1h ago
Why does it sometimes ask when connecting a HDMI projector?
tomasphan•53m ago
Apple has to make it annoying to use a non-Apple device with your Apple device. That sort of friction probably nets them 2% in keyboard sales per year.
daft_pink•16m ago
Thanks I’m always worried. I do the wrong thing when that thing pops up for my mouse.

Battle for Wesnoth: open-source, turn-based strategy game

https://www.wesnoth.org
86•akyuu•1h ago•13 comments

Launch HN: Freestyle: Sandboxes for AI Coding Agents

https://www.freestyle.sh
86•benswerd•2h ago•46 comments

Germany Doxes "UNKN," Head of RU Ransomware Gangs REvil, GandCrab

https://krebsonsecurity.com/2026/04/germany-doxes-unkn-head-of-ru-ransomware-gangs-revil-gandcrab/
190•Bender•4h ago•81 comments

A cryptography engineer's perspective on quantum computing timelines

https://words.filippo.io/crqc-timeline/
120•thadt•3h ago•42 comments

Sc-im: Spreadsheets in your terminal

https://github.com/andmarti1424/sc-im
73•m-hodges•2h ago•20 comments

Book review: There is no antimemetics division

https://www.stephendiehl.com/posts/no_antimimetics/
127•ibobev•5h ago•84 comments

Sky – an Elm-inspired language that compiles to Go

https://github.com/anzellai/sky
60•whalesalad•3h ago•5 comments

Show HN: GovAuctions lets you browse government auctions at once

https://www.govauctions.app/
40•player_piano•2h ago•18 comments

The Cult of Vibe Coding Is Insane

https://bramcohen.com/p/the-cult-of-vibe-coding-is-insane
10•drob518•18m ago•0 comments

Claude Code is unusable for complex engineering tasks with the Feb updates

https://github.com/anthropics/claude-code/issues/42796
394•StanAngeloff•4h ago•287 comments

Reducto releases Deep Extract

https://reducto.ai/blog/reducto-deep-extract-agent
25•raunakchowdhuri•2h ago•3 comments

What being ripped off taught me

https://belief.horse/notes/what-being-ripped-off-taught-me/
225•doctorhandshake•5h ago•136 comments

Eighteen Years of Greytrapping – Is the Weirdness Finally Paying Off?

https://nxdomain.no/~peter/eighteen_years_of_greytrapping.html
7•jruohonen•2d ago•0 comments

Adobe modifies hosts file to detect whether Creative Cloud is installed

https://www.osnews.com/story/144737/adobe-secretly-modifies-your-hosts-file-for-the-stupidest-rea...
70•rglullis•1h ago•35 comments

Show HN: I built a tiny LLM to demystify how language models work

https://github.com/arman-bd/guppylm
786•armanified•18h ago•120 comments

The Last Quiet Thing

https://www.terrygodier.com/the-last-quiet-thing
49•coinfused•2d ago•27 comments

I won't download your app. The web version is a-ok

https://www.0xsid.com/blog/wont-download-your-app
660•ssiddharth•4h ago•363 comments

PostHog (YC W20) Is Hiring

1•james_impliu•5h ago

Microsoft hasn't had a coherent GUI strategy since Petzold

https://www.jsnover.com/blog/2026/03/13/microsoft-hasnt-had-a-coherent-gui-strategy-since-petzold/
728•naves•1d ago•508 comments

Gemma 4 on iPhone

https://apps.apple.com/nl/app/google-ai-edge-gallery/id6749645337
803•janandonly•1d ago•223 comments

An open-source 240-antenna array to bounce signals off the Moon

https://moonrf.com/
229•hillcrestenigma•15h ago•47 comments

81yo Dodgers fan can no longer get tickets because he doesn't have a smartphone

https://twitter.com/Suzierizzo1/status/2040864617467924865
233•josephcsible•2h ago•218 comments

France pulls last gold held in US for $15B gain

https://www.mining.com/france-pulls-last-gold-held-in-us-for-15b-gain/
495•teleforce•10h ago•269 comments

The 1987 game “The Last Ninja” was 40 kilobytes

https://twitter.com/exQUIZitely/status/2040777977521398151
244•keepamovin•15h ago•161 comments

LÖVE: 2D Game Framework for Lua

https://github.com/love2d/love
389•cl3misch•2d ago•200 comments

Signals, the push-pull based algorithm

https://willybrauner.com/journal/signal-the-push-pull-based-algorithm
137•mpweiher•2d ago•34 comments

One ant for $220: The new frontier of wildlife trafficking

https://www.bbc.com/news/articles/cg4g44zv37qo
95•gmays•4d ago•26 comments

Show HN: Real-time AI (audio/video in, voice out) on an M3 Pro with Gemma E2B

https://github.com/fikrikarim/parlor
227•karimf•1d ago•26 comments

Drop, formerly Massdrop, ends most collaborations and rebrands under Corsair

https://drop.com/
113•stevebmark•14h ago•59 comments

Running Gemma 4 locally with LM Studio's new headless CLI and Claude Code

https://ai.georgeliu.com/p/running-google-gemma-4-locally-with
377•vbtechguy•1d ago•93 comments