:: Re: [DNG] Does dunst require dbus?
Kezdőlap
Delete this message
Reply to this message
Szerző: Florian Zieboll
Dátum:  
Címzett: dng
Tárgy: Re: [DNG] Does dunst require dbus?
On Fri, 22 Jan 2016 00:09:23 -0500
Steve Litt <slitt@???> wrote:

> different color terminals for
> ssh sessions


I had played a bit with the tiling and highly (GUI) configurable
"Terminator" but was bounced back to xterm very quickly due to its
footprint and wrote the following secremote.sh script. It has not been
tested with more than the few defined colors but I am not aware of any
limitations other than that of the X11 palette. As it is released to
the public now: feel free to use it as you like.

------------------
#!/bin/bash

# this script takes "user@host" or a hostname/IP as argument to
# establish a ssh connection in an individually background-colored
# xterm window as defined below

# connection definitions: multiple connections per color separated by
# colons, sequential numbering is required

CONNS0=gate.lan:user@???
CONNS1=user1@???:userx@ip
CONNS2=server2:sdfsdf.sdf
CONNS3=dljfghldkjf:someone@192.168.120.55
CONNS4=

# color definitions: numbering according to connection definitions

COLOR0=lightcyan
COLOR1=bisque
COLOR2=lightgrey
COLOR3=palegreen
COLOR4=
COLORELSE=honeydew

# shuffling variables

CONNALL=`set | grep CONNS`

CONNEXP=`echo "$CONNALL" | \
    sed    -e 's/\./\\\./g' \
        -e 's/CONNS[0-9]*\=//' \
        -e s/\'//g \
        -e 's/\:/\|/'`


CONNARR=($CONNEXP)

CONNLIN=`echo "${CONNARR[@]}" | \
    sed -e 's/\ /\|/g'`


COUNT=0

# assigning color to connection

if  [[ "$@" =~ ^($CONNLIN)$ ]] ; then
    while (( "$COUNT" < ${#CONNARR[@]} )) ; do
        if [[ "$@" =~ ^(${CONNARR[$COUNT]})$ ]] ; then
            break
        else
            COUNT=$(($COUNT+1))
        fi
    done
elif  [[ "$@" =~ \@($CONNLIN)$ ]] ; then
    while (( "$COUNT" < ${#CONNARR[@]} )) ; do
        if [[ "$@" =~ ^(${CONNARR[$COUNT]})$ ]] ; then
            break
        elif [[ "$@" =~ .*(${CONNARR[$COUNT]})$ ]] ; then
            break
        else
            COUNT=$(($COUNT+1))
        fi
    done
else
    COUNT=ELSE
fi


# colors, not numbers

COLOR=COLOR"$COUNT"
COLOR="${!COLOR}"

# start xterm and connect to server

xterm -bg "$COLOR" -T "${@/*@/}" -e ssh "$@" &

exit 0

------------------

Now I have a bunch of one-liners like the following in $PATH. This
might be less elegant but (form follows function) saves me even more
typing:

------------------
#!/bin/bash
xterm -bg bisque -T hostname -e ssh user@host &
exit 0
------------------

And of course some defaults in Xresources:

------------------
xterm*Background:    beige
xterm*Foreground:    black
xterm*faceName:        Inconsolata:size=11
------------------