dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 18ad6d5a3754c9545095a67adcf3077a0a61271b
parent cdea10c15abd7c8e5b3194e32e93978a3b3a70a2
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Mon,  4 May 2020 14:58:49 +0200

tmux layout for blog


Former-commit-id: ca8a41ddb0517f5ea5263525af8491a4232d958e
Diffstat:
Ascripts/blog | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+), 0 deletions(-)

diff --git a/scripts/blog b/scripts/blog @@ -0,0 +1,52 @@ +#!/bin/sh + +die() { + echo "$1" >&2 + exit 1 +} +blogdir="/Users/alex/Documents/Programming/thezeroalpha.github.io/blog" +[ -d "$blogdir" ] || die "Blog directory does not exist" +if ! command -v tmux 1>/dev/null 2>&1; then + echo "tmux not installed." >&2 + exit 1 +fi + +# Clear rbenv variables before starting tmux +unset RBENV_VERSION +unset RBENV_DIR + +tmux start-server; + +cd "$blogdir" || die "Cannot cd to $blogdir" + +# Create the session and the first window. Manually switch to root +# directory if required to support tmux < 1.9 +TMUX='' tmux new-session -d -s blog -n site +tmux send-keys -t blog:1 cd\ "$blogdir" C-m + + +# Create other windows. +tmux new-window -c "$blogdir" -t blog:2 -n post +tmux new-window -c "$blogdir" -t blog:3 -n server + + +# Window "site" +tmux send-keys -t blog:1 vim\ -o\ _layouts/default.html\ _sass/jekyll-theme-minimal.scss C-m + + +# Window "post" +tmux send-keys -t blog:2 vim C-m + + +# Window "server" +tmux send-keys -t blog:3 bundle\ exec\ jekyll\ serve\ --drafts C-m + + +tmux select-window -t blog:post +tmux select-pane -t blog:post.1 + +if [ -z "$TMUX" ]; then + exec tmux -u attach-session -t blog +else + exec tmux -u switch-client -t blog +fi