Commit 15259420 authored by Jay Ta'ala's avatar Jay Ta'ala
Browse files

Added scripts folder for several utility scripts I've authored.

parent 91d536fb
#!/bin/bash
showExample() {
echo -e "\ne.g. \""$(basename -- "$0")" 1920 1080 60\"\n"
}
createRes() {
cvt "$WIDTH" "$HEIGHT" "$REFRESH" | grep Modeline | sed "s/Modeline//" | xargs xrandr --newmode
}
addRes() {
xrandr --addmode eDP1 "$WIDTH"x"$HEIGHT"_"$REFRESH".00
}
# check arguments
if [ -z "$1" ]; then
echo "Please provide a screen width as the first argument"
showExample
exit 128
fi
if [ -z "$2" ]; then
echo "Please provide a screen height as the second argument"
showExample
exit 128
fi
if [ -z "$3" ]; then
echo "Please provide a refresh rate as the third argument"
showExample
exit 128
fi
#init
WIDTH=$1
HEIGHT=$2
REFRESH=$3
createRes || {
echo -e "\nERROR creating resolution with \"cvt\"\n"
exit 1
}
addRes || {
echo -e "\nERROR adding resolution with \"xrandr\"\n"
exit 1
}
exit 0
#!/bin/bash
# check have a delta argument
if [ -z "$1" ]; then
echo "Please provide a number of seconds to switch desktops as first argument"
exit 128
fi
if [ "$1" -lt 3 ]; then
echo "Please provide a number of seconds >= 3"
exit 128
fi
# init
numDesktops=2
desktop=$(xdotool get_desktop);
echo "Press Crtl+C or kill this script to stop the switching"
echo "Fist switch will occur in $1 seconds..."
while true
do
sleep $1
# change desktop
desktop=$((desktop + 1))
desktop=$((desktop % numDesktops))
xdotool set_desktop $desktop
done
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment