Can I "drag" a file into a window without a file manager?

Thanks to @derobert for recommending the Dragbox application to me.

Dragbox does exactly what I need. For example, I have a folder with a number of .png files that I would like to be able to drag into Chromium. Inside that folder, executing dragbox *.png creates this window:

A GUI window with the names of several files listed

I can use my mouse to drag files from there into Chromium, and it works flawlessly. However, getting to this point was a pain. As far as I am aware, Dragbox only officially supports Debian systems. I couldn't find it anywhere that natively worked for Arch. So, I've written a step-by-step guide to getting Dragbox working in Arch Linux. This is almost exactly what I did on my machine, with a couple modifications to follow better practices. If there's an error somewhere, you can look in this answer's edit history to see exactly what I did on my machine.

  1. Clone Dragbox's source to your computer by executing git clone https://github.com/engla/dragbox.git
  2. There will be a new directory called dragbox created inside your current working directory. Go inside.
  3. Dragbox and Dragbox's installation require Python 2, which comes standard on Arch Linux. However, it expects Python 2 to be the default Python installation, which isn't true on Arch. Get around this by executing export PYTHON=/bin/python2. Until you close your current terminal window, the environment variable $PYTHON will have the value /bin/python2. Dragbox's installation scripts check for that, and will use it over Python 3.
  4. Execute ./autogen.sh, ./configure, make and make install. make install must be done with root privileges (e.g. sudo make install).
  5. Dragbox is now installed on your computer, but is going to try to use Python 3 to run. With root privileges, open /usr/local/bin/dragbox in a text editor. Modify the shebang (the first line, that tells your shell what executable to run the script with) from #!/usr/bin/env python to #!/usr/bin/env python2.
  6. The script is now working, but it can't find the module containing the actual program. There are a couple of ways you can fix this.

    1. Include in your ~/.bashrc or similar a line reading export PYTHONPATH=$PYTHONPATH: immediately (as in, not even a space between) followed my the path to a directory. Python will now look in that directory when trying to import modules. Inside the directory created back in step 1, there will be a directory called Dropbox/ (with a capital D). Copy that directory to the directory you added to your $PYTHONPATH (e.g. if you wrote export PYTHONPATH=$PYTHONPATH:~/python/modules, copy the Dragbox/ directory to create ~/python/modules/Dragbox/).

    2. Probably worse practice, but you can copy that same directory to a directory already in your $PYTHONPATH. For example, you could copy it to create /usr/lib/python2.7/site-packages/.

If you've followed these steps, Dragbox should be working! You can now execute man dragbox to learn more about how to use it, and launch it by simply typing dragbox.


I had exactly the same problem a few months back and ultimately just wrote a tool to do it for me. When I saw this and found someone else had the same itch I cleaned it up so that someone other than me could actually get it running, and finished off my to-do list. The code is up now: https://github.com/mwh/dragon

To get it, run

git clone https://github.com/mwh/dragon.git
cd dragon
make

That will give you a standalone dragon executable - you can move it wherever you want. make install will put it in $HOME/.local/bin.

Either way, you can then:

dragon *.jpg

to get a simple window with draggable buttons for each of those files:

Screenshot of dragon showing a few files

You can drag any of those into a browser, a file manager, an editor, or anywhere else that speaks the standard drag-and-drop protocol.

If you want to go the other way, and drag things in to it, use --target — they'll be printed to standard output, or available to drag out again with if you use --keep as well.


To build you'll need a C compiler and the GTK+ 3 development headers - if you're on Arch you'll get those just by installing GTK+, but on other distributions you may have to apt-get install build-essentials libgtk3-dev or yum install gtk3-devel or similar first. Other than that it's entirely self-contained, with no constituent libraries or anything, and you can just put the executable where you want.

My use case is mostly one-off drags of only a few files (usually just one), without particularly caring how they show up, so if that doesn't line up with what you want then Dragbox (which I didn't see until recently) might still be better for you. Just yesterday I added the support for using it as a drag target as well, so that part hasn't had much use on my end. Other than that, though, I've been using this successfully for a while now. There are other modes and options described in the readme file.


You can easily navigate the filesystem within your browser, using the syntax:

file:///home/username/blah/blah

Open the path in an empty tab and from there you can drag and drop your file. At least with chrome/chromium, don't have other browsers here to try.