Recently I got an ASUS Radeon RX 580 to replace an NVidia Card I was tired of fighting and trying to make work properly. As it turns out, no video card is very easy to get working with Hackintosh!
Anyway, today the problem was after finally getting two monitors working the secondary monitor was booting with a weird rotation and was a pain in the ass to change each time I logged in because the mouse was about 5″ off location on that screen.
There must be a way to automate it, thought I.
Here’s how I did it.
# cd ~/Documents/Source # git clone https://github.com/CdLbB/fb-rotate.git # cd fb-rotate # gcc -w -o fb-rotate fb-rotate.c -framework IOKit -framework ApplicationServices # nano /Users/YOURUSERNAME/Library/LaunchAgents/com.YOURCOMPUTERNAME.fb-rotate.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.YOURUSERNAME.fb-rotate</string> <key>ProgramArguments</key> <array> <string>/Users/YOURUSERNAME/Documents/Source/rotate.sh</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
then get the list of your screens
# /Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -l
Which will output something like this
Display ID Resolution 0xb430e32 1920x1080 [main display] 0x2b287c4c 1200x1920
Take note of the screen you want to automatically rotate on boot. Copy the 0x00000 number.
# nano ~/Documents/Source/rotate.sh
And put fb-rotate command into the file
/Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -d 0X_YOURIDHERE -r 0 /Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -d 0X_YOURIDHERE -r 270
then make it executable
chmod +x ~/Documents/Source/rotate.sh
Now on your next reboot, it should auto flip your monitor the orientation you want. Obviously not a super elegant solution, but, whatever it’s done right, and, it work
If you want to test your scripts here they are testing:
launchctl load com.YOURUSERNAME.fb-rotate
launchctl unload com.YOURUSERNAME.fb-rotate.plist