summaryrefslogtreecommitdiffstats
path: root/FusionIcon/start.py
blob: 7dafdaddecdb44f71ff0ce6104901daa8ab14b6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This file is part of Fusion-icon.

# Fusion-icon 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.
#
# Fusion-icon 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, see <http://www.gnu.org/licenses/>.
#
# Author(s): crdlb, nesl247
#
# Copyright 2007 Christopher Williams <christopherw@verizon.net> 

from parser import options as parser_options
from util import env, config, apps, options, wms, decorators

def init():
	'Final start function, should be called once when fusion-icon starts'

	if not parser_options.no_start:
		# Do not restart the wm if it's already running
		if wms.active == wms.active == wms.old != 'compiz':
			#always restart compiz since we can't know compiz was started correctly
			print ' * %s is already running' %wms[wms.active].label
		else:
			print ' * Starting %s' %wms[wms.active].label
			wms.start()

config.check()

# Make some changes

if not parser_options.force_compiz:
	if wms.active not in wms:
		print ' * "%s" not installed' %wms.active
		if wms.fallback:
			print ' ... setting to fallback...'
		else:
			print ' ... No fallback window manager chosen'
		wms.active = wms.fallback
# if in a failsafe session, don't start with compiz (provides an easy way to make sure metacity starts for gnome users if compiz breaks)
	if wms.active == 'compiz' and env.failsafe:
		if wms.fallback:
			print ' * Failsafe session, setting to fallback...'
		else:
			print ' ... No fallback window manager chosen'
		
		wms.active = wms.fallback

elif 'compiz' in wms:
	wms.active = 'compiz'

else:
	raise SystemExit, ' *** Error: "--force-compiz" used and compiz not installed!'

# Set True if using Xorg AIGLX since the '--indirect-rendering' option has no effect in that situation. 
env.set()
if env.tfp == 'indirect' and 'indirect rendering' in options:
	options['indirect rendering'].sensitive = False
	if not options['indirect rendering'].enabled:
		options['indirect rendering'].enabled = True