Skip to content

Commit 5cc2fb0

Browse files
committed
Merge remote-tracking branch 'eMPee584/master'
2 parents 5e98d1f + 9fa202a commit 5cc2fb0

File tree

4 files changed

+87
-44
lines changed

4 files changed

+87
-44
lines changed

data/guake.schemas

+12
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@
105105
</locale>
106106
</schema>
107107

108+
<schema>
109+
<key>/schemas/apps/guake/general/start_fullscreen</key>
110+
<applyto>/apps/guake/general/start_fullscreen</applyto>
111+
<owner>guake</owner>
112+
<type>bool</type>
113+
<default>false</default>
114+
<locale name="C">
115+
<short>Start fullscreen.</short>
116+
<long>When true, the program will start in fullscreen mode.</long>
117+
</locale>
118+
</schema>
119+
108120
<schema>
109121
<key>/schemas/apps/guake/general/window_width</key>
110122
<applyto>/apps/guake/general/window_width</applyto>

data/prefs.glade

+14
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,20 @@
337337
<property name="position">2</property>
338338
</packing>
339339
</child>
340+
<child>
341+
<widget class="GtkCheckButton" id="start_fullscreen">
342+
<property name="label" translatable="yes">Start fullscreen</property>
343+
<property name="visible">True</property>
344+
<property name="can_focus">True</property>
345+
<property name="receives_default">False</property>
346+
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
347+
<property name="draw_indicator">True</property>
348+
<signal name="toggled" handler="on_start_fullscreen_toggled"/>
349+
</widget>
350+
<packing>
351+
<property name="position">3</property>
352+
</packing>
353+
</child>
340354
</widget>
341355
</child>
342356
</widget>

src/guake

+52-44
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ class GConfHandler(object):
193193
in guake.
194194
"""
195195
window_rect = self.guake.get_final_window_rect()
196-
self.guake.window.move(window_rect.x, window_rect.y)
197196
self.guake.window.resize(window_rect.width, window_rect.height)
197+
self.guake.window.move(window_rect.x, window_rect.y)
198198

199199
def scrollbar_toggled(self, client, connection_id, entry, data):
200200
"""If the gconf var use_scrollbar be changed, this method will
@@ -580,7 +580,7 @@ class Guake(SimpleGladeApp):
580580
self.selected_tab = None
581581

582582
# holds fullscreen status
583-
self.fullscreen = False
583+
self.is_fullscreen = False
584584

585585
# holds the timestamp of the losefocus event
586586
self.losefocus_time = 0
@@ -638,6 +638,9 @@ class Guake(SimpleGladeApp):
638638
label = gtk.accelerator_get_label(keyval, mask)
639639
filename = pixmapfile('guake-notification.png')
640640

641+
if self.client.get_bool(KEY('/general/start_fullscreen')):
642+
self.fullscreen()
643+
641644
if not self.hotkeys.bind(key, self.show_hide):
642645
notification = pynotify.Notification(
643646
_('Guake!'),
@@ -790,9 +793,8 @@ class Guake(SimpleGladeApp):
790793
if not self.term_list:
791794
self.add_tab()
792795

793-
window_rect = self.get_final_window_rect()
794-
self.window.move(window_rect.x, window_rect.y)
795-
self.window.resize(window_rect.width, window_rect.height)
796+
if not self.is_fullscreen:
797+
self.client.notify(KEY('/general/window_height'))
796798
self.window.show_all()
797799

798800
try:
@@ -955,36 +957,39 @@ class Guake(SimpleGladeApp):
955957

956958
def accel_toggle_fullscreen(self, *args):
957959
"""Callback toggle the fullscreen status of the main
958-
window. It uses the toolbar_visible_in_fullscreen variable
959-
from gconf to decide if the tabbar will or not be
960-
shown. Called by the accel key.
961-
"""
962-
val = self.client.get_bool(KEY('general/toolbar_visible_in_fullscreen'))
963-
964-
if not self.fullscreen:
965-
self.window.fullscreen()
966-
self.fullscreen = True
967-
968-
# The resizer widget really don't need to be shown in
969-
# fullscreen mode, but tabbar will only be shown if a
970-
# hidden gconf key is false.
971-
self.resizer.hide()
972-
if not val:
973-
self.toolbar.hide()
960+
window. Called by the accel key.
961+
"""
962+
963+
if not self.is_fullscreen:
964+
self.fullscreen()
974965
else:
975-
self.window.unfullscreen()
976-
self.fullscreen = False
977-
978-
# making sure that tabbar and resizer will come back to
979-
# their default state.
980-
self.client.notify(KEY('/general/window_tabbar'))
981-
self.client.notify(KEY('/general/show_resizer'))
982-
# make sure the window size is correct after returning
983-
# from fullscreen
984-
self.client.notify(KEY('/general/window_height'))
966+
self.unfullscreen()
985967

986968
return True
987969

970+
def fullscreen(self):
971+
self.window.fullscreen()
972+
self.is_fullscreen = True
973+
974+
# The resizer widget really don't need to be shown in
975+
# fullscreen mode, but tabbar will only be shown if a
976+
# hidden gconf key is false.
977+
self.resizer.hide()
978+
if not self.client.get_bool(KEY('general/toolbar_visible_in_fullscreen')):
979+
self.toolbar.hide()
980+
981+
def unfullscreen(self):
982+
self.window.unfullscreen()
983+
self.is_fullscreen = False
984+
985+
# making sure that tabbar and resizer will come back to
986+
# their default state.
987+
self.client.notify(KEY('/general/window_tabbar'))
988+
self.client.notify(KEY('/general/show_resizer'))
989+
# make sure the window size is correct after returning
990+
# from fullscreen. broken on old compiz/metacity versions :C
991+
self.client.notify(KEY('/general/window_height'))
992+
988993
# -- callbacks --
989994

990995
def on_terminal_exited(self, term, widget):
@@ -1317,6 +1322,10 @@ def main():
13171322
"""
13181323
from optparse import OptionParser
13191324
parser = OptionParser()
1325+
parser.add_option('-f', '--fullscreen', dest='fullscreen',
1326+
action='store_true', default=False,
1327+
help=_('Put Guake in fullscreen mode'))
1328+
13201329
parser.add_option('-t', '--toggle-visibility', dest='show_hide',
13211330
action='store_true', default=False,
13221331
help=_('Toggles the visibility of the terminal window'))
@@ -1367,47 +1376,46 @@ def main():
13671376
remote_object = DbusManager(instance)
13681377
already_running = False
13691378

1370-
called_with_param = False
1379+
only_show_hide = True
13711380

1372-
if options.show_hide:
1373-
remote_object.show_hide()
1374-
called_with_param = True
1381+
if options.fullscreen:
1382+
instance.fullscreen()
13751383

13761384
if options.show_preferences:
13771385
remote_object.show_prefs()
1378-
called_with_param = True
1386+
only_show_hide = False
13791387

13801388
if options.new_tab:
13811389
remote_object.add_tab(options.new_tab)
1382-
called_with_param = True
1390+
only_show_hide = False
13831391

13841392
if options.select_tab:
13851393
selected = int(options.select_tab)
13861394
remote_object.select_tab(selected)
1387-
called_with_param = True
1395+
only_show_hide = False
13881396

13891397
if options.selected_tab:
13901398
selected = remote_object.get_selected_tab()
13911399
sys.stdout.write('%d\n' % selected)
1392-
called_with_param = True
1400+
only_show_hide = False
13931401

13941402
if options.command:
13951403
remote_object.execute_command(options.command)
1396-
called_with_param = True
1404+
only_show_hide = False
13971405

13981406
if options.rename_tab:
13991407
remote_object.rename_current_tab(options.rename_tab)
1400-
called_with_param = True
1408+
only_show_hide = False
14011409

14021410
if options.show_about:
14031411
remote_object.show_about()
1404-
called_with_param = True
1412+
only_show_hide = False
14051413

14061414
if options.quit:
14071415
remote_object.quit()
1408-
called_with_param = True
1416+
only_show_hide = False
14091417

1410-
if not called_with_param and already_running:
1418+
if already_running and only_show_hide:
14111419
# here we know that guake was called without any parameter and
14121420
# it is already running, so, lets toggle its visibility.
14131421
remote_object.show_hide()

src/prefs.py

+9
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ def on_window_tabbar_toggled(self, chk):
172172
"""
173173
self.client.set_bool(KEY('/general/window_tabbar'), chk.get_active())
174174

175+
def on_start_fullscreen_toggled(self, chk):
176+
"""Changes the activity of start_fullscreen in gconf
177+
"""
178+
self.client.set_bool(KEY('/general/start_fullscreen'), chk.get_active())
179+
175180
def on_window_height_value_changed(self, hscale):
176181
"""Changes the value of window_height in gconf
177182
"""
@@ -478,6 +483,10 @@ def load_configs(self):
478483
value = self.client.get_bool(KEY('/general/window_tabbar'))
479484
self.get_widget('window_tabbar').set_active(value)
480485

486+
# start fullscreen
487+
value = self.client.get_bool(KEY('/general/start_fullscreen'))
488+
self.get_widget('start_fullscreen').set_active(value)
489+
481490
# scrollbar
482491
value = self.client.get_bool(KEY('/general/use_scrollbar'))
483492
self.get_widget('use_scrollbar').set_active(value)

0 commit comments

Comments
 (0)