Permalink
Browse files

Add shortcut for transparency (fix #481)

Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
  • Loading branch information...
gsemet committed Apr 21, 2015
1 parent 1dfa206 commit b2fd53053b0ff61757ca8fac2f97b3fa10d0be30
Showing with 53 additions and 0 deletions.
  1. +24 −0 data/guake.schemas
  2. +11 −0 src/guake/gconfhandler.py
  3. +14 −0 src/guake/guake_app.py
  4. +4 −0 src/guake/prefs.py
@@ -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>
@@ -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'
@@ -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:
@@ -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.
"""
@@ -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',

0 comments on commit b2fd530

Please sign in to comment.