Created
April 3, 2024 07:30
-
-
Save MolarFox/368e1c055a782e41e71b29ad56b284dd to your computer and use it in GitHub Desktop.
Toggle display orientation (for 2-in-1 without working tilt sensor)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| tgt_disp="eDP-1" | |
| # Determine which index the orientation will be at. +1 if tgt_disp is primary (try running the edpi_state xrandr command without the cut to see why) | |
| disp_info=$(xrandr --query --verbose | grep "$tgt_disp") | |
| if [ $(echo "$disp_info" | cut -d ' ' -f 3) == "primary" ] | |
| then | |
| cut_index=6 | |
| else | |
| cut_index=5 | |
| fi | |
| edpi_state=$(echo "$disp_info" | cut -d ' ' -f $cut_index) | |
| if [ "$edpi_state" != "normal" ] | |
| then | |
| xrandr --output eDP-1 --rotate normal | |
| else | |
| xrandr --output eDP-1 --rotate left | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment