en Ubuntu o similar, para chromium y google-chrome
sed -i \
's,"exit_type":\s*"Crashed","exit_type":"Normal",g' \
~/.config/{google-chrome,chromium}/@(Profile\ ?|Default)/Preferences
Ejecute esto antes de iniciar el navegador. Puse esto en un script bash:
$ cat ~/bin/internet
#!/usr/bin/env bash
shopt -s extglob
sed -i \
's,"exit_type":\s*"Crashed","exit_type":"Normal",g' \
~/.config/{google-chrome,chromium}/@(Profile\ ?|Default)/Preferences
exec "$@"
También puede modificar .desktop
archivos si los usa:
$ sudo sed -i 's,Exec=,Exec=/home/bartek/bin/internet,g' /usr/share/applications/{google-chrome,chromium-browser}.desktop
$ grep Exec /usr/share/applications/{google-chrome,chromium-browser}.desktop
/usr/share/applications/google-chrome.desktop:Exec=/home/bartek/bin/internet /usr/bin/google-chrome-stable %U
/usr/share/applications/google-chrome.desktop:Exec=/home/bartek/bin/internet /usr/bin/google-chrome-stable
/usr/share/applications/google-chrome.desktop:Exec=/home/bartek/bin/internet /usr/bin/google-chrome-stable --incognito
/usr/share/applications/chromium-browser.desktop:Exec=/home/bartek/bin/internet chromium-browser %U
/usr/share/applications/chromium-browser.desktop:Exec=/home/bartek/bin/internet chromium-browser
/usr/share/applications/chromium-browser.desktop:Exec=/home/bartek/bin/internet chromium-browser --incognito
/usr/share/applications/chromium-browser.desktop:Exec=/home/bartek/bin/internet chromium-browser --temp-profile
Detalles del comando:
- replaces JSON file key "exit_type" from "Crashed" to "Normal"
- JSON might include white space after colons, removed
- {google-chrome,chromium} - bash brace expansion, creates multiple paths if any of those exist
- /@(Profile\ ?|Default) - bash extended pattern, similar to brace expansion, allows for wildcards ? in patterns
- I used comma instead of common / in sed pattern, for readability
Basado en la respuesta de Janot (esto a su vez basado en el trabajo de otros.