misc: initial import

Mon, 28 Jun 2021 14:16:58 +0200

author
David Demelier <markand@malikania.fr>
date
Mon, 28 Jun 2021 14:16:58 +0200
changeset 0
48426ca3a77b
child 1
75cd4dd83a0e

misc: initial import

.hgignore file | annotate | diff | comparison | revisions
GNUmakefile file | annotate | diff | comparison | revisions
LICENSE.md file | annotate | diff | comparison | revisions
README.md file | annotate | diff | comparison | revisions
dmenu-ssh/dmenu-ssh.sh file | annotate | diff | comparison | revisions
dmenu.subr file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Mon Jun 28 14:16:58 2021 +0200
@@ -0,0 +1,12 @@
+# vim/emacs specific.
+^tags$
+^tags.lock$
+^tags.temp$
+\.swp$
+\.swo$
+
+# macOS specific.
+\.DS_Store$
+
+# tools.
+^dmenu-ssh/dmenu-ssh$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GNUmakefile	Mon Jun 28 14:16:58 2021 +0200
@@ -0,0 +1,43 @@
+#
+# GNUmakefile -- GNU make for dmenutools
+#
+# Copyright (c) 2021 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+PREFIX=         /usr/local
+BINDIR=         ${PREFIX}/bin
+LIBEXECDIR=     ${PREFIX}/libexec
+
+TOOLS=          dmenu-ssh/dmenu-ssh
+
+.SUFFIXES:
+.SUFFIXES: .c .o .sh
+
+all: ${TOOLS}
+
+.sh:
+	sed -e "s,@LIBEXECDIR@,${LIBEXECDIR},g" < $< > $@
+	chmod +x $@
+
+install:
+	mkdir -p ${DESTDIR}${BINDIR}
+	cp ${TOOLS} ${DESTDIR}${BINDIR}
+	mkdir -p ${DESTDIR}${LIBEXECDIR}/dmenutools
+	cp dmenu.subr ${DESTDIR}${LIBEXECDIR}/dmenutools
+
+clean:
+	rm -f ${TOOLS}
+
+.PHONY: all clean install
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE.md	Mon Jun 28 14:16:58 2021 +0200
@@ -0,0 +1,16 @@
+dmenutools ISC LICENSE
+======================
+
+Copyright (c) 2021 David Demelier <markand@malikania.fr>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Mon Jun 28 14:16:58 2021 +0200
@@ -0,0 +1,16 @@
+dmenutools
+==========
+
+A set of convenient utilities for dmenu.
+
+- dmenu-ssh: open ssh connection.
+
+Documentation
+-------------
+
+See manual pages for each utilities.
+
+Author
+------
+
+David Demelier <markand@malikania.fr>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dmenu-ssh/dmenu-ssh.sh	Mon Jun 28 14:16:58 2021 +0200
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# dmenu-ssh -- open ssh connection
+#
+# Copyright (c) 2021 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+. @LIBEXECDIR@/dmenutools/dmenu.subr
+
+: "${ssh_command:=st -e ssh}"
+: "${ssh_config=$HOME/.ssh/config}"
+
+list()
+{
+	grep Host $ssh_config | awk '{ print $2 }'
+}
+
+if [ ! -r $ssh_config ]; then
+	dt_notify "dmenu-ssh" "no ssh config file"
+	exit 0
+fi
+
+host=$(list | dt_invoke)
+
+if [ -n "$host" ]; then
+	$ssh_command $host
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dmenu.subr	Mon Jun 28 14:16:58 2021 +0200
@@ -0,0 +1,43 @@
+#
+# dmenu.subr -- miscellaneous routines
+#
+# Copyright (c) 2021 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+: "${XDG_CONFIG_HOME:=${HOME}/.config}"
+
+if [ -f $XDG_CONFIG_HOME/dmenutools.conf ]; then
+	. $XDG_CONFIG_HOME/dmenutools.conf
+fi
+
+: "${dmenu_command:=dmenu}"
+
+#
+# dt_invoke options arguments
+#
+dt_invoke()
+{
+	${dmenu_command} "$@"
+}
+
+#
+# dt_notify subject message
+#
+dt_notify()
+{
+	notify-send "$1" "$2"
+}
+
+# vim: ft=sh:

mercurial