5

How to replace Siri with Google Assistant! [GUIDE]

 1 year ago
source link: https://forum.xda-developers.com/t/how-to-replace-siri-with-google-assistant-guide.3599734/#post-88564297
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to replace Siri with Google Assistant! [GUIDE]

_lucasys

New member
So as you may know, Google released their Assistant SDK a couple days back. Naturally, my first instinct was to replace Siri with Google Assistant on my MacBook Pro.
Here we go...

NOTICE: I am not responsible for any loss of data or damage to your computer. I strongly recommend backing up your device before following this tutorial. Proceed at your own risk.
You are installing the Google Assistant SDK on to your device, and there are limitations and differences between it and Google Home.
This is not elegant by any means and doesn't have a fancy GUI like Siri, so be warned. It's a bodge. But hey, it works


1. Firstly, download and extract the zip file attached to the bottom of this post. I chose to do this in the Downloads folder. If you haven't already installed Python 3, go ahead and install it (the pkg file is located in the '1. Python' folder).

2. Go to the Project Page (console.cloud.google.com/project) of Google's Cloud Platform Console, and click 'Create Project'. Name your project "My Google Assistant". After your project has been created, close the page.

3. Enable the Google Assistant API by following this link (console.developers.google.com/apis/api/embeddedassistant.googleapis.com/overview) and clicking 'Enable'. Make sure your project is selected (the project title is displayed at the top of the page). Click "Create Credentials", and select "Other UI (e.g. Windows, CLI tool)" and "User Data" in the following dropdown boxes. Give your OAuth 2.0 Client ID a name, and hit 'Create Client ID'. Call your Product "My Google Assistant". When you are prompted to download credentials, click 'I'll do this later'. You will be brought to a page with a list of OAuth 2.0 Client IDs, and you should see the one you just made. Click the download button to the side, and download it to a folder called "googleassistant" in your Home Directory.

4. Ensure that "Web & App Activity", "Location History", "Device Information" and "Voice & Audio Activity" are all enabled in your Activity Control page (myaccount.google.com/activitycontrols) so that Assistant can be personalised to you.

5. Open a Terminal window (Applications > Utilities > Terminal.app), and install pip if you haven't already installed it, by entering the command:
Code:
sudo easy_install pip
6. Navigate to your googleassistant directory:
Code:
cd ~/googleassistant
7. Install these dependencies:
Code:
python -m pip install google-assistant-sdk[samples]
8. Enter the following command, changing XX to the name of the json file you downloaded earlier:
Code:
python -m googlesamples.assistant.auth_helpers --client-secrets XX.json
9. You will be given a URL. Enter it into your browser and login to your Google Account to authorise the application. You will be given a code. Copy it, and enter it back into the Terminal window - this may take a few minutes.

10. Test that your Google Assistant works with your Mic by entering the following command; it will record 5 seconds of audio and play it back to you.
Code:
python -m googlesamples.assistant.audio_helpers
11. If you can hear yourself, entering the following command to start talking to your new Google Assistant! It can take a couple of minutes to load when you first enter the command, and can take a minute to realise you've finished speaking, so be patient! It does become a lot more responsive after you've ran it for the first time. When you enter the command, wait for it to prompt the command "press Enter to send a new request", and ignore any warnings.
Code:
python -m googlesamples.assistant
Congrats, you just got Google Assistant working on your Mac!

12. Now to replace Siri with Google Assistant, go to the '2. Assistant App' folder from the archive you downloaded and extracted from this post earlier. Copy it, and place it in the ~/googleassistant directory you created earlier.
All this app does is run the Terminal command from step 11 when pressed (if you're worried, all of these apps can be opened in Automator so you can see there's no funny business here).

13. Next, go to System Preferences > Users & Groups > Login Items, and add the Assistant app as a login item, and click the checkbox to Hide the app so it runs in the background.

14. Go to the directory '/System/Library/CoreServices/SystemAppearance.bundle/Contents', and press Cmd-I to bring up the Get Info dialog box. Give yourself Read & Write access by clicking the padlock at the bottom of the window, clicking the '+' Icon, your username, and setting your Privilege to 'Read & Write'.
Next, enter into the 'Resources' folder and do exactly the same thing to the file 'Assets.car', giving yourself Read & Write access.

15. Repeat step 14 at the directory '/System/Library/CoreServices/Siri.bundle/Contents', again with the 'Resources' folder and 'Assets.car' file.

16. IF YOU DO NOT HAVE A TOUCH BAR, SKIP THIS STEP!
Open the '3. Icons' folder from the archive you extracted earlier, and open ThemeEngine.app. Click 'Open Document', go the directory '/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources',
and click on 'Assets.car'. Go to the "TouchBarControlStripSiriContent" element, and backup the original image by dragging the 'normal' image to your Desktop or location of your choice.
Next, go into the Images > TouchBar folder and drag the 'sharedArt...' image into the 'normal' box to replace it. Click File > Save and exit.

17. If you do not have ThemeEngine open from the last step, open the '3. Icons' folder from the archive you extracted earlier, and open ThemeEngine.app.
Click 'Open Document', but this time go the directory '/System/Library/CoreServices/Siri.bundle/Contents/Resources', and click on 'Assets.car'.

Go through each element, and backup the original images by dragging both of the images in 'StatusMenuDark', 'StatusMenuLight', and the two images in 'ZZZZPackedAsset-1.0' and 'ZZZZPackedAsset-2.0' to your Desktop or another safe location.

Next, go into the Images > StatusMenuDark in the archive you extracted earlier, and ensure the 'StatusMenuDark' element is selected in ThemeEngine. In the folder, there will be two images - one that begins with 'siri-menu-icon-darkmode_', and one that begins with 'siri-menu-icon-darkmode@2x_'.
Look at the image that is selected in Theme Engine, and drag the image with the same name into its place.

Repeat this with the 'StatusMenuLight', 'ZZZZPackedAsset-1.0' and 'ZZZZPackedAsset-2.0' elements + folders in the archive (sidenote: the PackedAsset elements only have one image inside each, unlike the StatusMenu elements). After this, click File > Save and exit.

18. At this point, you have replaced the Siri Icons with Google Assistant Icons, and have Google Assistant set to open in the Terminal when you login. But all those Siri apps still just open Siri! Lets fix that.
It turns out that when you click the Siri Icon on your Touch Bar, in your Status bar, or open Siri in the Applications folder, they're actually all just shortcuts for opening Siri.app in the CoreServices folder.

In System Preferences, click on Siri and make sure it is DISABLED - do not close this window!
Next, open Activity Monitor (Applications > Utilities > Activity Monitor.app) and search for Siri. Kill Siri and its related service if running.
Open a new Finder Window, and navigate to '/System/Library/CoreServices'. Copy Siri.app and back it up somewhere safe. Go the archive, open the folder '4. Siri Shortcut', and copy Siri.app into the CoreServices folder, replacing the Siri app that's already there. Go back to your System Preferences window, and enable Siri. Close out of your windows, restart your mac, and hey presto - Siri has been fully replaced by Google Assistant! You're welcome.

That Siri.app is again an AppleScript made in Automator, and it essentially just enters 'Return' into the Terminal window when pressed. In other words, it's the equivalent of clicking 'return' in that Terminal window when you were talking to Google Assistant earlier. As I said, it's a bodge, but it works!
When the Terminal window launches, don't exit it! Instead, press Cmd-H to hide the window.

If you want to go back to Siri just follow this tutorial again (in the correct order), but replace the Assistant files with the Siri files that you backed up.

I hope you found this useful!
If you did, please follow me on twitter (@_lucasys) and help share this guide around

ZIP FILE: drive.google.com/file/d/0B9n0ZPG3Fgh3emJaanRHT2ZMSWc/view?usp=sharing
Screenshots: imgur.com/s88t7hC, imgur.com/qIi5t9W

Thanks to Alexander S. Zielenski and Mishaal Rahman

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK