Code Monkey home page Code Monkey logo

Comments (6)

DLFW avatar DLFW commented on June 11, 2024

Hi!

Two thoughts:

  1. The Überzug-logs show “remove”-actions, but no “add”-actions. This smells like the shown-hook is not invoked or does not work
  2. If you're not sure if the Issue is with Joshuto or with Überzug, just use Überzug directly from the shell and try to display an image. If it works, the problem is with the Joshuto configs, otherwise it's an Überzug problem.

Because the “add”-action does not show up in the logs, I would guess the problem is in the Joshuto config. Do you return 0 in the preview-script? (See the “❗Important”-Note in image_previews.md!) Is your max_preview_size there big enough for your image? I set this number to an insane big value, so that the preview is processed for any file. (I think this max_preview_size should actually be removed in Joshuto.)

If this does not lead you to the solution, maybe try to write some log-info from preview_file.sh and on_preview_shown.sh to some temp file (echo "yay" >> /tmp/something) and check if these scripts are actually invoked.

from joshuto.

ktnlikeasmallcat avatar ktnlikeasmallcat commented on June 11, 2024

Thanks for the guidance. It seems I'm unable to get uz++ showing anything at all using the json syntax on the command line. I might be doing it wrong, I'm using ueberzug layer, hitting enter and pasting {"action": "add", "x": 10, "y": 10, "identifier": "test", "path": "~/Pictures/foo/bar.png"} (I've tested several x,y values). It just hangs, so either I'm inputting the test wrong or something's gone sideways in uz++.

I'm working with some very modestly sized images.

I'd need to do the scripting in #366 in order to get that log info, right? It's somewhat dense to me at this moment, I'm having a hard time understanding what precisely would need to be done for that, but I'll revisit it and see if I can't wrap my head around it because the issues there look familiar to what I'm facing.

For now I'm simply using viu -b -w "${PREVIEW_WIDTH}" "${FILE_PATH}" && exit 0 in the preview.sh to create unicode block previews as a stopgap - I may also try to hack together something for getting a preview without block characters.

from joshuto.

DLFW avatar DLFW commented on June 11, 2024

Hi again,

for testing if überzug++ works at all (and with which configuration), you may want to use this example wrapper script from überzug++'s repo.

I also had quite some trouble to get it working. Seems there are some pitfalls. I solved my problems by playing around with this img-script. Images in the terminal are always a hack after all. 🙃

Yes, #366 exactly describes the test-logging I was talking about.

Let me try to list out the sequence of stuff that must work and can be tested by you:

  • Überzug++ must work; you may use Überzug++'s test script to check that
  • The wrapper script must work; hard to test by itself (you may call the show_image function in there from a Joshuto sub-process like the preview-script or a shell-call; I would skip this test in the beginning, just take care that the working Überzug++-configuration from the first step is used in the wrapper)
  • The preview-script (preview.sh, or whatever you called it) must be invoked by Joshuto for your images and it must return 0; test this by getting some text-preview for your image, like some metadata or just the path or whatever into the 3rd, right-most pane
  • Finally, the “preview-shown-hook” must be called by Joshuto the moment when the textual preview is displayed. Test this by some test-logging in your hook-script. The only mistake one could make here is to use a wrong path to the hook script in the config, I suppose...

If this all works but you still don't have an image, there must be something fishy with the wrapper script or how the show_image is called from the hook.

from joshuto.

ktnlikeasmallcat avatar ktnlikeasmallcat commented on June 11, 2024

Ueberzug++ is able to display images, according to the wrapper you linked. That I'm able to use viu to preview the image also means that the preview.sh script is also functioning, so the thing that's left for me to do is the second and fourth points here, but how to run those tests more or less escapes me. I appreciate your patience, how do I go about doing those tests exactly? I've copied what's in joshuto.toml's preview area directly, and double checked it corresponds with the paths to the hook scripts.

from joshuto.

DLFW avatar DLFW commented on June 11, 2024

Hi!
Well, you could start with adding a line

date >> /tmp/on_shown_hook_called.log

at the top of your ~/.config/joshuto/on_preview_shown.

Start Joshuto, move the cursor over some files that yield a text preview, and then check that the log-file has been created. Then just tail -f /tmp/on_shown_hook_called.log in another terminal and move your cursor in Joshuto over some files to preview and check that the hook-script is called for each of them in the log output.

If that does work, remove that line from your hook script and put it into your wrapper-script on the top of your show_image function and check if this function is called.

Let's think further once you're there.

You could also publish your dotfiles somewhere. If somebody has the time, he could have a look. Maybe you just missed the obvious. (Happens to me all the time...)

from joshuto.

scotty531 avatar scotty531 commented on June 11, 2024

I just fixed what seems to be the same problem. Check that the size and position are set in on_preview_shown and if it still doesn't work check your preview_file for image/*) and point it towards your on_preview_shown. You can debug it with loads of echos like how DLFW suggested.

from joshuto.

Related Issues (20)

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.