Ticket #162: Add-key-bindings-for-window-resizing.patch
| File Add-key-bindings-for-window-resizing.patch, 7.8 KB (added by astratto, 3 years ago) |
|---|
-
data/guake.schemas
From b34d0a2bba4f65d95d0dac4d422b0d721fad7578 Mon Sep 17 00:00:00 2001 From: Stefano Tortarolo <stefano.tortarolo@gmail.com> Date: Tue, 21 Jul 2009 14:22:54 +0200 Subject: [PATCH 4/4] Add key bindings for window resizing --- data/guake.schemas | 48 ++++++++++++++++++++++++++++++++++ src/guake.py | 65 +++++++++++++++++++++++++++++++++++++++++++++- src/guake_globals.py.in | 1 + src/prefs.py | 8 ++++++ 4 files changed, 120 insertions(+), 2 deletions(-) diff --git a/data/guake.schemas b/data/guake.schemas index b6b27b6..ae3e527 100644
a b 306 306 </schema> 307 307 308 308 <schema> 309 <key>/schemas/apps/guake/keybindings/local/increase_width</key> 310 <applyto>/apps/guake/keybindings/local/increase_width</applyto> 311 <owner>guake</owner> 312 <type>string</type> 313 <default><Control><Super>Right</default> 314 <locale name="C"> 315 <short>Increase width</short> 316 <long>Increase main window width.</long> 317 </locale> 318 </schema> 319 320 <schema> 321 <key>/schemas/apps/guake/keybindings/local/decrease_width</key> 322 <applyto>/apps/guake/keybindings/local/decrease_width</applyto> 323 <owner>guake</owner> 324 <type>string</type> 325 <default><Control><Super>Left</default> 326 <locale name="C"> 327 <short>Decrease main window width</short> 328 <long>Decrease main window width.</long> 329 </locale> 330 </schema> 331 332 <schema> 333 <key>/schemas/apps/guake/keybindings/local/increase_height</key> 334 <applyto>/apps/guake/keybindings/local/increase_height</applyto> 335 <owner>guake</owner> 336 <type>string</type> 337 <default><Control><Super>Up</default> 338 <locale name="C"> 339 <short>Increase height</short> 340 <long>Increase main window height.</long> 341 </locale> 342 </schema> 343 344 <schema> 345 <key>/schemas/apps/guake/keybindings/local/decrease_height</key> 346 <applyto>/apps/guake/keybindings/local/decrease_height</applyto> 347 <owner>guake</owner> 348 <type>string</type> 349 <default><Control><Super>Down</default> 350 <locale name="C"> 351 <short>Decrease main window height</short> 352 <long>Decrease main window height.</long> 353 </locale> 354 </schema> 355 356 <schema> 309 357 <key>/schemas/apps/guake/keybindings/local/new_tab</key> 310 358 <applyto>/apps/guake/keybindings/local/new_tab</applyto> 311 359 <owner>guake</owner> -
src/guake.py
diff --git a/src/guake.py b/src/guake.py index cb7afd4..1bdd0f3 100644
a b 43 43 from common import test_gconf, pixmapfile, gladefile, ShowableError, _ 44 44 from guake_globals import NAME, VERSION, LOCALE_DIR, KEY, GCONF_PATH, \ 45 45 TERMINAL_MATCH_EXPRS, TERMINAL_MATCH_TAGS, \ 46 ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER 46 ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, WINDOW_RESIZING_STEP 47 47 48 48 pynotify.init('Guake!') 49 49 … … 315 315 316 316 keys = ['toggle_fullscreen', 'new_tab', 'close_tab', 'rename_tab', 317 317 'previous_tab', 'next_tab', 'clipboard_copy', 'clipboard_paste', 318 'quit', 318 'quit', 'increase_width', 'decrease_width', 'increase_height', 319 'decrease_height', 319 320 ] 320 321 for key in keys: 321 322 notify_add(LKEY(key), self.reload_accelerators) … … 354 355 self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE, 355 356 gtk.main_quit) 356 357 358 key, mask = gtk.accelerator_parse(gets('increase_width')) 359 if key > 0: 360 self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE, 361 self.guake.accel_wincrease) 362 363 key, mask = gtk.accelerator_parse(gets('decrease_width')) 364 if key > 0: 365 self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE, 366 self.guake.accel_wdecrease) 367 368 key, mask = gtk.accelerator_parse(gets('increase_height')) 369 if key > 0: 370 self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE, 371 self.guake.accel_hincrease) 372 373 key, mask = gtk.accelerator_parse(gets('decrease_height')) 374 if key > 0: 375 self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE, 376 self.guake.accel_hdecrease) 377 357 378 key, mask = gtk.accelerator_parse(gets('new_tab')) 358 379 if key > 0: 359 380 self.accel_group.connect_group(key, mask, gtk.ACCEL_VISIBLE, … … 882 903 883 904 return True 884 905 906 def accel_wincrease(self, *args): 907 """Callback increase width using the window_width variable 908 """ 909 width = self.client.get_int(KEY('/general/window_width')) 910 if width + WINDOW_RESIZING_STEP >= 100: 911 width = 100 912 else: 913 width += WINDOW_RESIZING_STEP 914 self.client.set_int(KEY('/general/window_width'), width) 915 916 def accel_wdecrease(self, *args): 917 """Callback decrease width using the window_width variable 918 """ 919 width = self.client.get_int(KEY('/general/window_width')) 920 if width - WINDOW_RESIZING_STEP <= 0: 921 width = WINDOW_RESIZING_STEP 922 else: 923 width -= WINDOW_RESIZING_STEP 924 self.client.set_int(KEY('/general/window_width'), width) 925 926 def accel_hincrease(self, *args): 927 """Callback increase height using the window_height variable 928 """ 929 height = self.client.get_int(KEY('/general/window_height')) 930 if height + WINDOW_RESIZING_STEP >= 100: 931 height = 100 932 else: 933 height += WINDOW_RESIZING_STEP 934 self.client.set_int(KEY('/general/window_height'), height) 935 936 def accel_hdecrease(self, *args): 937 """Callback decrease height using the window_height variable 938 """ 939 height = self.client.get_int(KEY('/general/window_height')) 940 if height - WINDOW_RESIZING_STEP <= 0: 941 height = WINDOW_RESIZING_STEP 942 else: 943 height -= WINDOW_RESIZING_STEP 944 self.client.set_int(KEY('/general/window_height'), height) 945 885 946 # -- callbacks -- 886 947 887 948 def on_terminal_exited(self, term, widget): -
src/guake_globals.py.in
diff --git a/src/guake_globals.py.in b/src/guake_globals.py.in index 002e55a..aea240e 100644
a b 56 56 57 57 TERMINAL_MATCH_TAGS = 'schema', 'http', 'email' 58 58 ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT = range(3) 59 WINDOW_RESIZING_STEP = 10 -
src/prefs.py
diff --git a/src/prefs.py b/src/prefs.py index 92b6293..ab33cdf 100644
a b 57 57 'label': _('Toggle Guake visibility')}, 58 58 {'key': LKEY('toggle_fullscreen'), 59 59 'label': _('Toggle Fullscreen')}, 60 {'key': LKEY('increase_width'), 61 'label': _('Increase width')}, 62 {'key': LKEY('decrease_width'), 63 'label': _('Decrease width')}, 64 {'key': LKEY('increase_height'), 65 'label': _('Increase height')}, 66 {'key': LKEY('decrease_height'), 67 'label': _('Decrease height')}, 60 68 {'key': LKEY('quit'), 61 69 'label': _('Quit')}, 62 70 ]},