diff --git a/connmgr.py b/connmgr.py index 30d23a4..2c2bde2 100644 --- a/connmgr.py +++ b/connmgr.py @@ -36,17 +36,20 @@ import re import sys -VERSION = '0.8.3' +VERSION = '0.8.5' -supportedTerms = ["Gnome Terminal", "Terminator", "Guake", "TMux", "urxvt", "urxvt256c", "LilyTerm"] -supportedTermsCmd = ["gnome-terminal", "terminator", "guake", "tmux", "urxvt", "urxvt256c", "lilyterm"] -supportedTermsSite = ["http://library.gnome.org/users/gnome-terminal/stable/", - "http://www.tenshu.net/p/terminator.html", - "http://guake.org/", +supportedTerms = ["Gnome Terminal", "Terminator", "Guake", "TMux", "urxvt", "urxvt256c", "LilyTerm", "Mate Terminal", "XFCE Terminal", "Terminix"] +supportedTermsCmd = ["gnome-terminal", "terminator", "guake", "tmux", "urxvt", "urxvt256c", "lilyterm", "mate-terminal", "xfce4-terminal", "terminix"] +supportedTermsSite = ["http://library.gnome.org/users/gnome-terminal/stable/", + "http://www.tenshu.net/p/terminator.html", + "http://guake.org/", "http://tmux.sourceforge.net/", "http://software.schmorp.de/pkg/rxvt-unicode.html", "http://software.schmorp.de/pkg/rxvt-unicode.html", - "http://lilyterm.luna.com.tw/index.html" + "http://lilyterm.luna.com.tw/index.html", + "http://www.mate-desktop.org", + "http://www.xfce.org/", + "https://github.com/gnunn1/terminix" ] @@ -625,28 +628,14 @@ def a_host(line): lines = [line.strip() for line in file(SSH_CONFIG_FILE)] comments_removed = [remove_comment(line) for line in lines] blanks_removed = [line for line in comments_removed if line] + non_hosts_removed = [line for line in blanks_removed if a_host(line)] - block = itertools.groupby(blanks_removed, not_a_host) - - first_block = False - for key, group in block: - Info = dict([line.split(None, 1) for line in group]) - - if (not key): - if (not first_block): - first_block = True - importedHost = Info['Host'] - if (key and first_block): - if 'HostName' in Info: - importedHostname = Info['HostName'] - if 'User' in Info: - importedHostname = Info['User']+'@'+importedHostname - if 'Port' in Info: - importedHostname = '-p '+Info['Port']+' '+importedHostname - + for line in non_hosts_removed: + importedHosts = line.split(None)[1:] + for importedHost in importedHosts: if importedHost != '*': treestore.append(import_iter, ['__item__', - importedHost, importedHostname, 'Unnamed', 'ssh']) + importedHost, importedHost, 'Unnamed', 'ssh']) def is_folder(self, iter): if self.treestore.get_value(iter, 0) == '__folder__': diff --git a/extension.js b/extension.js index 0c82dac..71da3e4 100644 --- a/extension.js +++ b/extension.js @@ -74,11 +74,14 @@ const ConnectionManager = new Lang.Class({ this._searchProvider = new Search.SshSearchProvider('CONNECTION MANAGER'); if( typeof Main.overview.viewSelector === "object" && - typeof Main.overview.viewSelector._searchResults === "object" && - typeof Main.overview.viewSelector._searchResults._searchSystem === "object" && - typeof Main.overview.viewSelector._searchResults._searchSystem.addProvider === "function") { + typeof Main.overview.viewSelector._searchResults === "object") { + if(typeof Main.overview.viewSelector._searchResults._registerProvider === "function") { //3.14 + Main.overview.viewSelector._searchResults._registerProvider(this._searchProvider); + } else if(typeof Main.overview.viewSelector._searchResults._searchSystem === "object" && + typeof Main.overview.viewSelector._searchResults._searchSystem.addProvider === "function") { //3.12 Main.overview.viewSelector._searchResults._searchSystem.addProvider(this._searchProvider); - } + } + } this._readConf(); }, @@ -300,7 +303,7 @@ const ConnectionManager = new Lang.Class({ mycommand += commandTab[c]+' '; } - Util.spawnCommandLine(' sh -c '+(sshparamsTab[0]+' '+term+' '+mycommand).quote()+' &'); + Util.spawnCommandLine(' sh -c '+JSON.stringify(sshparamsTab[0]+' '+term+' '+mycommand)+' &'); }); } @@ -328,6 +331,11 @@ function enable() { } function disable() { + if(cm._searchProvider!=null) { + Main.overview.removeSearchProvider(cm._searchProvider); + cm._searchProvider = null; + } + cm.monitor.cancel(); cm.destroy(); } diff --git a/metadata.json b/metadata.json index 022d7ce..95e2e31 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,15 @@ { - "shell-version": ["3.12"], - "version": "0.8.3", + "shell-version": [ + "3.12", + "3.14", + "3.16", + "3.18", + "3.20", + "3.22", + "3.24", + "3.26" + ], + "version": "0.8.5", "uuid": "connectionmanager2@ciancio.net", "name": "Connection Manager", "description": "Simple GUI app for Gnome 3 that provides a menu for initiating SSH/Telnet/Custom Apps connections.", diff --git a/search.js b/search.js index 6079f9c..6fe7839 100644 --- a/search.js +++ b/search.js @@ -54,7 +54,8 @@ const SshSearchProvider = new Lang.Class({ for (var j=0; j 0) { - this.command += ' --window-with-profile=' + (this.child.Profile).quote(); + this.command += ' --window-with-profile=' + JSON.stringify(this.child.Profile); } - this.command += ' --title=' + (this.child.Name).quote(); - this.command += ' -e ' + ("sh -c " + (this.child.Protocol + " " + this.sshparams_noenv).quote()).quote(); + this.command += ' --title=' + JSON.stringify(this.child.Name); + this.command += ' -e ' + JSON.stringify("sh -c " + JSON.stringify(this.child.Protocol + " " + this.sshparams_noenv)); - this.command = 'sh -c ' + this.command.quote(); + this.command = 'sh -c ' + JSON.stringify(this.command); } if (this.child.Type == '__app__') { if (this.child.Protocol == 'True') { - this.command += this.cmdTerm + ' --title=' + (this.child.Name).quote() + ' -e '; - this.command += (this.child.Host).quote(); + this.command += this.cmdTerm + ' --title=' + JSON.stringify(this.child.Name) + ' -e '; + this.command += JSON.stringify(this.child.Host); } else { this.command += this.child.Host; } @@ -164,22 +168,22 @@ GnomeTerminalCommand.prototype = { this.command += ' '; if (this.child.Profile && this.child.Profile.length > 0) { - this.command += ' --tab-with-profile=' + (this.child.Profile).quote(); + this.command += ' --tab-with-profile=' + JSON.stringify(this.child.Profile); } - else + else { this.command = ' --tab '; } - this.command += ' --title=' + (this.child.Name).quote(); - this.command += ' -e ' + ("sh -c " + (this.child.Protocol + " " + this.sshparams_noenv).quote()).quote(); + this.command += ' --title=' + JSON.stringify(this.child.Name); + this.command += ' -e ' + JSON.stringify("sh -c " + JSON.stringify(this.child.Protocol + " " + this.sshparams_noenv)); } if (this.child.Type == '__app__') { // Ignore "execute in a shell" when open all as tabs - this.command += ' --tab --title=' + (this.child.Name).quote() + ' -e '; - this.command += (this.child.Host).quote(); + this.command += ' --tab --title=' + JSON.stringify(this.child.Name) + ' -e '; + this.command += JSON.stringify(this.child.Host); } return [this.command, this.sshparams]; @@ -209,21 +213,21 @@ TerminatorCommand.prototype = { } if (this.child.Profile && this.child.Profile.length > 0) { - this.command += ' --profile=' + (this.child.Profile).quote(); + this.command += ' --profile=' + JSON.stringify(this.child.Profile); } - this.command += ' --title=' + (this.child.Name).quote(); - this.command += ' -e ' + ("sh -c " + (this.child.Protocol + " " + this.sshparams_noenv).quote()).quote(); + this.command += ' --title=' + JSON.stringify(this.child.Name); + this.command += ' -e ' + JSON.stringify("sh -c " + JSON.stringify(this.child.Protocol + " " + this.sshparams_noenv)); - this.command = 'sh -c ' + this.command.quote(); + this.command = 'sh -c ' + JSON.stringify(this.command); } if (this.child.Type == '__app__') { if (this.child.Protocol == 'True') { - this.command += this.cmdTerm + ' --title=' + (this.child.Name).quote() + ' -e '; - this.command += (this.child.Host).quote(); + this.command += this.cmdTerm + ' --title=' + JSON.stringify(this.child.Name) + ' -e '; + this.command += JSON.stringify(this.child.Host); } else { this.command += this.child.Host; } @@ -250,17 +254,17 @@ GuakeCommand.prototype = { this.command += this.cmdTerm; - this.command += ' --new-tab=' + (this.child.Name).quote(); - this.command += ' --rename-tab=' + (this.child.Name).quote(); - this.command += ' -e ' + (this.sshparams +" sh -c " + (this.child.Protocol + " " + this.sshparams_noenv).quote()).quote(); + this.command += ' --new-tab=' + JSON.stringify(this.child.Name); + this.command += ' --rename-current-tab=' + JSON.stringify(this.child.Name); + this.command += ' -e ' + JSON.stringify(this.sshparams +" sh -c " + JSON.stringify(this.child.Protocol + " " + this.sshparams_noenv)); } if (this.child.Type == '__app__') { if (this.child.Protocol == 'True') { - this.command += this.cmdTerm + ' --rename-tab=' + (this.child.Name).quote() + ' --new-tab=' + (this.child.Name).quote() + ' -e '; - this.command += (this.child.Host).quote(); + this.command += this.cmdTerm + ' --rename-current-tab=' + JSON.stringify(this.child.Name) + ' --new-tab=' + JSON.stringify(this.child.Name) + ' -e '; + this.command += JSON.stringify(this.child.Host); } else { this.command += this.child.Host; } @@ -287,15 +291,15 @@ TMuxCommand.prototype = { this._setParams(); this.command += this.cmdTerm; - this.command += ' new-window -n ' + (this.child.Name).quote(); - this.command += ' ' + (this.sshparams + this.child.Protocol + " " + this.sshparams_noenv).quote(); + this.command += ' new-window -n ' + JSON.stringify(this.child.Name); + this.command += ' ' + JSON.stringify(this.sshparams + this.child.Protocol + " " + this.sshparams_noenv); } if (this.child.Type == '__app__') { if (this.child.Protocol == 'True') { - this.command += this.cmdTerm + ' new-window -n ' + (this.child.Name).quote(); - this.command += ' ' + (this.child.Host).quote(); + this.command += this.cmdTerm + ' new-window -n ' + JSON.stringify(this.child.Name); + this.command += ' ' + JSON.stringify(this.child.Host); } else { this.command += this.child.Host; } @@ -328,18 +332,18 @@ URXVTCommand.prototype = { this.command = this.sshparams + ' ' + this.command; } - this.command += ' -title ' + (this.child.Name).quote(); - this.command += ' -e ' + ("sh -c " + (this.child.Protocol + " " + this.sshparams_noenv).quote()); + this.command += ' -title ' + JSON.stringify(this.child.Name); + this.command += ' -e ' + JSON.stringify("sh -c " + (this.child.Protocol + " " + this.sshparams_noenv)); - this.command = 'sh -c ' + this.command.quote(); + this.command = 'sh -c ' + JSON.stringify(this.command); } if (this.child.Type == '__app__') { if (this.child.Protocol == 'True') { - this.command += this.cmdTerm + ' -title ' + (this.child.Name).quote() + ' -e '; - this.command += (this.child.Host).quote(); + this.command += this.cmdTerm + ' -title ' + JSON.stringify(this.child.Name) + ' -e '; + this.command += JSON.stringify(this.child.Host); } else { this.command += this.child.Host; } @@ -385,18 +389,18 @@ LilyTermCommand.prototype = { this.command = this.sshparams + ' ' + this.command; } - this.command += ' --title ' + (this.child.Name).quote(); - this.command += ' -s -e ' + ("sh -c " + (this.child.Protocol + " " + this.sshparams_noenv).quote()); + this.command += ' --title ' + JSON.stringify(this.child.Name); + this.command += ' -s -e ' + JSON.stringify("sh -c " + (this.child.Protocol + " " + this.sshparams_noenv)); - this.command = 'sh -c ' + this.command.quote(); + this.command = 'sh -c ' + JSON.stringify(this.command); } if (this.child.Type == '__app__') { if (this.child.Protocol == 'True') { - this.command += this.cmdTerm + ' --title ' + (this.child.Name).quote() + ' -s -e '; - this.command += (this.child.Host).quote(); + this.command += this.cmdTerm + ' --title ' + JSON.stringify(this.child.Name) + ' -s -e '; + this.command += JSON.stringify(this.child.Host); } else { this.command += this.child.Host; } @@ -408,3 +412,45 @@ LilyTermCommand.prototype = { } +// ****************************************************** +// TerminixTerm class derived from base class +// ****************************************************** +function TerminixCommand(terminal) { + this._init(terminal); +} + +TerminixCommand.prototype = { + __proto__: TerminalCommand.prototype, + + createCmd: function () { + + if (this.child.Type == '__item__') { + this._setParams(); + + this.command += this.cmdTerm; + + if (this.sshparams && this.sshparams.length > 0) { + this.command = this.sshparams + ' ' + this.command; + } + + this.command += ' --title ' + JSON.stringify(this.child.Name); + this.command += ' -e ' + JSON.stringify(this.child.Protocol + " " + this.sshparams_noenv); + + this.command = 'sh -c ' + JSON.stringify(this.command); + + } + + if (this.child.Type == '__app__') { + + if (this.child.Protocol == 'True') { + this.command += this.cmdTerm + ' --title ' + JSON.stringify(this.child.Name) + ' -e '; + this.command += JSON.stringify(this.child.Host); + } else { + this.command += this.child.Host; + } + } + + return this.command; + }, + +}