Code Monkey home page Code Monkey logo

meta-mac's Introduction

Meta Mac

Enables a Mac OS-like shortcut key experience on Linux.

For an overview of the various key remapping solutions, and Mac-to-Linux switcher options, see my article Key Remapping in Linux - 2021 Edition

Works in X & Wayland, and has awareness of which app is focused so that app-specific key combinations can be sent.

Dependencies

Installation

  1. Install keyd
sudo apt install libudev-dev
git clone https://github.com/rvaiya/keyd.git
cd keyd && make && sudo make install
  1. Run install script
./install.sh
  1. Enable keyd as a systemd service
sudo systemctl enable --now keyd

Done!

Which Shortcut Keys?

  • For cut/copy/paste key combos, translate to universal clipboard keys (works in terminal as well as other apps):

    • Cut: Cmd-X -> Ctrl-X
    • Copy: Cmd-C -> Ctrl-C (or Ctrl-Shift-C in Gnome Terminal)
    • Paste: Cmd-V -> Ctrl-V (or Ctrl-Shift-V in Gnome Terminal)
  • Window switching:

    • Switch: Cmd-Tab -> Meta-Tab
    • Switch backwards: (when in App Switch mode): Cmd-` => Shift-Meta-Tab
    • Switch between windows of same app: Cmd-`
    • Open the Launcher: Cmd-Space
  • Switch directly to an open tab, e.g. Firefox or VS Code:

    • Cmd-1 -> Alt-1
    • Cmd-2 -> Alt-2
    • ... etc.
  • The remaining Cmd-* key combos are translated to Ctrl-*, e.g.

    • Close Window: Cmd-W -> Ctrl-W (or Ctrl-Shift-W in Gnome Terminal)
    • New Tab: Cmd-T -> Ctrl-T (or Ctrl-Shift-T in Gnome Terminal)
    • Bold: Cmd-B -> Ctrl-B
    • Italics: Cmd-I -> Ctrl-I
    • etc.
  • Mouse clicks:

    • Command-Click -> Ctrl-Click

Why?

The biggest discomfort I have with Linux shortcut keys is the mismatch between the terminal's idea of copy-paste (Ctrl+Shift+C / Ctrl+Shift+V) and everything else in Linux (Ctrl+C / Ctrl+V). And Linux isn't alone--Windows, too, has a weird relationship with copy/paste when it comes to the command shell. Only on the Mac have I experienced the sensible default that Command-C will copy to the clipboard, and Command-V will paste, regardless of which app is running.

But why stop there? If you have experience with Mac OS and have the ability to make customizations in Linux (and boy, do you!) then why not make switching to Linux as comfortable as possible?

On a personal note, I've lived and worked on a Mac for the past 15 years, and while I still admire Apple's technical and design capability, our values have slowly been drifting apart over the years. Apple is no longer the underdog, and it's clear that it doesn't need to design for the values or culture of software developers any more.

What hardware/Linux distro do you use?

I'm very excited to joining the free culture movement once again via my first frame.work laptop and Pop!_OS. I've written Meta Mac and collaborated on the keyd project in the hope that it will ease the transition for others along this path as well.

Thanks

Thanks to Raheman Vaiya of keyd for a great library and for a lot of help.

meta-mac's People

Contributors

canadaduane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

meta-mac's Issues

Switch functionality of option+key?

Not much of an issue rather a request. After unsuccessfully battling with Kinto I found your solution to key remapping and it works like a charm. The only thing I'm missing right now are two things:

opt+q = @
opt+left/right = next word

I'd do it myself but I'm quite new to Linux and Keyd so I thought of sharing this with you as it may also improve on your desired end product.

Thanks so much for meta-mac!

Identify keyboard type before swapping modifier keys

The keyboard remapper that I normally use to get macOS keyboard shortcuts in Linux (Kinto.sh by Ben Reaves) has a procedure in the installer that asks for you to press the key 2nd to left of the space bar. This allows the install script to identify whether you are on a PC keyboard (Super/Win key code), an Apple keyboard (Option key code), a Chromebook keyboard, or an IBM keyboard with no with no Super/Win key. The Kinto GUI also lets you change the keyboard type on the fly, for when you need to switch physical keyboards.

I tried to test Meta Mac on a 2007 white MacBook3,1 which of course has an actual Apple keyboard with the Command key in the "correct" place for Mac keyboard shortcuts. This doesn't work well with Meta Mac because (I assume) it's currently only designed to turn a PC keyboard into behaving like a Mac keyboard, by swapping the Control key with the Alt key.

For Meta Mac to work for people who run Linux on actual Macs (I've got Ubuntu 21.10 on this MacBook), and for those who use Apple external keyboards connected to PC laptops, or for Chromebook users running Linux and other scenarios, you'll need to provide a way to specify or identify the type of keyboard the user is on, and a way to change the keyboard type if necessary.

meta can now be safely overloaded

As of 076a186 in keyd the meta key can now safely be used as both the overlay key and a layer activation key.

so gsettings set org.gnome.mutter overlay-key '' should no longer necessary.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.