/OSXmonad

Hammerspoon set up to imitate Xmonad

Primary LanguageLua

OSXmonad

Hammerspoon set up to imitate Xmonad

_guiInput_() {
  # DESC:   Ask for user input using a Mac dialog box
  # ARGS:   $1 (Optional) - Text in dialogue box (Default: Password)
  # OUTS:   None
  # NOTE:   https://github.com/herrbischoff/awesome-osx-command-line/blob/master/functions.md
  if _haveScriptableFinder_; then
    guiPrompt="${1:-Password:}"
    guiInput=$(
      osascript &>/dev/null <<EOF
      tell application "System Events"
          activate
          text returned of (display dialog "${guiPrompt}" default answer "" with hidden answer)
      end tell
EOF
  )
    echo -n "${guiInput}"
  else
    error "No GUI input without macOS"
    return 1
  fi

}