From 0ab9c43e73dd6f07b1a39aa65f651c48c4fb0c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mevl=C3=BCt=20Canvar?= Date: Wed, 6 Jan 2021 00:08:35 +0300 Subject: [PATCH] initial tilde-switch plugin commit --- plugins/tilde-switch/README.md | 9 ++++++++ plugins/tilde-switch/tilde-switch.plugin.zsh | 22 ++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 plugins/tilde-switch/README.md create mode 100644 plugins/tilde-switch/tilde-switch.plugin.zsh diff --git a/plugins/tilde-switch/README.md b/plugins/tilde-switch/README.md new file mode 100644 index 000000000..08f31fcff --- /dev/null +++ b/plugins/tilde-switch/README.md @@ -0,0 +1,9 @@ +# tilde-switch plugin + +By default, on some non-US keyboards of Macbooks like Swedish and Turkish, tilde key switched with a plus-minus key. So this plugin switches back the `±` key to `~` without needing any third-party tool or service. + +To use it, add `tilde-switch` to the plugins array of your `.zshrc` file: +``` +plugins=(... tilde-switch) +``` + diff --git a/plugins/tilde-switch/tilde-switch.plugin.zsh b/plugins/tilde-switch/tilde-switch.plugin.zsh new file mode 100644 index 000000000..9705a159d --- /dev/null +++ b/plugins/tilde-switch/tilde-switch.plugin.zsh @@ -0,0 +1,22 @@ +#!/usr/bin/env zsh + +# +# tilde-switch-zsh +# +# This key binding plugin gets tilde key back on MacOS +# Swithes back ± key to ~ +# +# Copyright(c) 2021 Mevlut Canvar +# MIT Licensed +# + +# +# Mevlüt Canvar +# GitHub: https://github.com/mcanvar +# Twitter: https://twitter.com/mevlutcanvar +# + +# +# This solution taken from here: https://apple.stackexchange.com/a/353941 +# +hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000064},{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035}]}' > /dev/null