之前用的别人提供的 applescript 代码
tell application "System Preferences"
	set current pane to pane "com.apple.preference.keyboard"
end tell
tell application process "System Preferences"
	repeat until exists tab group 1 of window "Keyboard"
	delay 0.5
	end repeat
	click radio button "Keyboard" of tab group 1 of window "Keyboard"
	try
		click checkbox "Use F1, F2, etc. keys as standard function keys on external keyboards" of tab group 1 of window "Keyboard"
	end try
	try
                click checkbox "Use F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard"
        end try
end tell
tell application "System Preferences" to quit
但 macos 13 设置里这个选项的位置变了,之前的不能用了,有大佬知道怎么改吗
     1 
                    
                    Quanuanc      2022-12-22 09:26:33 +08:00    如果你的系统语言是英文的,可以试试这个: https://www.icloud.com/shortcuts/ba6118a07c80470c934c52c95d29117e ,从这个帖子 https://www.reddit.com/r/shortcuts/comments/w8tnqa/automatic_fn_toggle_shortcut_for_mac_os_x_ventura/来的。   
                如果你的系统语言是中文的,修改一下上面的脚本也能用,这是我修改的版本: https://www.icloud.com/shortcuts/7dde5bdd6c1e4c0dbd284d8cd7bb4660  | 
            
     2 
                    
                    Volekingsg      2022-12-22 09:29:02 +08:00 
                    
                    defaults write NSGlobalDomain com.apple.keyboard.fnState -bool true/false 
                 | 
            
     3 
                    
                    shervy      2022-12-22 11:25:48 +08:00 
                    
                    非程序员完全看不懂。 
                 | 
            
     4 
                    
                    sunrisewestern   OP @Quanuanc 虽然会弹出设置界面,但可以用,感谢 
                 | 
            
     5 
                    
                    sunrisewestern   OP @Volekingsg 改这个 plist 好像不会立即生效 
                 | 
            
     6 
                    
                    Volekingsg      2022-12-23 15:11:59 +08:00 
                    
                    @sunrisewestern  #5 确实,事前事后 kill 一些东西都没用,也不确定是不是我没找对 
                 | 
            
     7 
                    
                    ooops      2022-12-28 13:13:29 +08:00 via iPhone 
                    
                    不如 karabiner 重新映射一套了 
                 |