https://github.com/citkane/gtk-browser-widget
Gtk Browser Widget (GBW) is a cross platform GTK 4 widget that makes available an embedded browser engine of your choice.
https://github.com/citkane/gtk-browser-widget
browser-engine gtk gtk4 gtk4-widget webview2
Last synced: about 2 months ago
JSON representation
Gtk Browser Widget (GBW) is a cross platform GTK 4 widget that makes available an embedded browser engine of your choice.
- Host: GitHub
- URL: https://github.com/citkane/gtk-browser-widget
- Owner: citkane
- License: mit
- Created: 2025-07-17T17:57:07.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-11T20:19:26.000Z (10 months ago)
- Last Synced: 2025-08-11T20:25:19.756Z (10 months ago)
- Topics: browser-engine, gtk, gtk4, gtk4-widget, webview2
- Language: C++
- Homepage:
- Size: 144 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Gtk Browser Widget (GBW)
> [!WARNING]
> **This is pre-ALPHA work in progress software**
GBW is a cross-platform [GTK 4](https://www.gtk.org/) widget that makes available an embedded browser engine of your choice:
- MsWebview2 (ALPHA)
- Webkit (in progress) - [discussion](https://github.com/citkane/gtk-browser-widget/discussions/4)
- Chromium (in progress)
GBW is developed with the [gtkmm 4](https://gtkmm.gnome.org/en/) C++ library. More [language bindings](#language-bindings-roadmap) are on the roadmap.
### Minimal usage example (C++):
```c++
// gtkmm headers MUST be included first
#include
#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(0, nullptr);
};
```
### Installation
At this ALPHA stage, only MsWebview2 for Windows browser engine option is available.
You will need [MSys2](https://www.msys2.org/) installed, and then proceed from a MSys2 UCRT bash terminal:
```bash
# 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
- [MsWebview2](examples/mswebview2)
- Webkit (todo)
- Chromium (todo)
## Contributing
Please [fork](https://github.com/citkane/gtk-browser-widget/fork) this repository and submit pull requests against the [development branch](https://github.com/citkane/gtk-browser-widget/tree/development).
## Development
Development notes:
- [Gtk 4](include#gtk-4)
- [Operating Systems](include#operating-systems)
- [Browser Engines](include#browser-engines)
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](include/core/#gtkwindow-gtkwidget-and-embedding) 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