Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More organizing images #455

Open
mredaelli opened this issue Dec 26, 2021 · 1 comment
Open

More organizing images #455

mredaelli opened this issue Dec 26, 2021 · 1 comment

Comments

@mredaelli
Copy link

As a follow up to #366 (from which I will copy the awesome custom command), I think two things would make vimiv easier to use for moving stuff around:

  • is it possible to support dragging marked files to a folder library?
  • is it at all possible to have completion suggestion in the argument of the copy_marked argument?
@karlch
Copy link
Owner

karlch commented Jan 6, 2022

Hey, thanks for your interest and sorry for the delay, in the end I decided to take a few days off of programming over the holidays.

I am not 100-percent sure I understand the request.

  • Would this mean dragging with the mouse? To some file manager? Or to another vimiv instance?
  • This would be a simple path completion? In this case I can only think of a bit of a dirty hack as the actual completion models are currently not exposed via the api. Using the code in vimiv.completions which could break / change at any time as it is considered internal we would have something along:
import os
import shutil

from vimiv import api
from vimiv.completion import completionmodels


@api.commands.register()
def copy_marked(target: str):
    """Copy all marked images to target."""
    target = os.path.abspath(os.path.expanduser(target))
    if not os.path.isdir(target):
        raise api.commands.CommandError("target must be a directory")

    for src in api.mark.paths:
        shutil.copy(src, target)

    api.mark.mark_clear()


def init(*args, **kwargs):
    completionmodels.PathModel("copy-marked")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants