Skip to content

Commit

Permalink
Merge pull request #4 from ibrokemycomputer/main
Browse files Browse the repository at this point in the history
GNOME Shell 42 Compat
  • Loading branch information
ibrokemycomputer committed May 7, 2022
2 parents b177ff8 + 2c74d0c commit eecab06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
8 changes: 5 additions & 3 deletions extension.js
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
@@ -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
}

0 comments on commit eecab06

Please sign in to comment.