diff --git a/README.md b/README.md index 36b5033..e6523ab 100644 --- a/README.md +++ b/README.md @@ -175,8 +175,10 @@ cdf [pattern] # Find file/directory and cd to its location #### Usage: ```bash -proj # List all available projects -nix-config # Launch nix-config project tmux session +proj # List all available projects +proj nix-config # Launch nix-config project tmux session +proj blog # Launch blog project tmux session +proj homelab # Launch homelab project tmux session ``` #### Window-Based Configuration: diff --git a/config/projects.nix b/config/projects.nix index d6571e1..10f73ac 100644 --- a/config/projects.nix +++ b/config/projects.nix @@ -5,8 +5,7 @@ let in { projects = { - nix-config = { - session = "nix"; + nix = { description = "Nix configuration"; windows = [ { @@ -20,7 +19,6 @@ in }; homelab = { - session = "homelab"; description = "Homelab Deployment"; windows = [ { @@ -34,7 +32,6 @@ in }; note = { - session = "note"; description = "Obsidian notes"; windows = [ { @@ -48,7 +45,6 @@ in }; acapro = { - session = "aca-programs"; description = "Academic programs"; windows = [ { @@ -62,7 +58,6 @@ in }; blog = { - session = "blog"; description = "Personal blog project"; windows = [ { @@ -82,7 +77,6 @@ in }; homepage = { - session = "homepage"; description = "Personal Homepage"; windows = [ { @@ -96,7 +90,6 @@ in }; mdshortcut = { - session = "MDShortcut"; description = "Material design shortcut"; windows = [ { @@ -117,7 +110,6 @@ in }; daki3c = { - session = "DAKI3-C"; description = "DAKI3 course"; windows = [ { @@ -145,7 +137,6 @@ in }; daki3g = { - session = "DAKI3-G"; description = "DAKI3 group supervision"; windows = [ { @@ -159,7 +150,6 @@ in }; matmeet = { - session = "MaterialMeet"; description = "Material Meeting Slides"; windows = [ { @@ -173,7 +163,6 @@ in }; ddm = { - session = "DiffDisMatter"; description = "Inverse material design"; windows = [ { @@ -194,7 +183,6 @@ in }; misc = { - session = "Misc"; description = "Temp misc project"; windows = [ { diff --git a/modules/zsh.nix b/modules/zsh.nix index 10b3ce9..8a64610 100644 --- a/modules/zsh.nix +++ b/modules/zsh.nix @@ -44,15 +44,7 @@ in # Project shortcuts proj = "${projectLauncher}"; - } // ( - # Generate project aliases dynamically - builtins.listToAttrs ( - builtins.map (projectName: { - name = projectName; - value = "${projectLauncher} ${projectName}"; - }) (builtins.attrNames projectsConfig.projects) - ) - ); + }; initContent = '' # Load Powerlevel10k theme diff --git a/scripts/project-launcher.sh b/scripts/project-launcher.sh index cd9acfc..faad2f2 100755 --- a/scripts/project-launcher.sh +++ b/scripts/project-launcher.sh @@ -47,10 +47,10 @@ if [ -z "$PROJECT_NAME" ]; then fi # Parse and display projects with descriptions - jq -r '.projects | to_entries[] | "\(.key)|\(.value.description)|\(.value.session)"' "$PROJECTS_JSON" 2>/dev/null | \ - while IFS='|' read -r name desc session_name; do + jq -r '.projects | to_entries[] | "\(.key)|\(.value.description)"' "$PROJECTS_JSON" 2>/dev/null | \ + while IFS='|' read -r name desc; do # Check if session is running and format accordingly - if is_session_running "$session_name"; then + if is_session_running "$name"; then printf " \033[1;32m%-12s\033[0m %s\033[1;32m • Running\033[0m\n" \ "$name" "$desc" else @@ -85,7 +85,7 @@ if [ "$PROJECT_CONFIG" = "null" ]; then exit 1 fi -SESSION_NAME=$(echo "$PROJECT_CONFIG" | jq -r '.session') +SESSION_NAME="$PROJECT_NAME" DESCRIPTION=$(echo "$PROJECT_CONFIG" | jq -r '.description // empty') # Check if session already exists