config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 724aaf59a63ca2ab641baf344dfa3750a72f3919
parent 26bff24528508c62b9b6151381265af641b2e46d
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sun, 14 Feb 2021 12:37:35 -0800

Simplify the tat script

Add copywrite and license header and remove unused non-graphical
mode.

Diffstat:
Mmodules/scripts/.local/bin/tat | 28+++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/modules/scripts/.local/bin/tat b/modules/scripts/.local/bin/tat @@ -1,24 +1,10 @@ -#!/usr/bin/env ksh -#! tat -- attach to tmux session via an external menu -#! -#! With no arguments the select builtin of ksh(1) is used to select a -#! session and it is attached to using ksh. -#! -#! If the -e flag is given dmenu is used and the session is spawned -#! within a graphical terminal as specified by the TERMINAL environment -#! variable. +#!/bin/sh +# Copywrite 2021 Jacob R. Edwards +# License: GPLv3 +# +# tat -- attach to tmux(1) session selected with dmenu(1) list() { tmux ls | cut -d: -f1 ;} -nth() { head -n $@ | tail -1 ;} -term() { $TERMINAL -e $@ & } +attach() $TERMINAL -e tmux a -t $* -if [ "$1" = "-e" ]; then - shift - [ $# -gt 0 ] && session=`list | nth $@` - [ -z "$session" ] && session=`list | dmenu` - [ -n "$session" ] && term tmux a -t $session -else - [ $# -gt 0 ] && session=`list | nth $@` - [ -z "$session" ] && select session in `list`; do break; done - [ -n "$session" ] && term tmux a -t $session -fi +exec attach `list | dmenu $*` &