- Reorganize directory structure into core/, features/, and themes/ - Colocate application Nix logic, configs, scripts, and theme overrides - Implement 'Inversion of Control' for theming: apps now pull theme-specific layouts - Update flake.nix and shared library paths to match the new structure - Document the new Feature-Centric architecture in README.md
60 lines
1.5 KiB
Bash
Executable File
60 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
if (( $# != 4 )); then
|
|
echo -e "\e[32mLet's create a TUI shortcut you can start with the app launcher.\n\e[0m"
|
|
APP_NAME=$(gum input --prompt "Name> " --placeholder "My TUI")
|
|
APP_EXEC=$(gum input --prompt "Launch Command> " --placeholder "lazydocker or bash -c 'dust; read -n 1 -s'")
|
|
WINDOW_STYLE=$(gum choose --header "Window style" float tile)
|
|
ICON_URL=$(gum input --prompt "Icon URL> " --placeholder "See https://dashboardicons.com (must use PNG or SVG!)")
|
|
else
|
|
APP_NAME="$1"
|
|
APP_EXEC="$2"
|
|
WINDOW_STYLE="$3"
|
|
ICON_URL="$4"
|
|
fi
|
|
|
|
if [[ -z $APP_NAME || -z $APP_EXEC || -z $ICON_URL ]]; then
|
|
echo "You must set app name, app command, and icon URL!"
|
|
exit 1
|
|
fi
|
|
|
|
ICON_DIR="$HOME/.local/share/applications/icons"
|
|
DESKTOP_FILE="$HOME/.local/share/applications/$APP_NAME.desktop"
|
|
|
|
if [[ ! $ICON_URL =~ ^https?:// ]] && [[ -f $ICON_URL ]]; then
|
|
ICON_PATH="$ICON_URL"
|
|
else
|
|
ICON_PATH="$ICON_DIR/$APP_NAME.png"
|
|
mkdir -p "$ICON_DIR"
|
|
if ! curl -sL -o "$ICON_PATH" "$ICON_URL"; then
|
|
echo "Error: Failed to download icon."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if [[ $WINDOW_STYLE == "float" ]]; then
|
|
APP_CLASS="TUI.float"
|
|
else
|
|
APP_CLASS="TUI.tile"
|
|
fi
|
|
|
|
cat >"$DESKTOP_FILE" <<EOF
|
|
[Desktop Entry]
|
|
Version=1.0
|
|
Name=$APP_NAME
|
|
Comment=$APP_NAME
|
|
Exec=xdg-terminal-exec --app-id=$APP_CLASS -e $APP_EXEC
|
|
Terminal=false
|
|
Type=Application
|
|
Icon=$ICON_PATH
|
|
StartupNotify=true
|
|
EOF
|
|
|
|
chmod +x "$DESKTOP_FILE"
|
|
|
|
if (( $# != 4 )); then
|
|
echo -e "You can now find $APP_NAME using the app launcher (SUPER + SPACE)\n"
|
|
fi
|