Unverified Commit 8b61b7d5 authored by David Beniamine's avatar David Beniamine
Browse files

No interactions if only one screen

parent 23a51e01
Loading
Loading
Loading
Loading
+27 −10
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@


timeout=10
timeout=10
DEBUG=true
DEBUG=true
interaction=true
log(){
log(){
    if $DEBUG
    if $DEBUG
    then
    then
@@ -173,10 +174,16 @@ run_xrandr_cmd(){
    echo $new_cmd > /tmp/vp
    echo $new_cmd > /tmp/vp
    $new_cmd
    $new_cmd
    log  "Runned $new_cmd"
    log  "Runned $new_cmd"
    if $interaction
    then
        zenity --question --title "Configuration des écrans" \
        zenity --question --title "Configuration des écrans" \
            --text "La configuration des écrans vous convient-elle ?" \
            --text "La configuration des écrans vous convient-elle ?" \
            --timeout=$timeout
            --timeout=$timeout
    if [ $? != 0 ]
        code=$?
    else
        code=1
    fi
    if [ $code != 0 ]
    then
    then
        log "Restoring old command : $old_cmd"
        log "Restoring old command : $old_cmd"
        $old_cmd
        $old_cmd
@@ -184,12 +191,22 @@ run_xrandr_cmd(){
    log "exiting on $(date)"
    log "exiting on $(date)"
}
}


if [ $(echo $screens$MAIN_SCREEN| wc -l) -eq 1 ]
then
    interaction=false
fi

if $interaction
then
    choice=$(zenity --entry --title "Écran connecté" \
    choice=$(zenity --entry --title "Écran connecté" \
        --text "Selection du mode d'affichage" \
        --text "Selection du mode d'affichage" \
        --entry-text "Clone" 'Écrans étendus à droite' 'Écrans étendus à gauche' \
        --entry-text "Clone" 'Écrans étendus à droite' 'Écrans étendus à gauche' \
        'Écrans étendus en haut' 'Écrans étendus en bas' \
        'Écrans étendus en haut' 'Écrans étendus en bas' \
        --timeout $timeout)
        --timeout $timeout)
    code=$?
    code=$?
else
    code=5
fi


log "Choice '$choice' / code $code"
log "Choice '$choice' / code $code"