Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
GabubuAvailable authored May 17, 2022
1 parent 3979f62 commit 089bf42
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions ddisplay
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

0 comments on commit 089bf42

Please sign in to comment.