#!/bin/bash
mate-panel --reset --layout tuxedo

gsettings set org.mate.Marco.global-keybindings run-command-terminal ''

gsettings set org.mate.screensaver lock-enabled false
gsettings set org.mate.power-manager sleep-display- 1800
gsettings set org.mate.power-manager brightness-ac 100

gsettings set org.mate.power-manager action-sleep-type-ac 'nothing'
gsettings set org.mate.power-manager action-sleep-type-battery 'nothing'

gsettings set org.mate.power-manager button-lid-ac 'nothing'
gsettings set org.mate.power-manager button-lid-battery 'nothing'

gsettings set org.mate.power-manager button-hibernate 'nothing'
gsettings set org.mate.power-manager button-power 'nothing'
gsettings set org.mate.power-manager button-suspend 'nothing'

xhost + && sleep 2 && sudo -s pkexec calamares &

sleep 1

WID=$(xdotool search --sync --onlyvisible --name "Ubuntu MATE" | head -1)

xdotool windowactivate $WID
xdotool windowsize $WID 100% 100%
xdotool windowraise $WID

while true; do
  xdotool windowmap $WID
  sleep 0.5
  wmctrl -r "Ubuntu MATE" -b add,fullscreen
done
