thimc / vifmimg Goto Github PK
View Code? Open in Web Editor NEWImage previews for Vifm (vi file manager) using Überzug
License: GNU General Public License v3.0
Image previews for Vifm (vi file manager) using Überzug
License: GNU General Public License v3.0
It would be very nice, if the arguments to vifmrun would be passed to vifm like this:
vifm $@
So it would be still possible to give vifm arguments like the current dir it should open, like:
vifmrun ~/documents ~/other_working_dir
It's about this line:
https://github.com/cirala/vifmimg/blob/06495080dead3223f060e73eed45885b1ce58d21/vifmrun#L14
Been referenced here from There and when I install the two scripts in '/bin' when running vifm with vifmrun
and preview and image with ++w++ it seems to just freeze and not do anything after I press ++ctrl+c++ once it doe's manage to unfreeze but with the following error massage:
/usr/bin/vifmimg: 7: cannot create /home/pong/.cache/vifm/ueberzug-19287: Interrupted system call
and I've installed ueberzugpp with their Deb .sh script and
$ ueberzug layer -h
Does seem to echo me output.
Any idea why this is and how to fix it?
cool work, i am trying to move here from Far Manager.
I am very new.
The question:
Should it work in Windows 7, other Windows version ?
I can try all the things to install, but better is to know is it supposed to work also in Windows somehow
When going over multiple images which takes some time to load I loose control over vifm until the all images are loaded. For example if each image would take one second to load and I press j
10 times in a directory with images I have to wait 10 seconds before I gain control again. This does not happen in for example fzfimg
. Any idea how one could handle the loading of images without blocking input to vifm
?
Would it be possible to clear the image preview from the screen when the user runs the :shell
(or :sh
) command? I have nnoremap cd :shell<CR>
in my vifmrc so that I can easily change directories to whatever directory I happen to have open at the time in vifm. The problem comes from having an image preview open and running the command, as the image preview doesn't go away after going back to the shell prompt. The only ways to solve the problem are to either toggle the preview window visibility via :view
before using :sh
or going to something like a directory or text file which doesn't use Ueberzug.
Edit: I found a workaround to doing it. I just use the following remap:
nnoremap cd :!$XDG_CONFIG_HOME/vifm/scripts/vifmimg clear & $SHELL<CR>
Where XDG_CONFIG_HOME
is ~/.config
Xubuntu 22.04
Copied vifmimg and vifmrun in to ~/.local/bin map.
Added rights to files.
sudo chmod -R ~/.local/bin
In vifm added fileviewer code from the documentation.
fileviewer *.pdf
\ vifmimg pdf %px %py %pw %ph %c
\ %pc
\ vifmimg clear
fileviewer *.djvu
\ vifmimg djvu %px %py %pw %ph %c
\ %pc
\ vifmimg clear
fileviewer *.epub
\ vifmimg epub %px %py %pw %ph %c
\ %pc
\ vifmimg clear
fileviewer <video/*>
\ vifmimg video %px %py %pw %ph %c
\ %pc
\ vifmimg clear
fileviewer <image/*>
\ vifmimg draw %px %py %pw %ph %c
\ %pc
\ vifmimg clear
fileviewer <audio/*>
\ vifmimg audio %px %py %pw %ph %c
\ %pc
\ vifmimg clear
fileviewer <font/*>
\ vifmimg font %px %py %pw %ph %c
\ %pc
\ vifmimg clear
Installed ueberzurg from here
https://software.opensuse.org/download.html?project=home%3Ajustkidding&package=ueberzugpp
Added scripts to PATH in zshrc
LOCAL_BIN_SCRIPTS="/home/serii/.local/bin/:${PATH}"
CARGO="/home/serii/.cargo/bin/:$PATH"
PATH=$LOCAL_BIN_SCRIPTS:$CARGO
export PATH;
But image preview don't work.
Vifmimg doesn't preview images when using it as filepicker for an internet browser using the command urxvt -e vifmrun --choose-file=picked_file
. When running the command in terminal the pictures preview on the parent terminal and not on the terminal running vifm.
When I preview images vifm freezes and image isn't displayed.
When run from terminal it outputs this:
/usr/bin/vifmrun: line 14: 16287 Broken pipe tail --follow "$FIFO_UEBERZUG" 16288 Illegal instruction (core dumped) | ueberzug layer --silent --parser bash 2>&1 > /dev/null
I have copied vifmrun and vifmimg to /usr/bin/ which is already in $PATH and run
chmod +x /usr/bin/vifmimg
chmod +x /usr/bin/vifmrun
Opened vifm by vifmrun
.
Also I can see that pipe is created in ranger.
python-ueberzug 18.1.3-2, vifm 0.10-1
Shell: bash 5.0.7
Terminal: urxvt - happens on all others that I have tested
OS: Manjaro
Hi,
As many of you probably know, the author of Ueberzug, seebye has decided to stop maintaining Ueberzug because of various reasons that I won't go in to here. You're free to read that bit for yourself.
Until there is a maintained fork of Ueberzug, I will stop any development for vifmimg and lfimg as I don't want to maintain anything that relies on projects that no longer receives updates.
I hope that everyone here understands the situation and I just want to thank each and every one of you who contributed.
seebye/ueberzug: https://github.com/seebye/ueberzug/blob/master/README.md
Is it possible to display a text-based preview like the output of mediainfo
under a video preview?
I’ve tried editing vifmrc
the following way, but it makes vifm hang.
fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
\*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
\ vifmimg videopreview %px %py %pw %ph %c
\ %pc
\ vifmimg clear; mediainfo
If I replace what’s after the list of extensions with \ echo "test"; mediainfo
, the output of both commands appear as expected, so I wonder if I’m using an incorrect syntax or it’s a limitation.
I get invalid option as output. I downloaded the gnu tools and changed the stat command in vifmimg to gstat and it works now.
Hi,
I did the installation as indicated, and under Kitty, it works.
However, I noticed a little annoying dysfunction: when browsing the images, some of them are displayed very briefly (or not at all) and are replaced by a black rectangle, and then you have to go back to the image, sometimes several times, to get the display.
This anomaly apparently occurs randomly, and not necessarily on the same files or filetypes.
Is this problem known? Does it have a solution?
[Edit]. I just noticed it also works under gnome-terminal (I read somewhere it was not compatible with ueberzug), with the same anomaly and also another one : the image is not properly sized, nor centered in the right pane (it is placed randomly in the right pane, and its position depends on the size of the window).
Thanks
I'm following vifmimg setup ueberzugpp for vifm. I removed -p json
in
Line 16 in 6e4c562
When I open a pdf file, their is a thumbnail picture created in cache directory, which proof the other part works fine, but it the image do not shows up in vifm, and the vifm stucked. When I open a image, their also no image shows up, and the vifm also stucked.
I need help to setup ueberzugpp using vifm. Refer Not work in vifm and ueberzugpp stuck vifm
system: ubuntu server 20.04
terminal: alacritty
vifm:
Version: 0.12.1
Git info: built out of repository
Compiled at: Feb 20 2023 13:53:33
Support of extended keys is on
Parsing of .desktop files is enabled
With GTK+ library
Without magic library
With X11 library
With dynamic loading of X11 library
With file program
With -n option for cp and mv
With remote command execution
https://github.com/cirala/vifmimg/blob/e942606d01d2951eecc2e975bc3163161b2c651b/vifmrun#L20
I get errors when running vifm via vifmrun
, and the error seems to suggest that vifmrun
is looking for vifmimg
is the fixed path.
The current readme suggests vifmimg could be anywhere in path. Not sure whats the best way to fix this.
For me the image() function can't handle SVG files without conversion.
In vifmimg
, I added an "svg" case which passes by a png conversion.
"draw")
FILE="$PWD/$6"
image "$1" "$2" "$3" "$4" "$5" "$FILE"
;;
"svg")
[ ! -f "$PCACHE" ] && \
convert -background none "$6" "${PCACHE}.png"
image "$1" "$2" "$3" "$4" "$5" "${PCACHE}.png"
;;
In vifmrc
:
" Images & SVG
filextype {*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm,*.ico,*.tif,*.svg},<image/*> {View in qimgv} qimgv %f,
fileviewer <image/svg\+xml> $HOME/.config/vifm/scripts/vifmimg svg %px %py %pw %ph %c %pc $HOME/.config/vifm/scripts/vifmimg clear
fileviewer <image/*> $HOME/.config/vifm/scripts/vifmimg draw %px %py %pw %ph %c %pc $HOME/.config/vifm/scripts/vifmimg clear
I wanted to combine the display of images and the output of "identify" as header.
In vifmimg
, I added a new function image_margin_top() with a top margin of 2 Lines:
image_margin_top() {
printf '{"action": "add", "identifier": "vifm-preview", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$2" "$(( $3 + 2 ))" "$4" "$(( $5 - 2 ))" "$6" > "$FIFO_UEBERZUG"
}
I modifies "draw" & "svg" cases to use this function and then call identify:
"draw")
FILE="$PWD/$6"
image_margin_top "$1" "$2" "$3" "$4" "$5" "$FILE"
identify "$FILE" | awk '{print $2,$3,$4,$5,$6,$7}'
;;
"svg")
[ ! -f "$PCACHE" ] && \
convert -background none "$6" "${PCACHE}.png"
image_margin_top "$1" "$2" "$3" "$4" "$5" "${PCACHE}.png"
identify "$PWD/$6" | awk '{print $2,$3,$4,$5,$6,$7}'
;;
Example:
https://github.com/cirala/vifmimg/blob/e942606d01d2951eecc2e975bc3163161b2c651b/vifmimg#L5
The identifier used in add is now vifm-preview
instead of PREVIEW
used in pclear()
. In the current behavior, vifm
clear is not able to clear the image in the terminal.
Creating the preview might take some time for some some files and this slows down vifm
when you are navigating through your files.
Would it be possible to create a directory in ~/.cache
where vifmimg
could store it's previews so that when vifmimg
is trying to show a preview of file that it has made a preview of in the past, it can simply just use the image from the ~/.cache
?
This is just a thought, let me know what you think :)
Thank you for your work.
It is not an issue of yours
... but, since i do not see 'issues' in https://github.com/seebye/ueberzug site and since many users will try your Code, here is my experience.
I fresh installed opensuse tubleweed, copying my old 'home' partition in it. I used vifm with w3mimgdisplay that worked ok once. I noticed that it is not working anymore, not in my fresh install nor in my old system (probably some update broke it). I decided to try 'ueberzug'. I 'pip installed' it as normal user. I tried the bash example in seebye's site and it didn't worked complaining about Xlib error not having permission to open display. Of course neither your code was working.
Despite the 'drop python-xlib' of setup.py that mentions the site, I installed the python38-python-xlib package, since fresh install on opensuse tubleweed uses python38 at the present. After that installation your 'Code' works flawlessly.
Probably the pip is not updated with resent code of seebye's work, or i should activate python39 before pip install ueberzug. I do not know. The fact is that a rolling distribution like tubleweed that has python38 as default can not use ueberzug and consequently your code out of the box. So,
python38-python-xlib is needed.
Has any Arch user noticed this? trying to find out which package was broken as I write this. will update if I find anything. any help is appreciated.
Hi, I just had the time to make this POSIX compliant, which is always good. The difference is that the parser is not bash but a json file filled with printf s.
Also added a docx ,pptx, (and prob etc) viewer by converting them into pdf.
https://github.com/explosion-mental/scripts/blob/main/vifmimg
https://github.com/explosion-mental/scripts/blob/main/vifmrun
sorry too noob to pr.
I recently formated my system (mx linux 19.4 which is debian 10 buster based). Before formatting I had previews without no problem. Now, they all stopped working. I have installed all dependencies and made a minimal vifmrc with just fileviewer options. But still nothing is working. The thumbnails for pdf files are being generated in .cache/vifm but not showing in preview window.
I have the latest vifmimg scripts installed from the repository with make install
and use the recommend configuration in my vifmrc. ueberzug
version is 18.1.9
and my system is running Gentoo.
When I invoke vifm inside tmux with vifmrun
and scroll to a file which is supported by vifmimg the terminal freezes and I can't do anything anymore. Only killing vifm helps. The terminal is kitty
btw. but the same happens with alacritty
...
Doing the same outside tmux is no problem at all. How can I configure vifmimg that it at least throws an error message and let's me continue working?
the package (neither when searching pdftoppm nor for poppler-utils) does not appear to be in the arch repos. I also couldn't find any git repo page with information on how to build it from source.
Is there an alternative?
When I try to image preview in vifm it says that the file or directory doesn't exist. I have put both vifmimg and vifmrun in /usr/bin and made them executable through sudo chmod 777. Any way to fix this? Also I'm using Manjaro if that helps.
This script is great and I really appreciate your sharing it. Would have taken me weeks or months to cludge my way through getting something like this working (might have been beyond my abilities entirely, in fact). So thanks again, cheers!
Only hitch left on my path to vifm nirvana is that active previews cover vifm's menus (for example the sort menu 'S') such that I need to move off any previewable filetype in order to be able to see the menu properly. Corollary to this, the preview also sticks around if I drop to shell (with 's') covering some portion of the terminal. There doesn't seem to be any way to clear this. I understand this is just how ueberzug (or hacking image view into term at all) works, that it just covers the area specified and you don't get any kind of z-level control … but it would be great if I could maybe map a hotkey or something to blank/clear the preview manually? Hate to bother you with my ignorance, but I'm simply not savvy enough to know where to start with something like that and it might be a feature someone else would appreciate also.
as a title says, is there any way to run it on macos?
I am using the latest scripts and ran make install. I am using vifmrun to start vifm. This happends for both images and pdf. What can be the reason and how can I fix this?. Error shows like this
All said in the title. The $PPID
is the same (the tmux PID) for both vifm instances and so they try to use the same FIFO pipe.
Whenever I use vifm with this script the preview image does not appear for any file type and causes the entire program to crash and just locks up the terminal. I have all of the dependencies installed for both Ueberzug and this script.
I can consistently make it crash by doing the following:
1. Open vifm using vifmrun, as per instructions
2. :view
3. Position cursor over a video file
4. Open the video using l (or right arrow key) (builtin mapping)
5. Close the video
6. Close the background process error popup either via <CR> or Esc or <C-C>
7. Crash
Minimal vifmrc
:
fileviewer <video/*>
\ vifmimg video %px %py %pw %ph %c
\ %pc
\ vifmimg clear
filetype <video/*> mpv %c &
I don't see if there are any logs, and I'm not certain how to run it all under gdb
.
Hi, thanks for the script.
I have a problem with the script that results in files not being previewed.
/home/baitinq/.config/vifm/scripts/vifmrun: line 1: 4224 Broken pipe tail --follow "$FIFO_UEBERZUG" 4225 Segmentation fault (core dumped) | ueberzug layer --silent --parser bash 2>&1 > /dev/null /home/baitinq/.config/vifm/scripts/vifmrun: line 4: 5581 Hangup vifm
Do you have any idea why this could be caused and any possible solutions?
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.