What terminal command can I use to terminate the cursor/mouse process on a MacOSX?

左心房为你撑大大i 提交于 2021-02-08 11:13:12

问题


What terminal command can I use to terminate the cursor/mouse process on a MacOSX?

I'm changing the size of the mouse using another command in the terminal and now I need to restart the process that displays the cursor. I have searched for hours for a similar topic, but couldn't find one.

Does anybody know how to achieve this?


回答1:


If by "changing the size of the mouse using another command in the terminal", you mean that you set the System Preferences value (i.e. using 'defaults' command), then you could either log out and log back in, or it may be a bit tedious -- see this answer: How to programatically change the cursor size on a Mac

If all you need to do is to change a mouse cursor size system-wide, you can use UI scripting (as suggested in the answer I linked). The command to execute would be:

osascript -e '
tell application "System Preferences"
    reveal anchor "Seeing_Display" of pane id "com.apple.preference.universalaccess"
end tell
tell application "System Events"
    set theSlider to slider "Cursor size:" of group 1 of window 1 of application process "System Preferences"
    set stash to value of theSlider
    set value of theSlider to SIZE_OF_THE_CURSOR
    stash
end tell'

Note that you need to "enable assistive access" to osascript:

http://jacobsalmela.com/bash-script-enable-access-assistive-devices-programmatically-os-x-mavericks-10-9-x-simulate-keystrokes/

"is not allowed for assistive access" error when running AppleScript from Java



来源:https://stackoverflow.com/questions/36296487/what-terminal-command-can-i-use-to-terminate-the-cursor-mouse-process-on-a-macos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!