h4ckx0r revised this gist 1 month ago. Go to revision
1 file changed, 1 insertion, 1 deletion
macos-gamemode.md
| @@ -46,7 +46,7 @@ spctl -a -vv "Application.app" | |||
| 46 | 46 | --- | |
| 47 | 47 | ||
| 48 | 48 | ## Script automático | |
| 49 | - | Si prefieres automatizar todo, usa el script: [`enable-game-mode.sh`](./macos-gamemode/raw/HEAD/enable-game-mode.sh). | |
| 49 | + | Si prefieres automatizar todo, usa el script: [`enable-game-mode.sh`](./h4ckx0r/macos-gamemode#file-enable-game-mode-sh). | |
| 50 | 50 | **Uso básico:** | |
| 51 | 51 | ```bash | |
| 52 | 52 | chmod +x enable-game-mode.sh | |
h4ckx0r revised this gist 1 month ago. Go to revision
1 file changed, 1 insertion, 1 deletion
macos-gamemode.md
| @@ -46,7 +46,7 @@ spctl -a -vv "Application.app" | |||
| 46 | 46 | --- | |
| 47 | 47 | ||
| 48 | 48 | ## Script automático | |
| 49 | - | Si prefieres automatizar todo, usa el script: [`enable-game-mode.sh`](./enable-game-mode.sh). | |
| 49 | + | Si prefieres automatizar todo, usa el script: [`enable-game-mode.sh`](./macos-gamemode/raw/HEAD/enable-game-mode.sh). | |
| 50 | 50 | **Uso básico:** | |
| 51 | 51 | ```bash | |
| 52 | 52 | chmod +x enable-game-mode.sh | |
h4ckx0r revised this gist 1 month ago. Go to revision
2 files changed, 192 insertions, 8 deletions
enable-game-mode.sh(file created)
| @@ -0,0 +1,132 @@ | |||
| 1 | + | #!/usr/bin/env bash | |
| 2 | + | set -euo pipefail | |
| 3 | + | ||
| 4 | + | # enable-game-mode.sh | |
| 5 | + | # Añade LSApplicationCategoryType=public.app-category.games y LSSupportsGameMode=true | |
| 6 | + | # al Info.plist de una app .app y re-firma el bundle ad-hoc para uso local. | |
| 7 | + | # | |
| 8 | + | # Uso: | |
| 9 | + | # ./enable-game-mode.sh "/ruta/a/Application.app" [--category public.app-category.games] [--no-quarantine] [--no-deep] | |
| 10 | + | # | |
| 11 | + | # Ejemplo: | |
| 12 | + | # ./enable-game-mode.sh "/Applications/Application.app" | |
| 13 | + | ||
| 14 | + | CATEGORY="public.app-category.games" | |
| 15 | + | REMOVE_QUARANTINE=1 | |
| 16 | + | USE_DEEP=1 | |
| 17 | + | ||
| 18 | + | APP="" | |
| 19 | + | ||
| 20 | + | die() { | |
| 21 | + | echo "Error: $*" >&2 | |
| 22 | + | exit 1 | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | usage() { | |
| 26 | + | cat <<EOF | |
| 27 | + | Uso: $(basename "$0") "/ruta/a/App.app" [opciones] | |
| 28 | + | ||
| 29 | + | Opciones: | |
| 30 | + | --category <id> Cambia la categoría (por defecto: public.app-category.games) | |
| 31 | + | --no-quarantine No elimina atributos de cuarentena | |
| 32 | + | --no-deep Firma sin --deep (no recomendado) | |
| 33 | + | ||
| 34 | + | Ejemplo: | |
| 35 | + | $(basename "$0") "/Applications/Application.app" | |
| 36 | + | EOF | |
| 37 | + | } | |
| 38 | + | ||
| 39 | + | # Parseo simple de argumentos | |
| 40 | + | while [[ $# -gt 0 ]]; do | |
| 41 | + | case "$1" in | |
| 42 | + | --category) | |
| 43 | + | [[ $# -ge 2 ]] || die "--category requiere un valor" | |
| 44 | + | CATEGORY="$2" | |
| 45 | + | shift 2 | |
| 46 | + | ;; | |
| 47 | + | --no-quarantine) | |
| 48 | + | REMOVE_QUARANTINE=0 | |
| 49 | + | shift | |
| 50 | + | ;; | |
| 51 | + | --no-deep) | |
| 52 | + | USE_DEEP=0 | |
| 53 | + | shift | |
| 54 | + | ;; | |
| 55 | + | -h|--help) | |
| 56 | + | usage | |
| 57 | + | exit 0 | |
| 58 | + | ;; | |
| 59 | + | -*) | |
| 60 | + | die "Opción desconocida: $1" | |
| 61 | + | ;; | |
| 62 | + | *) | |
| 63 | + | if [[ -z "${APP}" ]]; then | |
| 64 | + | APP="$1" | |
| 65 | + | shift | |
| 66 | + | else | |
| 67 | + | die "Argumento inesperado: $1" | |
| 68 | + | fi | |
| 69 | + | ;; | |
| 70 | + | esac | |
| 71 | + | done | |
| 72 | + | ||
| 73 | + | [[ -n "${APP}" ]] || { usage; exit 1; } | |
| 74 | + | ||
| 75 | + | # Resolver ruta absoluta sin realpath | |
| 76 | + | APP_DIR="$(cd "$(dirname "$APP")" && pwd)" | |
| 77 | + | APP_NAME="$(basename "$APP")" | |
| 78 | + | APP_PATH="${APP_DIR}/${APP_NAME}" | |
| 79 | + | ||
| 80 | + | [[ -d "${APP_PATH}" && "${APP_PATH}" == *.app ]] || die "No parece un bundle .app válido: ${APP_PATH}" | |
| 81 | + | ||
| 82 | + | INFO_PLIST="${APP_PATH}/Contents/Info.plist" | |
| 83 | + | [[ -f "${INFO_PLIST}" ]] || die "No se encontró Info.plist en: ${INFO_PLIST}" | |
| 84 | + | ||
| 85 | + | # Comprobaciones de herramientas | |
| 86 | + | command -v plutil >/dev/null 2>&1 || die "plutil no encontrado" | |
| 87 | + | command -v codesign >/dev/null 2>&1 || die "codesign no encontrado" | |
| 88 | + | command -v xattr >/dev/null 2>&1 || echo "Aviso: xattr no encontrado; omitiendo cuarentena" >&2 | |
| 89 | + | command -v spctl >/dev/null 2>&1 || true | |
| 90 | + | ||
| 91 | + | # Copia de seguridad | |
| 92 | + | TS="$(date +%Y%m%d-%H%M%S)" | |
| 93 | + | BACKUP_PATH="${APP_PATH%.app}.backup-${TS}.app" | |
| 94 | + | echo "→ Creando copia de seguridad en: ${BACKUP_PATH}" | |
| 95 | + | cp -R "${APP_PATH}" "${BACKUP_PATH}" | |
| 96 | + | ||
| 97 | + | # (Opcional) Eliminar cuarentena | |
| 98 | + | if [[ "${REMOVE_QUARANTINE}" -eq 1 ]] && command -v xattr >/dev/null 2>&1; then | |
| 99 | + | echo "→ Eliminando cuarentena (si existe)" | |
| 100 | + | xattr -dr com.apple.quarantine "${APP_PATH}" || true | |
| 101 | + | fi | |
| 102 | + | ||
| 103 | + | # Editar Info.plist | |
| 104 | + | echo "→ Estableciendo LSApplicationCategoryType='${CATEGORY}'" | |
| 105 | + | plutil -replace LSApplicationCategoryType -string "${CATEGORY}" "${INFO_PLIST}" | |
| 106 | + | ||
| 107 | + | echo "→ Estableciendo LSSupportsGameMode=true" | |
| 108 | + | plutil -replace LSSupportsGameMode -bool true "${INFO_PLIST}" | |
| 109 | + | ||
| 110 | + | # Mostrar valores para confirmar | |
| 111 | + | echo "→ Claves establecidas:" | |
| 112 | + | plutil -p "${INFO_PLIST}" | grep -E "LSApplicationCategoryType|LSSupportsGameMode" || true | |
| 113 | + | ||
| 114 | + | # Re-firmar (ad-hoc) | |
| 115 | + | echo "→ Re-firmando bundle (ad-hoc)" | |
| 116 | + | if [[ "${USE_DEEP}" -eq 1 ]]; then | |
| 117 | + | codesign -f -s - --deep --preserve-metadata=entitlements,requirements,flags "${APP_PATH}" | |
| 118 | + | else | |
| 119 | + | codesign -f -s - --preserve-metadata=entitlements,requirements,flags "${APP_PATH}" | |
| 120 | + | fi | |
| 121 | + | ||
| 122 | + | # Verificaciones (best-effort) | |
| 123 | + | echo "→ Verificando firma y política de ejecución" | |
| 124 | + | codesign -dv --verbose=4 "${APP_PATH}" >/dev/null 2>&1 || true | |
| 125 | + | spctl -a -vv "${APP_PATH}" || true | |
| 126 | + | ||
| 127 | + | cat <<'DONE' | |
| 128 | + | ||
| 129 | + | Listo ✅ | |
| 130 | + | - Abre la app y ponla a pantalla completa para activar Game Mode durante la sesión. | |
| 131 | + | - Si algo falla, restaura la copia de seguridad creada junto al original. | |
| 132 | + | DONE | |
macos-gamemode.md
| @@ -1,13 +1,65 @@ | |||
| 1 | - | Add these lines into de app plist: | |
| 1 | + | # Activar Game Mode en una app de macOS (edición local) | |
| 2 | + | ||
| 3 | + | > **Resumen:** Vas a añadir dos claves al `Info.plist` para declarar la app como *Juegos* y marcarla como compatible con Game Mode, y después volver a firmarla ad‑hoc para que se ejecute localmente. | |
| 4 | + | ||
| 5 | + | ## Requisitos | |
| 6 | + | - macOS Sonoma (14) o posterior. | |
| 7 | + | - Terminal con permisos de administrador cuando sea necesario. | |
| 8 | + | - Trabaja sobre **una copia** si no quieres modificar el original. | |
| 9 | + | ||
| 10 | + | --- | |
| 11 | + | ||
| 12 | + | ## Pasos rápidos | |
| 13 | + | 1) **(Opcional) Quitar cuarentena y/o hacer copia** | |
| 14 | + | ```bash | |
| 15 | + | cp -R "/Applications/Application.app" ~/Desktop/ | |
| 16 | + | xattr -dr com.apple.quarantine ~/Desktop/Application.app # si la app está bloqueada | |
| 17 | + | cd ~/Desktop | |
| 2 | 18 | ``` | |
| 3 | - | <key>LSApplicationCategoryType</key> | |
| 4 | - | <string>public.app-category.games</string> | |
| 5 | - | <key>LSSupportsGameMode</key> | |
| 6 | - | <true/> | |
| 19 | + | ||
| 20 | + | 2) **Editar `Info.plist`** | |
| 21 | + | ```bash | |
| 22 | + | plutil -replace LSApplicationCategoryType -string "public.app-category.games" "Application.app/Contents/Info.plist" | |
| 23 | + | ||
| 24 | + | plutil -replace LSSupportsGameMode -bool true "Application.app/Contents/Info.plist" | |
| 7 | 25 | ``` | |
| 8 | - | Then cd where the app is located and run this command: | |
| 26 | + | ||
| 27 | + | 3) **Re-firmar ad‑hoc (uso local)** | |
| 28 | + | ```bash | |
| 29 | + | codesign -f -s - --deep --preserve-metadata=entitlements,requirements,flags "Application.app" | |
| 9 | 30 | ``` | |
| 10 | - | codesign -f -s - "Application.app" | |
| 31 | + | ||
| 32 | + | 4) **Abrir a pantalla completa** → Game Mode se activa durante la sesión. | |
| 33 | + | ||
| 34 | + | --- | |
| 35 | + | ||
| 36 | + | ## Verificaciones útiles | |
| 37 | + | ```bash | |
| 38 | + | # Comprobar claves | |
| 39 | + | plutil -p "Application.app/Contents/Info.plist" | grep -E "LSApplicationCategoryType|LSSupportsGameMode" | |
| 40 | + | ||
| 41 | + | # Ver firma y política de ejecución | |
| 42 | + | codesign -dv --verbose=4 "Application.app" | |
| 43 | + | spctl -a -vv "Application.app" | |
| 11 | 44 | ``` | |
| 12 | 45 | ||
| 13 | - | Now the app opens in game mode | |
| 46 | + | --- | |
| 47 | + | ||
| 48 | + | ## Script automático | |
| 49 | + | Si prefieres automatizar todo, usa el script: [`enable-game-mode.sh`](./enable-game-mode.sh). | |
| 50 | + | **Uso básico:** | |
| 51 | + | ```bash | |
| 52 | + | chmod +x enable-game-mode.sh | |
| 53 | + | ./enable-game-mode.sh "/Applications/Application.app" | |
| 54 | + | ``` | |
| 55 | + | **Flags opcionales:** | |
| 56 | + | - `--category <id>` para cambiar la categoría (por defecto: `public.app-category.games`). | |
| 57 | + | - `--no-quarantine` para no tocar atributos de cuarentena. | |
| 58 | + | - `--no-deep` para firmar sin `--deep` (no recomendado salvo bundles simples). | |
| 59 | + | ||
| 60 | + | --- | |
| 61 | + | ||
| 62 | + | ## Notas y advertencias | |
| 63 | + | - Cualquier cambio en el bundle invalida la firma original. Re‑firmar con `-s -` (ad‑hoc) es suficiente para uso local, **no** para distribución. | |
| 64 | + | - Si vas a distribuir la app, firma con **Developer ID** y **notariza** para evitar bloqueos de Gatekeeper. | |
| 65 | + | - Algunas apps pueden dejar de auto‑actualizarse tras modificar el bundle. | |
h4ckx0r revised this gist 1 month ago. Go to revision
1 file changed, 1 insertion, 1 deletion
macos-gamemode.md
| @@ -7,7 +7,7 @@ Add these lines into de app plist: | |||
| 7 | 7 | ``` | |
| 8 | 8 | Then cd where the app is located and run this command: | |
| 9 | 9 | ``` | |
| 10 | - | codesign -f -s - "Aplication.app" | |
| 10 | + | codesign -f -s - "Application.app" | |
| 11 | 11 | ``` | |
| 12 | 12 | ||
| 13 | 13 | Now the app opens in game mode | |
h4ckx0r revised this gist 1 month ago. Go to revision
1 file changed, 0 insertions, 0 deletions
macos-gamemode renamed to macos-gamemode.md
File renamed without changes
h4ckx0r revised this gist 1 month ago. Go to revision
1 file changed, 13 insertions
macos-gamemode(file created)
| @@ -0,0 +1,13 @@ | |||
| 1 | + | Add these lines into de app plist: | |
| 2 | + | ``` | |
| 3 | + | <key>LSApplicationCategoryType</key> | |
| 4 | + | <string>public.app-category.games</string> | |
| 5 | + | <key>LSSupportsGameMode</key> | |
| 6 | + | <true/> | |
| 7 | + | ``` | |
| 8 | + | Then cd where the app is located and run this command: | |
| 9 | + | ``` | |
| 10 | + | codesign -f -s - "Aplication.app" | |
| 11 | + | ``` | |
| 12 | + | ||
| 13 | + | Now the app opens in game mode | |