diff --git a/connect_xmpp.sh b/connect_xmpp.sh deleted file mode 100755 index dbf93c8..0000000 --- a/connect_xmpp.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/zsh -################################################################################ -# connect_xmpp.sh - spawn xmpp-client in tmux windows -# -# author: mutantmonkey -################################################################################ - -for session in "${XMPP_SESSIONS[@]}"; do - parts=("${(s/:/)session}") - window="${parts[1]}" - name="${parts[2]}" - - tmux new-window -d -t "$window" -n "xmpp:$name" \ - "xmpp-client -config-file $HOME/.config/xmpp-client/$name" - tmux set-window-option -t "$window" remain-on-exit on -done diff --git a/start_session.sh b/start_session.sh index f1da812..2cfad1e 100755 --- a/start_session.sh +++ b/start_session.sh @@ -2,7 +2,7 @@ # defaults start_irc=0 -start_ncmpcpp=0 +start_ncmpcpp=1 start_messaging=1 # read arguments and set variables as appropriate @@ -58,10 +58,23 @@ function restore_i3_layout { function connect_messaging { if [[ "$start_messaging" != 0 ]]; then - #nohup sh -c "sleep 5 && connect_xmpp.sh" >/dev/null 2>/dev/null & - nohup sh -c "sleep 5 && gtk-launch signal" >/dev/null 2>/dev/null & - nohup sh -c "sleep 5 && gtk-launch whatsapp" >/dev/null 2>/dev/null & - nohup sh -c "sleep 5 && gtk-launch telegramdesktop" >/dev/null 2>/dev/null & + i3-msg "workspace 3; append_layout $HOME/.config/i3/workspace-3.json" + sleep 5 && start_messengers_if_connected && return 0 + sleep 10 && start_messengers_if_connected && return 0 + sleep 25 && start_messengers_if_connected && return 0 + sleep 60 && start_messengers_if_connected && return 0 + sleep 125 && start_messengers_if_connected && return 0 + fi +} + +function start_messengers_if_connected { + if [[ "$(nmcli network connectivity)" == "full" ]]; then + gtk-launch signal-desktop + gtk-launch whatsapp + gtk-launch telegramdesktop + return 0 + else + return 1 fi }