Skip to content

Instantly share code, notes, and snippets.

@augustin64
Created November 22, 2021 19:57
Show Gist options
  • Save augustin64/2c32634751ad6ffbcaeb9993b7e70ec4 to your computer and use it in GitHub Desktop.
Save augustin64/2c32634751ad6ffbcaeb9993b7e70ec4 to your computer and use it in GitHub Desktop.
Self-describing
#!/usr/bin/sh
run() {
number=$1
shift
for _ in $(seq $number); do
$@
done
}
# Récupération des périphériques d'entrée connectés
devices=$(xinput list | grep -E "slave" | awk -Fid= '{print $2}' | awk '{print $1}')
# Désactive les périphériques 1 à 1
for i in $devices; do
xinput set-prop "$i" "Device Enabled" 0
done;
# Si le son est désactivé, il est activé à nouveau
if [[ $(pacmd list-sinks | awk '/muted/ {print $2}') == "yes" ]]; then
amixer set Master toggle
fi;
# Appuie 100 fois sur la touche volume+
run 100 "xdotool key XF86AudioRaiseVolume"
# Ouvre le rickroll
xdg-open https://www.youtube.com/watch\?v\=dQw4w9WgXcQ &
# Mettre le focus sur Firefox
xdotool windowactivate $(xdotool search --class Firefox)
# Attend que la page charge
sleep 5
# Met en plein écran
xdotool key f
# Attend que la vidéo se termine
sleep 212
# Réactive les périphériques
for i in $devices; do
xinput set-prop "$i" "Device Enabled" 1
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment