From 1225d879c33cecc2215193f08d73a62059671724 Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Tue, 8 Feb 2022 21:48:05 -0600 Subject: [PATCH] Logic for improved guake like terminal functionality --- data/terminator.metainfo.xml | 522 +++++++++++++++++++++++++++++++++++ doc/terminator.1 | 17 ++ terminatorlib/optionparse.py | 11 +- terminatorlib/window.py | 127 +++++++-- 4 files changed, 647 insertions(+), 30 deletions(-) create mode 100644 data/terminator.metainfo.xml diff --git a/data/terminator.metainfo.xml b/data/terminator.metainfo.xml new file mode 100644 index 000000000..6b044ccae --- /dev/null +++ b/data/terminator.metainfo.xml @@ -0,0 +1,522 @@ + + + terminator.desktop + CC0-1.0 + GPL-2.0-only + Terminator + Terminator + المتطرف + Terminator + Terminator + Тэрмінатар + Терминатор + টার্মিনেটর + Terminator + Terminator + Terminator + Terminátor + Terminator + Terminator + Terminator + Terminator + Terminator + Terminator + Terminatoro + Terminator + Terminator + Terminator + ترمیناتور + Terminator + Terminator + Terminator + Terminador + Terminator + टर्मिनेटर + Terminator + Terminator + Terminator + Terminator + Terminator + Terminator + Terminator + Terminator + Terminator + Terminator + Терминатор + 터미네이터 + Terminator + Terminator + Терминатор + ടെര്‍മിനേറ്റര്‍ + Terminator + Terminator + Terminator + Terminator + Terminator + Terminator + Terminator + Terminator + Terminator + Терминатор + ටර්මිනේටර් + Terminátor + Terminator + Terminator + Терминатор + Terminator + Terminator + Terminator + முனையம் + టెర్మినేటర్ + Terminator + Uçbirim + Terminator + Terminator + Terminator + Terminator 终端终结者 + Terminator + Multiple terminals in one window + Veelvuldige terminale in een venster + العديد من الطرفيات في نافذة واحدة + Delles terminales nuna ventana + Çoxsaylı terminallar bir pəncərədə + Некалькі тэрміналаў у акне + Множество терминали в един прозорец + এক উইন্ডোতে একাধিক টার্মিনাল + Više terminala u jednom prozoru + Diversos terminals en una finestra + Diversos terminals en una finestra + Vícero terminálů v jednom okně + Flere terminaler i et vindue + Mehrere Terminals in einem Fenster + Πολλαπλά τερματικά σε ένα παράθυρο + Multiple terminals in one window + Multiple terminals in one window + Multiple terminals in one window + Pluraj terminaloj en unu fenestro + Múltiples terminales en una ventana + Mitu terminaali ühes aknas + Hainbat terminal leiho bakarrean + Useita päätteitä yhdessä ikkunassa + Permet d'avoir plusieurs terminaux en une seule fenêtre + Múltiples terminales nunha ventá + מסופים מרובים בחלון אחד + एक विंडो में अनेक टर्मिनल + Višebrojni terminali u jednom prozoru + Több terminál egy ablakban + Մի քանի տերմինալ մեկ պատուհանում + Plure terminales in un fenestra + Banyak terminal dalam satu window + Margar útstöðvar í einum glugga + Molteplici terminali un una sola finestra + 複数の端末を一つのウインドウに + Akeh terminal ning sak jendelo + მრავალი ტერმინალები ერთ ფანჯარაში + Бір терезе ішінде көптік терминалдар + 창 하나에 터미널 여러 개 쓰기 + Keli terminalai viename lange + Daudzi termināļi vienā logā + Повеќе терминали во еден прозорец + ഒരു ജാലകത്തില്‍ ഒന്നിലധികം ടെര്‍മിനലുകള്‍ + Kesemua terminal dalam satu tetingkap + Flere terminaler i ett vindu + Meerdere terminals in één venster + Permet d'aver mantun terminal dins una sola fenèstra + Wiele terminali w jednym oknie + Múltiplos Terminais numa só janela + Múltiplos terminais em uma janela + Terminale multiple într-o singură fereastră + Несколько терминалов в одном окне + එක් වින්ඩෝවක ටර්මිනල් රාශියක් + Viaceré terminály v jednom okne + Več terminalov v enem oknu + Shumë terminale në një dritare + Више терминала у једном прозору + Loba terminal dina hiji jandela + Flera terminaler i ett fönster + Tungo amri kadhaa kwenye window moja + ஒரு சாளரத்தில் பல முனையங்கள் + ఒకే విండోలో బహుళ టెర్మినల్స్ + หลายเทอร์มินัลในหน้าต่างเดียว + Tek pencerede birden çok uçbirim + Кілька терміналів в одному вікні + ایک دریچے میں ایک سے زیادہ ٹرمنل + Mở nhiều terminal trong cùng cửa sổ + 一个窗口中的多个终端 + 單一視窗,多重終端 + +

The robot future of terminals

+

Robotizirana budućnost terminala

+

El futur robot de terminals

+

Robotická budoucnost terminálů

+

Fremtiden for robotterminaler

+

Die Roboterzukunft der Terminals

+

The robot future of terminals

+

The robot future of terminals

+

El futuro robot de terminales

+

ربات اینده ای پایانه است

+

Le futur robot des terminaux.

+

העתיד הרובוטי של המסופים

+

Robotska budućnost terminala

+

A terminálok robot jövője

+

Le robot futur del terminales

+

The robot future of terminals

+

Il futuro robot dei terminali

+

터미널이 지배하는 미래 세상

+

Terminal dari robot masa hadapan

+

De robottoekomst van terminals

+

Robotyczna przyszłość terminali

+

O robô futuro dos terminais

+

O robo do futuro dos terminais

+

Viitorul robot al terminalelor

+

Технологии будущего для терминалов

+

Robotická budúcnosť terminálov

+

Robot-framtid för terminaler

+

Umbile ya kiroboti ya tungo amri

+

高级终端的未来

+

終結者(Terminator) - 終端機器人的未來

+

A power-user tool for arranging terminals. It is inspired by programs such as gnome-multi-term, quadkonsole, etc. in that the main focus is arranging terminals in grids (tabs is the most common default method, which Terminator also supports).

+

Ein Werkzeug für erfahrene Nutzer, um Terminals anzuordnen. Es ist von Anwendungen wie gnome-multi-term, quadkonsole, usw. inspiriert, deren Hauptfokus darin besteht, Terminals in Raster anzuordnen (die Verwendung von Reitern ist die meist verbreitete Methode, welche auch ebenfalls von Terminator unterstützt wird).

+

Una herramienta de usuario avanzado para organizar terminales. Está inspirado en programas como gnome-multi-term, quadkonsole, etc. en que el enfoque principal es organizar las terminales en cuadrículas (las pestañas son el método por defecto más común, que Terminator también soporta).

+

Un outil pour utilisateur et utilisatrice expérimenté⋅e d'organisation des terminaux. Il s'inspire des programmes tels que gnome-multi-term, quadkonsole, etc. dont le principal objectif est l'organisation des terminaux en grille (sous forme d'onglets dans le mode par défaut le plus basique, mode que Terminator prend en charge).

+

כלי למשתמשים מתקדמים לארגון מסופים. שאב השראה מתכניות כגון gnome-multi-term,‏ quadkonsole וכו׳ בכך שעיקר המיקוד הוא בסידור מסופים ברשת (לשוניות היא צורת בררת המחדל הנפוצה ביותר שגם היא נתמכת ב־Terminator).

+

Profesionalni korisnički alat za raspoređivanje terminala, slično programima poput gnome-multi-term, quadkonsole, itd., a glavna ideja je pločasto raspoređivanje terminala (kartice su najraširenija metoda, koju Terminator također podržava).

+

Wszechstronne narzędzie do komponowania terminali. Inspirowane przez programy takie jak gnome-multi-term, quadkonsole, itp. w sposób, że główny nacisk kładziony jest na układanie terminali w prostokątne siatki (najczęstszą metodą są taby, które Terminator również wspiera).

+

Uma ferramenta destinada aos superusuários, útil para organização de terminais. Esta foi inspirada por programas como gnome-multi-term, quadkonsole, etc. em que o objetivo principal é organizar terminais em grades (abas é o método mais comum, o qual o Terminator também suporta).

+

Much of the behavior of Terminator is based on GNOME Terminal, and we are adding more features from that as time goes by, but we also want to extend out in different directions with useful features for sysadmins and other users.

+

Ein Großteil des Verhaltens von Terminator basiert auf dem GNOME-Terminal und wir fügen im Laufe der Zeit ständig neue Funktionen hinzu, aber wir wollen uns auch mit nützlichen Funktionen für Systemadministratoren und weitere Benutzergruppen in andere Richtungen weiterentwickeln.

+

Gran parte del comportamiento de Terminator está basado en GNOME Terminal, y estamos añadiendo más de esas características a medida que pasa el tiempo, pero también queremos extendernos en diferentes direcciones con características útiles para administradores de sistemas y otros usuarios.

+

Le fonctionnement de Terminator est principalement fondé sur celui de GNOME Terminal. Nous lui ajoutons des fonctionnalités au fur et à mesure, mais nous voulons aussi les étendre dans différentes directions, avec des fonctionnalités utiles pour les administrateurs système et les autres utilisateurs.

+

הרבה מההתנהגות של Terminator מבוססת על המסוף של GNOME ואנו מוסיפים תכונות נוספות עם הזמן אך אנו מעוניינים להתרחב לכיוונים נוספים עם תכונות שימושיות עבור מנהלי מערכת ומשתמשים אחרים.

+

Terminator se uveliko temelji se na GNOME Terminalu i s vremenom dodajemo daljnje njegove funkcije, ali ga također razvijamo s raznim dodatnim korisnim funkcijama za administratore sustava i za ostale korisnike.

+

Wiele zachowań Terminatora bazuje na GNOME Terminal i z biegiem czasu dodajemy nowe funkcjonalności stamtąd, ale chcemy również rozwijać się w innych kierunkach z funkcjonalnościami przydatnymi dla administaratorów i innych użytkowników.

+

Muito do comportamento do Terminator é baseado no Terminal do Gnome, e estamos adicionando mais recursos com o passar do tempo, mas também queremos estender isso em diferentes recursos para administradores e sistemas e outros usuários.

+

Some highlights:

+

Za istaći:

+

Alguns ressaltats:

+

Několik zajímavostí:

+

Nogle højdepunkter:

+

Einige Höhepunkte:

+

Some highlights:

+

Some highlights:

+

Algunos destacados:

+

برخی از نکات برجسته

+

Quelques points forts :

+

כמה דגשים:

+

Neke posebnosti su:

+

Néhányat kiemelve:

+

Alicun evidentias:

+

Some highlights:

+

Alcune evidenze:

+

ചില പ്രത്യേകതകൾ :

+

Beberapa sorotan:

+

Enkele hoogtepunten:

+

Qualques punts fòrts :

+

Kilka głównych funkcji:

+

Alguns destaques:

+

Alguns destaques:

+

Cateva puncte forte:

+

Ключевые особенности:

+

Zopár schopností:

+

Några höjdpunkter:

+

Maelezo kadhaa:

+

Bazı özellikler:

+

一些亮点:

+

特色

+ +

And lots more...

+

I još mnogo toga...

+

A mnoho dalšího…

+

Og meget mere...

+

Und vieles mehr…

+

And lots more...

+

And lots more...

+

Y mucho más...

+

و خیلی چیزها بیشتر.....

+

Et bien plus...

+

ועוד הרבה מעבר…

+

I još puno više …

+

És sok más...

+

E quantitates ancora...

+

And lots more...

+

Molto più...

+

그리고 더 많이...

+

അതുകൂടാതെ പിന്നെയും ധാരാളം ...

+

Dan banyak lagi...

+

En nog veel meer...

+

E plan mai encara...

+

I wiele więcej...

+

E muito mais...

+

E muito mais...

+

И многое другое...

+

A mnoho ďalšieho...

+

Och mycket mer...

+

Ve çok daha fazlası...

+

还有更多……

+

還有更多的特色...

+
+ + + https://4.bp.blogspot.com/-xt4Tja1TMQ0/Vdemmf8wYSI/AAAAAAAAA9A/uROTre0PMls/s1600/terminator_main_basic.png + The main window showing the application in action + Glavni prozor prikazuje aplikaciju u akciji + Hlavní okno zobrazující aplikaci v akci + Det primære vindue, som viser applikationen i funktion + Das Hauptfenster zeigt die aktive Anwendung + The main window showing the application in action + The main window showing the application in action + Ventana principal mostrando la aplicación en acción + پنجره ای اصلی نرم افزارهای فعال را نشان می دهد + La fenêtre principale montrant l'application en action + החלון הראשי שמציג את היישום הפעיל + Glavni prozor s prikazom programa u akciji + A főablak a futó alkalmazást mutatja + The main window showing the application in action + La finestra principale mostra l'applicazione attiva + Tetingkap utama menunjukkan aplikasi sedang bertindak + Het hoofdvenster toont de applicatie in actie + Główne okno programu pokazujące aplikację w działaniu + A janela principal que mostra a aplicação em ação + A janela principal mostrando a aplicação em ação + Главное окно, показывающее приложение в действии + Hlavné okno zobrazuje aplikáciu v akcii + Huvudfönstret visar programmet i verkan + Ana pencere çalışmakta olan uygulamayı gösteriyor + 主窗口用于显示当前的程序 + Terminator執行的畫面 + + + https://4.bp.blogspot.com/-rRxALSpEEZw/Vdeu58JgpnI/AAAAAAAAA9o/XewWKJ5HNo4/s1600/terminator_main_complex.png + Getting a little crazy with the terminals + Getting a little crazy with the terminals + Trocha bláznivosti s terminály + Gakker ud med terminalerne + Ein wenig verrückt werden mit den Terminals + Getting a little crazy with the terminals + Getting a little crazy with the terminals + Un poco de locura con las terminales + یکم متفاوت تر به نظر بیا با پایانه + Devenir un peu fou avec les terminaux. + להשתולל קצת עם המסופים + Poigravanje s terminalima + Egy kicsit megőrülni a terminálokkal + Getting a little crazy with the terminals + 터미널에 미쳐봅시다. + Buat sesuatu yang gila-gila dengan terminal + Een beetje gek worden met de terminals + Zaszalej z terminalami + A loucura de diversos terminais + Ficando um pouco louco com terminais + Немного сумасшествия с терминалами + Trochu sa pobláznime s terminálmi + Uçbirimlerle delirmeceler + 终端让人抓狂 + 多到瘋狂的終端 + + + https://2.bp.blogspot.com/-t_8oRyMXUls/VdemmRVnZnI/AAAAAAAAA88/rHIr8L1X7Ho/s1600/terminator_prefs_global.png + The preferences window where you can change the defaults + Prozor u kojem možete mijenjati zadane postavke + Okno předvoleb ve kterém je možné měnit výchozí hodnoty + Vinduet for indstillinger hvor du kan ændre standardinstillingerne + Das Einstellungsfenster, in dem die Standardwerte geändert werden können + Το παράθυρο προτιμήσεων όπου μπορείτε να αλλάξετε τις προεπιλογές + The preferences window where you can change the defaults + The preferences window where you can change the defaults + La ventana de preferencias dónde se pueden cambiar los valores predeterminados + پنجره ای تنظیمات مکانی است که شما می توانید تنظیمات پیش فرض را تغییر دهید + La fenêtre des préférences où vous pouvez modifier les réglages par défaut + חלון ההעדפות בו ניתן לשנות את בררות המחדל + Prozor postavki za mijenjanje standardnih vrijednosti + A beállítások ablakban megváltoztathatod az alapértelmezéseket + The preferences window where you can change the defaults + 기본 설정을 바꿀 수 있는 설정 창 + Tetingkap keutamaan yang mana anda boleh ubah lalai + Het voorkeurenvenster waar je de standaardwaarden kan veranderen + Okno ustawień w których możesz dostosować domyślną konfigurację + A janela de preferências na qual se pode alterar as definições padrão + A janela de preferências onde você pode alterar o padrão + Окно настроек, где можно изменить стандартные настройки + Okno nastaveni, kde môzete zmeniť štandardné nastavenia + Varsayılan ayarları değiştirebileceğiniz tercihler penceresi + 偏好设定窗口(改变默认设置) + 您可以在"偏好設定"中更改預設值 + + + https://github.com/gnome-terminator/terminator + terminator@lazyfrosch.de +
\ No newline at end of file diff --git a/doc/terminator.1 b/doc/terminator.1 index 5d27afaa9..b19d89443 100644 --- a/doc/terminator.1 +++ b/doc/terminator.1 @@ -46,6 +46,23 @@ based on the wishes of the child shell. .B \-\-geometry=GEOMETRY Specifies the preferred size and position of Terminator's window; see X(7). .TP +.B \-\-guake\-key=GUAKE_KEY +A Guake like terminal mode where terminal can be toggled by a key. +Usage Example: terminator \-\-guake\-key="F8" \-\-guake\-side left \-\-guake\-width 700 \-\-guake\-height 800 +.TP +.B \-\-guake\-side=GUAKE_SIDE +Set the preferred screen edge position of a terminal in Guake like mode. +Options: top, bottom, left, right +Default: top +.TP +.B \-\-guake\-width=GUAKE_WIDTH +Set the preferred width when using Guake like mode. +Default: 800 +.TP +.B \-\-guake\-height=GUAKE_HEIGHT +Set the preferred height when using Guake like mode. +Default: 600 +.TP .B \-e, \-\-command=COMMAND Runs the specified command instead of your default shell or profile specified command. Note: if Terminator is launched as x-terminal-emulator \-e behaves like \-x, and the longform becomes diff --git a/terminatorlib/optionparse.py b/terminatorlib/optionparse.py index befafa6e4..5ddf49aab 100644 --- a/terminatorlib/optionparse.py +++ b/terminatorlib/optionparse.py @@ -16,6 +16,7 @@ """Terminator.optionparse - Parse commandline options""" import argparse +from argparse import RawTextHelpFormatter import sys import os @@ -37,7 +38,7 @@ def parse_options(): """Parse the command line options""" is_x_terminal_emulator = os.path.basename(sys.argv[0]) == 'x-terminal-emulator' - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser(formatter_class=RawTextHelpFormatter) parser.add_argument('-v', '--version', action='store_true', dest='version', help=_('Display program version')) @@ -56,6 +57,14 @@ def parse_options(): parser.add_argument('--geometry', dest='geometry', type=str, help=_('Set the preferred size and position of the window' '(see X man page)')) + parser.add_argument('--guake-key', dest='guake_key', type=str, + help=_('A Guake like terminal mode where terminal can be toggled by a key.\nUsage Example: terminator --guake-key="F8" --guake-side left --guake-width 700 --guake-height 800')) + parser.add_argument('--guake-side', dest='guake_side', default="top", type=str, + help=_('Set the preferred screen edge position of a terminal in Guake like mode.\nOptions: top, bottom, left, right\nDefault: top')) + parser.add_argument('--guake-width', dest='guake_width', default="800", type=str, + help=_('Set the preferred width when using Guake like mode.\nDefault: 800')) + parser.add_argument('--guake-height', dest='guake_height', default="600", type=str, + help=_('Set the preferred height when using Guake like mode.\nDefault: 600')) if not is_x_terminal_emulator: parser.add_argument('-e', '--command', dest='command', help=_('Specify a command to execute inside the terminal')) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 04c60a4cb..8f2008a43 100644 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -77,13 +77,17 @@ def __init__(self): # self.set_property('allow-shrink', True) # FIXME FOR GTK3, or do we need this actually? icon_to_apply='' - self.register_callbacks() + self.apply_config() self.title = WindowTitle(self) self.title.update() - - self.preventHide = False + + self.preventHide = False + + self.display = Gdk.Display().get_default() + self.mouse = self.display.get_default_seat().get_pointer() + self.guake_key = None options = self.config.options_get() if options: @@ -92,15 +96,42 @@ def __init__(self): if options.role: self.set_role(options.role) - + if options.forcedicon is not None: icon_to_apply = options.forcedicon if options.geometry: if not self.parse_geometry(options.geometry): - err('Window::__init__: Unable to parse geometry: %s' % + err('Window::__init__: Unable to parse geometry: %s' % options.geometry) + if options.guake_key: + self.guake_key = options.guake_key + + if options.guake_side and options.guake_width and options.guake_height: + if options.guake_side in ["top", "bottom", "left", "right"]: + self.guake_side = options.guake_side + else: + self.guake_key = False + err('Window::__init__: Unable to parse guake_side: %s' % + options.guake_side) + + try: + self.guake_width = int(options.guake_width) + self.guake_height = int(options.guake_height) + except Exception as e: + self.guake_key = False + err('Window::__init__: Unable to parse guake_width: %s and/or guake_height: %s' % + options.guake_width, options.guake_height) + + if self.guake_key: + self.set_decorated(False) + self.set_default_size(self.guake_width, self.guake_height) + else: + self.guake_key = None + + self.register_callbacks() + self.apply_icon(icon_to_apply) self.pending_set_rough_geometry_hint = False @@ -118,6 +149,36 @@ def do_set_property(self, prop, value): else: raise AttributeError('unknown property %s' % prop.name) + # NOTE: Gdk.VisibilityState.UNOBSCURED presumably isn't reliable due to transparency in moddern wms. + # Seems to work okay for our needs but should be kept in mind for future changes.... + def _bind_window_to_position(self, widget, eve): + if eve.state == Gdk.VisibilityState.UNOBSCURED: + window_w, window_h = self.guake_width, self.guake_height + screen, mouse_x, mouse_y = self.mouse.get_position() + monitor = self.display.get_monitor_at_point(mouse_x, mouse_y) + geom_rect = monitor.get_geometry() + x, y, w, h = geom_rect.x, geom_rect.y, geom_rect.width, geom_rect.height + + if not self.is_maximized() and not self.isfullscreen: + if self.guake_side == "top": + new_x = (w - (window_w + ((w - window_w)/2) )) + x + new_y = y + if self.guake_side == "bottom": + new_x = (w - (window_w + ((w - window_w)/2) )) + x + new_y = (h - window_h) + y + if self.guake_side == "left": + new_x = x + new_y = (h - (window_h + ((h - window_h)/2) )) + y + if self.guake_side == "right": + new_x = (w - window_w) + x + new_y = (h - (window_h + ((h - window_h)/2) )) + y + else: + new_x = x + new_y = y + + self.move(new_x, new_y) + + def register_callbacks(self): """Connect the GTK+ signals we care about""" self.connect('key-press-event', self.on_key_press) @@ -128,22 +189,28 @@ def register_callbacks(self): self.connect('focus-out-event', self.on_focus_out) self.connect('focus-in-event', self.on_focus_in) + toggle_key = self.config['keybindings']['hide_window'] + if self.guake_key not in ('', None): + toggle_key = self.guake_key + guake_unload_id = self.connect('visibility-notify-event', self._bind_window_to_position) + # Attempt to grab a global hotkey for hiding the window. # If we fail, we'll never hide the window, iconifying instead. - if self.config['keybindings']['hide_window'] not in ('', None): - if display_manager() == 'X11': - try: - self.hidebound = Keybinder.bind( - self.config['keybindings']['hide_window'], - self.on_hide_window) - except (KeyError, NameError): - pass - - if not self.hidebound: - err('Unable to bind hide_window key, another instance/window has it.') - self.hidefunc = self.iconify - else: - self.hidefunc = self.hide + if toggle_key and display_manager() == 'X11': + try: + self.hidebound = Keybinder.bind(toggle_key, self.on_hide_window) + except (KeyError, NameError): + pass + + if not self.hidebound: + err('Unable to bind hide_window key, another instance/window has it.') + self.hidefunc = self.iconify + + if self.guake_key not in ('', None): + GObject.signal_handler_disconnect(self, guake_unload_id) + self.set_decorated(True) + else: + self.hidefunc = self.hide def apply_config(self): """Apply various configuration options""" @@ -293,7 +360,7 @@ def on_delete_event(self, window, event, data=None): def confirm_close(self, window, type): """Display a confirmation dialog when the user is closing multiple terminals in one window""" - + return(not (self.construct_confirm_close(window, type) == Gtk.ResponseType.ACCEPT)) def on_destroy_event(self, widget, data=None): @@ -317,8 +384,10 @@ def on_hide_window(self, data=None): if (time.time() - self.losefocus_time < 0.1) and \ self.config['hide_on_lose_focus']: return + if self.position: self.move(self.position[0], self.position[1]) + self.show() self.grab_focus() try: @@ -333,7 +402,7 @@ def on_hide_window(self, data=None): # pylint: disable-msg=W0613 def on_window_state_changed(self, window, event): """Handle the state of the window changing""" - self.isfullscreen = bool(event.new_window_state & + self.isfullscreen = bool(event.new_window_state & Gdk.WindowState.FULLSCREEN) self.ismaximised = bool(event.new_window_state & Gdk.WindowState.MAXIMIZED) @@ -392,7 +461,7 @@ def set_real_transparency(self, value=True): visual = screen.get_rgba_visual() if visual: self.set_visual(visual) - + def show(self, startup=False): """Undo the startup show request if started in hidden mode""" #Present is necessary to grab focus when window is hidden from taskbar. @@ -481,7 +550,7 @@ def split_axis(self, widget, vertical=True, cwd=None, sibling=None, widgetfirst= container = maker.make('VPaned') else: container = maker.make('HPaned') - + self.set_pos_by_ratio = True if not sibling: @@ -505,7 +574,7 @@ def split_axis(self, widget, vertical=True, cwd=None, sibling=None, widgetfirst= for term in order: container.add(term) container.show_all() - + while Gtk.events_pending(): Gtk.main_iteration_do(False) sibling.grab_focus() @@ -547,7 +616,7 @@ def zoom(self, widget, font_scale=True): self.set_property('term_zoomed', True) if font_scale: - widget.cnxids.new(widget, 'size-allocate', + widget.cnxids.new(widget, 'size-allocate', widget.zoom_scale, self.zoom_data) widget.grab_focus() @@ -603,7 +672,7 @@ def rotate(self, widget, clockwise): def get_terminals(self): return(util.enumerate_descendants(self)[1]) - + def get_visible_terminals(self): """Walk down the widget tree to find all of the visible terminals. Mostly using Container::get_visible_terminals()""" @@ -693,7 +762,7 @@ def set_rough_geometry_hints(self): extra_height = win_height - total_font_height dbg('setting geometry hints: (ewidth:%s)(eheight:%s),\ -(fwidth:%s)(fheight:%s)' % (extra_width, extra_height, +(fwidth:%s)(fheight:%s)' % (extra_width, extra_height, font_width, font_height)) geometry = Gdk.Geometry() geometry.base_width = extra_width @@ -817,7 +886,7 @@ def ungroup_tab(self, widget): if not maker.isinstance(notebook, 'Notebook'): dbg('note in a notebook, refusing to ungroup tab') return - + self.set_groups(None, self.get_visible_terminals()) def move_tab(self, widget, direction): @@ -850,7 +919,7 @@ def move_tab(self, widget, direction): else: err('unknown direction: %s' % direction) return - + notebook.reorder_child(child, page) def navigate_terminal(self, terminal, direction):