Skip to content

Commit

Permalink
Add shortcut for transparency (fix #481)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaetan Semet <[email protected]>
  • Loading branch information
gsemet committed Apr 21, 2015
1 parent 6ca26e6 commit 094a5f0
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
24 changes: 24 additions & 0 deletions data/guake.schemas
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,30 @@
</locale>
</schema>

<schema>
<key>/schemas/apps/guake/keybindings/local/increase_transparency</key>
<applyto>/apps/guake/keybindings/local/increase_transparency</applyto>
<owner>guake</owner>
<type>string</type>
<default>&lt;Control&gt;Shift&gt;Up</default>
<locale name="C">
<short>Increase transparency.</short>
<long>Increase the terminal transparency.</long>
</locale>
</schema>

<schema>
<key>/schemas/apps/guake/keybindings/local/decrease_transparency</key>
<applyto>/apps/guake/keybindings/local/decrease_transparency</applyto>
<owner>guake</owner>
<type>string</type>
<default>&lt;Control&gt;Shift&gt;Down</default>
<locale name="C">
<short>Decrease transparency.</short>
<long>Decrease the terminal transparency.</long>
</locale>
</schema>

<schema>
<key>/schemas/apps/guake/keybindings/local/clipboard_copy</key>
<applyto>/apps/guake/keybindings/local/clipboard_copy</applyto>
Expand Down
11 changes: 11 additions & 0 deletions src/guake/gconfhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ def __init__(self, guake):
keys = ['toggle_fullscreen', 'new_tab', 'close_tab', 'rename_current_tab',
'previous_tab', 'next_tab', 'clipboard_copy', 'clipboard_paste',
'quit', 'zoom_in', 'zoom_out', 'increase_height', 'decrease_height',
'increase_transparency', 'decrease_transparency',
"search_on_web", 'move_tab_left', 'move_tab_right',
'switch_tab1', 'switch_tab2', 'switch_tab3', 'switch_tab4', 'switch_tab5',
'switch_tab6', 'switch_tab7', 'switch_tab8', 'switch_tab9', 'switch_tab10'
Expand Down Expand Up @@ -468,6 +469,16 @@ def load_accelerators(self):
self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE,
self.guake.accel_decrease_height)

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

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

for tab in xrange(1, 11):
key, mask = gtk.accelerator_parse(gets('switch_tab%d' % tab))
if key > 0:
Expand Down
14 changes: 14 additions & 0 deletions src/guake/guake_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,20 @@ def accel_decrease_height(self, *args):
self.client.set_int(KEY('/general/window_height'), int(height) - 2)
return True

def accel_increase_transparency(self, *args):
"""Callback to increase transparency.
"""
transparency = self.client.get_int(KEY('/style/background/transparency'))
self.client.set_int(KEY('/style/background/transparency'), int(transparency) + 2)
return True

def accel_decrease_transparency(self, *args):
"""Callback to decrease transparency.
"""
transparency = self.client.get_int(KEY('/style/background/transparency'))
self.client.set_int(KEY('/style/background/transparency'), int(transparency) - 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/guake/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
'label': 'Increase height'},
{'key': LKEY('decrease_height'),
'label': 'Decrease height'},
{'key': LKEY('increase_transparency'),
'label': 'Increase transparency'},
{'key': LKEY('decrease_transparency'),
'label': 'Decrease transparency'},
]},

{'label': 'Clipboard',
Expand Down

0 comments on commit 094a5f0

Please sign in to comment.