Some ports of some gtk2 commits that were still outstanding

* Fix the tab switching if a terminal on another tab exits
* Fix for those not running IBus, where the IBus workaround caused broken keys in other keymaps set with non-IBus tools
* PuTTY paste mode
* Updated and grouped default shortcuts in man page
* Fix PuTTY paste mode so Ctrl-Right-Drag, and application mouse handling in terminal still works
* Added smart copy mode switch to prefs
* Merge feature branch for tab/terminal title editing from Haim Daniel
This commit is contained in:
Stephen Boddy 2015-12-01 02:21:00 +01:00
commit 7518c16588
12 changed files with 382 additions and 174 deletions

View File

@ -14,6 +14,12 @@ terminator GTK3:
LP#1518557) LP#1518557)
* Change the scroll_on_output default to false (Egmont Koblinger, * Change the scroll_on_output default to false (Egmont Koblinger,
LP#1392822) LP#1392822)
* PuTTY paste mode (Nemilya, LP#1416682) with some alterations
(Steve Boddy)
* Updated and grouped default shortcuts in man page (Steve Boddy)
* Added smart copy mode switch to prefs (Steve Boddy, LP#1223129)
* Merge feature branch for tab/terminal title editing (Haim
Daniel LP#1417747)
Bug fixes Bug fixes
* Fix a GI version warning for Notify library (Mattias Eriksson) * Fix a GI version warning for Notify library (Mattias Eriksson)
@ -49,6 +55,13 @@ terminator GTK3:
* Remove unsupported utmp for now, till alternative solution * Remove unsupported utmp for now, till alternative solution
* Fix the "Run command as login shell" (Egmont Koblinger, * Fix the "Run command as login shell" (Egmont Koblinger,
LP#1520991) LP#1520991)
* Fix the tab switching if a terminal on another tab exits (Steve
Boddy, LP#943311)
* Fix for those not running IBus, where the IBus workaround
caused broken keys in other keymaps set with non-IBus tools
(Steve Boddy, LP#1494606)
* Fix PuTTY paste mode so Ctrl-Right-Drag, and application mouse
handling in terminal still works (Steve Boddy)
terminator 0.97: terminator 0.97:
* Allow font dimming in inactive terminals * Allow font dimming in inactive terminals

View File

@ -3,36 +3,36 @@
Terminator \- Multiple GNOME terminals in one window Terminator \- Multiple GNOME terminals in one window
.SH "SYNOPSIS" .SH "SYNOPSIS"
.B terminator .B terminator
.RI [ options ] .RI [ options ]
.br .br
.SH "DESCRIPTION" .SH "DESCRIPTION"
This manual page documents \fBTerminator\fP, a terminal emulator application. This manual page documents \fBTerminator\fP, a terminal emulator application.
.PP .PP
\fBTerminator\fP is a program that allows users to set up flexible \fBTerminator\fP is a program that allows users to set up flexible
arrangements of GNOME terminals. It is aimed at those who normally arrangements of GNOME terminals. It is aimed at those who normally
arrange lots of terminals near each other, but don't want to use a arrange lots of terminals near each other, but don't want to use a
frame based window manager. frame based window manager.
.SH "OPTIONS" .SH "OPTIONS"
This program follow the usual GNU command line syntax, with long This program follow the usual GNU command line syntax, with long
options starting with two dashes (`\-'). options starting with two dashes (`\-').
A summary of options is included below. A summary of options is included below.
.TP .TP
.B \-h, \-\-help .B \-h, \-\-help
Show summary of options Show summary of options
.TP .TP
.B \-v, \-\-version .B \-v, \-\-version
Show the version of the Terminator installation Show the version of the Terminator installation
.TP .TP
.B \-m, \-\-maximise .B \-m, \-\-maximise
Start with a maximised window Start with a maximised window
.TP .TP
.B \-f, \-\-fullscreen .B \-f, \-\-fullscreen
Start with a fullscreen window Start with a fullscreen window
.TP .TP
.B \-b, \-\-borderless .B \-b, \-\-borderless
Instruct the window manager not to render borders/decoration on the Instruct the window manager not to render borders/decoration on the
Terminator window (this works well with \-m) Terminator window (this works well with \-m)
.TP .TP
.B \-H, \-\-hidden .B \-H, \-\-hidden
Hide the Terminator window by default. Its visibility can be toggled Hide the Terminator window by default. Its visibility can be toggled
with the \fBhide_window\fR keyboard shortcut (Ctrl-Shift-Alt-a by default) with the \fBhide_window\fR keyboard shortcut (Ctrl-Shift-Alt-a by default)
@ -48,7 +48,7 @@ Specifies the preferred size and position of Terminator's window; see X(7).
Runs the specified command instead of your default shell or profile specified command. Note: if 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 Terminator is launched as x-terminal-emulator \-e behaves like \-x, and the longform becomes
\-\-execute2=COMMAND \-\-execute2=COMMAND
.TP .TP
.B \-x, \-\-execute COMMAND [ARGS] .B \-x, \-\-execute COMMAND [ARGS]
Runs \fBthe rest of the command line\fR instead of your default shell or profile specified command. Runs \fBthe rest of the command line\fR instead of your default shell or profile specified command.
.TP .TP
@ -78,11 +78,11 @@ Set a custom icon for the window (by file or name)
Disable DBus Disable DBus
.TP .TP
.B \-d, \-\-debug .B \-d, \-\-debug
Enable debugging output (please use this when reporting bugs). This Enable debugging output (please use this when reporting bugs). This
can be specified twice to enable a built-in python debugging server. can be specified twice to enable a built-in python debugging server.
.TP .TP
.B \-\-debug\-classes=DEBUG_CLASSES .B \-\-debug\-classes=DEBUG_CLASSES
If this is specified as a comma separated list, debugging output will If this is specified as a comma separated list, debugging output will
only be printed from the specified classes. only be printed from the specified classes.
.TP .TP
.B \-\-debug\-methods=DEBUG_METHODS .B \-\-debug\-methods=DEBUG_METHODS
@ -94,48 +94,43 @@ will be displayed
.B \-\-new-tab .B \-\-new-tab
If this is specified and Terminator is already running, DBus will be If this is specified and Terminator is already running, DBus will be
used to spawn a new tab in the first Terminator window. used to spawn a new tab in the first Terminator window.
.TP
.SH "KEYBINDINGS" .SH "KEYBINDINGS"
The following keybindings can be used to control Terminator: The following default keybindings can be used to control Terminator:
.TP .TP
.B Super+R .B F1
\fBR\fRotate terminals clockwise. Launches the full HTML manual.
.TP .SS Creation & Destruction
.B Super+Shift+R .PP
\fBR\fRotate terminals counter-clockwise. The following items relate to creating and destroying terminals.
.TP .TP
.B Ctrl+Shift+O .B Ctrl+Shift+O
Split terminals H\fBo\fRrizontally. Split terminals H\fBo\fRrizontally.
.TP .TP
.B Ctrl+Shift+E .B Ctrl+Shift+E
Split terminals V\fBe\fRrtically. Split terminals V\fBe\fRrtically.
.TP
.B Ctrl+Shift+Right
Move parent dragbar \fBRight\fR.
.TP
.B Ctrl+Shift+Left
Move parent dragbar \fBLeft\fR.
.TP
.B Ctrl+Shift+Up
Move parent dragbar \fBUp\fR.
.TP
.B Ctrl+Shift+Down
Move parent dragbar \fBDown\fR.
.TP
.B Ctrl+Shift+S
Hide/Show \fBS\fRcrollbar.
.TP
.B Ctrl+Shift+F
Search within terminal scrollback
.TP .TP
.B Ctrl+Shift+N or Ctrl+Tab .B Ctrl+Shift+T
Move to \fBn\fRext terminal within the same tab, use Ctrl+PageDown to move to the next tab. Open new \fBt\fRab.
If \fBcycle_term_tab\fR is \fBFalse\fR, cycle within the same tab will be disabled .TP
.TP .B Ctrl+Shift+I
.B Ctrl+Shift+P or Ctrl+Shift+Tab Open a new window. (Note: Unlike in previous releases, this window is
Move to \fBp\fRrevious terminal within the same tab, use Ctrl+PageUp to move to the previous tab. part of the same Terminator process.)
If \fBcycle_term_tab\fR is \fBFalse\fR, cycle within the same tab will be disabled .TP
.TP .B Super+I
Spawn a new Terminator process.
.TP
.B Alt+L
Open \fBl\fRayout launcher.
.TP
.B Ctrl+Shift+W
Close the current terminal.
.TP
.B Ctrl+Shift+Q
Close the current window.
.SS Navigation
.PP
The following items relate to moving between and around terminals.
.TP
.B Alt+Up .B Alt+Up
Move to the terminal \fBabove\fR the current one. Move to the terminal \fBabove\fR the current one.
.TP .TP
@ -148,75 +143,40 @@ Move to the terminal \fBleft of\fR the current one.
.B Alt+Right .B Alt+Right
Move to the terminal \fBright of\fR the current one. Move to the terminal \fBright of\fR the current one.
.TP .TP
.B Ctrl+Shift+C
Copy selected text to clipboard
.TP
.B Ctrl+Shift+V
Paste clipboard text
.TP
.B Ctrl+Shift+W
Close the current terminal.
.TP
.B Ctrl+Shift+Q
Quits Terminator
.TP
.B Ctrl+Shift+X
Toggle between showing all terminals and only showing the current one (maximise).
.TP
.B Ctrl+Shift+Z
Toggle between showing all terminals and only showing a scaled version of the current one (zoom).
.TP
.B Ctrl+Shift+T
Open new \fBt\fRab
.TP
.B Ctrl+PageDown .B Ctrl+PageDown
Move to next Tab Move to next Tab.
.TP .TP
.B Ctrl+PageUp .B Ctrl+PageUp
Move to previous Tab Move to previous Tab.
.TP .TP
.B Ctrl+Shift+PageDown .B Ctrl+Shift+N or Ctrl+Tab
Swap tab position with next Tab Move to \fBn\fRext terminal within the same tab, use Ctrl+PageDown to move to the next tab.
If \fBcycle_term_tab\fR is \fBFalse\fR, cycle within the same tab will be disabled.
.TP .TP
.B Ctrl+Shift+PageUp .B Ctrl+Shift+P or Ctrl+Shift+Tab
Swap tab position with previous Tab Move to \fBp\fRrevious terminal within the same tab, use Ctrl+PageUp to move to the previous tab.
If \fBcycle_term_tab\fR is \fBFalse\fR, cycle within the same tab will be disabled.
.SS Organisation
.PP
The following items relate to arranging and resizing terminals.
.TP .TP
.B Ctrl+Plus (+) .B Ctrl+Shift+Right
Increase font size. \fBNote:\fP this may require you to press shift, depending on your keyboard Move parent dragbar \fBRight\fR.
.TP .TP
.B Ctrl+Minus (-) .B Ctrl+Shift+Left
Decrease font size. \fBNote:\fP this may require you to press shift, depending on your keyboard Move parent dragbar \fBLeft\fR.
.TP .TP
.B Ctrl+Zero (0) .B Ctrl+Shift+Up
Restore font size to original setting. Move parent dragbar \fBUp\fR.
.TP .TP
.B F11 .B Ctrl+Shift+Down
Toggle fullscreen Move parent dragbar \fBDown\fR.
.TP .TP
.B Ctrl+Shift+R .B Super+R
Reset terminal state \fBR\fRotate terminals clockwise.
.TP .TP
.B Ctrl+Shift+G .B Super+Shift+R
Reset terminal state and clear window \fBR\fRotate terminals counter-clockwise.
.TP
.B Super+g
Group all terminals so that any input sent to one of them, goes to all of them.
.TP
.B Super+Shift+G
Remove grouping from all terminals.
.TP
.B Super+t
Group all terminals in the current tab so input sent to one of them, goes to all terminals in the current tab.
.TP
.B Super+Shift+T
Remove grouping from all terminals in the current tab.
.TP
.B Ctrl+Shift+I
Open a new window (note: unlike in previous releases, this window is
part of the same Terminator process)
.TP
.B Super+i
Spawn a new Terminator process
.TP .TP
.SH "Drag and Drop" .SH "Drag and Drop"
The layout can be modified by moving terminals with Drag and Drop. The layout can be modified by moving terminals with Drag and Drop.
@ -224,10 +184,101 @@ To start dragging a terminal, click and hold on its titlebar.
Alternatively, hold down \fBCtrl\fP, click and hold the \fBright\fP mouse button. Alternatively, hold down \fBCtrl\fP, click and hold the \fBright\fP mouse button.
Then, \fB**Release Ctrl**\fP. You can now drag the terminal to the point in the layout you would like it to be. Then, \fB**Release Ctrl**\fP. You can now drag the terminal to the point in the layout you would like it to be.
The zone where the terminal would be inserted will be highlighted. The zone where the terminal would be inserted will be highlighted.
.TP
.B Ctrl+Shift+PageDown
Swap tab position with next Tab.
.TP
.B Ctrl+Shift+PageUp
Swap tab position with previous Tab.
.SS Miscellaneous
.PP
The following items relate to miscellaneous terminal related functions.
.TP
.B Ctrl+Shift+C
Copy selected text to clipboard.
.TP
.B Ctrl+Shift+V
Paste clipboard text.
.TP
.B Ctrl+Shift+S
Hide/Show \fBS\fRcrollbar.
.TP
.B Ctrl+Shift+F
Search within terminal scrollback.
.TP
.B Ctrl+Shift+R
Reset terminal state.
.TP
.B Ctrl+Shift+G
Reset terminal state and clear window.
.TP
.B Ctrl+Plus (+)
Increase font size. \fBNote:\fP This may require you to press shift, depending on your keyboard.
.TP
.B Ctrl+Minus (-)
Decrease font size. \fBNote:\fP This may require you to press shift, depending on your keyboard.
.TP
.B Ctrl+Zero (0)
Restore font size to original setting.
.TP
.B Ctrl+W
Rename window title.
.TP
.B Ctrl+A
Rename tab title.
.TP
.B Ctrl+X
Rename terminal title.
.TP
.B Super+1
Insert terminal number, i.e. 1 to 12.
.TP
.B Super+0
Insert padded terminal number, i.e. 01 to 12.
.SS Grouping & Broadcasting
.PP
The following items relate to helping to focus on a specific terminal.
.TP
.B F11
Toggle window to fullscreen.
.TP
.B Ctrl+Shift+X
Toggle between showing all terminals and only showing the current one (maximise).
.TP
.B Ctrl+Shift+Z
Toggle between showing all terminals and only showing a scaled version of the current one (zoom).
.TP
.B Ctrl+Shift+Alt+A
Hide the initial window. Note that this is a global binding, and can only be bound once.
.PP
The following items relate to grouping and broadcasting.
.TP
.B Super+T
Group all terminals in the current tab so input sent to one of them, goes to all terminals in the current tab.
.TP
.B Super+Shift+T
Remove grouping from all terminals in the current tab.
.TP
.B Super+G
Group all terminals so that any input sent to one of them, goes to all of them.
.TP
.B Super+Shift+G
Remove grouping from all terminals.
.TP
.B Alt+A
Broadcast to All terminals.
.TP
.B Alt+G
Broadcast to Grouped terminals.
.TP
.B Alt+O
Broadcast Off.
.PP
Most of these keybindings are changeable in the Preferences.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR terminator_config(5) .BR terminator_config(5)
.SH "AUTHOR" .SH "AUTHOR"
Terminator was written by Chris Jones <cmsj@tenshu.net> and others. Terminator was written by Chris Jones <cmsj@tenshu.net> and others.
.PP .PP
This manual page was written by Chris Jones <cmsj@tenshu.net> This manual page was written by Chris Jones <cmsj@tenshu.net>
and others. and others.

View File

@ -34,7 +34,7 @@ These are the options Terminator currently supports in the global_config section
.TP .TP
.B dbus .B dbus
Control whether or not Terminator will load its DBus server. When this server is loaded, running Terminator multiple times will cause the first Terminator process to open additional windows. If this configuration item is set to False, or the python dbus module is unavailable, running Terminator multiple times will run a separate Terminator process for each invocation. Control whether or not Terminator will load its DBus server. When this server is loaded, running Terminator multiple times will cause the first Terminator process to open additional windows. If this configuration item is set to False, or the python dbus module is unavailable, running Terminator multiple times will run a separate Terminator process for each invocation.
Default value: \fBFalse\fR Default value: \fBTrue\fR
.TP .TP
.B focus .B focus
Control how focus is given to terminals. 'click' means the focus only moves to a terminal after you click in it. 'sloppy' means the focus will follow the mouse pointer. 'system' means the focus will match that used by a GNOME window manager. Control how focus is given to terminals. 'click' means the focus only moves to a terminal after you click in it. 'sloppy' means the focus will follow the mouse pointer. 'system' means the focus will match that used by a GNOME window manager.
@ -46,7 +46,7 @@ Default value: \fB-1\fR
.TP .TP
.B geometry_hinting .B geometry_hinting
If True the window will resize in step with font sizes, if False it will follow pixels If True the window will resize in step with font sizes, if False it will follow pixels
Default value: \fBTrue\fR Default value: \fBFalse\fR
.TP .TP
.B window_state .B window_state
When set to 'normal' the Terminator window opens normally. 'maximise' opens the window in a maximised state, 'fullscreen' in a fullscreen state and 'hidden' will make it not shown by default. When set to 'normal' the Terminator window opens normally. 'maximise' opens the window in a maximised state, 'fullscreen' in a fullscreen state and 'hidden' will make it not shown by default.
@ -136,6 +136,14 @@ Controls whether splits/tabs will continue to use the profile of their peer term
the default profile. the default profile.
Default value: \fBFalse\fR Default value: \fBFalse\fR
.TP .TP
.B putty_paste_style \fR(boolean)
If set to True, right-click will paste the Primary selection, middle-click will popup the context menu.
Default value: \fBFalse\fR
.TP
.B smart_copy \fR(boolean)
If set to True, and there is no selection, the shortcut is allowed to pass through. This is useful for overloading Ctrl-C to copy a selection, or send the SIGINT to the current process if there is no selection. If False the shortcut does not pass through at all, and the SIGINT does not get sent.
Default value: \fBTrue\fR
.TP
.B enabled_plugins .B enabled_plugins
A list of plugins which should be loaded by default. All other plugin classes will be ignored. The default value includes two A list of plugins which should be loaded by default. All other plugin classes will be ignored. The default value includes two
plugins related to Launchpad, which are enabled by default to provide continuity with earlier releases where these were the plugins related to Launchpad, which are enabled by default to provide continuity with earlier releases where these were the
@ -278,6 +286,18 @@ Note that <Alt><Shift>1 may need to be provided as <Alt>! or similar,
depending on your keyboard layout. depending on your keyboard layout.
Default value: \fBUnbound\fR Default value: \fBUnbound\fR
.TP .TP
.B edit_window_title
Edit the current active window's title
Default value: \fB<Ctrl>W\fR
.TP
.B edit_tab_title
Edit the currently active tab's title
Default value: \fB<Ctrl>A\fR
.TP
.B edit_terminal_title
Edit the currently active terminal's title
Default value: \fB<Ctrl>X\fR
.TP
.B full_screen .B full_screen
Toggle the window to a fullscreen window. Toggle the window to a fullscreen window.
Default value: \fBF11\fR Default value: \fBF11\fR

View File

@ -20,6 +20,8 @@
import sys import sys
import os import os
import psutil
import pwd
try: try:
ORIGCWD = os.getcwd() ORIGCWD = os.getcwd()
except OSError: except OSError:
@ -53,7 +55,11 @@ if __name__ == '__main__':
# Workaround for IBus intefering with broadcast when using dead keys # Workaround for IBus intefering with broadcast when using dead keys
# Environment also needs IBUS_DISABLE_SNOOPER=1, or double chars appear # Environment also needs IBUS_DISABLE_SNOOPER=1, or double chars appear
# in the receivers. # in the receivers.
os.environ['IBUS_DISABLE_SNOOPER']='1' username = pwd.getpwuid(os.getuid()).pw_name
ibus_running = [p for p in psutil.process_iter() if p.name == 'ibus-daemon' and p.username == username]
ibus_running = len(ibus_running) > 0
if ibus_running:
os.environ['IBUS_DISABLE_SNOOPER']='1'
dbus_service = None dbus_service = None
@ -107,6 +113,7 @@ if __name__ == '__main__':
TERMINATOR.set_origcwd(ORIGCWD) TERMINATOR.set_origcwd(ORIGCWD)
TERMINATOR.set_dbus_data(dbus_service) TERMINATOR.set_dbus_data(dbus_service)
TERMINATOR.reconfigure() TERMINATOR.reconfigure()
TERMINATOR.ibus_running = ibus_running
try: try:
dbg('Creating a terminal with layout: %s' % OPTIONS.layout) dbg('Creating a terminal with layout: %s' % OPTIONS.layout)

View File

@ -123,6 +123,8 @@ DEFAULTS = {
'always_split_with_profile': False, 'always_split_with_profile': False,
'title_use_system_font' : True, 'title_use_system_font' : True,
'title_font' : 'Sans 9', 'title_font' : 'Sans 9',
'putty_paste_style' : False,
'smart_copy' : True,
}, },
'keybindings': { 'keybindings': {
'zoom_in' : '<Control>plus', 'zoom_in' : '<Control>plus',
@ -190,7 +192,9 @@ DEFAULTS = {
'broadcast_all' : '<Alt>a', 'broadcast_all' : '<Alt>a',
'insert_number' : '<Super>1', 'insert_number' : '<Super>1',
'insert_padded' : '<Super>0', 'insert_padded' : '<Super>0',
'edit_window_title': '<Alt>t', 'edit_window_title': '<Control>w',
'edit_tab_title' : '<Control>a',
'edit_terminal_title': '<Control>x',
'layout_launcher' : '<Alt>l', 'layout_launcher' : '<Alt>l',
'next_profile' : '', 'next_profile' : '',
'previous_profile' : '', 'previous_profile' : '',

View File

@ -25,7 +25,8 @@ class EditableLabel(Gtk.EventBox):
# pylint: disable-msg=R0904 # pylint: disable-msg=R0904
""" """
An eventbox that partialy emulate a Gtk.Label An eventbox that partialy emulate a Gtk.Label
On double-click, the label is editable, entering an empty will revert back to automatic text On double-click or key binding the label is editable, entering an empty
will revert back to automatic text
""" """
_label = None _label = None
_ebox = None _ebox = None
@ -67,30 +68,34 @@ class EditableLabel(Gtk.EventBox):
"""get the text from the label""" """get the text from the label"""
return(self._label.get_text()) return(self._label.get_text())
def edit(self):
""" Start editing the widget text """
if self._entry:
return False
self.remove (self._label)
self._entry = Gtk.Entry ()
self._entry.set_text (self._label.get_text ())
self._entry.show ()
self.add (self._entry)
sig = self._entry.connect ("focus-out-event", self._entry_to_label)
self._entry_handler_id.append(sig)
sig = self._entry.connect ("activate", self._on_entry_activated)
self._entry_handler_id.append(sig)
sig = self._entry.connect ("key-press-event",
self._on_entry_keypress)
self._entry_handler_id.append(sig)
sig = self._entry.connect("button-press-event",
self._on_entry_buttonpress)
self._entry_handler_id.append(sig)
self._entry.grab_focus ()
def _on_click_text(self, widget, event): def _on_click_text(self, widget, event):
# pylint: disable-msg=W0613 # pylint: disable-msg=W0613
"""event handling text edition""" """event handling text edition"""
if event.button != 1: if event.button != 1:
return False return False
if event.type == Gdk.EventType._2BUTTON_PRESS: if event.type == Gdk.EventType._2BUTTON_PRESS:
if self._entry: self.edit()
return False
self.remove (self._label)
self._entry = Gtk.Entry ()
self._entry.set_text (self._label.get_text ())
self._entry.show ()
self.add (self._entry)
sig = self._entry.connect ("focus-out-event", self._entry_to_label)
self._entry_handler_id.append(sig)
sig = self._entry.connect ("activate", self._on_entry_activated)
self._entry_handler_id.append(sig)
sig = self._entry.connect ("key-press-event",
self._on_entry_keypress)
self._entry_handler_id.append(sig)
sig = self._entry.connect("button-press-event",
self._on_entry_buttonpress)
self._entry_handler_id.append(sig)
self._entry.grab_focus ()
return(True) return(True)
return(False) return(False)

View File

@ -40,9 +40,10 @@ class Notebook(Container, Gtk.Notebook):
child = window.get_child() child = window.get_child()
window.remove(child) window.remove(child)
window.add(self) window.add(self)
window_last_active_term = window.last_active_term
self.newtab(widget=child) self.newtab(widget=child)
if window.last_active_term: if window_last_active_term:
self.set_last_active_term(window.last_active_term) self.set_last_active_term(window_last_active_term)
window.last_active_term = None window.last_active_term = None
self.show_all() self.show_all()
@ -535,6 +536,9 @@ class TabLabel(Gtk.HBox):
else: else:
return(None) return(None)
def edit(self):
self.label.edit()
def update_button(self): def update_button(self):
"""Update the state of our close button""" """Update the state of our close button"""
if not self.config['close_button_on_tab']: if not self.config['close_button_on_tab']:

View File

@ -7,7 +7,7 @@ variants"""
import time import time
from gi.repository import GObject, Gtk, Gdk from gi.repository import GObject, Gtk, Gdk
from util import dbg, err from util import dbg, err, enumerate_descendants
from terminator import Terminator from terminator import Terminator
from factory import Factory from factory import Factory
from container import Container from container import Container
@ -259,6 +259,26 @@ class Paned(Container):
if self.closeterm(widget): if self.closeterm(widget):
# At this point we only have one child, which is the surviving term # At this point we only have one child, which is the surviving term
sibling = self.children[0] sibling = self.children[0]
first_term_sibling = sibling
cur_tabnum = None
focus_sibling = True
if self.get_toplevel().is_child_notebook():
notebook = self.get_toplevel().get_children()[0]
cur_tabnum = notebook.get_current_page()
tabnum = notebook.page_num_descendant(self)
nth_page = notebook.get_nth_page(tabnum)
exiting_term_was_last_active = (notebook.last_active_term[nth_page] == widget.uuid)
if exiting_term_was_last_active:
first_term_sibling = enumerate_descendants(self)[1][0]
notebook.set_last_active_term(first_term_sibling.uuid)
notebook.clean_last_active_term()
self.get_toplevel().last_active_term = None
if cur_tabnum != tabnum:
focus_sibling = False
elif self.get_toplevel().last_active_term != widget.uuid:
focus_sibling = False
self.remove(sibling) self.remove(sibling)
metadata = None metadata = None
@ -268,7 +288,12 @@ class Paned(Container):
parent.remove(self) parent.remove(self)
self.cnxids.remove_all() self.cnxids.remove_all()
parent.add(sibling, metadata) parent.add(sibling, metadata)
sibling.grab_focus() if cur_tabnum:
notebook.set_current_page(cur_tabnum)
if focus_sibling:
first_term_sibling.grab_focus()
elif not sibling.get_toplevel().is_child_notebook():
Terminator().find_terminal_by_uuid(sibling.get_toplevel().last_active_term.urn).grab_focus()
else: else:
dbg("Paned::wrapcloseterm: self.closeterm failed") dbg("Paned::wrapcloseterm: self.closeterm failed")

View File

@ -434,7 +434,7 @@
<object class="GtkTable" id="table8"> <object class="GtkTable" id="table8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="n_rows">6</property> <property name="n_rows">7</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="column_spacing">12</property> <property name="column_spacing">12</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -565,6 +565,25 @@
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="dbuscheck">
<property name="label" translatable="yes">DBus server</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_dbuscheck_toggled" swapped="no"/>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@ -576,7 +595,7 @@
<object class="GtkTable" id="table9"> <object class="GtkTable" id="table9">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="n_rows">6</property> <property name="n_rows">7</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="column_spacing">12</property> <property name="column_spacing">12</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -649,6 +668,38 @@
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="putty_paste_style">
<property name="label" translatable="yes">Putty style paste</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_putty_paste_style_toggled" swapped="no"/>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="smart_copy">
<property name="label" translatable="yes">Smart copy</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_smart_copy_toggled" swapped="no"/>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child> <child>
<object class="GtkCheckButton" id="always_split_with_profile"> <object class="GtkCheckButton" id="always_split_with_profile">
<property name="label" translatable="yes">Re-use profiles for new terminals</property> <property name="label" translatable="yes">Re-use profiles for new terminals</property>
@ -662,8 +713,8 @@
</object> </object>
<packing> <packing>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">2</property> <property name="top_attach">4</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -680,8 +731,8 @@
</object> </object>
<packing> <packing>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">3</property> <property name="top_attach">5</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -732,27 +783,8 @@
</object> </object>
<packing> <packing>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">4</property> <property name="top_attach">6</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="dbuscheck">
<property name="label" translatable="yes">DBus server</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_dbuscheck_toggled" swapped="no"/>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>

View File

@ -147,6 +147,8 @@ class PrefsEditor:
'insert_number' : _('Insert terminal number'), 'insert_number' : _('Insert terminal number'),
'insert_padded' : _('Insert padded terminal number'), 'insert_padded' : _('Insert padded terminal number'),
'edit_window_title': _('Edit window title'), 'edit_window_title': _('Edit window title'),
'edit_terminal_title': _('Edit terminal title'),
'edit_tab_title' : _('Edit tab title'),
'layout_launcher' : _('Open layout launcher window'), 'layout_launcher' : _('Open layout launcher window'),
'next_profile' : _('Switch to next profile'), 'next_profile' : _('Switch to next profile'),
'previous_profile' : _('Switch to previous profile'), 'previous_profile' : _('Switch to previous profile'),
@ -289,6 +291,12 @@ class PrefsEditor:
#Always split with profile #Always split with profile
widget = guiget('always_split_with_profile') widget = guiget('always_split_with_profile')
widget.set_active(self.config['always_split_with_profile']) widget.set_active(self.config['always_split_with_profile'])
# Putty paste style
widget = guiget('putty_paste_style')
widget.set_active(self.config['putty_paste_style'])
# Smart copy
widget = guiget('smart_copy')
widget.set_active(self.config['smart_copy'])
#Titlebar font selector #Titlebar font selector
# Use system font # Use system font
widget = guiget('title_system_font_checkbutton') widget = guiget('title_system_font_checkbutton')
@ -707,6 +715,16 @@ class PrefsEditor:
self.config['rewrap_on_resize'] = widget.get_active() self.config['rewrap_on_resize'] = widget.get_active()
self.config.save() self.config.save()
def on_putty_paste_style_toggled(self, widget):
"""Putty paste style setting changed"""
self.config['putty_paste_style'] = widget.get_active()
self.config.save()
def on_smart_copy_toggled(self, widget):
"""Putty paste style setting changed"""
self.config['smart_copy'] = widget.get_active()
self.config.save()
def on_cursor_blink_toggled(self, widget): def on_cursor_blink_toggled(self, widget):
"""Cursor blink setting changed""" """Cursor blink setting changed"""
self.config['cursor_blink'] = widget.get_active() self.config['cursor_blink'] = widget.get_active()

View File

@ -69,6 +69,10 @@ class Terminal(Gtk.VBox):
TARGET_TYPE_VTE = 8 TARGET_TYPE_VTE = 8
MOUSEBUTTON_LEFT = 1
MOUSEBUTTON_MIDDLE = 2
MOUSEBUTTON_RIGHT = 3
terminator = None terminator = None
vte = None vte = None
terminalbox = None terminalbox = None
@ -867,12 +871,13 @@ class Terminal(Gtk.VBox):
dbg('Terminal::on_keypress: Called on %s with no event' % widget) dbg('Terminal::on_keypress: Called on %s with no event' % widget)
return(False) return(False)
# Workaround for IBus intefering with broadcast when using dead keys # Workaround for IBus interfering with broadcast when using dead keys
# Environment also needs IBUS_DISABLE_SNOOPER=1, or double chars appear # Environment also needs IBUS_DISABLE_SNOOPER=1, or double chars appear
# in the receivers. # in the receivers.
if (event.state | Gdk.ModifierType.MODIFIER_MASK ) ^ Gdk.ModifierType.MODIFIER_MASK != 0: if self.terminator.ibus_running:
dbg('Terminal::on_keypress: Ingore processed event with event.state %d' % event.state) if (event.state | Gdk.ModifierType.MODIFIER_MASK ) ^ Gdk.ModifierType.MODIFIER_MASK != 0:
return(False) dbg('Terminal::on_keypress: Ingore processed event with event.state %d' % event.state)
return(False)
# FIXME: Does keybindings really want to live in Terminator()? # FIXME: Does keybindings really want to live in Terminator()?
mapping = self.terminator.keybindings.lookup(event) mapping = self.terminator.keybindings.lookup(event)
@ -890,6 +895,8 @@ class Terminal(Gtk.VBox):
if self.vte.get_has_selection (): if self.vte.get_has_selection ():
getattr(self, "key_" + mapping)() getattr(self, "key_" + mapping)()
return(True) return(True)
elif not self.config['smart_copy']:
return(True)
else: else:
getattr(self, "key_" + mapping)() getattr(self, "key_" + mapping)()
return(True) return(True)
@ -917,25 +924,32 @@ class Terminal(Gtk.VBox):
# Suppress double-click behavior # Suppress double-click behavior
return True return True
if event.button == 1: if self.config['putty_paste_style']:
middle_click = [self.popup_menu, (widget, event)]
right_click = [self.paste_clipboard, (True, )]
else:
middle_click = [self.paste_clipboard, (True, )]
right_click = [self.popup_menu, (widget, event)]
if event.button == self.MOUSEBUTTON_LEFT:
# Ctrl+leftclick on a URL should open it # Ctrl+leftclick on a URL should open it
if event.get_state() & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK: if event.get_state() & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK:
url = self.vte.match_check_event(event) url = self.vte.match_check_event(event)
if url[0]: if url[0]:
self.open_url(url, prepare=True) self.open_url(url, prepare=True)
elif event.button == 2: elif event.button == self.MOUSEBUTTON_MIDDLE:
# middleclick should paste the clipboard # middleclick should paste the clipboard
self.paste_clipboard(True) middle_click[0](*middle_click[1])
return(True) return(True)
elif event.button == 3: elif event.button == self.MOUSEBUTTON_RIGHT:
# rightclick should display a context menu if Ctrl is not pressed, # rightclick should display a context menu if Ctrl is not pressed,
# plus either the app is not interested in mouse events or Shift is pressed # plus either the app is not interested in mouse events or Shift is pressed
if event.get_state() & Gdk.ModifierType.CONTROL_MASK == 0: if event.get_state() & Gdk.ModifierType.CONTROL_MASK == 0:
if event.get_state() & Gdk.ModifierType.SHIFT_MASK == 0: if event.get_state() & Gdk.ModifierType.SHIFT_MASK == 0:
if not Vte.Terminal.do_button_press_event(self.vte, event): if not Vte.Terminal.do_button_press_event(self.vte, event):
self.popup_menu(widget, event) right_click[0](*right_click[1])
else: else:
self.popup_menu(widget, event) right_click[0](*right_click[1])
return(True) return(True)
return(False) return(False)
@ -1869,6 +1883,20 @@ class Terminal(Gtk.VBox):
dialog.destroy() dialog.destroy()
return return
def key_edit_tab_title(self):
window = self.get_toplevel()
if not window.is_child_notebook():
return
notebook = window.get_children()[0]
n_page = notebook.get_current_page()
page = notebook.get_nth_page(n_page)
label = notebook.get_tab_label(page)
label.edit()
def key_edit_terminal_title(self):
self.titlebar.label.edit()
def key_layout_launcher(self): def key_layout_launcher(self):
LAYOUTLAUNCHER=LayoutLauncher() LAYOUTLAUNCHER=LayoutLauncher()

View File

@ -48,6 +48,7 @@ class Terminator(Borg):
pid_cwd = None pid_cwd = None
gnome_client = None gnome_client = None
debug_address = None debug_address = None
ibus_running = None
doing_layout = None doing_layout = None
layoutname = None layoutname = None