summaryrefslogtreecommitdiff
path: root/ar/.local/bin/opentasktui
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-01-24 20:35:27 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-01-24 20:35:27 +0900
commitc80a54e42b52ce297f0f2f71af23c562832025c7 (patch)
treedcce8bb977a770f473325d48f6f70b21d9818a40 /ar/.local/bin/opentasktui
init
Diffstat (limited to 'ar/.local/bin/opentasktui')
-rwxr-xr-xar/.local/bin/opentasktui27
1 files changed, 27 insertions, 0 deletions
diff --git a/ar/.local/bin/opentasktui b/ar/.local/bin/opentasktui
new file mode 100755
index 0000000..fa9ec5c
--- /dev/null
+++ b/ar/.local/bin/opentasktui
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# Capture the current session name
+current_session=$(tmux display-message -p '#S')
+
+# Parse the task description from the argument
+TASK_DESCRIPTION="$1"
+
+# Create a new tmux session named 'new-task-session' and run 'tui -r current'
+tmux new-session -d -s new-task-session "taskwarrior-tui -r current"
+
+# Sleep for a bit to allow tui to load
+sleep 0.1
+
+# Send the keystrokes needed to filter tasks by description to the target pane
+tmux send-keys -t new-task-session:1.1 "/description:$TASK_DESCRIPTION" C-m
+
+# Attach to the new session
+tmux switch-client -t new-task-session
+
+# Wait for the session to be closed, either by the user or some other way
+while tmux has-session -t new-task-session 2>/dev/null; do
+ sleep 0.1
+done
+
+# Switch back to the original session
+tmux switch-client -t "$current_session"