Created
August 19, 2017 13:19
-
-
Save mohemohe/b9882ea6cadcef6efb101b5338936acf to your computer and use it in GitHub Desktop.
sshの接続先に応じてKDE Konsoleのプロファイルを変える
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
| KONSOLE_PROFILE= | |
| function precmd_preexec_ssh-iikanji() { | |
| local CMD=${1} | |
| local NEXT_PROFILE= | |
| case "$CMD" in | |
| *ssh*prd* ) { | |
| NEXT_PROFILE=ArgonautRed | |
| } ;; | |
| *ssh*stg* ) { | |
| NEXT_PROFILE=ArgonautPurple | |
| } ;; | |
| *ssh*dev* ) { | |
| NEXT_PROFILE=ArgonautGreen | |
| } ;; | |
| *ssh*home* ) { | |
| NEXT_PROFILE=ArgonautBlue | |
| } ;; | |
| esac | |
| if [[ "$NEXT_PROFILE" == "" ]]; then { | |
| NEXT_PROFILE=Argonaut | |
| } fi | |
| if [[ ! "$KONSOLE_PROFILE" == "$NEXT_PROFILE" ]]; then { | |
| KONSOLE_PROFILE=$NEXT_PROFILE | |
| if [[ "${__TERMINAL_EMULATOR}" == "konsole" ]]; then { | |
| konsoleprofile colors=$NEXT_PROFILE | |
| } fi | |
| } fi | |
| } | |
| autoload -Uz add-zsh-hook | |
| add-zsh-hook precmd precmd_preexec_ssh-iikanji | |
| add-zsh-hook preexec precmd_preexec_ssh-iikanji |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment