Simplify the logic of project lanucher
This commit is contained in:
parent
0c72fedeb8
commit
f58a088c43
4 changed files with 10 additions and 28 deletions
|
|
@ -176,7 +176,9 @@ 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 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:
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue