#!/bin/bash

# Copyright (C) 2012-2015 X2Go Project - http://wiki.x2go.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Copyright (C) 2012-2015 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>

X2GO_SESSION=$1

# MATE's monitors.xml breaks full screen mode of X2Go/NX
if echo $X2GO_SESSION | egrep "$USER-[[:digit:]]{2,}-[[:digit:]]+_stDMATE_dp.*" >/dev/null; then
	test -w ~/.config/monitors.xml && mv ~/.config/monitors.xml ~/.config/monitors.xml.disabled-for-X2Go-session-start
	(sleep 20; test -w ~/.config/monitors.xml.disabled-for-X2Go-session-start && mv ~/.config/monitors.xml.disabled-for-X2Go-session-start ~/.config/monitors.xml;)&
fi
exit 0

