blobdrop(1)

NAME
blobdrop - Quickly drag and drop files from the terminal

SYNOPSIS
blobdrop [-hvbciIkpRt] [-f OPT] [-P OPT] [-s OPT] [-x OPT] FILES

DESCRIPTION

This program allows you to drag files directly from the terminal to other applications. It can be used both as a source (files can be dragged from the terminal) and as a sink (dropped file names will be printed in the terminal). Filenames can either be given as command line arguments or by piping them into stdin, one filename per line. Several frontends are available to drag files from. By default, blobdrop will immediately start the drag operation without having to hold down the mouse. The user can then just click on the target drop location, meaning by default there is no GUI involved. See FRONTENDS for more information.

-h, --help
    Show help.

-v, --version
    Show version information.

-b, --frameless
    Show a frameless window.

-c, --cursor
    Spawn the window at the location of the mouse cursor.

-f, --frontend OPT
    Selects the frontend. Must be one of {"auto" (default), "gui", "immediate", "notify", "clipboard", "stdout"}. For a more detailed explanation of the frontend options see FRONTENDS below.

-i, --intercept
    Intercept another drag and drop operation. This option is useful to convert other external drag and drop events into drag and drop events that use any of the available frontends. Using this option will unconditionally start the gui frontend to intercept another drag and drop operation. Once an element is dropped into the window, the --frontend option determines the frontend of the outgoing converted drag and drop event.

-I, --icon-only
    Show only thumbnail icons. This option has no effect if a frontend other than the gui frontend is active.

-k, --keep
    When using sink mode, keep dropped files around by default.

-p, --persistent
    Do not auto-hide the window while dragging.

-P, --prefix
    Manually specify a remote prefix to be used with the --remote option instead of using a heuristic.

-R, --remote
    Enable ssh remote transparency. This sets the URI scheme to sftp:// and the username, hostname and port based on heuristics, thus making it possible to drag and drop across a forwarded X11 session from a remote host. DnD requires trusted X11 forwarding (ssh -Y). In case of the heuristic failing, the --prefix option can be used to manually set a value.

-s, --thumb-size OPT
    Sets the size of the thumbnail for listed images. The default size is 64.

-t, --ontop
    Keep the window on top of other windows.

-x, --auto-quit OPT
    Changes the conditions when blobdrop will automatically quit. Must be one of {"never", "first", "all" (default)}. See AUTOQUIT BEHAVIOUR below.

EXIT STATUS
Returns zero on success.

FRONTENDS
Blobdrop has multiple frontends available that change the behaviour how the drag and drop operation starts. The frontend can be chosen with the --frontend option.

  auto
This is the default frontend and chooses one of the following frontends automatically based on some conditions. On X11, the immediate frontend is used unless no file is passed, in which case the gui frontend is started instead. On Wayland the gui frontend is used in all cases due to limitations of the Wayland protocol.

  gui
This frontend shows an user interface that lists all items. Each item can be conveniently dragged on its own, or alternatively there is a button to drag all items at once.

  immediate
This frontend starts the drag operation automatically without showing a GUI in between. The user does not need to hold any mouse button and can just move the mouse cursor to the target location and then click once to drop the files.
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.
Another feature implemented in immediate mode is that the parent terminal window will be hidden automatically during the drag operation, unless the --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.

  notify
This frontend spawns a notification containing the URLs of the files to drag in the x-kde-urls field. Window managers with support for this field then enable the notification to be dragged itself into other application windows. This option is mainly useful on KDE Plasma.

  clipboard
This copies the file URIs (not the content) to the clipboard, which can then be pasted in supported programs.

  stdout
This frontend simply prints all files in the terminal as OSC8 links. Terminal emulators with support for OSC8 could allow the user to drag and drop such links directly. This option is equivalent to "ls --hyperlink=always".

AUTOQUIT BEHAVIOUR
Using --auto-quit it is possible to specify the behaviour when blobdrop will automatically quit. The following options are possible, all is the default behaviour.

  never
This option means that blobdrop will never automatically quit.

  first
Using this option causes blobdrop to quit after the first drag operation has finished.

  all
With this option blobdrop keeps track of which items have been dragged already. It quits when all paths have been dragged at least once.

DEFAULT ARGUMENTS
The $BLOBDROP_ARGS environment variable can be used to provide default arguments. The default arguments will be prepended to the actually passed arguments, for example:

    $ BLOBDROP_ARGS="-f gui -p" blobdrop -x never image.png
    $ # is equivalent to:
    $ blobdrop -f gui -p -x never image.png

This can be useful to change the default value of some options permanently.

EXAMPLES
Here are some example usecases. The following example drags all png files in the current directory.

    $ blobdrop *.png

The next example drags a single file and explicitly does not show a GUI, always starting the drag operation right away. The user does not need to hold any mouse button. Then the user can just click on the target location to drop the file.

    $ blobdrop -f immediate upload.mp4

The example below shows a new frameless window that always stays on top of other windows, containing all files chosen in the fzf selection selection prompt.

    $ blobdrop -tb -f gui $(fzf -m)

In this example blobdrop sends a desktop notification containing the URL of the given file and then quits immediately. On supported window managers the desktop notification itself can be dragged and dropped to any application.

    $ blobdrop -f notify doc.pdf

The below example shows a window displaying all files that contain the phrase "uploadable". The UI will show up right away and if the grep command takes a while, then the UI will already display the files that were found so far. The list will be updated live, as all operations are done asynchronously.

    $ grep -R --files-with-matches uploadable | blobdrop

The example below spawns a window under the cursor that intercepts any existing drag and drop operation and converts it into an outgoing immediate drag and drop operation. This can be helpful for touchpad users, where needing to hold a mouse button while simultaneously moving the mouse is an accessibility nightmare.

    $ blobdrop -ic -f immediate -x first

It is also possible to integrate blobdrop in other external programs. For example if you use the ranger commandline file manager, you can use blobdrop to drag any file with a simple keybinding in your ~/.config/ranger/rc.conf:

    map <C-d> shell blobdrop %p

In tmux it is possible to drag the file under the cursor on double click with this "oneliner" keybinding:

    bind -n DoubleClick1Pane run-shell "blobdrop \"#{pane_current_path}/$(echo '#{mouse_line}' | cut -c -$((#{mouse_x} - 1)) | grep -o '\\S*$' )\"\"$(echo '#{mouse_line}' | cut -c #{mouse_x}- | grep -o '^\\S*')\""

HOMEPAGE
https://github.com/vimpostor/blobdrop Please report bugs and feature requests in the issue tracker.