14

I am working on creating Unity Launcher icons for web applications. Evolution comes with quicklists so you can compose, go to calendar, etc.:

enter image description here

I want to replicate the same thing but for my gmail icon. The Unity LauncherAPI page talks about how to create static quicklists:

 X-Ayatana-Desktop-Shortcuts=Screen;Window

[Screen Shortcut Group]
Name=Take a screenshot of the whole screen
Exec=gnome-screenshot
TargetEnvironment=Unity

[Window Shortcut Group]
Name=Take a screenshot of the current window
Exec=gnome-screenshot -w
TargetEnvironment=Unity

I have the .desktop file of the Gmail shortcut, so I can edit it to add the static quicklists, my question is, what do I put in the Exec= line to have it open in my browser so I can make Compose, Contacts, and Calendar go to the right place?

(assuming I have the correct URLs, I'm more wondering about the Exec syntax)

Jorge Castro
  • 71,754

2 Answers2

13

If you got a URL, just open it using the default web browser:

...
X-Ayatana-Desktop-Shortcuts=Compose

[Compose Shortcut Group]
Name=Compose Mail
Exec=xdg-open 'https://mail.google.com/mail/?shva=1#compose'
TargetEnvironment=Unity

Or if you like to use a different browser, e.g. Chromium:

Exec=chromium-browser 'https://mail.google.com/mail/?shva=1#compose'

Chromium also allows you to open the URL in a window without toolbars:

Exec=chromium-browser --app='https://mail.google.com/mail/?shva=1#compose'

Of course this only works if you are already logged in or got a cookie. Else it will only take you to the login page.

htorque
  • 64,798
  • 1
    I think it would be better to use chromium-browser --app="https://mail.google.com/mail/?shva=1#compose" – Treviño Apr 01 '11 at 12:19
  • 1
    Thanks for the hint, added to the answer (although personally I always like to see the full URL). – htorque Apr 01 '11 at 14:33
7

htorque's answer is correct, here's the relevant section for a final .desktop gmail file for anyone who wants to do all the Google services in one icon. Here is the final .desktop file in it's entirety.

(Make sure you modify the path to the icon to match where it is on your system)

[Desktop Entry]
Version=1.0
Name=Gmail
Exec=chromium --app="https://mail.google.com/mail"
Terminal=false
Icon=/home/jorge/gmail.png
Type=Application
Categories=Network;WebBrowser;

X-Ayatana-Desktop-Shortcuts=Compose;Contacts;Calendar

[Compose Shortcut Group]
Name=Compose New Message
Exec=chromium-browser --app='https://mail.google.com/mail/?shva=1#compose'
TargetEnvironment=Unity

[Contacts Shortcut Group]
Name=Contacts
Exec=chromium-browser --app='http://www.google.com/contacts'
TargetEnvironment=Unity

[Calendar Shortcut Group]
Name=Calendar
Exec=chromium-browser --app='http://calendar.google.com'
TargetEnvironment=Unity
Jorge Castro
  • 71,754