(I'm on Arch Linux, using i3 as my wm and xterm as my terminal emulator, though I don't know if any of that is relevant.)

Occasionally, a website asks me to drag a file with my mouse from my desktop into the internet browser's window. Almost always, there is an alternative, but recently I found something I want to do that requires the drag and drop. Unfortunately, I don't have a file manager. I navigate my computer's file system solely through bash.

Is there a way I can fake the drag and drop action? Can I tell my browser "I just dropped this file onto you" without actually doing it?

Worst case scenario, I can download a graphical file manager exclusively to drop files into my web browser, but I'd like to avoid that solution.

  • 4
    > Can I tell my browser "I just dropped this file onto you" without actually doing it?" Sounds like a great question for the javascript community on stackexchange.
    – jayhendren
    Commented Jun 18, 2014 at 19:52
  • Also see www:mechanize or a derivative. There is perl and python it seems. The more solutions the better!
    – user44370
    Commented Jun 18, 2014 at 20:57
  • 1
    dragbox doesn't exist anymore. please change your accepted answer. Commented Jun 29, 2019 at 17:05
  • 1
    @yukashimahuksay done, thanks for the heads up Commented Jul 4, 2019 at 15:27

5 Answers 5


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

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.

  • Thank you! It took seconds to build/install! I'll use that! The --target option is a blast!
    – user44370
    Commented Jun 21, 2014 at 4:18
  • Nice, small, standalone binary. With nice small Makefile. Perfect. Thank you!
    – ctn
    Commented Sep 30, 2014 at 17:11
  • 5
    You are a hero. This tool is also available on the AUR under the name dragon-drag-and-drop-git.
    – FichteFoll
    Commented May 7, 2019 at 23:53
  • 2
    I love you! arch community loves U! thank you! I had been searching for this for ages. Commented Jun 29, 2019 at 17:39
  • 1
    For me it was sudo apt install libgtk-3-dev then make and make install. Works great.
    – tremby
    Commented Apr 27, 2022 at 21:18

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.

  • 2
    Actually, using /usr/bin/env python2 is the recommended way these days, since PEP 394 got adopted. Commented Jun 18, 2014 at 23:13
  • 1
    You don't need the second fix. Simply copy the Dragbox directory into the PYTHONPATH somewhere (like in the python2 site-packages, either system or per-user). That line is executed only when dragbox cannot import that package.
    – Bakuriu
    Commented Jun 19, 2014 at 11:21
  • @Seth Well, thanks I guess. I made a python script run on a slightly different system than it was designed for, that still had python on it :P I'm glad it was python, though, since that's the only language I'm fluent enough in to have made this happen. Commented Jun 19, 2014 at 14:26
  • 2
    With Archlinux, the real solution for this type of thing is to wrtie a PKGBUILD. You largely do what you've done, but you put it into a special script that allows pacman to manage the files for you so you don't ever have to go mucking around in the system should you want to update or remove it.
    – HalosGhost
    Commented Jun 20, 2014 at 7:06
  • 4
    Dragbox seems to be dead. The git-repo is gone.
    – kaleissin
    Commented Mar 21, 2019 at 10:54

Just solved the issue myself.

Quite possibly the easiest way is to use the "Open file..." dialog. You can simply drag and drop from the gtk file dialog, just like a file manager.

You may need to open a separate window to make sure the dialog doesn't steal the screen.

That's it. That easy.

  • Awesome! No need to install anything. I'm using Firefox so I cannot click the menu, but Ctrl+o works just fine. Commented Oct 6, 2016 at 19:01
  • Words cannot express the awesomeness of this answer! Commented Jan 13 at 20:47

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


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.

  • This isn't working for me, but I can't tell if it's a problem with the method you describe or a problem with the userscript that wants me to drop stuff in... Commented Jun 18, 2014 at 20:18
  • I think there's a command line switch or a attribute within chrome you have to enable to allow this.
    – slm
    Commented Jun 18, 2014 at 20:22
  • Would chrome://flags be the right place to look for something like this? That's where I'm looking at the moment. Commented Jun 18, 2014 at 20:28
  • @undergroundmonorail mmm you're right, I just tried with the demo at dropzonejs.com and it doesn't work. Could definitively be a permission problem, though Commented Jun 18, 2014 at 20:30
  • 5
    – slm
    Commented Jun 18, 2014 at 21:22

You can start the GTK file dialog using a command line tool like zenity and drag'n'drop from there.


zenity --file-selection

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .