-
Notifications
You must be signed in to change notification settings - Fork 260
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
Feature: Insert terminal name to terminal (for broadcast) #540
Comments
Should be fairly easy to write as a plugin, and I may take a stab at it. |
It will be excellent! |
so |
I make a simple patch to add diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py
index 4715e86c..26bc7b2c 100644
--- a/terminatorlib/terminal.py
+++ b/terminatorlib/terminal.py
@@ -567,6 +567,10 @@ class Terminal(Gtk.VBox):
menu.append(Gtk.SeparatorMenuItem())
+ item = Gtk.MenuItem.new_with_mnemonic(_('_Insert terminal name'))
+ item.connect('activate', lambda x: self.emit('enumerate', 2))
+ menu.append(item)
+
item = Gtk.MenuItem.new_with_mnemonic(_('_Insert terminal number'))
item.connect('activate', lambda x: self.emit('enumerate', False))
menu.append(item)
diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py
index 6cbf4d68..2af294b9 100644
--- a/terminatorlib/terminator.py
+++ b/terminatorlib/terminator.py
@@ -588,8 +588,13 @@ class Terminator(Borg):
terminals.extend(win_terminals)
for term in self.get_target_terms(widget):
- idx = terminals.index(term)
- term.feed(numstr % (idx + 1))
+ # print('term:', term.get_window_title())
+ if pad == 2:
+ name = term.get_window_title()
+ term.feed(name.encode())
+ else:
+ idx = terminals.index(term)
+ term.feed(numstr.encode() % (idx + 1))
def get_sibling_terms(self, widget):
termset = []
if you wish term custom title override term title: -name = term.get_window_title()
+name = term.titlebar.get_custom_string() or term.get_window_title() here is demo record: terminator_insert_term_name.mp4 |
these days I feel that especially the
that made Considering that split screen and broadcast input are such a feature for terminator think about add this feature to terminator rather than plugin ? |
will you think about make this as built-in ? seems it's not possible to change the //seems a PR for built-in: |
This plugin inserts the name of the terminal, as determined by Terminal.get_window_title() to all open terminals. Fixes gnome-terminator#540
Sorry @yurenchen000, I rewrote this as a plugin. You have a good point that it was a really useful function, but I didn't like two things:
The resulting code is not that much more verbose, it has to be explicitly enabled, and it's much more clear what the code is doing. |
@mattrose Got it, // I use terminal name occasionally for cluster operate. On the contrary, I rarely use insert numbers. Thanks for making plugins for our minority users 😂 BTW, is there any way to sort & splitter the context-menu items ? // That's one reason I don't often use the context-menu. |
@mattrose Maybe it should be discussed in a new post |
Lemme mock it up in the titlebar group menu. I think we can fit it in there. |
Sorry, I misread your code, and I thought you wanted to add it to the context menu. I thought about this last night and don't actually have a problem with adding it to the group menu. I'm going to pull in the group menu stuff. I'll keep the plugin in mainly for my own purposes. |
(ง •̀_•́)ง yes, Thank you for spending time with minority users, me. And, BTW think about extend the plugin system capacity for group-menu ? If you agree with this, |
This plugin inserts the name of the terminal, as determined by Terminal.get_window_title() to all open terminals. Fixes gnome-terminator#540
Problem: I want to ssh to 30 servers with different names at the same time, (password is the same) - I don't want on start ssh on start Terminator but during work - on choosen servers not all servers in a group.
My solution is easy: If I put my saved layout - my servers names and user in "Terminal name" field",
then only one think which I need is to insert "terminal name" to all terminal in group - similar to "Insert Terminal Number".
What will be to do:
add option "Insert Terminal Name to Terminal" for shortcuts and terminal context menu.
If if will have for ex. 30 terminals in grid - all with Terminal Name: user1@server1.com, user2@server2.com ....
(If I want not to log to some of it, I disable broadcast for it)
I will can now:
"ssh ("Insert Terminal Name ") - enter (and now I am ssh to 30 servers at the same time).
Jacceko
The text was updated successfully, but these errors were encountered: