Git Product home page Git Product logo

ripdrag's Introduction

What is ripdrag?

Crates.io GitHub top language Crates.io

ripdrag is an application that lets you drag and drop files from and to the terminal.

It's designed to be feature to feature* compatible with dragon, while being written in modern Rust and GTK4.

Example.mp4

*some features like --on-top can't be ported over because of limitations in gtk4

Use cases

Many applications expect files to be dragged into them. Normally you would have to put your beloved terminal aside and open a file manager to that, but now you can just type ripdrag FILENAME and be done.

Used in combination with a fuzzy finder like fzf - e.g. ripdrag $(fzf) - can make for an amazingly quick and painless terminal experience.

Installation

Click to see the installation guide

Install the required dependencies

Ubuntu 22.04 or later

sudo apt install libgtk-4-dev build-essential curl
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh

Fedora\CentOS\RHEL

sudo dnf install cargo gdk-pixbuf2-devel pango-devel graphene-devel cairo-gobject-devel cairo-devel python2-cairo-devel gtk4-devel

Arch Linux

ripdrag is on the AUR: ripdrag-git

If you want to install it manually, you need to install the requirements:

sudo pacman -Sy --needed rust gtk4 base-devel

MacOS

You need to have homebrew installed.

brew install rustup gtk4
rustup-init

NetBSD

A pre-compiled binary is available from the official repositories. To install it simply run,

pkgin install ripdrag

Install the binary

(Do not use sudo, if you don't want it to be installed on root)

cargo install ripdrag

Add cargo to path

(Not added by default)

PATH=$PATH:~/.cargo/bin

Usage

Usage: ripdrag [OPTIONS] [PATH]...

Arguments:
  [PATH]...  Paths to the files you want to drag

Options:
  -v, --verbose                  Be verbose
  -t, --target                   Act as a target instead of source
  -k, --keep                     With --target, keep files to drag out
  -r, --resizable                Make the window resizable
  -x, --and-exit                 Exit after first successful drag or drop
  -i, --icons-only               Only display icons, no labels
  -d, --disable-thumbnails       Don't load thumbnails from images
  -s, --icon-size <SIZE>         Size of icons and thumbnails [default: 32]
  -W, --content-width <WIDTH>    Min width of the main window [default: 360]
  -H, --content-height <HEIGHT>  Default height of the main window [default: 360]
  -I, --from-stdin               Accept paths from stdin
  -a, --all                      Drag all the items together
  -A, --all-compact              Show only the number of items and drag them together
  -n, --no-click                 Don't open files on click
  -b, --basename                 Always show basename of each file
  -h, --help                     Print help
  -V, --version                  Print version

TODO

There are still lots of thing to be done! Mainly:

  • clean up code
  • pacman, deb, rpm, windows and macos build scripts
  • automated builds

Feel free to contribute ;)

ripdrag's People

Contributors

0323pin avatar fabillotic avatar feddynventor avatar fqqf avatar huanie avatar matthiasbeyer avatar nik012003 avatar tkna91 avatar tranzystorekk avatar txtyash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ripdrag's Issues

suggestion: add option to disable opening images from ripdrag

Current behaviour is when you click an entry in the ripdrag window it will open the image, I think there should be an option to disable it (-n/--no-click for example) as:

  1. I don't think the function of this utility should be an image opener, you have file managers for that (lf, ranger etc) or image viewers such as nsxiv.
  2. If you are selecting selecting multiple items by CTRL clicking or SHIFT clicking it will open an image each time and that is just super annoying.

Missing dependency: libgtk4-dev (package 'gtk4') for build gtk4-sys

--- stdout
cargo:rerun-if-env-changed=GTK4_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:warning="pkg-config" "--libs" "--cflags" "gtk4" "gtk4 >= 4.0.0" did not exit successfully: exit status: 1
error: could not find system library 'gtk4' required by the 'gtk4-sys' crate

--- stderr
Package gtk4 was not found in the pkg-config search path.
Perhaps you should add the directory containing gtk4.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk4' found Package gtk4 was not found in the pkg-config search path. Perhaps you should add the directory containing gtk4.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk4' found

Use _NET_WM_WINDOW_TYPE_UTILITY?

Most tiling window managers choose to tile or float windows based on their Freedesktop window type. Currently, ripdrag uses _NET_WM_WINDOW_TYPE_DESKTOP, which is presumably the default.

Would you consider changing to _NET_WM_WINDOW_TYPE_UTILITY? This seems like a better fit, and would also make tiling WMs float the window by default, which seems more in line with the intended behavior.

_NET_WM_WINDOW_TYPE_UTILITY indicates a small persistent utility window, such as a palette or toolbox. It is distinct from type TOOLBAR because it does not correspond to a toolbar torn off from the main application. It's distinct from type DIALOG because it isn't a transient dialog, the user will probably keep it open while they're working.

option to disable thumbnails

Nice piece of software, thanks a lot!

When running ripdrag *.jpg in a folder that contains plenty of jpegs, it seems to render the thumbnails synchronously, which slows down the startup of the program dramatically. Would it be possible to add an option to disable thumbnails alltogether?

Drag&drop doesnt work on sway

Hello. I switched to sway few weeks ago. Im in love with CLI-tools, that allow me to drag&drop from CLI, but im expiriencing troobles with that on Wayland. Drag window shows up, but i cant drop anything. Sometimes i can, sometimes - cant. Can u suggest some solution for me? Or, at least, tell me, how to debug it properly.

Also, your app gives me error:

(ripdrag:72048): Gdk-WARNING **: 13:40:05.111: Compositor doesn't support moving popups, relying on remapping

If this error is related to my bug - how can i enable moving popups? Is that even possible?

Demonstration:
https://github.com/nik012003/ripdrag/assets/23531195/d8e614ec-f707-4cdb-9d6f-4b493b3e0f98

1 file gets lost (?) when dragging & dropping to Telegram client.

I don't know if it's always been there or if it happens with other apps as well, but when I drag & drop files to Telegram (on wayland, haven't tested on xorg) one file is lost in the process, e.g. if there are 101 files in ripdrag, only 100 will get dropped to Telegram. And when I drop 1 file from ripdrag, Telegram doesn't register the drag&drop event at all. Other clients that I've tested seem to work just fine.
dragon also works as one would expect with Telegram, thought.

using `-r` still has a minimum height as specified by `-h`

If I specify the -r option, I can resize the window vertically and horizontally. There seems to be no minimum width, but there is a minimum height, under which I cannot get. I assume that is the standard height from -h?

This is on i3-gaps.

Missing Dependency: cairo for cairo-sys-rs build

Same issue as with pango

--- stdout
cargo:rerun-if-env-changed=CAIRO_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:warning="pkg-config" "--libs" "--cflags" "cairo" "cairo >= 1.14" did not exit successfully: exit status: 1
error: could not find system library 'cairo' required by the 'cairo-sys-rs' crate

--- stderr
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing cairo.pc' to the PKG_CONFIG_PATH environment variable No package 'cairo' found Package cairo was not found in the pkg-config search path. Perhaps you should add the directory containing cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found

NetBSD package nearly ready

Hi,

I've just packaged ripdrag for NetBSD/pkgsrc.
The package is currently in the wip (work-in-progess) repo, since we have a branch freeze coming-up in a couple of days.

I will import the package into the main package repo once the freeze is over. Also, I want to look into why it's printing warnings about libEGL. The package is working as it should, though.

Here's the merge log, in case you're interested https://mail-index.netbsd.org/pkgsrc-wip-changes/2022/09/16/msg024969.html

Missing Dependency: pango library for pango-sys build

Title says it all

--- stdout
cargo:rerun-if-env-changed=PANGO_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:warning="pkg-config" "--libs" "--cflags" "pango" "pango >= 1.46" did not exit successfully: exit status: 1
error: could not find system library 'pango' required by the 'pango-sys' crate

--- stderr
Package pango was not found in the pkg-config search path.
Perhaps you should add the directory containing pango.pc' to the PKG_CONFIG_PATH environment variable No package 'pango' found Package pango was not found in the pkg-config search path. Perhaps you should add the directory containing pango.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pango' found

Can't drop file with `--target`

On Manjaro Linux with i3 and ripdrag v0.2.0, running ripdrag --target and dragging a file from a file manager (pcmanfm-qt) does nothing. After that, dragging more files (or strings) prints the following to the console:

(ripdrag:404510): Gtk-WARNING **: 12:31:07.362: (../gtk/gtk/gtkdroptarget.c:477):gtk_drop_target_handle_crossing: runtime check failed: (self->drop == NULL || self->drop == crossing->drop)

(ripdrag:404510): Gtk-CRITICAL **: 12:31:07.362: gtk_drop_target_handle_event: assertion 'self->drop == gdk_dnd_event_get_drop (event)' failed

Both of these messages are repeated many times. The former whenever I move the mouse over the popup, and the latter whenever I drop something onto it, possibly other times.

Before dropping the first file, nothing is printed and I am able to drop strings correctly. After dropping the first file, all dragging and dropping of files or strings fails in the above way.

--verbose does not seem to change the output.

Can't install ripdrag on Kubuntu because rustc is too old

Full error upon running cargo install ripgrep (non-sudo):

error: failed to compile `ripdrag v0.4.2`, intermediate artifacts can be found at `/tmp/cargo-installItzQP5`

Caused by:
  package `glib-macros v0.18.0` cannot be built because it requires rustc 1.70 or newer, while the currently active rustc version is 1.67.1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 23.04
Release:        23.04
Codename:       lunar

WM_CLASS(STRING): Empty name and instance values

Usually, there is WM_CLASS property with name and instance, so i3 users could match the window.

I still can match ripdrag with title property:

for_window [title="ripdrag"] floating enable

However, these properties are there for a reason, and must be given a reasonable values
image

Thank you, really liked ripdrag

TODO: update gtk dep to >0.8

Starting from version 0.7, the gtk crate has revamped the communication channels model and some ListStore stuff, so currently ripdrag failes to compile with newer versions of the crate.

Milestone for v0.5

Using an MacOS and Chrome (Gmail) doesn't attach the file

Hi there,

This project is really what I needed on my Mac, and I was super excited about it, and I installed it immediately.

Tried to test it to attach a file in browser's Gmail (using Chrome), and when I drag the file, it basically pastes the path to the file, instead of attaching it to the email.

If I do the same using Finder (MacOS's file manager), it properly attaches the file.

I was wondering if this is something that is a known issue/can be fixed.

Thank you

Doesn't work on macos

Installed:

  • ripdrag via cargo
  • gtk4 via brew
  • rustup from official website and initialized

Command:

ripdrag {{items}}

Items show up in the interface but when dragging to slack or whatsapp, nothing happens

In whatsapp, it says:

The document you tried adding has no content

doesnt keep the file order

when I drag and drop multiple files fron ripdrag to obsidian it doens't keep the order of the files I selected.
please fix this

Questions. Newbie, tho...

I so wanna get involved in OSS - is main.rs the entire ripdrag program? Its useful, but I normally go the OTHER way - I want to drag INTO the folder...

Thanks for creating, what other features do YOU want to add/work on?

suggestion: remove the --all option and instead add a button

Instead of having a separate option and having to wonder whether you want to drag all the files at once or just one by one, there should just be a button/header/icon/label "Drag All"/whatever in the ripdrag window that is always there with which you can decide whether you want to drag all or individually once you've already spawned it.

Great tool nonetheless, I can now finally throw away my GUI file manager for good.

Build instructions using Docker

To get a binary built in your current workdir:

$ docker run --rm -it -v "$(pwd):/workspace" rust:1.71.0-bookworm  # >= bookworm required to have gtk4 available in Ubuntu repos
$ git clone https://github.com/nik012003/ripdrag.git
$ cd ripdrag
$ apt update && apt install cargo libgtk-4-dev build-essential
$ cargo build
$ cp target/debug/ripdrag /workspace/

Can't use with `mpv`

Hello there. Hope you're doing well. Thank you for creating this modern version of dragon!

Description

I tried to use ripdrag to drag subtitle to mpv, but it'd kill mpv and the ripdrag's window would stay remain. The same workflow works with dragon.

Reproducible steps

  1. list current directory structure:
➜ ls
sample.mkv  sample.srt
  1. run mpv sample.mkv:
➜ mpv sample.mkv
   cplayer:  (+) Video --vid=1 (*) (hevc 1280x718 23.976fps)
   cplayer:  (+) Audio --aid=1 --alang=eng (*) (ac3 6ch 48000Hz)
   cplayer:      Subs  --sid=1 '21.srt' (subrip) (external)
Cannot load libcuda.so.1
    ffmpeg: AVHWDeviceContext: Cannot load libcuda.so.1
    ffmpeg: AVHWDeviceContext: Could not dynamically load CUDA
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Cannot load libcuda.so.1
    ffmpeg: AVHWDeviceContext: Cannot load libcuda.so.1
    ffmpeg: AVHWDeviceContext: Could not dynamically load CUDA
ffmpeg/video: hevc_v4l2m2m: Could not find a valid device
ffmpeg/video: hevc_v4l2m2m: can't configure decoder
        vd: Could not open codec.
ao/pipewire: The --audio-stream-silence option is set. This will break certain player behavior.
   cplayer: AO: [pipewire] 48000Hz 5.1(side) 6ch floatp
   cplayer: VO: [gpu] 1280x718 yuv420p10
statusline: (Paused) AV: 00:00:18 / 00:23:22 (1%) x1.80 A-V:  0.000
  1. ripdrag --verbose sample.srt

  2. drag ripdrag's window to mpv

  3. mpv is killed and ripdrag's window persists

Error from mpv:

statusline: (Paused) AV: 00:00:18 / 00:23:22 (1%) x1.80 A-V:  0.000
      file: Cannot open file '': No such file or directory
    stream: Failed to open .
   cplayer:
statusline: (Paused) AV: 00:00:18 / 00:23:22 (1%) x1.80 A-V:  0.000
   cplayer:      Subs  --sid=1 (subrip)
   cplayer: No video or audio streams selected.
   cplayer:
   cplayer: Exiting... (Some errors happened)

Version

Linux 6.1.62-1-lts
mpv 0.36.0
ripdrag 0.4.4

Thank you in advance!

Add tags for version releases

Adding git tags like v0.2.0 when a new version is cut in Cargo.toml would make it possible for package maintainers from various linux distros to get involved more easily and package ripdrag

Issue while installing fedora dependencies - [Error: Unable to find a match: cargo-devel]

I'm running fedora 38 and followed the readme instructions for installing dependencies but got the following error:

❯ sudo dnf install cargo gdk-pixbuf2-devel pango-devel graphene-devel cargo-devel cairo-gobject-devel cairo-devel python2-cairo-devel gtk4-devel
Last metadata expiration check: 0:16:32 ago on Sunday 30 July 2023 04:40:57 PM.
Package cargo-1.71.0-1.fc38.x86_64 is already installed.
Package gdk-pixbuf2-devel-2.42.10-2.fc38.x86_64 is already installed.
Package pango-devel-1.50.14-1.fc38.x86_64 is already installed.
No match for argument: cargo-devel
Package cairo-gobject-devel-1.17.8-4.fc38.x86_64 is already installed.
Package cairo-devel-1.17.8-4.fc38.x86_64 is already installed.
Error: Unable to find a match: cargo-devel

Removing the cargo-devel package fixed the issue and the other dependencies installed fine.
Then installed ripdrag using cargo install ripdrag and it installed correctly, able to execute the program.

Error when using '-A' flag, installed using Cargo on Ubuntu 22.04

When using the -A or --all-compact flag, ripdrag fails and I get the following error message.

thread 'main' panicked at 'Source property n-items on type GListStore not found', /home/ethan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glib-0.17.10/src/object.rs:3789:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Running the command again with "RUST_BACKTRACE=1" or "RUST_BACKTRACE=full" doesn't seem to give any useful information, but I can provide it if it would help.

I am using Gnome on Ubuntu 22.04, and I installed ripdrag using the recommended method from the github page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.