In Chrome and Gnome Terminal, I want to add context menu entries to search Youtube. Any pointers as to how that can be done?
This can be done by adding sections describing desktop actions to the launcher of the application. For example, the launcher of the Google Chrome application contains a few such sections to add the "New Window" and "New Incognito Window" sections, like:
[Desktop Entry] Version=1.0 ... [Desktop Action new-window] Name=New Window Exec=/usr/bin/google-chrome-stable [Desktop Action new-private-window] Name=New Incognito Window Exec=/usr/bin/google-chrome-stable --incognito
By adding your own
[Desktop action ...] sections, you can add additional right-click options or modify the existing ones.
Copy the launcher to your
~/.local/share/applications if you are the only user needing the additional right-click items. You can then copy and customize the launcher as a normal user.
If you wish to make the change available systemwide, then modify a copy of the launcher in
/usr/local/share/applications. You need to create the folder as it does not exist by default in Ubuntu. You could also edit the installed launcher directly, but it may be overwritten on a subsequent update. You need root permissions to make these system wide changes.