contour icon indicating copy to clipboard operation
contour copied to clipboard

Possible Integration with tabbed?

Open xinslu opened this issue 1 year ago • 4 comments

Hi, really like the work done with this terminal. I was just wondering if it was possible to use the tabbing utility from suckless, tabbed (https://tools.suckless.org/tabbed/) along with contour. Other terminals like alacritty allow the ability to embed using the --embed flag allowing integration. Could this possibly pursued be as a short term solution to UI tab? I didn't mark this as a feature request because I'm not sure if something needs to be changed.

xinslu avatar Dec 08 '23 03:12 xinslu

Nice idea. And many thanks for the interest .

We should just find out how to do that when working with Qt library, which we use for the frontend. 🤔

christianparpart avatar Dec 08 '23 07:12 christianparpart

We should just find out how to do that when working with Qt library, which we use for the frontend. 🤔

Qt has a QTabWidget widget that can replace the current central widget in the main window. This does exactly what is needed and only really needs reorder, tab close, new tab, and tab naming schemes. With a bit of theming it can be implemented quite nicely into the terminal look and feel.

Now, if you want to have trees... that's a little more complex

ghost avatar Dec 09 '23 14:12 ghost

I tried looking up how to do embedd a QML application into an external window that is only known by its Window Id. I could not really find anything (only very old Qt 4.8-style way that would have accepted a Window-Id).

NB: On tabbed support, I planned using: https://github.com/antonypro/QGoodWindow

christianparpart avatar Dec 09 '23 16:12 christianparpart

Update: I may have found a way to get this implemented for Qt based applications (like Contour) via QWindow::fromId(WId embedInto)

PoC draft

// Target window to embed into
unsigned int windowId = 0x12345;

// Convert window ID to native X11 window handle
Window nativeWindow = XGetWindow(display, XDefaultRootWindow(display), windowId);

// Create a QWindow from the native window
QWindow* qWindow = QWindow::fromWinId(nativeWindow);

// Create a QWidget from the QWindow
QWidget* embeddedWidget = QWidget::createWindowContainer(qWindow);

// Add contour QML app here (?)
QQuickView* qmlView = new QQuickView();
embeddedWidget->layout()->addWidget(qmlView);

// Parent the embeddedWidget to the native window
embeddedWidget->setParent(nativeWindow);

// Show and manage the embeddedWidget
embeddedWidget->show();

christianparpart avatar Dec 10 '23 19:12 christianparpart