2

My friend used this script (do not run this!!) to change all my keys to h. How can I undo this?

4
  • 2
    Start a new shell. If he had put this code into one of your startup files, use a text editor to remove it first. Also, be more careful in the future how you select your friends. Commented Dec 1, 2022 at 10:06
  • 1
    @user1934428 The script (or, to be correct, the script which the linked script downloads and executes) changes the keybindings for the current user. Opening a new shell will not help.
    – nohillside
    Commented Dec 1, 2022 at 10:57
  • @nohillside : Not a subshell of course (this would not be possible anyway), but a completely new shell tab. I don't see how the local key binding change in one zsh process could possibly influence the keybinding in a completely unrelated zsh process, unless the remapping of the key is done on the OS-level (in which even a text editor would not work). Commented Dec 1, 2022 at 11:02
  • 1
    @user1934428 hidutil (which is what the scripts use) changes the keybindings for the current user, not for the current shell. If you want to check yourself: download the script and edit it to replace eval with echo. Run it to see the URL for the second script and download this as well. Do the eval/echo replacement on the second script as well and run it.
    – nohillside
    Commented Dec 1, 2022 at 11:56

1 Answer 1

2
hidutil property --set '{"UserKeyMapping":[]}'

will reset the key mappings introduced by this script.

PS: A reboot should also solve the problem.

3
  • iknow this command but i want block this script
    – wolfe_m
    Commented Nov 30, 2022 at 22:26
  • 1
    @wolfe_m You can't block scripts from getting executed.
    – nohillside
    Commented Nov 30, 2022 at 22:41
  • 3
    Don't let your friend near your computer.
    – IconDaemon
    Commented Nov 30, 2022 at 23:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .