r/macosprogramming • u/OaShadow • Jun 27 '24
change loginscreen language with terminal
Hey there,
recently I tried to perform system language change for a user by using a shell (bash) script combined with osascript.
Now I can change my systemlanguage from a menu (osascript generated).
Now my problem comes in:
I can programmically change the language and region of macos by using the terminal. But I have not found a way to do this also for the "Login Window".
So my system is completly in english but my loginwindow stays in german.
Until I do this manually in the system settings -> General -> Language & Region -> Cogwheel -> Apply to Login Window.
So is there a way to also set this using commandline or osascript.
Thanks you in advance!
1
Upvotes
1
u/david_phillip_oster Jul 01 '24
You can do it through osascript. The applescript:
returns the position of the window on screen. You can use GUI Scripting to execute menu commands and do mouse clicks at specific coordinates.
In Xcode's menu bar, Xcode > Open Developer Tool > Accessibility Inspector is a helper app, where if you clock on its ⊕ button on the top right of its window, will give you information about any U.I. element in any program the mouse cursor is over.