pthom / imgui_manual

https://pthom.github.io/imgui_manual_online - an interactive manual for ImGui
MIT License
304 stars 23 forks source link

Clicking links in desktop build doesn't open the browser #8

Closed jrynkiew closed 2 years ago

jrynkiew commented 2 years ago

Hi Pascal,

Screenshot from 2022-03-19 09-29-16

When I build the imgui_manual using desktop mode (on Linux with X11, SDL2, SDL2_Image) everything works great, but clicking links does not open a new browser window. Can this be fixed? Have you investigated this issue before?

pthom commented 2 years ago

Hello,

I did not implement this on desktop mode for linux (since imgui_manual is mainly intended to be used on emscripten). However, changing this should be easy:

Look at HyperlinkHelper.cpp

Something around this (not tested) should work (if xdg-open is installed)


void OpenUrl(const std::string &url)
{
...
...
...
#elif defined(TARGET_OS_MAC)
        std::string cmd = std::string("open ") + url.c_str();
        system(cmd.c_str());
#elif defined(__linux__)
    std::string cmd = std::string("xdg-open ") + url;
    system(cmd.c_str()); 
#endif
jrynkiew commented 2 years ago

Wow, thank You! It worked like a charm straight away!. You're the boss!