From 4c27a8e3f13ce99b3dfc718d250850aaa00d44e9 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Wed, 29 Nov 2023 13:12:15 +0100 Subject: [PATCH] Adding bin files tmuxssh allow to connect and attach or create a tmux session. --- bin/.bin/auto-presel | 13 +++++++++++++ bin/.bin/sshtmux | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100755 bin/.bin/auto-presel create mode 100755 bin/.bin/sshtmux diff --git a/bin/.bin/auto-presel b/bin/.bin/auto-presel new file mode 100755 index 0000000..5d79479 --- /dev/null +++ b/bin/.bin/auto-presel @@ -0,0 +1,13 @@ +#! /bin/sh +# Original script by https://github.com/ikn/ , modified to use splitting method of +# https://github.com/baskerville/bspwm/tree/master/examples/external_rules/pseudo_automatic_mode +fwid=$(bspc query -N -n focused) + +wattr wh $fwid | { + read width height + if [ $width -gt $height ] ; then + bspc node -p \~east + else + bspc node -p \~south + fi +} diff --git a/bin/.bin/sshtmux b/bin/.bin/sshtmux new file mode 100755 index 0000000..47cad92 --- /dev/null +++ b/bin/.bin/sshtmux @@ -0,0 +1,11 @@ +#!/bin/sh + +# A name for the session +session_name="$(whoami)_sess" + +if [ ! -z $1 ]; then + ssh -t "$1" "tmux attach -t $session_name || tmux new -s $session_name" +else + echo "Usage: sshtmux HOSTNAME" + echo "You must specify a hostname" +fi