Skip to content

Commit

Permalink
Set layer overlay for dropdown terminal on wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
stefonarch committed Apr 25, 2024
1 parent 8c5ff85 commit ae072a1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ endif()
set(LXQTBT_MINIMUM_VERSION "2.0.0")
set(QT_MINIMUM_VERSION "6.3.0")
set(QT_MAJOR_VERSION "6")
set(SHELLQT_MINIMUM_VERSION "6.0.0")

find_package(Qt6Core ${QT_MINIMUM_VERSION} REQUIRED)
find_package(Qt6Gui ${QT_MINIMUM_VERSION} REQUIRED)
Expand All @@ -40,6 +41,8 @@ if (BUILD_TESTS)
find_package(Qt6 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Test)
endif()

find_package(LayerShellQt ${SHELLQT_MINIMUM_VERSION} REQUIRED)

include(LXQtPreventInSourceBuilds)
include(FindPkgConfig)
pkg_check_modules(LIBCANBERRA libcanberra)
Expand Down Expand Up @@ -211,6 +214,7 @@ target_link_libraries(${EXE_NAME}
Qt6::Gui
Qt6::Widgets
qtermwidget6
LayerShellQtInterface
util
)
if(QXT_FOUND)
Expand Down
19 changes: 19 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#include "qterminalapp.h"
#include "dbusaddressable.h"

#include <LayerShellQt/Shell>
#include <LayerShellQt/Window>


typedef std::function<bool(MainWindow&, QAction *)> checkfn;
Q_DECLARE_METATYPE(checkfn)

Expand Down Expand Up @@ -166,6 +170,21 @@ MainWindow::~MainWindow()

void MainWindow::enableDropMode()
{
if (QGuiApplication::platformName() == QStringLiteral("wayland"))
{
winId();
if (QWindow *win = windowHandle())
{
if (LayerShellQt::Window* layershell = LayerShellQt::Window::get(win))
{
layershell->setLayer(LayerShellQt::Window::Layer::LayerOverlay);
layershell->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityOnDemand);
LayerShellQt::Window::Anchors anchors = {LayerShellQt::Window::AnchorTop};
layershell->setAnchors(anchors);
}
}
}

setWindowFlags(Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint);

m_dropLockButton = new QToolButton(this);
Expand Down

0 comments on commit ae072a1

Please sign in to comment.