Commit 68ae484a authored by Diego Pasqualin's avatar Diego Pasqualin

le-edubar: Fix logic about setting the default background

Signed-off-by: 's avatarDiego Pasqualin <dpasqualin@c3sl.ufpr.br>
parent ded2a68b
......@@ -19,7 +19,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
cont=0
width_old=0
height_old=0
dir="/usr/share/le-edubar/themes/Default-Single"
......@@ -32,7 +31,6 @@ v_height=( 600 760 768 768 800 1024 1200 1050 1080)
v_length=${#v_width[@]}
prefix="file:///usr/share/backgrounds/le5-wallpaper"
user=$(whoami|cut -d- -f1)
proinfo=check_proinfo
function get_screen_width () {
xrandr --current | grep current | cut -d"," -f 2 | cut -d" " -f3 2>/dev/null
......@@ -74,6 +72,7 @@ function replace_cairo_conf () {
cp "$dir/_MainDock_-2.conf" $conf2
fi
}
function set_default_background(){
local resolution=$1
gsettings set org.gnome.desktop.background picture-uri ${prefix}${resolution}.png
......@@ -83,9 +82,9 @@ function set_default_background(){
# The function verifies if the system is from proinfo project or private machine.
function check_proinfo(){
if dpkg --get-selections | grep -q le-proinfodata; then
return 0 # Return true to proinfo installed
echo "true" # Return true to proinfo installed
else
return 1
echo "false"
fi
}
......@@ -121,6 +120,8 @@ else
echo $current_pid > $lock
fi
proinfo=$(check_proinfo)
while true
do
reopen_edubar="false"
......@@ -130,18 +131,14 @@ do
height=$(get_screen_height)
div=$(echo "scale=1;$width/$height"|bc)
compare=$(echo "$div < 1.5"|bc)
if [ "$user" = "aluno" ] && $proinfo; then
adjust_background_default "$compare"
fi
# Check wallpaper if is the default and adjusts
if using_default_background; then
if [ "$cont" -eq "0" ]; then
let cont++
# We will force the aluno user to use the default background in the correct
# aspect ratio. Other users will get the aspect ratio fixed only if they are
# using the default background.
if [ "$proinfo" = "true" -a "$user" = "aluno" ] || using_default_background; then
adjust_background_default "$compare"
fi
else
cont=0
fi
# Check whether screen resolution has changed
if [ "$width" != "$width_old" -o "$height" != "$height_old" ]; then
width_old=$width
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment