(scripts) check git repositories on tmux start
This commit is contained in:
@@ -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;
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user