diff options
author | mail_redacted_for_web | 2022-03-19 19:27:36 +0100 |
---|---|---|
committer | mail_redacted_for_web | 2022-03-19 19:27:36 +0100 |
commit | 53b55b4b10ef6344a882402d5dcaf11d87b78d3f (patch) | |
tree | a4c8f2248fe0ef17d2c7cd98a62adfc5f0a2a7ca /bin | |
download | dotfiles-53b55b4b10ef6344a882402d5dcaf11d87b78d3f.tar.bz2 |
Initial commit
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ssh-agent-launcher | 48 | ||||
-rwxr-xr-x | bin/sxs | 35 |
2 files changed, 83 insertions, 0 deletions
diff --git a/bin/ssh-agent-launcher b/bin/ssh-agent-launcher new file mode 100755 index 0000000..0d116dc --- /dev/null +++ b/bin/ssh-agent-launcher @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +if [ -z "$SSHENVFILE" ];then + printf "SSHENVFILE not set, no target for SSH environment variables.\\n" >&2 + exit 1 +fi + +VERB=1 +KILLIT=0 +while getopts ":qf" SHOPT;do + case "$SHOPT" in + q) VERB=0;; + f) KILLIT=1;; + *) printf "WAT\n" >&2;exit 127;; + esac +done +shift "$(( OPTIND -1 ))" + +[ "$VERB" -eq 1 ]&&printf "[....] Starting SSH agent.\\033[s" +ROEDGROED="$(pgrep -U "$(whoami)" ssh-agent|grep -v grep|awk '{print $1}')" + +if [ -n "$ROEDGROED" ];then + if [ "$KILLIT" -eq 1 ];then + for i in $(echo "$ROEDGROED");do kill "$i" >/dev/null 2>&1||break;done + case "$?" in + 0);; + *) + [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[31mFAIL\\033[0m]\\033[u\\033[K\\n" + exit 2 + ;; + esac + else + [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[30;1mSKIP\\033[0m]\\033[u\\033[K (running, PID: %s)\\n" "$ROEDGROED" + exit 0 + fi +fi +ssh-agent >"$SSHENVFILE" 2>&1&&chmod 0600 "$SSHENVFILE" >/dev/null 2>&1 +case "$?" in + 0) + sed -i 's/^echo[^\;]*\;//g' "$SSHENVFILE" >/dev/null 2>&1 + [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[32m OK \\033[0m]\\033[u\\033[K\\n" + exit 0 + ;; + *) + [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[31mFAIL\\033[0m]\\033[u\\033[K\\n" + exit 1 + ;; +esac @@ -0,0 +1,35 @@ +#!/bin/bash + +pidof -s xinit && exit 0 + +[ -z "$STXTARG" ] && STXTARG="$1" + +if [ -z "$STXTARG" ];then + read -p "Start: e16, xmonad, gnome or kde? " STXTARG + [ -z "$STXTARG" ] && STXTARG="xmonad" +fi + +case "$STXTARG" in + e16) + diff ~/.xsession-e16 ~/.xsession &> /dev/null + [ "$?" -ne 0 ] && ln -sf .xsession-e16 ~/.xsession + ;; + xmonad) + diff ~/.xsession-xmonad ~/.xsession &> /dev/null + [ "$?" -ne 0 ] && ln -sf .xsession-xmonad ~/.xsession + ;; + gnome) + diff ~/.xsession-gnome ~/.xsession &> /dev/null + [ "$?" -ne 0 ] && ln -sf .xsession-gnome ~/.xsession + ;; + kde) + diff ~/.xsession-kde ~/.xsession &> /dev/null + [ "$?" -ne 0 ] && ln -sf .xsession-kde ~/.xsession + ;; + *) + echo "Sorry, I don't know $STXTARG as window manager." + exit 1 + ;; +esac + +startx |