From 4c8b2b9c3bc806b8c2288f5a65b7eec8a7943ce4 Mon Sep 17 00:00:00 2001 From: kake26 Date: Sat, 15 Mar 2025 19:58:28 -0500 Subject: [PATCH] saving in case --- modules/tmux.bash | 26 ++++++++++++++++++++++++++ script.bash | 26 +++++++++++++++++++++----- 2 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 modules/tmux.bash diff --git a/modules/tmux.bash b/modules/tmux.bash new file mode 100644 index 0000000..eaf91c0 --- /dev/null +++ b/modules/tmux.bash @@ -0,0 +1,26 @@ +#!/bin/bash + +# windows = konsole tabs +# panes = konsole splits + +# Send keys to a tmux pane +tmux_send_keys() { + local pane="$1" + local keys="$2" + tmux send-keys -t "$pane" "$keys" C-m +} + +# Capture pane content from tmux +tmux_capture_pane() { + local pane="$1" + tmux capture-pane -p -t "$pane" +} + +# List all available tmux panes +tmux_list_panes() { + tmux list-panes -F "#{window_id} #{pane_id} #{pane_title} #{pane_current_command}" +} + +tmux_list_windows() { + tmux list-windows -F "#{window_id} #{window_name} #{window_current_command}" +} \ No newline at end of file diff --git a/script.bash b/script.bash index e12d563..c2fc3ec 100755 --- a/script.bash +++ b/script.bash @@ -19,13 +19,29 @@ cleanup() { } source ./modules/config_json.bash # can be json or ini, I preffer json -source ./modules/gui.bash -source ./modules/ntfy.bash +#source ./modules/gui.bash +#source ./modules/ntfy.bash #source ./modules/keydb.bash - +source ./modules/tmux.bash # Keydb / Redis interaction functions, works for both -show_notification "Hello World!" +# show_notification "Hello World!" + +# send_ntfy_message "Hello World!" "kuma" + +# Get list of panes + +# We check how many windows + +windows=$(tmux_list_windows) + +echo "Windows" +echo "$windows" + +# We check how many panes +panes=$(tmux_list_panes) + +echo "Panes" +echo "$panes" -send_ntfy_message "Hello World!" "kuma" \ No newline at end of file