From 5062ae7d368872ceb9fbeda4744dcd4e57bd54b5 Mon Sep 17 00:00:00 2001 From: Keegan Date: Fri, 19 Aug 2022 18:01:41 -0400 Subject: [PATCH] royally messed up tmux script. removing auto start until i bother to fix it --- bin/startup/quote.sh | 2 +- bin/startup/tmux_startup.sh | 50 +++++++++++++++++++++++++++---------- install.conf.yaml | 2 +- tmux.conf | 2 -- zshrc | 6 ++++- 5 files changed, 44 insertions(+), 18 deletions(-) diff --git a/bin/startup/quote.sh b/bin/startup/quote.sh index 5ad7f00..da82d63 100755 --- a/bin/startup/quote.sh +++ b/bin/startup/quote.sh @@ -24,5 +24,5 @@ else fi get_qotd # sets quote and author -printf '"%s" - %s\n' "$quote" "$author" +printf '\n"%s"\n - %s\n' "$quote" "$author" | fold -s diff --git a/bin/startup/tmux_startup.sh b/bin/startup/tmux_startup.sh index de34063..2aef79f 100755 --- a/bin/startup/tmux_startup.sh +++ b/bin/startup/tmux_startup.sh @@ -15,33 +15,57 @@ set_greeting() { fi } -session="doormat" - -session_exists=$(tmux list-sessions 2>/dev/null | grep $session) # get rid of "no server" error - -if [[ -z $session_exists ]] ; then - - - tmux new-session -d -s $session - set_greeting +lay_doormat(){ + # formats a tmux session stored under $session + set_greeting # set $Greeting based on TOD window="Good $Greeting" tmux select-window -t $session:0 + # creating a weather view on right quater tmux split-window -h -p 25 tmux send-keys 'cd && clear && curl --silent -fL https://wttr.in?Fn' Enter + + # creating a central vim pane taking up half the screen and a little box on the top left tmux select-pane -t 0 tmux split-window -h -p 66 tmux select-pane -t 0 tmux split-window -v -p 90 - tmux select-pane -t 0 - tmux send-keys 'cd && clear && quote.sh' Enter + # clearing bottom left tmux select-pane -t 1 tmux send-keys 'cd && clear' C-m + # writing quote to top left + tmux select-pane -t 0 + tmux send-keys 'cd && clear && ~/.dotfiles/bin/startup/quote.sh' Enter + # opening vim tmux select-pane -t 2 tmux send-keys 'cd && clear && vim' C-m + # renaming based on TOD tmux rename-window -t $session:0 "$window" -fi +} + +session="doormat" -#tmux -2 attach-session -t "$session" + +if [[ ! tmuxhas-session -t $session 2>/d ]] ; then + # no server + tmux new-session -d -t "$session" + lay_doormat +else + # existing server + cur_session=$(tmux list-sessions 2>/dev/null | awk '{print $1}' | cut -d ":" -f 1) + if [[ "$cur_session" == "$session" ]] ; then + # check to see if window is set up + cur_window=$(tmux list-windows -t "$session" 2>/dev/null | grep Good) + if [[ -z $cur_window ]] ; then + # no window active + lay_doormat + #tmux -2 attach-session -t "$session" + fi + else + # doormat exists get window + tmux new-session -d -t "$session" + lay_doormat + fi +fi diff --git a/install.conf.yaml b/install.conf.yaml index 23146a6..eff3a81 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -24,7 +24,7 @@ path: oh-my-zsh/custom/plugins/zsh-autosuggestions ~/.oh-my-zsh/custom/themes/powerlevel10k.zsh-theme: oh-my-zsh/custom/themes/powerlevel10k/powerlevel10k.zsh-theme - shell: +- shell: - [$HOME/.dotfiles/bin/weather/symbol_test.sh, Testing weather symbols] - [cp ./vim/hybrid/colors/hybrid.vim ./vim/colors/hybrid.vim, Setting up theme] - [tmux/plugins/tpm/bin/install_plugins, Installing Tmux Plugins] diff --git a/tmux.conf b/tmux.conf index 4761991..e40749f 100644 --- a/tmux.conf +++ b/tmux.conf @@ -34,8 +34,6 @@ set -g @plugin 'tmux-plugins/tmux-continuum' # ressurct config set -g @continuum-save-interval 10 -set -g @continuum-boot 'on' -set -g @continuum-systemd-start-cmd '~/.dotfiles/bin/startup/tmux_startup.sh' set -g @resurrect-capture-pane-contents 'on' set -g @resurrect-strategy-vim 'session' diff --git a/zshrc b/zshrc index 9663e7c..313a1c6 100644 --- a/zshrc +++ b/zshrc @@ -18,7 +18,8 @@ export GOBIN=$GOPATH/bin export PATH=$PATH:$GOBIN:$GOPATH:$GOROOT:$GOROOT/bin # adding scripts to path -export PATH=$PATH:$HOME/.dotfiles/bin/startup:$HOME/.dotfiles/bin +export PATH=$PATH:$HOME/.dotfiles/bin/startup:$HOME/.dotfiles/bin:$HOME/.dotfiles/bin/weather + # Set name of the theme to load --- if set to "random", it will # load a random theme each time oh-my-zsh is loaded, in which case, # to know which specific one was loaded, run: echo $RANDOM_THEME @@ -149,3 +150,6 @@ alias water="$HOME/.dotfiles/bin/water/water.sh" # setting up location variables # source "$HOME/.dotfiles/bin/weather/location.sh" +# +# tmux doormat script +# source "$HOME/.dotfiles/bin/startup/tmux_startup.sh"