Skip to content

Swap mac keyboard option and command

Swap the mac keyboard option and command keys, and enable function keys without the need to press fn first.

Add the following line to the i3 config.

/usr/lib/systemd/system/mac-keyboard.service
[Unit]
 Description=mac-keyboard
[Service]
 Type=oneshot
 ExecStart=/bin/sh -c "echo 1 > /sys/module/hid_apple/parameters/swap_opt_cmd && echo 2 > /sys/module/hid_apple/parameters/fnmode"
 ExecStop=/bin/sh -c "echo 0 > /sys/module/hid_apple/parameters/swap_opt_cmd && echo 1 > /sys/module/hid_apple/parameters/fnmode"
 RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
systemctl --system daemon-reload
systemctl start mac-keyboard.service
systemctl enable mac-keyboard.service

Back to top