Skip to content

Commit

Permalink
Adds shortcuts to increase and decrease height
Browse files Browse the repository at this point in the history
  • Loading branch information
seth-- committed Aug 11, 2014
1 parent 00408c3 commit e0f5d00
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
24 changes: 24 additions & 0 deletions data/guake.schemas
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,30 @@
</locale>
</schema>

<schema>
<key>/schemas/apps/guake/keybindings/local/increase_height</key>
<applyto>/apps/guake/keybindings/local/increase_height</applyto>
<owner>guake</owner>
<type>string</type>
<default>&lt;Control&gt;Down</default>
<locale name="C">
<short>Increase height.</short>
<long>Increase the screen height.</long>
</locale>
</schema>

<schema>
<key>/schemas/apps/guake/keybindings/local/decrease_height</key>
<applyto>/apps/guake/keybindings/local/decrease_height</applyto>
<owner>guake</owner>
<type>string</type>
<default>&lt;Control&gt;Up</default>
<locale name="C">
<short>Decrease height.</short>
<long>Decrease the screen height.</long>
</locale>
</schema>

<schema>
<key>/schemas/apps/guake/keybindings/local/clipboard_copy</key>
<applyto>/apps/guake/keybindings/local/clipboard_copy</applyto>
Expand Down
34 changes: 33 additions & 1 deletion src/guake
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ class GConfKeyHandler(object):

keys = ['toggle_fullscreen', 'new_tab', 'close_tab', 'rename_current_tab',
'previous_tab', 'next_tab', 'clipboard_copy', 'clipboard_paste',
'quit', 'zoom_in', 'zoom_out', "search_on_web",
'quit', 'zoom_in', 'zoom_out', 'increase_height', 'decrease_height', "search_on_web",
'switch_tab1', 'switch_tab2', 'switch_tab3', 'switch_tab4', 'switch_tab5',
'switch_tab6', 'switch_tab7', 'switch_tab8', 'switch_tab9', 'switch_tab10'
]
Expand Down Expand Up @@ -492,6 +492,16 @@ class GConfKeyHandler(object):
self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE,
self.guake.accel_zoom_out)

key, mask = gtk.accelerator_parse(gets('increase_height'))
if key > 0:
self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE,
self.guake.accel_increase_height)

key, mask = gtk.accelerator_parse(gets('decrease_height'))
if key > 0:
self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE,
self.guake.accel_decrease_height)

for tab in xrange(1, 11):
key, mask = gtk.accelerator_parse(gets('switch_tab%d' % tab))
if key > 0:
Expand Down Expand Up @@ -1228,6 +1238,28 @@ class Guake(SimpleGladeApp):
term.decrease_font_size()
return True

def accel_increase_height(self, *args):
"""Callback to increase height.
"""
try:
height = self.client.get_float(KEY('/general/window_height'))
except:
height = self.client.get_int(KEY('/general/window_height'))

self.client.set_int(KEY('/general/window_height'), int(height) + 2)
return True

def accel_decrease_height(self, *args):
"""Callback to decrease height.
"""
try:
height = self.client.get_float(KEY('/general/window_height'))
except:
height = self.client.get_int(KEY('/general/window_height'))

self.client.set_int(KEY('/general/window_height'), int(height) - 2)
return True

def accel_add(self, *args):
"""Callback to add a new tab. Called by the accel key.
"""
Expand Down
4 changes: 4 additions & 0 deletions src/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
'label': 'Zoom in'},
{'key': LKEY('zoom_in_alt'),
'label': 'Zoom in (alternative)'},
{'key': LKEY('increase_height'),
'label': 'Increase height'},
{'key': LKEY('decrease_height'),
'label': 'Decrease height'},
]},

{'label': 'Clipboard',
Expand Down

0 comments on commit e0f5d00

Please sign in to comment.