ref(fish): simplified scripts

- removed sd as dependency (use sed instead)
- simplified tmux_sessionizer's logic (turned out that primeagen did some redundant stuff)
This commit is contained in:
Léana 江 2023-11-09 21:21:17 +01:00 committed by Léana 江
parent 4af2cf013d
commit ac817d08fb
4 changed files with 25 additions and 42 deletions

View file

@ -1,28 +1,20 @@
function tmux_home
set session_name "home"
set tmux_running (pgrep tmux)
# create and attach first session
if [ -z "$TMUX" ] && [ -z "$tmux_running" ]
# create session if doesn't exist
if ! tmux has-session -t=$session_name 2> /dev/null
tmux \
new-session -s $session_name \; \
new-session -ds $session_name \; \
new-window -t $session_name \; \
select-window -t $session_name:1 \;
select-window -t $session_name:1
end
# attach or switch
if [ -z $TMUX ]
tmux attach-session -t $session_name
else
# create session is doesn't exist
if ! tmux has-session -t=$session_name 2> /dev/null
tmux \
new-session -ds $session_name \; \
new-window -t $session_name \; \
select-window -t $session_name:1 \;
end
# attach or switch
if [ -z $TMUX ]
tmux attach-session -t $session_name
else
tmux switch-client -t $session_name
end
tmux switch-client -t $session_name
end
end