Last active
May 29, 2019 16:37
-
-
Save ivan/13995ff1cc1be5e760b456946622e43d to your computer and use it in GitHub Desktop.
Create and run konsole profile for ssh to user@host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Automatically create a konsole profile for ssh to user@host and start | |
# a new konsole with said profile. | |
# | |
# Remember to bind "Clone Tab" to e.g. Ctrl+T to open new tabs using the | |
# current profile instead of the default profile. | |
set -eu | |
user_host=$1 | |
profiles_dir=~/.local/share/konsole | |
# Make sure you have a Command= in this profile | |
default_profile="Profile #1.profile" | |
# We need to generate a konsole profile because konsole -p is broken: | |
# https://bugs.kde.org/show_bug.cgi?id=387375 | |
cat -- "$profiles_dir/$default_profile" |\ | |
sed -r "s/^Name=.*/Name=$user_host/g" |\ | |
sed -r "s/^Command=.*/Command=ssh $user_host/g" \ | |
> "$profiles_dir/$user_host.profile" | |
konsole --profile "$user_host" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment