馃敡 Where my dotfiles lives in harmony and peace, most of the time
1#!/usr/bin/env bash
2set -euo pipefail
3
4projects_dir="${HOME}/projects"
5
6if [[ ! -d "${projects_dir}" ]]; then
7 notify-send "Open Agent" "${projects_dir} not found"
8 exit 1
9fi
10
11mapfile -t projects < <(find "${projects_dir}" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort)
12
13if [[ ${#projects[@]} -eq 0 ]]; then
14 notify-send "Open Agent" "No projects available"
15 exit 0
16fi
17
18project_selection=$(printf '%s\n' "${projects[@]}" | fuzzel -x 20 -d -I --prompt="馃搧 > " || true)
19
20if [[ -z "${project_selection}" ]]; then
21 exit 0
22fi
23
24project_path="${projects_dir}/${project_selection}"
25
26if [[ ! -d "${project_path}" ]]; then
27 notify-send "Open Agent" "${project_selection} is not a directory"
28 exit 1
29fi
30
31options=(
32 "codex --dangerously-bypass-approvals-and-sandbox"
33 "pi"
34 "amp --no-ide --dangerously-allow-all"
35)
36
37tool_selection=$(printf '%s\n' "${options[@]}" | fuzzel -x 20 -d -I --prompt="馃 > " || true)
38
39if [[ -z "${tool_selection}" ]]; then
40 exit 0
41fi
42
43uwsm app -- alacritty --working-directory "${project_path}" --command zsh -ic "${tool_selection}"