From 8effb9cb27f041a0bf85e9b4b68834b21525d525 Mon Sep 17 00:00:00 2001 From: Kacper Marzecki Date: Tue, 18 Mar 2025 22:05:53 +0100 Subject: [PATCH] os-specific td launcher --- scripts/td | 2 +- scripts/tmux-td | 15 +++++---------- scripts/tmux-td-bash | 13 +++++++++++++ scripts/tmux-td-zsh | 13 +++++++++++++ 4 files changed, 32 insertions(+), 11 deletions(-) create mode 100755 scripts/tmux-td-bash create mode 100755 scripts/tmux-td-zsh diff --git a/scripts/td b/scripts/td index 1954a95..6b65124 100755 --- a/scripts/td +++ b/scripts/td @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh node ~/git/td/dist/cli.js diff --git a/scripts/tmux-td b/scripts/tmux-td index 07ab828..c173bea 100755 --- a/scripts/tmux-td +++ b/scripts/tmux-td @@ -1,13 +1,8 @@ -#!/bin/zsh +#!/bin/sh -if ! tmux has-session -t td-cli 2>/dev/null; then - tmux setenv -g TD_TASK_DIR ~/git/tasks/ - tmux new-session -d -s td-cli ~/installs/scripts/td -fi - -if [[ "$(tmux display-message -p -F "#{session_name}")" == "td-cli" ]]; then - tmux detach-client - tmux display-popup -C +# Check if Zsh is available +if command -v zsh >/dev/null 2>&1; then + zsh scripts/tmux-td-zsh else - tmux display-popup -d -C -E -w90% -h90% 'tmux attach-session -x -f wait-exit -t td-cli' + bash scripts/tmux-td-bash fi diff --git a/scripts/tmux-td-bash b/scripts/tmux-td-bash new file mode 100755 index 0000000..0a3b794 --- /dev/null +++ b/scripts/tmux-td-bash @@ -0,0 +1,13 @@ +#!/bin/bash + +if ! tmux has-session -t td-cli 2>/dev/null; then + tmux setenv -g TD_TASK_DIR ~/git/tasks/ + tmux new-session -d -s td-cli /home/omnissiah/installs/scripts/td +fi + +if [ "$(tmux display-message -p -F "#{session_name}")" = "td-cli" ]; then + tmux detach-client + tmux display-popup -C +else + tmux display-popup -d -C -E -w90% -h90% 'tmux attach-session -x -t td-cli' +fi diff --git a/scripts/tmux-td-zsh b/scripts/tmux-td-zsh new file mode 100755 index 0000000..07ab828 --- /dev/null +++ b/scripts/tmux-td-zsh @@ -0,0 +1,13 @@ +#!/bin/zsh + +if ! tmux has-session -t td-cli 2>/dev/null; then + tmux setenv -g TD_TASK_DIR ~/git/tasks/ + tmux new-session -d -s td-cli ~/installs/scripts/td +fi + +if [[ "$(tmux display-message -p -F "#{session_name}")" == "td-cli" ]]; then + tmux detach-client + tmux display-popup -C +else + tmux display-popup -d -C -E -w90% -h90% 'tmux attach-session -x -f wait-exit -t td-cli' +fi