#!/bin/bash

#Load file mapings
. /usr/local/lib/desktop-session/desktop-session-file-locations.sh

TEXTDOMAINDIR=/usr/share/locale
TEXTDOMAIN=desktop-session-menu-window

TEXT=$"Your window manager was not one of the supported window managers. This window is to provide the same function as the Other Desktops menu"

OLDIFS="$IFS"
IFS="|"
while :
do 
    SWITCH_WM_EXEC=$(yad --width=300 --height=400 --title=$"Other Desktops" --text="$TEXT" --image-on-top --image="info" --list --radiolist --column="" --column=$"Session Name" --column="Session Exec:HD" `cat /usr/share/desktop-session/wm-menus/RAW-wm-menu` --print-column=3 $BUTTON --button=$"Disable Window":"3" --button=$"Control Center":"2" --button="gtk-cancel:1" --button="gtk-ok:0")
    case $? in
        0)  #echo "$SWITCH_WM_EXEC" # For testing without switching
            eval $SWITCH_WM_EXEC # Make the switch
            break
        ;;
        1)  break  ;;
        2)  antixcc.sh & ;;
        3)  sed -ir "s/^OTHER_DESKTOPS_WINDOW=\".*\"/OTHER_DESKTOPS_WINDOW=\"false\"/" $user_config;  
            break ;;
        *)  echo $"Not sure what to do with value $?" ;
            break ;;
    esac
done
IFS="$OLDIFS"
