Skip to content

Gtk Browser Widget (GBW) is a cross platform GTK 4 widget that makes available an embedded browser engine of your choice.

License

Notifications You must be signed in to change notification settings

citkane/gtk-browser-widget

Repository files navigation

Gtk Browser Widget (GBW)

Gtk Browser Widget

Warning

This is pre-ALPHA work in progress software

GBW is a cross-platform GTK 4 widget that makes available an embedded browser engine of your choice:

  • MsWebview2 (ALPHA)
  • Webkit (in progress) - discussion
  • Chromium (in progress)

GBW is developed with the gtkmm 4 C++ library. More language bindings are on the roadmap.

Minimal usage example (C++):

// gtkmm headers MUST be included first
#include <gtkmm/applicationwindow.h>

#include "Gbw_widget.hh"

class Application : public Gtk::ApplicationWindow {
public:
  Application() : browser() {

    browser.ready().connect([this] {
      auto gbw = browser.api().core;
      gbw->Navigate(L"https://www.gtk.org/");
    });

    set_title("Example GBW application");
    set_default_size(1000, 900);
    set_child(browser);
  };
private:
  gbw::Gbw_widget browser;
};


#ifdef _WIN32
int CALLBACK WinMain(_In_ HINSTANCE /*hInstance*/,
                     _In_ HINSTANCE /*hPrevInstance*/, _In_ LPSTR /*lpCmdLine*/,
                     _In_ int /*nCmdShow*/) {
#else
int main() {
#endif
  auto app = Gtk::Application::create("org.gbw.example");
  return app->make_window_and_run<Application>(0, nullptr);
};

Installation

At this ALPHA stage, only MsWebview2 for Windows browser engine option is available.
You will need MSys2 installed, and then proceed from a MSys2 UCRT bash terminal:

# Install Msys2 system dependencies
pacman -Suy # Do this twice for a fresh install to update the core
pacman -S mingw-w64-ucrt-x86_64-clang-tools-extra
pacman -S mingw-w64-ucrt-x86_64-cmake
pacman -S mingw-w64-ucrt-x86_64-gtkmm-4.0
pacman -S git

# Clone the GBW repository
git clone https://github.com/citkane/gtk-browser-widget.git
cd gtk-browser-widget

# Use the installer script 
source installer.sh
## Answer the prompts to select your build
packages_install
generate
build
install
run

Example code

Contributing

Please fork this repository and submit pull requests against the development branch.

Development

Development notes:

GBW wants to uncomplicate and unboilerplate the embedded browser app development experience. What it does:

  • Starts a browser engine instance,
  • presents a browser window in a new top level Gtk:Window
  • pseudo-embeds the window into the gbw::Gbw_widget instance,
  • provides to the developer a full API of their chosen web engine

From there, it is the developer's prerogative to plumb up their GTK application to the browser API in a way that suits their logic. GBW is not a framework, but rather a simple tool.

Plugins

Plugins optionally extend GBW to provide functionallity for common usage patterns.

Bind (todo)

Provides an easy to consume interface that binds native callback functions to browser-side javascript functions.

Language Bindings (roadmap)

GBW is developed in C++, but will provide bindings for other GTK supported languages:

  • C
  • C# (via Gir.Core)
  • JavaScript
  • Python
  • Perl
  • Rust
  • Vala

About

Gtk Browser Widget (GBW) is a cross platform GTK 4 widget that makes available an embedded browser engine of your choice.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •