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