You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
#!/usr/bin/env python
|
|
# Copyright 2008-2010 Mir 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.
|
|
|
|
import pygtk
|
|
pygtk.require('2.0')
|
|
import gtk
|
|
import os
|
|
import sys
|
|
import re
|
|
import subprocess
|
|
|
|
if __name__ == "__main__":
|
|
if gtk.gdk.get_display():
|
|
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
|
|
|
# Here we connect the "destroy" event to a signal handler
|
|
window.connect("destroy", lambda w: gtk.main_quit())
|
|
pipe = subprocess.Popen(["xdpyinfo"],
|
|
stdout=subprocess.PIPE, env=os.environ)
|
|
reRes = re.compile("dimensions:\s+(\d+)x(\d+)\s+pixels")
|
|
cx, cy = 1024, 768
|
|
if pipe.wait() == 0:
|
|
for line in pipe.stdout:
|
|
searchRes = reRes.search(line)
|
|
if searchRes:
|
|
cx, cy = int(searchRes.group(1)), int(searchRes.group(2))
|
|
break
|
|
pipe.stdout.close()
|
|
window.set_size_request(cx,cy)
|
|
window.maximize()
|
|
|
|
window.set_border_width(0)
|
|
window.modify_bg(gtk.STATE_NORMAL,
|
|
gtk.gdk.rgb_get_colormap().alloc_color('#5F7583'))
|
|
|
|
window.show()
|
|
pid = os.fork()
|
|
if not pid:
|
|
gtk.main()
|
|
sys.exit(0)
|