Skip to content

Commit

Permalink
Merge pull request #11 from xWTF/master
Browse files Browse the repository at this point in the history
Fix hostname display for serial port sessions
  • Loading branch information
jjw24 committed Nov 2, 2022
2 parents f0b7efb + 6dbdd2a commit f07d2b6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Flow.Launcher.Plugin.Putty/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,15 @@ private bool LaunchPuttySession(string session, PuttySession puttySession = null

var p = new Process { StartInfo = { FileName = puttyPath } };

if (!string.IsNullOrEmpty(puttySession?.Hostname))
if (!string.IsNullOrEmpty(puttySession?.Identifier))
{
p.StartInfo.Arguments = "-load \"" + puttySession.Identifier + "\"";
p.StartInfo.ArgumentList.Add("-load");
p.StartInfo.ArgumentList.Add(puttySession.Identifier);
}
else if (!string.IsNullOrEmpty(session))
{
p.StartInfo.Arguments = "-ssh \"" + session + "\"";
p.StartInfo.ArgumentList.Add("-ssh");
p.StartInfo.ArgumentList.Add(session);
}

if (settings.AlwaysStartsSessionMaximized)
Expand Down
10 changes: 8 additions & 2 deletions Flow.Launcher.Plugin.Putty/PuttySessionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,19 @@ public IEnumerable<PuttySession> GetAll()
}
try
{
results.Add(new PuttySession
var session = new PuttySession
{
Identifier = Uri.UnescapeDataString(subKey),
Protocol = puttySessionSubKey.GetValue("Protocol").ToString(),
Username = puttySessionSubKey.GetValue("UserName").ToString(),
Hostname = puttySessionSubKey.GetValue("HostName").ToString(),
});
};
if (session.Protocol == "serial")
{
session.Hostname = $"{puttySessionSubKey.GetValue("SerialLine")}?baud={puttySessionSubKey.GetValue("SerialSpeed")}";
session.Username = string.Empty; // ensure ToString doesn't append username
}
results.Add(session);
}
catch (Exception)
{
Expand Down
2 changes: 1 addition & 1 deletion Flow.Launcher.Plugin.Putty/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Name": "Putty",
"Description": "Launch Putty Sessions",
"Author":"Konstantin Zaitcev, Kai Eichinger (@cH40zLord)",
"Version":"2.1.3",
"Version":"2.2.0",
"Language": "csharp",
"Website": "https://github.com/jjw24/Flow.Launcher.Plugin.Putty",
"ExecuteFileName": "Flow.Launcher.Plugin.Putty.dll",
Expand Down

0 comments on commit f07d2b6

Please sign in to comment.