[Sugar-devel] Widget to show a notification message with a link

Gustavo Duarte gus.duarte at gmail.com
Sat Dec 6 21:57:22 EST 2014


Finally I found the setting needed to open links with Browser Activity
by default.

xdg-mime default sugar-browser.desktop x-scheme-handler/http
and

xdg-mime default sugar-browser.desktop x-scheme-handler/https

Adding this settings, links on notifications messages should be opened
by BrowserActivity.

Offcourse a bash script to launch BrowserActivit  is needed. Something like:

#!/bin/sh
while [ -n "$2" ] ; do
    case "$1" in

        -u | --uri)         uri="$2"         ;;

        *) echo unknown argument $1 $2 ;;

    esac
    shift;shift
done

sugar-launch org.laptop.WebActivity --uri "$uri"

Thanks a lot for all your tips, were very helpfully.

Gustavo.

On Sat, Dec 6, 2014 at 3:59 PM, Jerry Vonau <me at jvonau.ca> wrote:
> Hi Gustavo,
>
>> On December 6, 2014 at 10:42 AM Gustavo Duarte <gus.duarte at gmail.com>
>> wrote:
>>
>>
>> Add an actions, isn't an option, because the notification-daemon
>> (Ubuntu 12.04 precise) does't support actions.
>>
>> From freedesktop specs https://developer.gnome.org/notification-spec/
>> "
>> Actions
>>
>> The actions send a request message back to the notification client
>> when invoked. This functionality may not be implemented by the
>> notification server, conforming clients should check if it is
>> available before using it (see the GetCapabilities message in
>> Protocol). An implementation is free to ignore any requested by the
>> client. As an example one possible rendering of actions would be as
>> buttons in the notification popup.
>>
>> Actions are sent over as a list of pairs. Each even element in the
>> list (starting at index 0) represents the identifier for the action.
>> Each odd element in the list is the localized string that will be
>> displayed to the user."
>>
>>
>> However hyperlinks is supported, if I add <a
>> href="http://sugarlabs.org"> SugarLabs , works. Not exactly as I
>> want .... :(
>>
>> When I do a click on the link, Firefox is opened.
>>
>> I tried change the system default browser setting with:
>>
>> gconftool-2 -s /desktop/gnome/applications/browser/exec --type string
>> '/usr/local/bin/sugar-browser "%s"'
>>
>> Notice: sugar-browser is a bash script to launch BrowserActivity.
>>
>> But after that, Firefox still opened each doing click on link of
>> notification message.
>>
>>
>> So the problem now is, how change the default browser on Sugar.
>>
>
> Hum, sounds like the system's default mime definitions might be pointed to
> Firefox in /usr/share/applications/defaults.list. What does "xdg-mime query
> default text/html" return? The XO here returns 'firefox.desktop' even
> without having the Firefox rpm installed. Not sure what the correct way of
> overriding this list would be, create
> "~/.local/share/applications/mimeapps.list", or maybe using "xdg-mime
> default ..."? Both of those ideas would need a .desktop file for browse
> thou.
>
> Hope it helps,
>
> Jerry
>
>> Any idea ?
>>
>> Thanks in advance.
>>
>> Gustavo.
>>
>> On Fri, Dec 5, 2014 at 9:27 PM, Gustavo Duarte <gus.duarte at gmail.com>
>> wrote:
>> > Greats !! Thanks for these tips.
>> >
>> > El 05/12/2014 17:59, "Gonzalo Odiard" <godiard at sugarlabs.org> escribió:
>> >
>> >> +1
>> >>
>> >> On Fri, Dec 5, 2014 at 4:57 PM, Sam P. <sam.parkinson3 at gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> If my memory is right, the freedesktop notification spec includes
>> >>> "actions". You can have multiple of these and they are displayed like
>> >>> buttons [1]. When they are clicked you get a callback event.
>> >>>
>> >>> I would prefer to implement the standard ranter than something
>> >>> proprietary. That is just my opinions.
>> >>>
>> >>> Thanks,
>> >>> Sam
>> >>>
>> >>> [1]:  imgur.com/e8r9OZr
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Gonzalo Odiard
>> >>
>> >> SugarLabs - Software for children learning
>> _______________________________________________
>> Sugar-devel mailing list
>> Sugar-devel at lists.sugarlabs.org
>> http://lists.sugarlabs.org/listinfo/sugar-devel


More information about the Sugar-devel mailing list