@@ -360,5 +360,63 @@ adjust_binary
360360# compute URL to download
361361TARBALL_URL=${GITHUB_DOWNLOAD} /${TAG} /${NAME}
362362
363+ # check if the existing 'tdl' in PATH is a ThreeDotsLabs binary
364+ is_our_tdl () {
365+ existing_tdl=$( command -v tdl 2> /dev/null) || return 1
366+ strings " $existing_tdl " 2> /dev/null | grep -q " ThreeDotsLabs"
367+ }
368+
369+ # detect naming conflicts with other tools (e.g. omarchy) before installing
370+ detect_conflict () {
371+ HAS_OMARCHY=false
372+ HAS_OTHER_TDL=false
373+
374+ if [ -d " $HOME /.local/share/omarchy" ]; then
375+ HAS_OMARCHY=true
376+ fi
377+
378+ if is_command tdl && ! is_our_tdl; then
379+ HAS_OTHER_TDL=true
380+ fi
381+
382+ if [ " $HAS_OMARCHY " = false ] && [ " $HAS_OTHER_TDL " = false ]; then
383+ return
384+ fi
385+
386+ echo " " > /dev/tty
387+ if [ " $HAS_OMARCHY " = true ]; then
388+ echo " NOTE: Omarchy detected on this system." > /dev/tty
389+ echo " Omarchy provides its own 'tdl' command (Tmux Dev Layout) as a bash function," > /dev/tty
390+ echo " which would shadow the ThreeDotsLabs CLI binary." > /dev/tty
391+ elif [ " $HAS_OTHER_TDL " = true ]; then
392+ existing=$( command -v tdl)
393+ echo " NOTE: Another 'tdl' command was found at: ${existing} " > /dev/tty
394+ echo " Installing the ThreeDotsLabs CLI as 'tdl' would conflict with it." > /dev/tty
395+ fi
396+
397+ echo " " > /dev/tty
398+ echo " Options:" > /dev/tty
399+ echo " 1) Install as 'threedots' instead of 'tdl' (recommended)" > /dev/tty
400+ echo " 2) Install as 'tdl' anyway" > /dev/tty
401+ if [ " $HAS_OMARCHY " = true ]; then
402+ echo " " > /dev/tty
403+ echo " Tip: To disable omarchy's 'tdl' and use the ThreeDotsLabs CLI as 'tdl'," > /dev/tty
404+ echo " add this line to your ~/.bashrc (after omarchy's rc is sourced):" > /dev/tty
405+ echo " unset -f tdl" > /dev/tty
406+ fi
407+ echo " " > /dev/tty
408+
409+ printf " Choose [1/2] (default: 1): " > /dev/tty
410+ read choice < /dev/tty 2> /dev/null || choice=" 1"
411+ case " $choice " in
412+ 2) log_info " installing as 'tdl' (user chose to keep the name)" ;;
413+ * ) BINARY=" threedots"
414+ log_info " installing as 'threedots' to avoid conflict"
415+ ;;
416+ esac
417+ }
418+
419+ detect_conflict
420+
363421# do it
364422execute
0 commit comments