Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ list(TRANSFORM QT_MODULES PREPEND "Qt6::")
list(APPEND LINK_LIBS ${QT_MODULES})

if (UNIX AND NOT APPLE)
find_package(PkgConfig REQUIRED)
list(APPEND PKGCONFIG_MODULES "xcb" "xcb-ewmh")
foreach(PKG IN LISTS PKGCONFIG_MODULES)
pkg_check_modules("${PKG}" REQUIRED IMPORTED_TARGET "${PKG}")
endforeach()
list(TRANSFORM PKGCONFIG_MODULES PREPEND "PkgConfig::")
list(APPEND LINK_LIBS ${PKGCONFIG_MODULES})
find_package(PkgConfig QUIET)
if (PkgConfig_FOUND)
pkg_check_modules(XCB QUIET IMPORTED_TARGET xcb xcb-ewmh)
endif()
if (TARGET PkgConfig::XCB)
list(APPEND LINK_LIBS PkgConfig::XCB)
add_compile_definitions(BLOBDROP_WITH_X11)
message(STATUS "X11 terminal lowering enabled")
else()
message(STATUS "X11 terminal lowering disabled (requires xcb and xcb-ewmh)")
endif()
endif()

include(FetchContent)
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# Run with: podman run -v "$PWD:/output" blobdrop
FROM docker.io/vimpostor/appimage-qt6

RUN apt-get -y install libxcb-ewmh-dev

ADD . /build
WORKDIR /build
RUN scripts/build-appimage.sh
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ cmake --build build
cmake --install build
```

X11 terminal lowering is enabled automatically on Unix (except macOS) when `pkg-config` finds the `xcb` and `xcb-ewmh` development packages. Otherwise, it is omitted; Qt still supports running Blobdrop on X11 without it.

# Usage

```bash
Expand Down
2 changes: 1 addition & 1 deletion doc/man/man1/blobdrop.1
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ This frontend starts the drag operation automatically without showing a GUI in b
.br
Due to limitations in Wayland, this option is only available on X11. This option also works over XWayland, but then the target drop location is required to be running in XWayland too. Native Wayland does not have support for this frontend, because the spec requires an implicit grab for native wl_data_device::start_drag() operations, thus making it impossible to implement this workflow on Wayland.
.br
Another feature implemented in immediate mode is that the parent terminal window will be hidden automatically during the drag operation, unless the
When built with the optional xcb and xcb-ewmh dependencies available, another feature implemented in immediate mode is that the parent terminal window will be hidden automatically during the drag operation, unless the
.B \-\-persistent
option is set. This is useful for usecases where the target application is hidden behind the terminal where blobdrop was started from, which is often the case with floating window managers. This is an additional second usability improvement that is unfortunately also not possible to implement on Wayland due to "security" restrictions.

Expand Down
2 changes: 0 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
qt6.qtbase
qt6.qtdeclarative
qt6.qtsvg
xorg.libxcb
xorg.xcbutilwm
];

cmakeFlags = quartz.lib.cmakeWrapper { inherit pkgs; cmakeFile = ./CMakeLists.txt; };
Expand Down
4 changes: 2 additions & 2 deletions src/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void Backend::copy_to_clipboard(const std::vector<Path> &paths) {
}

void Backend::hide_terminal() {
#if !defined(Q_OS_WIN) && !defined(Q_OS_DARWIN)
#ifdef BLOBDROP_WITH_X11
if (Settings::get()->suppress_always_on_bottom || Settings::get()->intercept || !Stdin::get()->is_tty || !xcb.init()) {
return;
}
Expand All @@ -135,7 +135,7 @@ void Backend::hide_terminal() {
}

void Backend::restore_terminal() {
#if !defined(Q_OS_WIN) && !defined(Q_OS_DARWIN)
#ifdef BLOBDROP_WITH_X11
if (!last_window) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "Util/util.hpp"
#include "path.hpp"

#if !defined(Q_OS_WIN) && !defined(Q_OS_DARWIN)
#ifdef BLOBDROP_WITH_X11
#include "xcb.hpp"
#endif

Expand All @@ -36,7 +36,7 @@ class Backend : public QObject {
void drag_finished();
private:
QDrag *drag = nullptr;
#if !defined(Q_OS_WIN) && !defined(Q_OS_DARWIN)
#ifdef BLOBDROP_WITH_X11
Xcb xcb;
xcb_window_t last_window = 0;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/xcb.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "xcb.hpp"

#if !defined(Q_OS_WIN) && !defined(Q_OS_DARWIN)
#ifdef BLOBDROP_WITH_X11

#include <QGuiApplication>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion src/xcb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <qglobal.h>

#if !defined(Q_OS_WIN) && !defined(Q_OS_DARWIN)
#ifdef BLOBDROP_WITH_X11

#include <xcb/xcb_ewmh.h>
#include <xcb/xproto.h>
Expand Down