#!/bin/bash output=$(xrandr | grep ' connected ' | awk '{print $1}' | head -1) echo $output > /tmp/montog screenSize=$(xrandr | awk 'BEGIN {foundOutput=0} / '$output' / {foundOutput=1} /\*\+/ {print $1} /^[^ ]/ {if(foundOutput) exit 0}') echo $screenSize >> /tmp/montog if [ "$screenSize" != "" ]; then xrandr --output $output --fb $screenSize --off if [[ $LANG == fr* ]]; then MESSAGE="Écran éteint" else MESSAGE="Monitor Off Now" fi else xrandr --output $output --auto if [[ $LANG == fr* ]]; then MESSAGE="Écran allumé" else MESSAGE="Monitor Back on" fi fi notify-send "$MESSAGE"