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

Open directory in thumbnail mode #851

Open
ViciousBadger opened this issue Dec 16, 2024 · 2 comments
Open

Open directory in thumbnail mode #851

ViciousBadger opened this issue Dec 16, 2024 · 2 comments

Comments

@ViciousBadger
Copy link

Hello!

Migrating from nsxiv, I miss the ability to open all images in a directory in thumbnail mode directly from the command line.

I have a little workaround that almost works: Opening vimiv with this command: vimiv --command 'open-selected' --command 'enter thumbnail' $directory. It works only when the directory does not contain any subdirectories, because otherwise, vimiv will enter the first subdirectory and open an empty thumbnail view..

@luravoid
Copy link

luravoid commented Jan 2, 2025

here is my workaround:

#!/bin/sh

directory=$(pwd)

first_image=$(find "$directory" -type f \( -iname "*.jpg" -o -iname "*.png" -o -iname "*.jpeg" \) | sort | head -n 1)

if [ -n "$first_image" ]; then
	vimiv --command "open '$first_image'" --command 'enter thumbnail' --command 'toggle library'
else
	echo "No image files found in directory: $directory"
fi

@ViciousBadger
Copy link
Author

Thanks! Works very well with an additional -maxdepth 1 to prevent accidentally opening subdirectories :)

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