Add session detection and running indicator to project launcher
- Add is_session_running() function to detect active tmux sessions - Update project display to show green "• Running" indicator for active projects - Fix session detection to use correct session names from project config - Improve project listing with real-time status information - Update projects.nix with shortened key names and descriptions Features: - Visual feedback for which projects are currently running - Uses proper tmux session names from project configuration - Clean green indicator that only appears for running sessions - Maintains existing project launcher functionality and layout 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a6162712e3
commit
f7bfb04b38
2 changed files with 18 additions and 7 deletions
|
|
@ -41,7 +41,7 @@
|
||||||
name = "MDShortcut";
|
name = "MDShortcut";
|
||||||
codePath = "/Users/yanlin/Documents/Projects/Material Design Shortcut/MDShortcut-dev";
|
codePath = "/Users/yanlin/Documents/Projects/Material Design Shortcut/MDShortcut-dev";
|
||||||
paperPath = "/Users/yanlin/Documents/Projects/Material Design Shortcut/MDShortcut-paper";
|
paperPath = "/Users/yanlin/Documents/Projects/Material Design Shortcut/MDShortcut-paper";
|
||||||
description = "Material Design Shortcut research project";
|
description = "Material design shortcut";
|
||||||
server = "aicloud";
|
server = "aicloud";
|
||||||
remoteDir = "~/MDS";
|
remoteDir = "~/MDS";
|
||||||
};
|
};
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
description = "DAKI3 course Demo code";
|
description = "DAKI3 course Demo code";
|
||||||
};
|
};
|
||||||
|
|
||||||
diffdismatter = {
|
ddm = {
|
||||||
template = "research";
|
template = "research";
|
||||||
name = "DiffDisMatter";
|
name = "DiffDisMatter";
|
||||||
codePath = "/Users/yanlin/Documents/Projects/Inverse Design of Disordered Materials/DiffDisMatter-dev";
|
codePath = "/Users/yanlin/Documents/Projects/Inverse Design of Disordered Materials/DiffDisMatter-dev";
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,12 @@ CONFIG_DIR="$(dirname "$0")/../config"
|
||||||
PROJECTS_JSON="$CONFIG_DIR/projects.json"
|
PROJECTS_JSON="$CONFIG_DIR/projects.json"
|
||||||
TEMPLATES_DIR="$(dirname "$0")/templates"
|
TEMPLATES_DIR="$(dirname "$0")/templates"
|
||||||
|
|
||||||
|
# Check if tmux session is running
|
||||||
|
is_session_running() {
|
||||||
|
local session_name="$1"
|
||||||
|
tmux has-session -t "$session_name" 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z "$PROJECT_NAME" ]; then
|
if [ -z "$PROJECT_NAME" ]; then
|
||||||
printf "\033[1;36mAvailable Projects:\033[0m\n\n"
|
printf "\033[1;36mAvailable Projects:\033[0m\n\n"
|
||||||
|
|
||||||
|
|
@ -19,11 +25,16 @@ if [ -z "$PROJECT_NAME" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Parse and display projects with descriptions
|
# Parse and display projects with descriptions
|
||||||
jq -r '.projects | to_entries[] | "\(.key)|\(.value.description)|\(.value.template)"' "$PROJECTS_JSON" 2>/dev/null | \
|
jq -r '.projects | to_entries[] | "\(.key)|\(.value.description)|\(.value.template)|\(.value.name)"' "$PROJECTS_JSON" 2>/dev/null | \
|
||||||
while IFS='|' read -r name desc template; do
|
while IFS='|' read -r name desc template session_name; do
|
||||||
# Format with consistent spacing
|
# Check if session is running and format accordingly
|
||||||
|
if is_session_running "$session_name"; then
|
||||||
|
printf " \033[1;32m%-12s\033[0m \033[2m[%-8s]\033[0m %s\033[1;32m • Running\033[0m\n" \
|
||||||
|
"$name" "$template" "$desc"
|
||||||
|
else
|
||||||
printf " \033[1;32m%-12s\033[0m \033[2m[%-8s]\033[0m %s\n" \
|
printf " \033[1;32m%-12s\033[0m \033[2m[%-8s]\033[0m %s\n" \
|
||||||
"$name" "$template" "$desc"
|
"$name" "$template" "$desc"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue