-
Notifications
You must be signed in to change notification settings - Fork 603
2337 allow resize the drop down terminal #2338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0d4b50c
aa85c99
71abfee
09e270b
b953ed2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,70 +1,70 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- Generated with glade 3.18.3 --> | ||
| <!-- Generated with glade 3.40.0 --> | ||
| <interface domain="guake"> | ||
| <requires lib="gtk+" version="3.10"/> | ||
| <object class="GtkMenu" id="tray-menu"> | ||
| <property name="visible">True</property> | ||
| <property name="can_focus">False</property> | ||
| <property name="can-focus">False</property> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a convention change to go with the glade version bump I presume? |
||
| <child> | ||
| <object class="GtkImageMenuItem" id="prefs-menuitem"> | ||
| <property name="label">gtk-preferences</property> | ||
| <property name="visible">True</property> | ||
| <property name="can_focus">False</property> | ||
| <property name="use_underline">True</property> | ||
| <property name="use_stock">True</property> | ||
| <property name="can-focus">False</property> | ||
| <property name="use-underline">True</property> | ||
| <property name="use-stock">True</property> | ||
| <signal name="activate" handler="show_prefs" swapped="no"/> | ||
| </object> | ||
| </child> | ||
| <child> | ||
| <object class="GtkImageMenuItem" id="about-menuitem"> | ||
| <property name="label">gtk-about</property> | ||
| <property name="visible">True</property> | ||
| <property name="can_focus">False</property> | ||
| <property name="use_underline">True</property> | ||
| <property name="use_stock">True</property> | ||
| <property name="can-focus">False</property> | ||
| <property name="use-underline">True</property> | ||
| <property name="use-stock">True</property> | ||
| <signal name="activate" handler="show_about" swapped="no"/> | ||
| </object> | ||
| </child> | ||
| <child> | ||
| <object class="GtkSeparatorMenuItem" id="separador-mmenu"> | ||
| <property name="visible">True</property> | ||
| <property name="can_focus">False</property> | ||
| <property name="can-focus">False</property> | ||
| </object> | ||
| </child> | ||
| <child> | ||
| <object class="GtkImageMenuItem" id="quit-menuitem"> | ||
| <property name="label" translatable="yes">Quit</property> | ||
| <property name="visible">True</property> | ||
| <property name="can_focus">False</property> | ||
| <property name="use_stock">False</property> | ||
| <property name="can-focus">False</property> | ||
| <property name="use-stock">False</property> | ||
| <signal name="activate" handler="accel_quit" swapped="no"/> | ||
| </object> | ||
| </child> | ||
| </object> | ||
| <object class="GtkWindow" id="window-root"> | ||
| <property name="can_focus">False</property> | ||
| <property name="has_focus">True</property> | ||
| <property name="can-focus">False</property> | ||
| <property name="has-focus">True</property> | ||
| <property name="title" translatable="yes">Guake!</property> | ||
| <property name="skip_taskbar_hint">True</property> | ||
| <property name="skip_pager_hint">True</property> | ||
| <property name="urgency_hint">True</property> | ||
| <property name="skip-taskbar-hint">True</property> | ||
| <property name="skip-pager-hint">True</property> | ||
| <property name="urgency-hint">True</property> | ||
| <property name="decorated">False</property> | ||
| <child> | ||
| <object class="GtkBox" id="mainframe"> | ||
| <property name="visible">True</property> | ||
| <property name="can_focus">False</property> | ||
| <property name="can-focus">False</property> | ||
| <property name="orientation">vertical</property> | ||
| <child> | ||
| <object class="GtkNotebook" id="notebook-teminals"> | ||
| <property name="name">notebook-teminals</property> | ||
| <property name="visible">True</property> | ||
| <property name="can_focus">True</property> | ||
| <property name="has_focus">True</property> | ||
| <property name="is_focus">True</property> | ||
| <property name="tab_pos">bottom</property> | ||
| <property name="show_tabs">False</property> | ||
| <property name="show_border">False</property> | ||
| <property name="enable_popup">True</property> | ||
| <property name="can-focus">True</property> | ||
| <property name="has-focus">True</property> | ||
| <property name="is-focus">True</property> | ||
| <property name="tab-pos">bottom</property> | ||
| <property name="show-tabs">False</property> | ||
| <property name="show-border">False</property> | ||
| <property name="enable-popup">True</property> | ||
| </object> | ||
| <packing> | ||
| <property name="expand">True</property> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,7 @@ | |
| from guake.utils import FullscreenManager | ||
| from guake.utils import HidePrevention | ||
| from guake.utils import RectCalculator | ||
| from guake.utils import SettingsOverride | ||
| from guake.utils import TabNameUtils | ||
| from guake.utils import get_server_time | ||
| from guake.utils import save_tabs_when_changed | ||
|
|
@@ -190,6 +191,21 @@ def load_schema(): | |
| self.mainframe = self.get_widget("mainframe") | ||
| self.mainframe.remove(self.get_widget("notebook-teminals")) | ||
|
|
||
| # Window is undecorated (no WM title bar/borders), so provide a thin | ||
| # drag handle at the bottom edge to let users resize it manually. | ||
| # This is for issue: https://github.com/Guake/guake/issues/2337 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't put issue numbers in comments, just describe what the code does. |
||
| self.resize_handle = Gtk.EventBox() | ||
| self.resize_handle.set_size_request(-1, 8) | ||
| self.resize_handle.connect( | ||
| "realize", | ||
| lambda widget: widget.get_window().set_cursor( | ||
| Gdk.Cursor.new_from_name(Gdk.Display.get_default(), "ns-resize") | ||
| ), | ||
| ) | ||
| self.resize_handle.connect("button-press-event", self.on_resize_handle_button_press) | ||
| self.mainframe.pack_end(self.resize_handle, False, False, 0) | ||
| self.resize_handle.show() | ||
|
|
||
| # Pending restore for terminal split after show-up | ||
| # [(RootTerminalBox, TerminaBox, panes), ...] | ||
| self.pending_restore_page_split = [] | ||
|
|
@@ -223,6 +239,11 @@ def load_schema(): | |
| # Debounce accel_search_terminal | ||
| self.prev_accel_search_terminal_time = 0.0 | ||
|
|
||
| # holds the GLib source id for the pending resize-debounce timeout | ||
| # used to capture resizing activities for https://github.com/Guake/guake/issues/2337 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar deal |
||
| self.resize_debounce_source_id = None | ||
| self.settings_override: SettingsOverride = {} | ||
|
|
||
| # holds the timestamp of the losefocus event | ||
| self.losefocus_time = 0 | ||
|
|
||
|
|
@@ -237,6 +258,7 @@ def load_schema(): | |
|
|
||
| self.window.connect("focus-out-event", self.on_window_losefocus) | ||
| self.window.connect("focus-in-event", self.on_window_takefocus) | ||
| self.window.connect("configure-event", self.on_window_configure) | ||
|
|
||
| # Handling the delete-event of the main window to avoid | ||
| # problems when closing it. | ||
|
|
@@ -544,6 +566,45 @@ def losefocus_callback(sleep_time): | |
| def on_window_takefocus(self, window, event): | ||
| self.takefocus_time = get_server_time(self.window) | ||
|
|
||
| def on_resize_handle_button_press(self, widget, event): | ||
| if event.button == 1: | ||
| self.window.begin_resize_drag( | ||
| Gdk.WindowEdge.SOUTH, event.button, int(event.x_root), int(event.y_root), event.time | ||
| ) | ||
| return True | ||
|
|
||
| def on_window_configure(self, window, event): | ||
| """Captures resizing activity for https://github.com/Guake/guake/issues/2337. | ||
|
|
||
| Using Debounce strategy with GLib to capture event when user has completed | ||
| resizing their window. | ||
| """ | ||
| if self.resize_debounce_source_id is not None: | ||
| GLib.source_remove(self.resize_debounce_source_id) | ||
|
|
||
| self.resize_debounce_source_id = GLib.timeout_add( | ||
| 300, self.on_resize_debounced, event.width, event.height | ||
| ) | ||
| return False | ||
|
|
||
| def on_resize_debounced(self, width, height): | ||
| self.resize_debounce_source_id = None | ||
|
|
||
| workarea = RectCalculator.get_final_window_monitor( | ||
| self.settings, self.window | ||
| ).get_workarea() | ||
| if workarea.height <= 0 or workarea.width <= 0: | ||
| log.warning("Skipping resize-override update: invalid workarea %r", workarea) | ||
| return GLib.SOURCE_REMOVE | ||
|
|
||
| self.settings_override = SettingsOverride( | ||
| height_percentage=min(round(height / workarea.height * 100), 100), | ||
| width_percentage=min(round(width / workarea.width * 100), 100), | ||
| ) | ||
|
|
||
| log.debug("Resize settled at %sx%s -> %r", width, height, self.settings_override) | ||
| return GLib.SOURCE_REMOVE | ||
|
|
||
| def show_menu(self, status_icon, button, activate_time): | ||
| """Show the tray icon menu.""" | ||
| menu = self.get_widget("tray-menu") | ||
|
|
@@ -696,7 +757,9 @@ def show(self): | |
|
|
||
| # setting window in all desktops | ||
|
|
||
| window_rect = RectCalculator.set_final_window_rect(self.settings, self.window) | ||
| window_rect = RectCalculator.set_final_window_rect( | ||
| self.settings, self.window, self.settings_override | ||
| ) | ||
| self.window.stick() | ||
|
|
||
| # add tab must be called before window.show to avoid a | ||
|
|
@@ -714,8 +777,11 @@ def show(self): | |
| GLib.idle_add(lambda: self.window.move(window_rect.x, window_rect.y) and False) | ||
|
|
||
| # this works around an issue in fluxbox | ||
| # Note: re-applies the rect directly (rather than going through | ||
| # triggerOnChangedValue) so this synthetic re-trigger doesn't clear | ||
| # settings_override the way a real "window-height" change should. | ||
| if not self.fullscreen_manager.is_fullscreen(): | ||
| self.settings.general.triggerOnChangedValue(self.settings.general, "window-height") | ||
| RectCalculator.set_final_window_rect(self.settings, self.window, self.settings_override) | ||
|
|
||
| time = get_server_time(self.window) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| release_summary: > | ||
| You can now resize the drop-down terminal by dragging its bottom edge, | ||
| similar to Windows Terminal - handy for temporarily expanding the | ||
| terminal to read long command output without leaving the drop-down view. | ||
|
|
||
| features: | ||
| - | | ||
| - Allow resizing the drop-down terminal by dragging its bottom edge (#2337). | ||
|
|
||
| known_issues: | ||
|
|
||
| upgrade: | ||
|
|
||
| deprecations: | ||
|
|
||
| security: | ||
|
|
||
| fixes: | ||
|
|
||
| translations: | ||
|
|
||
| notes_for_package_maintainers: | ||
|
|
||
| other: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change our linter versions. Out of scope, do this in another PR.