Skip to content
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

GNOME Shell 42 Compat #4

Merged
merged 2 commits into from
May 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const St = imports.gi.St;
const ByteArray = imports.byteArray;

const ExtensionUtils = imports.misc.extensionUtils;
const Util = imports.misc.util;
Expand All @@ -22,7 +23,9 @@ let SSHQuickConnect = class SSHQuickConnect extends PanelMenu.Button {

this.createIcon();
// Get ~/.ssh/config as string
const hostString = GLib.spawn_command_line_sync("cat " + GLib.get_home_dir() + "/.ssh/config")[1].toString();
const hostString = ByteArray.toString(
GLib.file_get_contents(GLib.get_home_dir() + '/.ssh/config')[1]
);
// Parse string into array of Hosts
this.hosts = hostString.split('\n').join('{{NEWLINE}}').split('\r').join('{{NEWLINE}}').split('{{NEWLINE}}')
.map(item => item.trim())
Expand Down Expand Up @@ -71,7 +74,6 @@ let SSHQuickConnect = class SSHQuickConnect extends PanelMenu.Button {
* EXTENSION BOILERPLATE
*/

// Compatibility with gnome-shell >= 3.32
if (SHELL_MAJOR > 39 || SHELL_MINOR > 30) {
SSHQuickConnect = GObject.registerClass(
{ GTypeName: 'SSHQuickConnect' },
Expand All @@ -97,4 +99,4 @@ function disable() {
indicator.destroy();
indicator = null;
}
}
}
11 changes: 4 additions & 7 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"uuid": "ssh-quick-connect@ibrokemy.computer",
"name": "SSH Quick Connect",
"description": "This extension puts an icon in the panel with a simple dropdown menu that launches items from your ~.ssh/config",
"version": 1,
"shell-version": [
"3.36",
"40.0"
],
"url": "https://www.github.com/ibrokemycomputer/gnome-shell-extension-ssh-quick-connect"
"description": "This extension puts an icon in the panel with a simple dropdown menu that launches items from your ssh configs",
"shell-version": [ "3.36", "40", "41", "42" ],
"url": "https://www.github.com/ibrokemycomputer/gnome-shell-extension-ssh-quick-connect",
"version": 2
}