(scripts) check git repositories on tmux start

This commit is contained in:
scbj
2026-06-19 09:53:18 +02:00
parent 6189aec9b5
commit 36101d63d6
2 changed files with 29 additions and 4 deletions
@@ -1,6 +1,6 @@
[Desktop Entry]
Name=netbrowser
Comment=launch zegonix browser of choice
Name=firefox
Comment=launch zegonix' browser of choice
Exec=bash start-browser.sh
Type=Application
Categories=Network;WebBrowser;
+27 -2
View File
@@ -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