* Landry Breuil <[email protected]> le [06-05-2019 09:45:08 +0200]:
> On Mon, May 06, 2019 at 08:04:02AM +0200, Bruno Flückiger wrote:
> > On 01.05., Marcus MERIGHI wrote:
> > > Hello,
> > >
> > > [email protected] (Okan Demirmen), 2019.04.29 (Mon) 16:19 (CEST):
> > > > On Fri 2019.04.26 at 07:15 +0200, Bruno Fl?ckiger wrote:
> > > > > Hi,
> > > > >
> > > > > The ssh menu of cwm(1) doesn't filter duplicated hostnames when
> > > > > reading
> > > > > them from ~/.ssh/known_hosts. This patch makes sure each hostname is
> > > > > only displayed once to the menu.
> > > >
> > > > Sure, maybe; but why again do we even have this inside a window manager?
> > > > Really, the known_hosts parsing is incomplete at best; either the entire
> > > > parsing code needs to be lifted from ssh or this (mis)feature should be
> > > > removed from cwm. I prefer the latter.
> > >
> > > FWIW, i use "M-period" a lot... are there easy alternatives?
> > >
> > > Marcus
> > >
> >
> > I'm thinking about transforming the ssh menu into a standalone
> > application. This way the (mis)feature could be removed, but those who
> > like using would get an adequate replacement. Any opinions about that?
>
> there are already standalone applications that do this among other
> things, https://github.com/davatorium/rofi comes to my mind (yes, it's in
> ports).
>
> Landry
>
CWM is a window manager.
It should manage windows, not ssh IMHO.
I use the following (perfectible) shell script, bind to a key in any
window manager :
#!/bin/sh
# run ssh session in one hosts listed in
# ~/.ssh/config
# ~/.ssh/known_hosts
# Require : x11/dmenu <https://tools.suckless.org/dmenu/>
# Author : thuban <[email protected]>
# Licence : MIT
# term ?
TERMINAL='xterm'
# few options for dmenu
NB="#151515"
NF="#e1e5ea"
SF="#151515"
SB="#75a9e8"
FN="Liberation Mono-12"
PROMPT="ssh host:"
LINES=6
C=~/.ssh/config
K=~/.ssh/known_hosts
HOST=$(
(awk '/Host [^*]/ {print $2}' "${C}"
cut -d' ' -f 1 "${K}" |\
cut -d',' -f1 |\
sed -e 's;\[;;' -e 's;\];;'
) | sort -u \
| dmenu -l ${LINES} \
-fn "${FN}" \
-nb "${NB}" \
-nf "${NF}" \
-sb "${SB}" \
-sf "${SF}" \
-p "${PROMPT}")
if [ -n "${HOST}"]; then
case "${HOST}" in
*:*) "${TERMINAL}" -e "ssh ssh://${HOST}" ;;
*) "${TERMINAL}" -e "ssh ${HOST}" ;;
esac
fi
exit
--
thuban