From 120f7fe29e5a56b6eb7721104d51f46889a2d15d Mon Sep 17 00:00:00 2001 From: thek4n Date: Wed, 3 Apr 2024 13:59:43 +0300 Subject: [PATCH] add tmux systemd service --- home/user/.bashrc | 8 ++++++-- home/user/.config/zsh/.zshrc | 7 ++++++- home/user/.tmux/01.sh | 2 +- install-hooks/tmux/post-install | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/home/user/.bashrc b/home/user/.bashrc index 6d6a10d..328e1ce 100644 --- a/home/user/.bashrc +++ b/home/user/.bashrc @@ -1,8 +1,12 @@ #!/usr/bin/env bash -# .bashrc by TheK4n # https://github.com/TheK4n/dotfiles -if command -v tmux &>/dev/null && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ] && [ "$(tty)" != "/dev/tty3" ]; then +if \ + [ "$(tty)" != "/dev/tty3" ] && \ + [ -z "$TMUX" ] && \ + [[ ! "$TERM" =~ tmux ]] && \ + command -v tmux &>/dev/null +then exec tmux fi diff --git a/home/user/.config/zsh/.zshrc b/home/user/.config/zsh/.zshrc index 6288dd3..c885c3f 100644 --- a/home/user/.config/zsh/.zshrc +++ b/home/user/.config/zsh/.zshrc @@ -1,7 +1,12 @@ # .zshrc by TheK4n # https://github.com/TheK4n/dotfiles -if command -v tmux &>/dev/null && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ] && [ "$(tty)" != "/dev/tty3" ]; then +if \ + [ "$(tty)" != "/dev/tty3" ] && \ + [ -z "$TMUX" ] && \ + [[ ! "$TERM" =~ tmux ]] && \ + command -v tmux &>/dev/null +then exec tmux fi diff --git a/home/user/.tmux/01.sh b/home/user/.tmux/01.sh index 69c3bc8..f8704f8 100755 --- a/home/user/.tmux/01.sh +++ b/home/user/.tmux/01.sh @@ -11,7 +11,7 @@ if ! tmux has-session -t "$SESSION"; then tmux new-session -s "$SESSION" -d -n "$MAINW" -c "$WORKING_PROJECT" tmux send-keys -t "$SESSION:$MAINW" '$EDITOR' Enter tmux send-keys -t "$SESSION:$MAINW" , f f - tmux splitw -t "$SESSION:$MAINW" -d -h -l 35% -c '#{pane_current_path}' + tmux splitw -t "$SESSION:$MAINW" -d -h -l 40% -c '#{pane_current_path}' fi tmux switch-client -t "$SESSION" \ No newline at end of file diff --git a/install-hooks/tmux/post-install b/install-hooks/tmux/post-install index d5d7c42..4e7a117 100755 --- a/install-hooks/tmux/post-install +++ b/install-hooks/tmux/post-install @@ -1,4 +1,4 @@ #!/usr/bin/env bash -systemctl --user enable --now tmux +command -v systemctl && systemctl --user enable --now tmux git clone https://github.com/tmux-plugins/tpm "$HOME/.config/tmux/plugins/tpm" \ No newline at end of file