#!/bin/sh
#
#    Copyright (C) 2014-2022  Ruben Rodriguez <ruben@trisquel.info>
#
#    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
#

VERSION=5
COMPONENT=main

. ./config

sed 's/ubuntu/trisquel/' -i debian/rules

cat << EOF > debian/01_trisquel.conf
#
# background = Background file to use, either an image path or a color (e.g. #772953)
# theme-name = GTK+ theme to use
# icon-theme-name = Icon theme to use
# font-name = Font to use
# xft-antialias = Whether to antialias Xft fonts (true or false)
# xft-dpi = Resolution for Xft in dots per inch (e.g. 96)
# xft-hintstyle = What degree of hinting to use (none, slight, medium, or hintfull)
# xft-rgba = Type of subpixel antialiasing (none, rgb, bgr, vrgb or vbgr)
# indicators = semi-colon ";" separated list of allowed indicator modules. Built-in indicators include "~a11y", "~language", "~session", "~power". Unity indicators can be represented by short name (e.g. "sound", "power"), service file name, or absolute path
# show-clock (true or false)
# clock-format = strftime-format string, e.g. %H:%M
# keyboard = command to launch on-screen keyboard
# position = main window position: x y
# default-user-image = Image used as default user icon, path or #icon-name
# screensaver-timeout = Timeout (in seconds) until the screen blanks when the greeter is called as lockscreen
#
[greeter]
background=/usr/share/backgrounds/aramo.jpg
theme-name=Trisquel-dark
icon-theme-name=trisquel
indicators = ~clock;~spacer;~host;~spacer;~a11y;~language;~session;~power
default-user-image = /usr/share/pixmaps/trisquel.svg
keyboard = onboard
reader = orca-lightdm-wrapper
a11y-states = keyboard;reader;contrast;font
clock-format = %x %X
EOF

cat << EOF > orca-lightdm-wrapper
#!/bin/sh

# Make sure speech-dispatcher is not running
pkill -9 speech-dispatcher

# Make sure that pulseaudio is running and not muted. This prevents sound initialization errors in the lightdm session
pulseaudio --start
pactl set-sink-mute @DEFAULT_SINK@ true
pactl set-sink-mute @DEFAULT_SINK@ false

which espeak paplay >/dev/null && espeak "Trisquel login" --stdout|paplay
exec orca --replace --no-setup --disable splash-window, \$@
EOF
chmod 755 orca-lightdm-wrapper
echo orca-lightdm-wrapper /usr/bin >> debian/lightdm-gtk-greeter.install

# Add dependency on lightdm, to simplify metapackages
sed 's/Depends:/Depends: lightdm,\n/' -i debian/control

changelog "Trisquel themed"

package

