Merge lp:~waldner/terminator/fast-resize into lp:terminator/gtk3
- fast-resize
- Merge into gtk3
Status: | Needs review | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~waldner/terminator/fast-resize | ||||
Merge into: | lp:terminator/gtk3 | ||||
Diff against target: |
395 lines (+159/-18) 8 files modified
doc/terminator_config.5 (+20/-0) terminatorlib/config.py (+5/-0) terminatorlib/container.py (+1/-1) terminatorlib/notebook.py (+1/-1) terminatorlib/paned.py (+13/-7) terminatorlib/preferences.glade (+80/-3) terminatorlib/prefseditor.py (+22/-1) terminatorlib/terminal.py (+17/-5) |
||||
To merge this branch: | bzr merge lp:~waldner/terminator/fast-resize | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Terminator | Pending | ||
Review via email: mp+341534@code.launchpad.net |
Commit message
Add new option for fast-resizing. Update glade and man page.
Description of the change
Add new option for fast-resizing. Update glade and man page.
Discussion at https:/
Bryce Harrington (bryce) wrote : | # |
> Any news on this?
I would recommend not to use the shift+arrow key combos. I suspect the reason they're unused is because for some people and some keyboards that combo is hit a lot accidentally. If alt+ctrl+
As I think Stephen already mentioned, it's hard to find unused key combos for Terminator, so wise to avoid adding new ones unless absolutely necessary.
If the need for this patch is primarily due to need for configuring your terminal layout on startup, it may be overall better to look at creating a profile with pre-defined terminal window layouts. I can explain how to do this if that's your use case.
In the first comment of the bug report, the idea was floated to make the resize amount for ctrl+shift+arrow configurable. Would that satisfy your requirements? If so, it may be a way to avoid using up key combos.
Waldner (waldner) wrote : | # |
After a bit of experimenting, I settled on the separate keyboard shortcut for fast resize because I wanted to be able to alternate regular (slow) and fast resizing as needed, depending on what I'm doing.
Also, using a preset configuration to be applied at terminal startup doesn't work for me, since I keep splitting/removing windows all the time and the need to do a fast resize at a given moment is dictated by the task I'm actually performing (eg, I need to quickly resize to better see a long log line, but then I resize back just as quickly).
Shift+arrow keys is what works for me, and as far as I can see it's unused in terminator (as per terminatorlib/
- 1796. By Waldner
-
Safer default keyboard shortcuts for fast resize function, as per discussion
at https://code.launchpad .net/~waldner/ terminator/ fast-resize/ +merge/ 341534
Waldner (waldner) wrote : | # |
FWIW, here's the safer default of <Ctrl><
Waldner (waldner) wrote : | # |
Is there anything else that should be done to get this in shape?
Unmerged revisions
- 1796. By Waldner
-
Safer default keyboard shortcuts for fast resize function, as per discussion
at https://code.launchpad .net/~waldner/ terminator/ fast-resize/ +merge/ 341534 - 1795. By Waldner
-
New "fast resize" functionality, updated glade and man page.
Preview Diff
1 | === modified file 'doc/terminator_config.5' |
2 | --- doc/terminator_config.5 2016-12-06 01:01:48 +0000 |
3 | +++ doc/terminator_config.5 2018-08-11 15:07:16 +0000 |
4 | @@ -78,6 +78,10 @@ |
5 | If set to True, the tab bar will not fill the width of the window. The titlebars of the tabs will only take as much space as is necessary for the text they contain. Except, that is, if the tabs no longer fit the width of the window - in that case scroll buttons will appear to move through the tabs. |
6 | Default value: \fBFalse\fR |
7 | .TP |
8 | +.B resize_multiplier \fR(integer) |
9 | +When resizing the terminal using "fast" mode (eg with Shift + arrow keys), how many rows or column to move at a time. Setting this to a higher value is useful especially for horizontal resizing on very wide screens. See \fBresize_up_fast\fR, \fBresize_down_fast\fR, \fBresize_left_fast\fR, \fBresize_right_fast\fR. |
10 | +Default value: \fB1\fR |
11 | +.TP |
12 | .B try_posix_regexp \fR(boolean) |
13 | If set to True, URL matching regexps will try to use POSIX style first, and fall back on GNU style on failure. If you are on Linux but URL matches don't work, try setting this to True. If you are not on Linux, but you get VTE warnings on startup saying "Error compiling regular expression", set this to False to silence them (they are otherwise harmless). |
14 | Default value: \fBFalse\fR on Linux, \fBTrue\fR otherwise. |
15 | @@ -244,18 +248,34 @@ |
16 | Move the parent dragbar upwards. |
17 | Default value: \fB<Ctrl><Shift>Up\fR |
18 | .TP |
19 | +.B resize_up_fast |
20 | +Move the parent dragbar upwards (\fBresize_multiplier\fR rows at a time). |
21 | +Default value: \fB<Ctrl><Shift><Alt>Up\fR |
22 | +.TP |
23 | .B resize_down |
24 | Move the parent dragbar downwards. |
25 | Default value: \fB<Ctrl><Shift>Down\fR |
26 | .TP |
27 | +.B resize_down_fast |
28 | +Move the parent dragbar downwards (\fBresize_multiplier\fR rows at a time). |
29 | +Default value: \fB<Ctrl><Shift><Alt>Down\fR |
30 | +.TP |
31 | .B resize_left |
32 | Move the parent dragbar left. |
33 | Default value: \fB<Ctrl><Shift>Left\fR |
34 | .TP |
35 | +.B resize_left_fast |
36 | +Move the parent dragbar left (\fBresize_multiplier\fR columns at a time). |
37 | +Default value: \fB<Ctrl><Shift><Alt>Left\fR |
38 | +.TP |
39 | .B resize_right |
40 | Move the parent dragbar right. |
41 | Default value: \fB<Ctrl><Shift>Right\fR |
42 | .TP |
43 | +.B resize_right_fast |
44 | +Move the parent dragbar right (\fBresize_multiplier\fR columns at a time). |
45 | +Default value: \fB<Ctrl><Shift><Alt>Right\fR |
46 | +.TP |
47 | .B move_tab_right |
48 | Swap the current tab with the one to its right. |
49 | Default value: \fB<Ctrl><Shift>Page_Down\fR |
50 | |
51 | === modified file 'terminatorlib/config.py' |
52 | --- terminatorlib/config.py 2017-02-01 09:03:29 +0000 |
53 | +++ terminatorlib/config.py 2018-08-11 15:07:16 +0000 |
54 | @@ -102,6 +102,7 @@ |
55 | 'sticky' : False, |
56 | 'use_custom_url_handler': False, |
57 | 'custom_url_handler' : '', |
58 | + 'resize_multiplier' : 1, |
59 | 'disable_real_transparency' : False, |
60 | 'title_hide_sizetext' : False, |
61 | 'title_transmit_fg_color' : '#ffffff', |
62 | @@ -154,6 +155,10 @@ |
63 | 'resize_down' : '<Shift><Control>Down', |
64 | 'resize_left' : '<Shift><Control>Left', |
65 | 'resize_right' : '<Shift><Control>Right', |
66 | + 'resize_up_fast' : '<Ctrl><Shift><Alt>Up', |
67 | + 'resize_down_fast' : '<Ctrl><Shift><Alt>Down', |
68 | + 'resize_left_fast' : '<Ctrl><Shift><Alt>Left', |
69 | + 'resize_right_fast': '<Ctrl><Shift><Alt>Right', |
70 | 'move_tab_right' : '<Shift><Control>Page_Down', |
71 | 'move_tab_left' : '<Shift><Control>Page_Up', |
72 | 'toggle_zoom' : '<Shift><Control>x', |
73 | |
74 | === modified file 'terminatorlib/container.py' |
75 | --- terminatorlib/container.py 2017-02-11 18:59:31 +0000 |
76 | +++ terminatorlib/container.py 2018-08-11 15:07:16 +0000 |
77 | @@ -131,7 +131,7 @@ |
78 | self.terminator.group_hoover() |
79 | return(True) |
80 | |
81 | - def resizeterm(self, widget, keyname): |
82 | + def resizeterm(self, widget, keyname, fast = False): |
83 | """Handle a keyboard event requesting a terminal resize""" |
84 | raise NotImplementedError('resizeterm') |
85 | |
86 | |
87 | === modified file 'terminatorlib/notebook.py' |
88 | --- terminatorlib/notebook.py 2017-02-13 16:30:37 +0000 |
89 | +++ terminatorlib/notebook.py 2018-08-11 15:07:16 +0000 |
90 | @@ -376,7 +376,7 @@ |
91 | err('Notebook::closetab: child is unknown type %s' % child) |
92 | return |
93 | |
94 | - def resizeterm(self, widget, keyname): |
95 | + def resizeterm(self, widget, keyname, fast = False): |
96 | """Handle a keyboard event requesting a terminal resize""" |
97 | raise NotImplementedError('resizeterm') |
98 | |
99 | |
100 | === modified file 'terminatorlib/paned.py' |
101 | --- terminatorlib/paned.py 2017-02-13 16:30:37 +0000 |
102 | +++ terminatorlib/paned.py 2018-08-11 15:07:16 +0000 |
103 | @@ -31,7 +31,7 @@ |
104 | self.signals.append({'name': 'resize-term', |
105 | 'flags': GObject.SignalFlags.RUN_LAST, |
106 | 'return_type': None, |
107 | - 'param_types': (GObject.TYPE_STRING,)}) |
108 | + 'param_types': (GObject.TYPE_STRING, GObject.TYPE_BOOLEAN)}) |
109 | |
110 | |
111 | # pylint: disable-msg=W0613 |
112 | @@ -323,16 +323,22 @@ |
113 | parent.replace(self, child) |
114 | del(self) |
115 | |
116 | - def resizeterm(self, widget, keyname): |
117 | + def resizeterm(self, widget, keyname, fast = False): |
118 | """Handle a keyboard event requesting a terminal resize""" |
119 | + |
120 | + if fast: |
121 | + multiplier = self.config['resize_multiplier'] |
122 | + else: |
123 | + multiplier = 1 |
124 | + |
125 | if keyname in ['up', 'down'] and isinstance(self, Gtk.VPaned): |
126 | # This is a key we can handle |
127 | position = self.get_position() |
128 | |
129 | if self.maker.isinstance(widget, 'Terminal'): |
130 | - fontheight = widget.vte.get_char_height() |
131 | + fontheight = widget.vte.get_char_height() * multiplier |
132 | else: |
133 | - fontheight = 10 |
134 | + fontheight = 10 * multiplier |
135 | |
136 | if keyname == 'up': |
137 | self.set_position(position - fontheight) |
138 | @@ -343,9 +349,9 @@ |
139 | position = self.get_position() |
140 | |
141 | if self.maker.isinstance(widget, 'Terminal'): |
142 | - fontwidth = widget.vte.get_char_width() |
143 | + fontwidth = widget.vte.get_char_width() * multiplier |
144 | else: |
145 | - fontwidth = 10 |
146 | + fontwidth = 10 * multiplier |
147 | |
148 | if keyname == 'left': |
149 | self.set_position(position - fontwidth) |
150 | @@ -353,7 +359,7 @@ |
151 | self.set_position(position + fontwidth) |
152 | else: |
153 | # This is not a key we can handle |
154 | - self.emit('resize-term', keyname) |
155 | + self.emit('resize-term', keyname, fast) |
156 | |
157 | def create_layout(self, layout): |
158 | """Apply layout configuration""" |
159 | |
160 | === modified file 'terminatorlib/preferences.glade' |
161 | --- terminatorlib/preferences.glade 2016-12-13 21:08:02 +0000 |
162 | +++ terminatorlib/preferences.glade 2018-08-11 15:07:16 +0000 |
163 | @@ -1,5 +1,5 @@ |
164 | <?xml version="1.0" encoding="UTF-8"?> |
165 | -<!-- Generated with glade 3.18.3 --> |
166 | +<!-- Generated with glade 3.20.2 --> |
167 | <interface> |
168 | <requires lib="gtk+" version="3.10"/> |
169 | <object class="GtkListStore" id="BackspaceKeyListStore"> |
170 | @@ -348,6 +348,11 @@ |
171 | <property name="step_increment">0.10000000000000001</property> |
172 | <property name="page_increment">0.20000000000000001</property> |
173 | </object> |
174 | + <object class="GtkAdjustment" id="adjustment8"> |
175 | + <property name="upper">100</property> |
176 | + <property name="step_increment">1</property> |
177 | + <property name="page_increment">10</property> |
178 | + </object> |
179 | <object class="GtkAdjustment" id="background_darkness_scale"> |
180 | <property name="upper">1</property> |
181 | <property name="step_increment">0.10000000000000001</property> |
182 | @@ -1014,6 +1019,55 @@ |
183 | <property name="top_attach">0</property> |
184 | </packing> |
185 | </child> |
186 | + <child> |
187 | + <object class="GtkLabel" id="label34"> |
188 | + <property name="visible">True</property> |
189 | + <property name="can_focus">False</property> |
190 | + <property name="tooltip_text" translatable="yes">How many rows/columns at a time to resize with ctrl+shift+alt+arrow</property> |
191 | + <property name="label" translatable="yes">Resize multiplier: </property> |
192 | + <property name="xalign">0</property> |
193 | + </object> |
194 | + <packing> |
195 | + <property name="left_attach">0</property> |
196 | + <property name="top_attach">3</property> |
197 | + </packing> |
198 | + </child> |
199 | + <child> |
200 | + <object class="GtkScale" id="resize_multiplier_scale"> |
201 | + <property name="visible">True</property> |
202 | + <property name="can_focus">True</property> |
203 | + <property name="hexpand">True</property> |
204 | + <property name="adjustment">adjustment8</property> |
205 | + <property name="digits">3</property> |
206 | + <property name="draw_value">False</property> |
207 | + <signal name="value-changed" handler="on_resize_multiplier_changed" swapped="no"/> |
208 | + </object> |
209 | + <packing> |
210 | + <property name="left_attach">2</property> |
211 | + <property name="top_attach">3</property> |
212 | + </packing> |
213 | + </child> |
214 | + <child> |
215 | + <object class="GtkLabel" id="resize_multiplier_label"> |
216 | + <property name="visible">True</property> |
217 | + <property name="can_focus">False</property> |
218 | + <property name="halign">end</property> |
219 | + <property name="label" translatable="yes">1</property> |
220 | + </object> |
221 | + <packing> |
222 | + <property name="left_attach">1</property> |
223 | + <property name="top_attach">3</property> |
224 | + </packing> |
225 | + </child> |
226 | + <child> |
227 | + <placeholder/> |
228 | + </child> |
229 | + <child> |
230 | + <placeholder/> |
231 | + </child> |
232 | + <child> |
233 | + <placeholder/> |
234 | + </child> |
235 | </object> |
236 | <packing> |
237 | <property name="expand">True</property> |
238 | @@ -1308,8 +1362,8 @@ |
239 | <property name="use_action_appearance">False</property> |
240 | <property name="visible">True</property> |
241 | <property name="can_focus">True</property> |
242 | - <property name="receives_default">True</property> |
243 | <property name="focus_on_click">False</property> |
244 | + <property name="receives_default">True</property> |
245 | <property name="font">Sans 12</property> |
246 | <property name="title" translatable="yes">Choose A Titlebar Font</property> |
247 | <property name="use_font">True</property> |
248 | @@ -1535,8 +1589,8 @@ |
249 | <property name="use_action_appearance">False</property> |
250 | <property name="visible">True</property> |
251 | <property name="can_focus">True</property> |
252 | - <property name="receives_default">True</property> |
253 | <property name="focus_on_click">False</property> |
254 | + <property name="receives_default">True</property> |
255 | <property name="font">Sans 12</property> |
256 | <property name="title" translatable="yes">Choose A Terminal Font</property> |
257 | <property name="use_font">True</property> |
258 | @@ -1667,6 +1721,26 @@ |
259 | <property name="position">6</property> |
260 | </packing> |
261 | </child> |
262 | + <child> |
263 | + <object class="GtkBox"> |
264 | + <property name="visible">True</property> |
265 | + <property name="can_focus">False</property> |
266 | + <child> |
267 | + <placeholder/> |
268 | + </child> |
269 | + <child> |
270 | + <placeholder/> |
271 | + </child> |
272 | + <child> |
273 | + <placeholder/> |
274 | + </child> |
275 | + </object> |
276 | + <packing> |
277 | + <property name="expand">False</property> |
278 | + <property name="fill">True</property> |
279 | + <property name="position">7</property> |
280 | + </packing> |
281 | + </child> |
282 | </object> |
283 | <packing> |
284 | <property name="expand">False</property> |
285 | @@ -3875,6 +3949,9 @@ |
286 | </child> |
287 | </object> |
288 | </child> |
289 | + <child type="titlebar"> |
290 | + <placeholder/> |
291 | + </child> |
292 | </object> |
293 | <object class="GtkSizeGroup" id="sizegroup1"> |
294 | <widgets> |
295 | |
296 | === modified file 'terminatorlib/prefseditor.py' |
297 | --- terminatorlib/prefseditor.py 2017-06-24 02:02:38 +0000 |
298 | +++ terminatorlib/prefseditor.py 2018-08-11 15:07:16 +0000 |
299 | @@ -127,6 +127,10 @@ |
300 | 'resize_down' : _('Resize the terminal down'), |
301 | 'resize_left' : _('Resize the terminal left'), |
302 | 'resize_right' : _('Resize the terminal right'), |
303 | + 'resize_up_fast' : _('Resize the terminal up (faster)'), |
304 | + 'resize_down_fast' : _('Resize the terminal down (faster)'), |
305 | + 'resize_left_fast' : _('Resize the terminal left (faster)'), |
306 | + 'resize_right_fast': _('Resize the terminal right (faster)'), |
307 | 'move_tab_right' : _('Move the tab right'), |
308 | 'move_tab_left' : _('Move the tab left'), |
309 | 'toggle_zoom' : _('Maximize terminal'), |
310 | @@ -223,7 +227,6 @@ |
311 | """Update the preferences window with all the configuration from |
312 | Config()""" |
313 | guiget = self.builder.get_object |
314 | - |
315 | ## Global tab |
316 | # Mouse focus |
317 | focus = self.config['focus'] |
318 | @@ -292,6 +295,11 @@ |
319 | # homogeneous_tabbar |
320 | widget = guiget('homogeneouscheck') |
321 | widget.set_active(self.config['homogeneous_tabbar']) |
322 | + # resize_multiplier |
323 | + widget = guiget('resize_multiplier_scale') |
324 | + widget.set_value(int(self.config['resize_multiplier'])) |
325 | + widget = guiget('resize_multiplier_label') |
326 | + widget.set_text('%d' % (int(self.config['resize_multiplier']))) |
327 | # DBus Server |
328 | widget = guiget('dbuscheck') |
329 | widget.set_active(self.config['dbus']) |
330 | @@ -700,6 +708,19 @@ |
331 | self.config['borderless'] = not widget.get_active() |
332 | self.config.save() |
333 | |
334 | + def on_resize_multiplier_changed(self, widget): |
335 | + """resize_multiplier setting changed""" |
336 | + value = widget.get_value() |
337 | + if value < 1: |
338 | + value = 1 |
339 | + if value > 100: |
340 | + value = 100 |
341 | + self.config['resize_multiplier'] = int(value) |
342 | + self.config.save() |
343 | + guiget = self.builder.get_object |
344 | + label_widget = guiget('resize_multiplier_label') |
345 | + label_widget.set_text('%d' % (int(value))) |
346 | + |
347 | def on_extrastylingcheck_toggled(self, widget): |
348 | """Extra styling setting changed""" |
349 | self.config['extra_styling'] = widget.get_active() |
350 | |
351 | === modified file 'terminatorlib/terminal.py' |
352 | --- terminatorlib/terminal.py 2017-06-24 02:02:38 +0000 |
353 | +++ terminatorlib/terminal.py 2018-08-11 15:07:16 +0000 |
354 | @@ -56,7 +56,7 @@ |
355 | 'maximise': (GObject.SignalFlags.RUN_LAST, None, ()), |
356 | 'unzoom': (GObject.SignalFlags.RUN_LAST, None, ()), |
357 | 'resize-term': (GObject.SignalFlags.RUN_LAST, None, |
358 | - (GObject.TYPE_STRING,)), |
359 | + (GObject.TYPE_STRING, GObject.TYPE_BOOLEAN)), |
360 | 'navigate': (GObject.SignalFlags.RUN_LAST, None, |
361 | (GObject.TYPE_STRING,)), |
362 | 'tab-change': (GObject.SignalFlags.RUN_LAST, None, |
363 | @@ -1742,16 +1742,28 @@ |
364 | self.close() |
365 | |
366 | def key_resize_up(self): |
367 | - self.emit('resize-term', 'up') |
368 | + self.emit('resize-term', 'up', False) |
369 | |
370 | def key_resize_down(self): |
371 | - self.emit('resize-term', 'down') |
372 | + self.emit('resize-term', 'down', False) |
373 | |
374 | def key_resize_left(self): |
375 | - self.emit('resize-term', 'left') |
376 | + self.emit('resize-term', 'left', False) |
377 | |
378 | def key_resize_right(self): |
379 | - self.emit('resize-term', 'right') |
380 | + self.emit('resize-term', 'right', False) |
381 | + |
382 | + def key_resize_up_fast(self): |
383 | + self.emit('resize-term', 'up', True) |
384 | + |
385 | + def key_resize_down_fast(self): |
386 | + self.emit('resize-term', 'down', True) |
387 | + |
388 | + def key_resize_left_fast(self): |
389 | + self.emit('resize-term', 'left', True) |
390 | + |
391 | + def key_resize_right_fast(self): |
392 | + self.emit('resize-term', 'right', True) |
393 | |
394 | def key_move_tab_right(self): |
395 | self.emit('move-tab', 'right') |
Any news on this?