From 58634ceee4618a9fa8653ef057476165b38894a6 Mon Sep 17 00:00:00 2001 From: scbj Date: Fri, 19 Jun 2026 09:53:18 +0200 Subject: [PATCH] (scripts) check git repositories on tmux start --- scripts/default-tmux-session.sh | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/scripts/default-tmux-session.sh b/scripts/default-tmux-session.sh index b660dd8..d117296 100755 --- a/scripts/default-tmux-session.sh +++ b/scripts/default-tmux-session.sh @@ -4,6 +4,17 @@ default_session='quak' dummy_session='dummy' temp_window='temp' +function check_remote { + if [[ -z "$1" ]]; then + notify-send "[dmux]" "SCRIPT ERROR!" + return 1 + fi + + if [[ -n "$(git fetch --all)" ]]; then + notify-send "[$1]" "update available" + fi +} + function create_default_session { if [[ -n "$TMUX" ]]; then echo "already attached to a session. don't nest tmux sessions" @@ -40,9 +51,23 @@ function create_default_session { # dont forget the '-d' option, otherwise the session is closed # before the rest of the commands are executed tmux new-session -d -s "${default_session}" -n "${temp_window}" -c "${HOME}" # create dummy window to set default path for new windows - tmux new-window -t "${default_session}" -n "dotfiles" -c "${path_dotfiles}" - tmux new-window -t "${default_session}" -n "docs" -c "${path_documentation}" + + # open window for config and check git status + if [[ -n "${path_dotfiles}" ]]; then + tmux new-window -t "${default_session}" -n "dotfiles" -c "${path_dotfiles}" + tmux select-window -t "${default_session}:dotfiles" + check_remote "dotfiles" + fi + + if [[ -n "${path_documentation}" ]]; then + tmux new-window -t "${default_session}" -n "docs" -c "${path_documentation}" + tmux select-window -t "${default_session}:docs" + check_remote "collection" + fi + tmux new-window -t "${default_session}" -n "stuff" -c "${HOME}" + tmux select-window -t "${default_session}:stuff" + tmux kill-window -t "${temp_window}" ## NOTE: this causes the script to exit only, when the session is ended