Skip to content

Instantly share code, notes, and snippets.

@manuelmorales
Last active December 15, 2015 21:59
Show Gist options
  • Select an option

  • Save manuelmorales/5330008 to your computer and use it in GitHub Desktop.

Select an option

Save manuelmorales/5330008 to your computer and use it in GitHub Desktop.
(WIP) Make Chrome Open SSH Links on an Existing Tmux Session

Make Chrome Open SSH Links on an Existing Tmux Session

THIS IS WORK IN PROGRESS

Create bin/tmux-ssh-open and make it runable with chmod 755 bin/tmux-ssh-open:

#!/bin/bash                                                                                                                                                      address=`echo $1 | cut -d / -f 3`
port=`echo $1 | cut -d / -f 4`
if [ "$port" == "" ]; then
  port=22
fi
tmux new-window \; send-keys "ssh ${address} -p ${port}^M"

Add the config to Gnome:

gconftool-2 -s /desktop/gnome/url-handlers/ssh/command '~/bin/tmux-ssh-open %s' --type String
gconftool-2 -s /desktop/gnome/url-handlers/ssh/enabled --type Boolean true

Create ~/.local/share/applications/ssh.desktop

[Desktop Entry]
Terminal=false
Type=Application
Exec=tmux-ssh-open %F

Add the magic lines to ~/.local/share/applications/mimeapps.list:

[Default Applications]
x-scheme-handler/ssh=ssh.desktop

exo-open ssh://localhost should now work.

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment