Hacker News new | past | comments | ask | show | jobs | submit login
Keyboard tricks from a macOS app dev (alinpanaitiu.com)
210 points by imaq on April 23, 2023 | hide | past | favorite | 149 comments



I was hoping this was about lesser known macOS keyboard shortcuts. Alas.

Apple has a pretty exhaustive list of so-called document shortcuts that I find particularly useful: https://support.apple.com/en-us/HT201236#text

Ctrl+A and Ctrl+E in particular to jump to the beginning and end of a line are a pair that I use dozens of times per day.

Same with Opt+Delete to delete the previous word.

I use Opt+Left Arrow and Opt+Right Arrow to move the cursor back and forward by whole words so often that I didn't even think about including it in here until I unconsciously used it while editing text.

Also:

Cmd+Space brings up Spotlight and is a great way to launch apps and open documents.

I've used SizeUp for well over a decade to rearrange my Mac's open windows. It's literally the first app I install when I get a new computer. https://www.irradiatedsoftware.com/sizeup/


I find it fascinating that your examples are actually the readline/emacs shortcuts, or the workarounds that had to be implemented for the lack of PC keys (Home/End/PgUp/PgDown)

The more I got familiar with MacOS, the more I realized all those feature pictures ople praise MacOS for are just workarounds / copies from other systems, and (even power-) users just aren't familiar with other systems hence their amaze.

The inconsistencies that come with intermixing ctrl-option-command are just mind blowing. Even Windows got this right by making the Windows key control window manager specific actions.


It all depends on where one got their start in computing. I started on a Mac in 1996, and though the keyboard that it came with had home/end/etc I never learned to use them because I didn’t do much that was keyboard intensive, with most of my computer usage being drawing/graphics, games, or web browsing.

By the time I’d started working as a dev fulltime where those keys might’ve been useful, laptops had taken over and my work machine was a MacBook Air which wasn’t large enough to fit those keys even if they’d wanted to, and so I learned the built in macOS text nav shortcuts. They were never a workaround for me because I’d never used the home/end/etc cluster in the first place.

Even today when using Windows or Linux it’s with a 60/65% keyboard without those keys because that’s what’s comfortable. Reaching over to hit home/end on a larger keyboard would feel odd with how far removed it is from the rest of the board.


I always hated the home/end keys. The way Mac does it is way better and I didn’t really start using Macs until two decades after I used windows and Linux. Cmd+left/right is way easier to use, especially on a laptop and custom keyboard.


> or the workarounds that had to be implemented for the lack of PC keys (Home/End/PgUp/PgDown)

Those keys are not lacking, but on laptop keyboards they are hidden behind the fn+arrow keys. But they also are not workarounds or replacements for those keys. On macOS Home and End scroll the document to the beginning or end, not the cursor to the beginning or end of the line. That can be done with cmd-arrow.


Lots of those shortcuts are basically Emacs shortcuts. I’m always sad using gdocs on Linux that they don’t support the Emacs shortcuts.


Side note that these Emacs shortcuts also work on iOS pretty much everywhere (you even get it for free in completely custom text renderers, so long as you adopt the UITextInput protocol)


How are you using the modifier keys in iOS?


Just connect a Bluetooth keyboard.

Sometimes I use an iPad plus Bluetooth keyboard for writing.

What's annoying is that keyboard shortcuts mostly work in apps, but are sometimes buggy, because I think they're so rarely tested.


Not just Emacs, but anything that uses readline or similar libraries. Most shells for example.

https://en.wikipedia.org/wiki/GNU_Readline

https://github.com/chzyer/readline/blob/master/doc/shortcut....


I mean, readline shortcuts are also based on Emacs ones.


Always assumed it was the other way around without any particular evidence.


Yep. Yank and Kill work too, among others


I love these built in shortcuts. I’ve added Karabiner to remap caps lock to esc and ctrl (not for Vim) and also right cmd-hjkl for instant arrow key access.

Spotlight usually works for most of my needs as well.

It’s frustrating when an app overwrites built in shortcuts like in Intellij on Mac, searching for shortcuts in the menu bar search doesn’t allow opt-delete if I remember correctly.

Speaking of menu bar search… one of my favorite commands is opt-shift-/ to search available commands in the menu bar of an app.


IntelliJ text expansion hotkeys (option + up/down) or spell checker (option enter) should be part of every operating system.


It's much better to rebind all of those to more ergonomic alternatives that match your other apps using the tools listed (eg, to similar cursor keys you use in a text editor), which is also useful for non Macs you use (where you could do the same rebunds), rather then learning yet another set of bad old combos


The defaults can be changed (DefaultKeyBindings.dict). However, those keybindings are not just “yet another set of bad old combos”; the same keybindings are used by default in Emacs on any platform, and by most POSIX shells and interpreters (Bash, Zsh, Fish, IPython, etc.). On Mac, they’re inherited by most other GUI text editors (e.g. Sublime).


These are exactly another set of bad old combos, and the fact that their use is widespread is just another example of how bad very common things are:

  -  it doesn't make sense to have a/e as beginning/end, there is a symmetry in the commands, but there is no symmetry in the a/e keybindings, they are on different rows

  - likewise, it doesn't make sense to use the less convenient ⌃ for such a frequent command (and this is also the rightful criticism of all the bad Emacs pinky defaults)
For example, you could use right ⌘ (a thumb key) as your text movement key (or even Space), then you have home keys

  - JKL; for cursor movements and

  - DF for your word movements (instead of having to move your whole hand to ⌥◀/▶)

  - A/⇧A for line start/end movements or maybe A/G if it's frequent enough to not warrant using ⇧
And then that would match your text editor keybinds, so you don't have to waste time remembering platform-specific keys.

And re. those other apps - it's better to rebind them all (or, rather, use a tool to have the keybinds work in all of them) as well to use something good rather that stick with the bad just because someone lacked good design chops in the past


Yeah. Those are the key combos for editing text, especially on a Mac. If an app does not support them, it's going to be some weird cross platform monstrosity and you're better off if you find a competitor.


Thats because they come from GNU Readline


I agree, Readline is the reason they got so widespread. But note that except Bash, none of the shells and interpreters I listed actually use GNU Readline these days — and that Emacs and its keybindings predates Readline.


sizeup is excellent. add swish and it's even better.


I recently purchased a MacBook, and while I'm thoroughly impressed with the hardware, I find the keyboard navigation in the desktop environment somewhat lacking in comparison to my previous experience.

Having used Linux Pop OS for many years, I've grown accustomed to the intuitive and powerful tiling window manager and keyboard navigation shortcuts it offers. I'm struggling to find a comparable solution on the macOS platform.


It's a sore-spot for sure. I've found that Rectangle[0] does a good enough job.

[0] https://rectangleapp.com/


Rectangle is so good - it's the first thing I recommend anyone new to MacOS download. I don't know why apple hasn't implemented this natively.


Magnet is also pretty good


Hammerspoon is by far the best option for devs, it’s more powerful than pretty much every solution out there, including better touch tool, and the only additional software I need is karabiner elements and alttab. Those three pieces of software will solve every single problem you have with Mac.


Does Rectangle has a shortcut to switch the focused window in a split screen?



Hammerspoon can do it for I have it in my config. I also have it so I can switch to open windows on the same Space (I can throw windows into a tiled view and jump around to them). It's extremely flexible if you are willing to play around with it.


I’ve kind of solved this. You can snap windows but you need to add a shortcut in systems to do it. It’s not perfect, but it does work and overtime you miss it less and less


I’m a very happy user of Rectangle, as well.


As a more general suggestion, macOS likely isn’t good at imitating what you previously had, try to understand the workflow they’re proposing, adapt and learn it, it generally gets second nature and pretty decent soon enough, getting to work the way you envision is not apple’s strong suit.


Classic blame the user kind of argument, what is the alternative workflow to "snap windows with a hotkey" then?


The point is that when switching OSs you are going to run into lots of places where the new OS does things differently that what you are used to. Your choice is to fight the new OS and try to keep doing things the way you are used to or embrace the new OS and learn some new workflows.

That doesn’t mean adopting everything or abandoning everything, just try to be flexible and try some different things out. Just because it is different doesn’t mean it is broken.

For window management there are dozens (at least) third party tools that add features like snap window. Try some out to see what you like. Rectangle, Magnet, Moom, BetterSnapTool come to mind but here are others.


so "3rd apps exist" that's your argument? I thought it was "alternative workflow"?


My point was a suggestion to entertain the idea of adopting alternate workflows native to the new OS when you switch. When that doesn’t work there are often 3rd party tools to address the difference.


The better general suggestion is to find good tools to make your OS life more comfortable rather than admitting defeat right away and imitating the bad old stuck ways of the OS

(it's not Apple's strong suit, but there is an app for tha™)


Sometimes that works. Sometimes you're just stuck.

For example, AFAIK, there's no way to eliminate the animation that's triggered when switching spaces/virtual desktops.


this is not an example of a "workflow they’re proposing"

(also, afaik https://github.com/koekeishiya/yabai allows you to eliminate the animation completely)


Do you know some good ressources to learn how to use macOS the productive way, using mostly keyboard shortcuts instead of the trackpad?


Apple maintains a list of macOS keyboard shortcuts that might be useful: https://support.apple.com/en-us/HT201236


You can use hammerspoon to solve almost every issue you have.


I don’t really tile windows much. The main case where I do is with a bunch of terminal windows. Most of what I get out of a tiling window manager is full screen by default and easy keys to switch workspaces.

On macOS the thing that drives me insane is that the many-finger swipe to switch desktops won’t focus the target window until the animation is totally done (like 0.7s after starting). I wish it works like cmd+tab which changes focus instantly. Apart from that I guess I’m not that bothered because I mostly just full screen things. Emacs and iterm2 can do their own tiling of windows.


I am not sure whether it applies to this case, but you might try turning on ‘Reduce motion’ under the Accessibility settings, which eliminates some animation delays.


Reduce motion changes the animation to fade-in fade-out but updating focus is still delayed


Just a heads up — you can solve that one annoyance; there are terminal commands that will reduce that animation to instantaneous.


I tried changing various defaults but lots of them seemed to no longer work. Maybe I only tried the options to increase the speed or I didn’t restart enough things or I spelled something wrong. I also tried looking at the binaries for relevant-looking names of defaults to change and didn’t find any (including the options that old internet advice recommended changing)


The keyboard shortcuts to do this animate much quicker than the swipe does. In the past I've set up BetterTouchTool to press the corresponding key on left and right swipes.

The only disadvantage is that there is no way to "peek" the previous desktop like you can with the built in swipes.


I suspect the constant emphasis on mouse use, ever since the first Macintosh, has created an attitude of "keyboard doesn't matter"; I've noticed that even early Windows is very usable with only a keyboard (the Alt, underlined letters, and arrow keys method is particularly well-designed), whereas e.g. classic MacOS is basically unusable without a mouse.

In later versions they added keyboard access, but it still feels like it was done as a bare-minimum concession and not originally planned.


I had the opposite experience with MacOS. I hold every OS I've used since the early aughts up against MacOS 9 and they are all lacking in terms of keyboard navigation. Maybe it was because I had the previous 10 years to practice, but I felt I could do almost anything in pre-OSX MacOS with the keyboard, only relying on the mouse for application-specific stuff like photo editing. Navigating, filtering, opening files and folders were all incredibly easy.

In KDE it's pretty much a joke every time I have to save-as. Can't even get through that filesystem menu without a mouse unless it supports <ctrl>-l. Dolphin is slightly better, especially if you enable the console pane to make it easier to switch to the command line, but it's still way behind Apple's finder from 1999.


but I felt I could do almost anything in pre-OSX MacOS with the keyboard

How do you open the menus and browse through them to find and select the option you want?


IIRC for the most part option-f would bring me to the file menu. I could down-arrow to scroll through it or hit the right arrow to move to the next menu. In that way I could navigate pretty well.


> has created an attitude of "keyboard doesn't matter";

I think you would be surprised at just how powerful the keyboard subsystem in osx is and how malleable it is with some programs or even just editing the plist shortcuts. every menu item in any application can be given a per app or universal shortcut in `system preferences | keyboard | shortcuts | app shortcuts`

You can also use a thing like hammerspoon to do whatever you can imagine basically too... i have a few things for window manipulations via hammerspoon.

You can set up very complex keyboard re-mappings/shortcuts using something like karabiner elements.

you can also change the keyboard access to be navigable via tab in keyboard settings too.

and you can access the menu via ctrl-f2 by default. those settings are changeable too via the keyboard preference pane.

i think you'd be surprised at how much apple cares about accessibility so keyboard nav is not just a power user thing.

At the end of the day I think apple put a lot of thought into the UI and i'd feel pretty stymied going back to windows.(though now the power utilities finally let you remap the windows key to something more useful like ctrl.


Except you can't bind every menu item: some menu names are dynamic, so you can't bind to them, and not all the keys are supported, and there is no left/right modifier differentiation. Also, you have to retype the full command path by hand, which is insane, so you can't do that either (you should be able to just hover over a command and press keybind to rebind)

Even with the awesomeness of Karabiner Elements there are some unfortunate limitations

But yeah, I'd be surprised if it were a powerful system, that's so rare in the keyboard land...


Can’t you handle a lot of that with Automator? Honestly it’s funny to see so many people saying Mac is terrible at this when I can’t imagine a worse OS for shortcuts than windows and Linux you have to script everything. Mac managed to make it user friendly and scriptable at the same time.


A lot of what? What's your Automator handler that I can select a dynamic menu item and change those two keybinds with my arbitrary key combo?

Also, how is it user friendly to require users to retype the full menu taxonomy???


>What's your Automator handler that I can select a dynamic menu item and change those two keybinds with my arbitrary key combo?

no clue, I don't use automator, but from what I understand of applescript and automator this should be completely possible. For what it's worth I use Hammerspoon like the other commentor and it's by far the best system I've seen for any OS. Also the more people that use it the better it gets so I highly recommend it.

>Also, how is it user friendly to require users to retype the full menu taxonomy???

I mean... you're able to change any arbitrary menu item in any program that exists. That's extremely powerful. I don't really know how you would make it make it any more user friendly.


I've already tried Hammerspoon a while ago

> any arbitrary menu item in any program that exists

That's false

> I don't really know how you would make it make it any more user friendly.

Just read my comment, it tells you exactly how to make it user friendly. And it's easy to come up with a few more ideas


> That's false

In what way?

> Just read my comment, it tells you exactly how to make it user friendly.

I’ve reread all of your comments in this thread and find no such thing.


use hammerspoon[0] if you are so dead set on making this edgecase work. on the whole the system is quite flexible.

there's also applescript that can do a lot of other things too. I dislike the language but it's fairly powerful too.

[0] http://www.hammerspoon.org/docs/hs.application.html#getMenuI...


I'm not dead set, that's why I wouldn't waste time on writing a "this can take a little while to complete, because quite a large number of round trips are required to the source application, to get the information" in another bad language when it's much simpler to use Karabiner to send the offending keybind

By the way, what would I do with this menu info, is there another function to permanently rebind a given menu item?

I was just pointing a few fundamental flaws in this "surprisingly powerful" system


you can write a hammerspoon script that will intercept some hotkey you want to use for that menu item and select it yes.


I don't get it, this is much worse vs a direct rebind, which is instant

Also, this brings confusion between the key shown in the menu and the key that is used to activate it, is the Mac ecosystem powerful enough to fix this little usability snag?


I was talking about pre-OSX.


My observation too.

It is kind of evolution, just for computers.

Macs early developed good pointing devices and as a result many keyboard related aspects can afford to be somewhere between weird and crazy.

Bonus for Mac people insisting everything is fine.

And I still consider getting a MacBook Pro next month, Windows PCs are that bad even with WSL :-/

Edit: at least these days, fn and ctrl can finally be remapped and CMD-tab can be fixed so it works consistently between two Firefox (or two Safari) windows, an IDE and Finder. It used to be that I would have to CMD-tab to the Firefox group, then CMD-| to get to the correct browser window and it was one of the things that truly messed up my workdays the last time I used Mac back in 2012. (No dedicated home/end buttons and every app seemingly being free to choose what shortcut they would use for it was probably the most painful one though.)


I’ll just throw Magnet in the ring for a tiling solution.

I have keyboard shortcuts well in muscle memory now for left/right third/half/two-thirds, and all four corners at a quarter of screen, and full screen. I find that meets 90% of my needs.

Left/right two-thirds is my go-to when coding on 14”. VSCode on the left, Safari on the right. Both big enough to work well, but both leave enough of the other visible to be useful.

Nice little app, costs some reasonable amount of money as a one-off purchase.


I use Magnet, but settings not syncing across devices is a bit annoying.


Hammerspoon can handle that and much more, way more customizable and you can do amazing things like grid layouts. Completely open source, totally free, and the more people that use it the better it gets so I highly recommend it.


You can mimic that in part with yabai (https://github.com/koekeishiya/yabai). Disabling SIP gets you instant Space switching and creating without animation just like Pop_OS.

But you can get very far to an automated tiling WM and keyboard navigation even without disabling SIP.


Just because this often comes up; I don't want to disable SIP. However I'm very happy with yabai.


I didn't realize it was possible to use it without disabling SIP, excited to give it another shot! AltTab with a few modifications is currently my preferred way to manage windows.


To be honest I always wrote off Yabai until someone here commented that it works fine without disabling SIP. Only a small subset of features need that.


As another suggestion, Better Touch Tool does great for tiling window manager and adding shortcuts.

It's one of the first things I always need. It started coming from Linux with a similar experience to you.

----

A big shortcut for me is cmd+shift+/

It allows searching on all submenus. So when I'm working on an IDE for example, it's how I find those obscure options I know are there but I don't use frequently enough to remember the shortcut.


I use NixOS+GNOME+pop-shell for tiling windows on Linux, and I love it!

I am quite frequently on MacOS, and I use Yabai[0] and skhd[1], managed with Nix-Darwin[2] for tiling windows and custom keyboard shortcuts. With how I make my Linux and MacOS builds look and feel identical it's pretty easy for me to forget when I'm on one vs the other.

For anyone curious, here's my repository for deploying my configs[3]. It's awesome to have one source of truth for managing NixOS servers and workstations, MacOS workstations, and other Linux workstations with Nix installed.

[0] https://github.com/koekeishiya/yabai

[1] https://github.com/koekeishiya/skhd

[2] http://daiderd.com/nix-darwin/

[3] https://github.com/heywoodlh/nixos-configs


I've been using https://www.hammerspoon.org/ for more than 5 years and it's perfect.


You are probably better off ignoring Apples built in Window management controls unless you really like the way “Spaces” work. I find them too restrictive. Same with the green icon “full screen” mode. As others have mentioned, there are tones of third part tools that manage windows in various ways and you’ll probably find one that works for you.


If you're okay with a non-open source app (App store purchase) -- "Magnet" is the way to go.

Otherwise go with whats been suggested by others


Divvy for window management (assign your own shortcut).

For almost everything else there's a standardized system-wide shortcut (including the ancient ones like Ctrl+a/e for text).

If there isn't a shortcut, but the app exposes the action in a menu, you can assign a custom shortcut from keyboard settings.

MacOS has traditionally been very friendly to keyboard navigation. Well, until somewhat recently when mobile-only/mobile-first devs started just slapping Catalyst on and calling it a day. Even Apple's own apps suffer from this.


> If there isn't a shortcut, but the app exposes the action in a menu, you can assign a custom shortcut from keyboard settings.

The standardized menu system is underrated, IMO.

Setting aside preferences for the menubar being global vs. being attached to app windows, the fact that it's system-owned makes features like this possible. Apple was able to implement custom keybinds for menu items in arbitrary apps because they know that 99.9% of apps use the system menubar. This would be next to impossible on Windows where menubar implementations are disparate and numerous (even within first party apps), and while something similar could be patched together on Linux, it'd only work on some (mostly Qt) apps since GTK has mostly abandoned menus altogether.

This also enables the menu search in macOS Help menus to work, which is underused despite being basically a command palette for every app.


Menu bar search is underused for sure. One of my top commands after I learned about it.


Yeah I find some of the shortcuts confusing, like if I want to enter a directory in Finder I push ENTER and that's ... rename? Instead I'm meant to push PLACE OF INTEREST SIGN + O


Oh yeah, that's a stupid keybind, made worse by the fact you can't reliably change it since you can't differentiate when you're in a text field

But then you can mostly get by with a finder alternative


Cmd-down would also work.


This post and thread are terrific, and the day I learned common Emacs bindings work in most corners of macOS was momentous, but…

Whenever advanced keyboard shortcuts are under discussion, I’m reminded of something I read, I think by Bruce Tognazzini, on an early Apple study of keyboard vs. mouse. They had set up the usual usability test—run through these common spreadsheet tasks or whatever—and compared skilled users exclusively on mouse with equally skilled users issuing keyboard commands via shortcut. Maybe they swapped them back and forth on the modes, I don’t recall.

When the experiment was over, the mouse and keyboard users agreed: Shortcuts were faster, switching hands to the mouse and issuing commands via the cursor was slower. But the actual measured results showed no significant difference. Tog speculated that there’s some deep perceptual circuitry that’s tuned to notice the cost of mode-switching but submerge into the subconscious the cost of recall.

EDIT: I'm sure he's referenced it a dozen times in a dozen places, but here's a version of Tog's analysis that's roughly what I remember:

https://www.asktog.com/TOI/toi06KeyboardVMouse1.html

We’ve done a cool $50 million of R & D on the Apple Human Interface. We discovered, among other things, two pertinent facts:

- Test subjects consistently report that keyboarding is faster than mousing.

- The stopwatch consistently proves mousing is faster than keyboarding.

This contradiction between user-experience and reality apparently forms the basis for many user/developers’ belief that the keyboard is faster.

People new to the mouse find the process of acquiring it every time they want to do anything other than type to be incredibly time-wasting. And therein lies the very advantage of the mouse: it is boring to find it because the two-second search does not require high-level cognitive engagement.

It takes two seconds to decide upon which special-function key to press. Deciding among abstract symbols is a high-level cognitive function. Not only is this decision not boring, the user actually experiences amnesia! Real amnesia! The time-slice spent making the decision simply ceases to exist.


I don't think this proves anything. For example there is a massive difference between people using shortcuts in an everyday application, people used to Vim/Emacs/whatever to a point they can do the basics without thinking about them, and people who actually customized their setup for their workflow.

And to me it looks like they only focused on the first case because of sentences like this:

> It takes two seconds to decide upon which special-function key to press

Yes, I can definitely believe that I wouldn't be faster than a mouse user if I had to select text with a keyboard in notepad or press Ctrl-Alt-whatever to do simple tasks. But good luck beating a proficient Vim user at anything that has to do with cursor movements, search/replace or repetitive steps - watch a competitive coder use Vim and see how often it takes them "two seconds to decide" to do anything.

I think overall people have a decent intuition about what the more efficient way to control an application is. I frequently use the mouse/touchpad too, because in many GUIs it's simply faster and you can feel that even when you start out focused on the keyboard. Often users switch between window management and using graphical applications, and in those cases leaving the hand on the mouse is the more convenient approach.

And lastly - does it even matter? When someone perceives a certain approach to be faster or smoother, then why not let them? In almost all cases the speed difference doesn't matter.


I wonder in what conditions this is true for.

I can imagine that moving the mouse to open an app from the macOS dock is about the same speed as using the Cmd+Space or some shortcut.

I can't imagine using the mouse to go to the start/end of line is quicker than using an easy to reach keyboard shortcut to do so.

I'd also wonder about differences in general computing literacy/etc. between 1989 and now. -- I'm not sure "people new to the mouse" describes a meaningful subset of professional computer users these days.


You might want to read this about that study: https://danluu.com/keyboard-v-mouse/

It's a counter-intuitive conclusion because it's a wrong conclusion.


The blog post mentions text expansion via Raycast, but macOS has had its own native text expansion for a long time now (I think maybe since 10.5? Would need to check) under System (Preferences|Settings) > Keyboard > Text Replacements, which comes with the added bonus of syncing to your other Macs and iDevices via iCloud. I've been using it for years and at least for my needs it works great.

Not mentioned are the text navigation shortcuts that have been built into macOS for a similarly long period of time. They work in any text field in nearly every app (with exception to a few oddball apps that are usually built with "game engine style" UI frameworks), and come in both control-based emacs style and Apple style flavors[0]. I use these constantly and they work exceptionally well for smaller keyboards (e.g. 60% or HHKB).

[0]: https://jblevins.org/log/kbd


Author here, I use the native macOS replacements as well, mostly because they sync with iOS and they save me a lot of typing on iPhone and iPad.

But Raycast works differently in that:

    - it has dynamic replacements (see the video where I use ,td to type today's date for example)
    - can place cursor somewhere inside the replacement
    - makes it easy to add new snippets (Cmd-S on copied text)
    - is a lot faster in general and can work inside words as well


> I use ,td to type today's date

That single feature alone is worth the app to me.


Ah this is from the creator of the 'rcmd' tool. I absolutely love it. Press the right command key + the first letter of an app and it switches right to it! (rcmd + for firefox, i for iTerm, s for Slack, ...)

I came from i3 with 8 predefined windows, but the simplicity of rcmd is really amazing.


Thank you, I'm really happy to read you find rcmd so useful ^_^ Also came from i3wm and missed it sorely until I finally settled on rcmd + single-space.

Using multiple spaces on macOS is nowhere as easy as on i3.


Do you plan to make a post about your flute-making? Most interested.


I actually do plan, yes! There's so little concrete info on this subject on the internet, that I had to do a ton of trial and error to get fipple design right, tuning, choosing the right wood etc.

I want to collect all my notes on this and publish a series of articles in 1-2 months. Glad to see others interested!


Better Touch Tool changed the way that I operate. Sequencing of keys can make you a productive monster:) Practically speaking, I remove the use of short keys that require to break my fingers every day.


Yeah my most recent discovery is using GPT4 to create applescripts which are triggered by a key combination. One that I use all the time is to open a chrome window with a specific profile to certain webpages


Yes! I'm sure I'm not using it anywhere close to its full potential, but just being able to two-finger tap a link to open it in a new tab is huge.

What are your favorite shortcuts?


I am using it with specific sequencing for different apps. One of the more strange use -cases is the combination of BTT and touch-bar-simmulator with Figma. Adding functionality to my vertical mouse and trackballs with different profiles for apps and so on.


TIL about https://folivora.ai/ (BetterTouchTool). Brilliant.. and it's so refreshing to see an app that I will own and won't be a subscription. I can't stand that.


I guess this is only of tangential relevance to the post, but Ctrl+n (which should work the same as arrow down) has been broken in Spotlight as of macOS Ventura.

The fact that this completely standard binding has been broken in a crucial macOS app for 5 months basically tells me that Apple does not care about the "Emacs-style" shortcuts in macOS.


It stopped working in safari too (for picking items from the dropdown of suggestions when you type into the address bar). Even if you edit `DefaultKeybinding.dict`, some of the bindings just don't take. Also broken in some places is 'alt-b' and 'alt-f' for forward and backward word movement. I've been remedying this with BetterTouchTool, but it isn't the same in some places.


This might be the place to ask, since half an hour of searching the other day came up empty for Apple Silicon Macs: does anyone know how to diagnose hotkey conflicts? I use hyper (caps) + q, e to navigate between spaces but hyper + q recently stopped working, so … I can only go right.


Try Shortcut Detective. https://www.irradiatedsoftware.com/labs/

I haven’t used it for a couple of years, so it may be flakey, but worth a shot.


Thank you! Unfortunately it hasn’t been updated in a while and is very flaky on M1 Macs. Recognises some keys and not others - unfortunately not the one I need in this instance.


One trivial trick that maybe isn’t widely known: holding down option changes some menus to have additional/alternate options, eg delete vs move to trash, at one point you could get more resolution options. I don’t think I’ve seen this anywhere else (on windows if you right click a file and click ‘delete’ while holding shift, you get actual deletion instead of moving to trash, but the text on the menu doesn’t update)


You can configure the zoom function in the accessibility settings, too. And zoom in and out using the two finger scroll gesture. I use it daily.


Yep, Apple added a lot of options for configuring zooming. I went through all the Accessibility settings multiple times to find something that works for me. I used three-finger-double-tap for a while, but I really like three-finger-tap for middle click so it clashed with that.

That's why I eventually settled for the rcmd-lcmd sequence, it's much more convenient for me and doesn't clash with my other bindings.


apps you can install which allow keyboard tricks, rather than macOS native.


Just finding the app native ones can be useful, I spent several years using macOs before someone told me about apple-spacebar bringing up a spotlight quick search, which is not the main way I launch things that aren't terminal commands.


spotlight also does simple math! so convenient.


BTT is great man, it just allows you to configure any shortcut for any app.

But the one key I use the most is assigning “`” key as the back button. You keep your hand on that key while surfing web or any app that has a back navigation, it’s just so much better than clicking or remembering each apps back shortcut.

If you really need to type ` then you assign fn-` it’s really rarely used


FYI, the keyboard shortcut for back is ⌘+[, and forward is ⌘+]. This is system-wide, and works in apps like Safari, Finder, Chrome, System Settings, etc.


CMD + left / right arrow key also works, for everyone without a US layout


My man must not write JS


Or shell, or ruby, or markdown, or even just use Slack.

Sure there are generally (sometimes better) alternatives in those but backticks are pretty common for me.


Yep i knew there was a language that goes there too often


It's better to assign literal ` to double tap than requiring a hard to reach modifier


I've been happy using a combination of Karabiner, Hammerspoon, Quicksilver, and Espanso for these types of tasks for many years.

Although the only thing I really need Karabiner for is remapping caps lock to a custom-defined "hyper" key (something odd combination of right and left shift, alt, command, etc) that everything else can use.


Big fan and long-time user of rcmd, Hyperkey, Rectangle, BTT - all lovingly-crafted by independent developers. All solo, I believe.

I know Raycast is getting a lot of attention right now but isn’t this a VC-backed SaaS? How do people feel about inviting them on to their desktop - aren’t you worried about the inevitable other shoe dropping?


Author here, glad you like rcmd! About Raycast, I was a longtime fan of Alfred, and still bought version 5 and use it all the time for file search and navigation, as Raycast is severely lacking here.

But I really like what Raycast has become for the rest of the stuff. For example the calculator is just amazing, it replaced Soulver and Alfred completely for me, doing the currency and datetime operations a lot more intuitively.

And for now, Raycast is a full fledged app whose binary I own completely and works offline. So even if the Raycast company had problems, I can keep using the current binary forever. There's not much functionality that would go extinct with OS updates.

I'd say it's worth the risk.


Some very good utilities listed in the article!

FuzzyKey would be really awesome, it's indeed an issue to remember all the complex conditional rebinds (and even in which app you've made it)

Would be nice if you could have an easily accessible cheat sheet and also press any combo in an app and let it tell you where and how it was defined


I used to have a clipboard manager that gave me access to my last X copied items, as well as a navigable list of snippets. A few years back, a MacOS update broke whatever tool I was using, and I ended up buying BetterTouchTool. BTT does give me my clipboard history, and it appears to be very powerful in general, but I can't figure out an easy way to replicate the navigable list of snippets.

I do use the MacOS text expansion system for my name and a few other items, but what it lacks is (1) I cannot use hyperlinked text in the expanded snippet, and (2) it requires me to remember an incantation for each expansion (I want to be able to look at a list of items and pick the one I want.

Does anyone know of a tool that can do this? I don't mind paying, but free is always appreciated!


Alfred (https://alfredapp.com) has a snippet manager (and a _whole_ lot more kbd goodies)


Raycast's snippets mentioned in the article can do exactly that, screenshot here: https://shots.panaitiu.com/GmT5v4Zj

It can do the incantation thingie, but it also allows binding a hotkey to showing a list of your snippets, searching through them, and inserting them with Enter.

It can also do hyperlinks, bold, italic, if the app you're typing into supports rich text. Example: https://shots.panaitiu.com/gw50Zdcm


Thanks, I was just checking it out based on the article mention. Looks like it's free for personal use, too!

EDIT: Looks like for snippets, it requires a key command to get Raycast to appear, then you have to say Search Snippets, then you have to type your search string, then you have to select the desired snippet. Is it really this many steps? My old workflow was shift-cmd-v, choose the desired snippet via arrow keys, hit return. With muscle memory, this ended up taking less than 4 seconds for most snippets.


Nope, you can do it in a single step. You can record a hotkey for any action that Raycast has, you don't need to go to the main UI: https://shots.panaitiu.com/y6cGQTLN

I rarely if ever see that main search UI, I have hotkeys for all my favorite workflows.


Dope, thanks!


If you can’t get that working, Alfred[1] is a similar app with Snippets functionality including rich text, dynamic replacements, and is configurable to bring up the search by hotkey.

[1]: https://www.alfredapp.com


Just FYI: you can use hyperlinks etc. in the BetterTouchTool expanded snippet. You just need to select the appropriate "Paste Type". You can also enter raw HTML and then select the "Paste Format: Interpret entered text as HTML source" option. When pasted it will then output the formatted text instead of the HTML source.


I've used Quicksilver for clipboard history historically. There is a currently a bug that I've been meaning to delve into: https://github.com/quicksilver/Quicksilver/issues/2913 but still generally usable. Particularly handy combined with adding simple AppleScript or JXA actions to manipulate the content (I have several simple ones for example to run a regex, to clean extraneous content around a number, a phone number, strip whitespace, indent 4 spaces for pasting into a markdown codeblock on SO, etc etc).

The Shelf plug-in also very handy along similar lines.


This is the way: https://maccy.app


Looks sleek and very lightweight; where does it say how it handles snippets? Or is the 'pinned' functionality supposed to be used to get old items to hang around?



OK thanks. Funny, the commenter in that thread came from the same software as me — ClipMenu. It was simple and worked great!


FastScripts[1] might be worth a look. I've been meaning to check it out myself though so I can't offer any personal experience with it.

[1] https://redsweater.com/fastscripts/


Alfred has a clipboard history among a billion other things


These are impressive, but can they fix an app that intercepts MacOS's defaults and hijacks them with inferior versions?

Specifically I am interested in fixes for Outlook, which overrides the default text editing cursor movement commands with its own shortcuts.


By the way, is there a good trick to detect whether there is a currently active text field with your cursor in it? That's one crucial missing piece of context for all of the keyboard trick apps I am aware of, and that prevents fixing some rather annoying app bugs (like finder's enter not working to rename)

These utilities are only able to detect which app is running, but no what's going on inside the app


Tangential topic: my wife has been using MacOS for several years now, and she's a non-IT, average "office" user. She kind of struggles with some of the ways in which you can be really productive with MacOS, and I tried to find a course or something to help her out, but the results are not great.

Is there any online resource that you would recommend to help her refine her skills?


Allow me to leave this link here for anyone who’s interested in controlling window sizes and positions from LaunchBar and possibly other keyboard-based launchers on macOS.

https://github.com/adriannier/applescript-Nudge-My-Window


I built something similar myself with Karabiner Elements: https://www.youtube.com/watch?v=j4b_uQX3Vu0

TL;DR: Capslock is Hyper key when held (Escape when pressed). Then I have hyperkey sublayers to allow for having essentially infinite commands: Capslock + O ("Open") + S ("Slack"), Capslock + S ("System") + U = Volume Up, J = Volume Down, etc.


One of the best things I’ve configured with BTT is to remove the global Quit application (cmd+Q) and global Hide application (cmd+H) keybindings. I use cmd+W all the time to shut tabs and a slight miss click would close the entire app.


With Karabiner Elements you could also bind quit to double Cmd+Q, I do that for "important" apps where accidental quit is bad, but for others (or for apps that don't have tabs) I leave quit to a single Cmd+Q


cmd-Q can be disabled in System Preferences too. Handy! No more tears.


In this vein, I've got a Hammerspoon script so I can hit cmd-option-ctrl N, to make a new desktop with a fresh chrome window in it.


Contexts.app for a more traditional alt-tab.


I had a lot higher hopes for this.

I get the impression OP is a junior dev.


I use HammerSpoon with the ShiftIt spoon.

https://github.com/peterklijn/hammerspoon-shiftit

I like to move windows around with just my left hand, which doesn't work if you use the right command key.

Instead you can use left_alt + left_command together

The full list of commands I use with the ShiftIt spoon:

  spoon.ShiftIt:bindHotkeys({
    left = {{ 'alt', 'cmd' }, 'z' },
    right = {{ 'alt', 'cmd' }, 'x' },
    up = {{ 'alt', 'cmd' }, 'q' },
    down = {{ 'alt', 'cmd' }, 'a' },
    resizeIn = {{ 'alt', 'cmd' }, '-' },
    resizeOut = {{ 'alt', 'cmd' }, '=' },
    toggleZoom = {{ 'alt', 'cmd' }, 'f' },
    upleft = {{ 'alt', 'cmd' }, '1' },
    upright = {{ 'alt', 'cmd' }, '2' },
    botleft = {{ 'alt', 'cmd' }, '3' },
    botright = {{ 'alt', 'cmd' }, '4' }
  })
Alt = Option on Mac

To move a window to the center of the screen with Hammerspoon:

  hs.hotkey.bind({"cmd", "alt"}, "s", function()
    -- size focused window to middle third of display
      local win = hs.window.focusedWindow()
      local f = win:frame()
      local screen = win:screen()
      local max = screen:frame()

      f.x = max.x + (max.w / 3)
      f.y = max.y
      f.w = max.w / 3
      f.h = max.h
      win:setFrame(f)
    end)
To move a window to the next/previous screen (external display):

  -- move window to next screen
  -- bind hotkey
  hs.hotkey.bind({'alt', 'ctrl', 'cmd'}, ']', function()
    -- get the focused window
    local win = hs.window.focusedWindow()
    -- get the screen where the focused window is displayed, a.k.a. current screen
    local screen = win:screen()
    -- compute the unitRect of the focused window relative to the current screen
    -- and move the window to the next screen setting the same unitRect 
    win:move(win:frame():toUnitRect(screen:frame()), screen:next(), true, 0)
  end)

  -- move window to previous screen
  -- bind hotkey
  hs.hotkey.bind({'alt', 'ctrl', 'cmd'}, '[', function()
    -- get the focused window
    local win = hs.window.focusedWindow()
    -- get the screen where the focused window is displayed, a.k.a. current screen
    local screen = win:screen()
    -- compute the unitRect of the focused window relative to the current screen
    -- and move the window to the previous screen setting the same unitRect 
    win:move(win:frame():toUnitRect(screen:frame()), screen:previous(), true, 0)
  end)
I use left alt and left command together for one handed shortcuts.

I use Quicksilver to set triggers to open apps with left_alt + "key"

https://qsapp.com/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: