Move scripts to .local/bin

Moved all personal scripts to ~/.local/bin to be systemd file hierarchy
compliant, as well as XDG compliant. Since they are not configuration
options they don't have anything to do in .config directories.
Also, it's just easier to find than the previous .config/scripts/bin.
This commit is contained in:
Marty Oehme 2019-05-23 11:20:11 +02:00
parent 5970e2f13d
commit df45a08c6c
5 changed files with 1 additions and 1 deletions

43
.local/bin/tm Executable file
View file

@ -0,0 +1,43 @@
#!/bin/sh
#
# Attach to a tmux session, or create it if it doesnt exist
if [ -e $XDG_CONFIG_HOME/tmux/tmux.conf ]; then
start="tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf"
else
start=tmux
fi
path_name="$(basename "$PWD" | tr . -)"
curr_dir=${1-$path_name}
session_name=${1:-$curr_dir}
_not_in_tmux() {
[ -z "$TMUX" ]
}
_session_exists() {
$start has-session -t "$session_name"
}
_create_detached_session() {
(TMUX='' $start new-session -Ad -s "$session_name")
}
_get_session_name() {
#${1:-$session_name}
return "blubb"
}
_attach_or_create() {
if _not_in_tmux; then
$start new-session -As "$session_name"
else
if ! _session_exists; then
_create_detached_session
fi
$start switch-client -t "$session_name"
fi
}
_attach_or_create