4

How do i create a keyboard shortcut to open a chrome app or web page? How to do it from the command line?

2 Answers2

5

Open URL from command line: google-chrome http://www.example.com

Open URL as application from command line: google-chrome --app=http://www.example.com

Create keyboard shortcut for opening URL:
System Settings > Keyboard > Shortcuts > Custom > +
- Name: Foo
- Command: google-chrome http://www.example.com
- Press Apply
- Select the new row, then press and hold down the desired keys

Create keyboard shortcut for opening URL as application:
System Settings > Keyboard > Shortcuts > Custom > +
- Name: Bar
- Command: google-chrome --app=http://www.example.com
- Press Apply
- Select the new row, then press and hold down the desired keys

3

Find your chrome app shortcuts files at: ~/.local/share/applications

You will find there a list of *.desktop files. In the inside they will look something like this:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=Google Drive
Exec=/opt/google/chrome/google-chrome %U --profile-directory=Default --app-id=apdfllckaasghufndbhieahigkjlhiii
Icon=chrome-apdfllckaasghufndbhieahigkjlhiii-Default
NoDisplay=true
StartupWMClass=crx_apdfllckaasghufndbhieahigkjlhiii

Copy that exec command to your shortcut command.

/opt/google/chrome/google-chrome --profile-directory=Default --app-id=apdfllckaasghufndbhieahigkjlhiii

credit to @Jacob Vlijm