Try   HackMD

My macOS tweaks coming from Ubuntu

On June 2023, I've decided to abandon "desktop" Linux. I can't bear having to work around everything all the time, not even counting the tons of problems that occur whenever I do a major version upgrade (e.g., when I upgraded from 21.10 to 22.04, my PPAs broken obviously, and also I lost all the hack I had made to the /etc to work around problems). I am officially back to macOS starting 26 June 2023. I'll still use my Linux workstation remotely over Mosh, but not as a desktop environment.

To smoothen the transition, I use the following hacks on macOS:

  1. Linear Mouse since I can't stand macOS' mouse acceleration and also to fix my mouse wheel's direction. My config:

    Setting Value
    Pointer -> Pointer acceleration 0.5
    Pointer -> Pointer speed 0.1717
    Scrolling -> Scrolling mode By Lines
    Scrolling -> Distance 2
  2. Magnet to be able to move windows around and move them to 1/2 of the display.

  3. AltTab to switch between windows instead cmd+tab's application switching.

  4. Audio Switch to make sure my bluetooth headset's microphone never get used (any wired mic close enough to the mouth is better than a bluetooth mic; the macbook pro's mics are good for that matter).

  5. MenuMeters to see the network activity in the top menu bar.

  6. Screenshots tweaks:

    ​​​​defaults write com.apple.screencapture location ~/Downloads
    ​​​​defaults write com.apple.screencapture disable-shadow -bool true
    ​​​​defaults write com.apple.screencapture show-thumbnail -bool false
    ​​​​
    ​​​​# MacOS trick: change the screenshot generated name.
    ​​​​# Source: https://apple.stackexchange.com/questions/251385
    ​​​​#
    ​​​​# ⚠️  You can't change the name of generated screenshots!
    ​​​​#
    ​​​​defaults write com.apple.screencapture "include-date" 0
    ​​​​defaults write com.apple.screencapture name screenshot-"$(date +%Y-%m-%d)-$(date +%H%M)"
    
  7. Font in iTerm2:

    ​​​​brew install font-hack-nerd-font
    
  8. Play/pause in YouTube Music: To fix the Play/Pause/Forward/Backward buttons in YouTube Music's Electron app, make sure that the Media flag is enabled in chrome://flags. Also, don't try to disable Apple Music app from launching on "Play", otherwise you will also disable the media keys entirely!

  9. iTerm2 writes weird characters on click after an ssh session with tmux unexpectedly ended:

    ​​​​$ 0;37;9M0;37;9m0;24;6M0;24;6m
    

    That's because "mouse reporting" is still enabled for the current shell session. To disable mouse reporting, run:

    ​​​​printf '\e[?1000l'  # disables mouse reporting
    

    To know more: https://superuser.com/questions/802698/disable-mouse-reporting-in-a-terminal-session-after-tmux-exits-unexpectedly

  10. ctrl+space doesn't work in VSCode: disable system shortcut for "Previous input source".

  11. Zsh is borked (e.g., up arrow no longer filters previous commands starting with what's in your prompt):

    ​​​​rm -rf ~/.antigen
    

Not specific to macOS

To launch VSCode Insiders from the command-line using the code command rather than the longer version code-insiders:

sudo ln -sf $(which code-insiders) $(which code)

For recording screencasts and videos

  • Teleprompter.app
  • KeyCastr

Option+arrow doesn't work in VSCode

# In don't want to rely on OMZ anymore. But I love this word-to-word jump on
# ctrl-left-arrow and ctrl-right-arrow (instead of jumping to the next space,
# it jumps to the next word).
# https://coderwall.com/p/a8uxma/zsh-iterm2-osx-shortcuts
#
# This is for iTerm2:
bindkey "\eb" backward-word
bindkey "\ef" forward-word
# For VSCode. I ran "cat | hexdump -C" to know what key was sent when pressing
# alt+left.`
bindkey "\e[1;3D" backward-word
bindkey "\e[1;3C" forward-word