Fix background for gdm

master3.3 3.1.3
parent 30689da83f
commit f748341b0a

@ -0,0 +1,63 @@
#!/usr/bin/env python
# Copyright 2008-2012 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from PySide import QtCore, QtGui
import os,sys
class ImageViewer(QtGui.QMainWindow):
def __init__(self):
super(ImageViewer, self).__init__()
self.setWindowFlags(QtCore.Qt.X11BypassWindowManagerHint)
self.imageLabel = QtGui.QLabel()
self.imageLabel.setScaledContents(True)
self.setCentralWidget(self.imageLabel)
screen = QtGui.QDesktopWidget().screenGeometry()
self.setGeometry(screen)
self.open('/usr/share/wallpapers/dm-background.png') or \
self.open('/usr/share/apps/ksplash/Themes/CalculateSplashEn/'
'400x300/background.png') or \
self.setBackground()
def selectColor(self):
try:
if filter(re.compile(r"(cld|cldx|cldg|cmc|cls)-themes-12").search,
os.listdir('/var/db/pkg/media-gfx')):
return "#73a363"
except:
pass
return '#30648b'
def setBackground(self):
self.setStyleSheet("background-color: %s"%self.selectColor())
def open(self,fileName):
image = QtGui.QImage(fileName)
if image.isNull():
return False
self.imageLabel.setPixmap(QtGui.QPixmap.fromImage(image))
self.imageLabel.adjustSize()
return True
if __name__ == '__main__':
import sys
app = QtGui.QApplication(sys.argv)
imageViewer = ImageViewer()
imageViewer.show()
sys.exit(app.exec_())

@ -83,6 +83,13 @@ umount_user_res(){
fi
}
gtk_background(){
if [[ -n $(env | grep RUNNING_UNDER_GDM=true) ]] && ls /var/db/pkg/gnome-base/gdm-2* &>/dev/null;
then
/usr/bin/env HOME=/root python2 /usr/share/calculate/xdm/setbg &
BG_PID=$(ps ax | sed -nr "s/^\s*([0-9]+)\s.*setbg$/\1/p")
fi
}
OPTS=$(getopt -o $SHORTOPTS --long $LONGOPTS -n "$progname" -- "$@")
@ -138,6 +145,7 @@ fi
FILELIST=$(find ${EXECDIR} -type f | sort)
[[ $FILELIST ]] || warning "${EXECDIR} hasn't scripts"
gtk_background
DOMAIN_USER="`desktop_variable_value desktop.ur_domain_set`"
for script in $FILELIST
do

@ -34,7 +34,8 @@ data_files = []
data_files += [('/usr/share/calculate/xdm', ['data/cmd_login',
'data/functions',
'data/xdm'])] + \
'data/xdm',
'data/setbg'])] + \
[('/usr/share/calculate/xdm/login.d',
['data/login.d/00init',
'data/login.d/20desktop',

Loading…
Cancel
Save