-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3979f62
commit 089bf42
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
# ddisplay - connectivity to your monitor it's now easier ;) | ||
|
||
############################### SETTINGS (EDIT THEM) ############################################## | ||
PRIMARY="$(printf 'HERE')" # Choose your correct primary display (use xrandr for more info) | ||
SECONDARY="$(printf 'HERE')" # Choose your connected display (again, xrandr for more info)) | ||
RESOLUTION="$(printf 'HERE')" # Your native resolution for the primary display | ||
################################################################################################### | ||
|
||
# Mirror resolutions | ||
MIRROR() | ||
{ | ||
# Asking for the resolution | ||
MIRROR=$(printf "4K UHD\n1080p\n720p\n480p\nNah I give up" | dmenu -b -l 5 -p "Choose the resolution.") | ||
|
||
if [ "$MIRROR" = "4K UHD" ]; then | ||
xrandr --output $PRIMARY --rate 60 --mode 3840×2160 --fb 3840×2160 --panning 3840×2160 --output $SECONDARY --rate 60 --mode 3840×2160 --same-as $PRIMARY | ||
elif [ "$MIRROR" = "1080p" ]; then | ||
xrandr --output $PRIMARY --rate 60 --mode 1920x1080 --fb 1920x1080 --panning 1920x1080 --output $SECONDARY --rate 60 --mode 1920x1080 --same-as $PRIMARY | ||
elif [ "$MIRROR" = "720p" ]; then | ||
xrandr --output $PRIMARY --rate 60 --mode 1280x720 --fb 1280x720 --panning 1280x720 --output $SECONDARY --rate 60 --mode 1280x720 --same-as $PRIMARY | ||
elif [ "$MIRROR" = "480p" ]; then | ||
xrandr --output $PRIMARY --rate 60 --mode 640x480 --fb 640x480 --panning 640x480 --output $SECONDARY --rate 60 --mode 640x480 --same-as $PRIMARY | ||
elif [ "$MIRROR" = "Exit" ]; then | ||
exit 0 | ||
fi | ||
exit 0 | ||
} | ||
|
||
# Asking what you want to do | ||
ACTION=$(printf "Mirror\nExternal\nDisconnect\nExit" | dmenu -b -l 5 -p "What do you want to do with your cool monitor?") | ||
|
||
if [ "$ACTION" = "Mirror" ]; then | ||
MIRROR | ||
elif [ "$ACTION" = "External" ]; then | ||
xrandr --output $SECONDARY --auto --right-of $PRIMARY | ||
elif [ "$ACTION" = "Disconnect" ]; then | ||
xrandr --output $PRIMARY --rate 60 --mode $RESOLUTION --fb $RESOLUTION --panning $RESOLUTION --output $SECONDARY --off && xrandr --output $SECONDARY --off --right-of $PRIMARY | ||
elif [ "$ACTION" = "Exit" ]; then | ||
exit 0 | ||
fi | ||
exit 0 |