#!/bin/bash
#Auteur :      Christophe L pour Aciah
#licence :     GNU General Public Licence v3
# Dépendances : wmctrl -> sudo apt-get install wmctrl
# Description : Fermeture de toutes les fenêtres ouvertes
# Peut être apelé par le raccourci : CTRL + MAJ + X

# 
BURO="Desktop"

case $LANG in
	fr*)
        BURO="Bureau"
        ;;

esac

###

WIN_IDs=$(wmctrl -l | grep -vwE "($BURO)$|xfce4-panel$" | cut -f1 -d' ')
for i in $WIN_IDs; do 
    wmctrl -ic "$i";
done


# Keep checking and waiting until all windows are closed 
while [ $WIN_IDs ]; do 
    sleep 0.1; 
    WIN_IDs=$(wmctrl -l | grep -vwE "($BURO)$|xfce4-panel$" | cut -f1 -d' ')
done

exit 0