How do i create a keyboard shortcut to open a chrome app or web page? How to do it from the command line?
-
5In `~/.local/share/applications`, your app is represented by a .desktop file. Please post the content of the file's Exec= -line – Jacob Vlijm Mar 22 '17 at 11:58
-
things such as: chrome-aohghmighkkkiainnegkcijnfilokake-Default.desktop chrome-apdfllckaahabafndbhiekkkgkjlhalf-Default.desktop – Tiago Bértolo Mar 22 '17 at 12:41
-
2Put the content of those desktop files in the question. – Shreyash S Sarnayak Mar 22 '17 at 12:57
-
2^exactly, open the file e.g. with gedit or run `cat file.desktop` – Jacob Vlijm Mar 22 '17 at 13:07
2 Answers
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
- 584
- 2
- 6
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
- 806
- 1
- 8
- 18