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

Images are pixelated #50

Open
rodude123 opened this issue Sep 6, 2023 · 5 comments
Open

Images are pixelated #50

rodude123 opened this issue Sep 6, 2023 · 5 comments

Comments

@rodude123
Copy link

I'm using lunarvim and I have enabled this but images are pixelated in kitty.
image
I can share my wholej config if you'd like

lvim.builtin.telescope.on_config_done = function(telescope)
  pcall(telescope.load_extension, "media_files")
end
local previewers = require("telescope.previewers")

lvim.builtin.telescope.register_previewer = function(telescope)


    local new_maker = function(filepath, bufnr, opts)
      opts = opts or {}

      filepath = vim.fn.expand(filepath)
      job_id = vim.loop.spawn('kitty', {
        args = {'+kitten', 'icat', '--place', opts.x..'%', opts.y..'%', '--silent', filepath},
        detached = true
      }, function(code)
        -- command finished
      end)

      return bufnr
    end

    local get_command = function(filepath)
        return {
          "kitty",
          "+kitten", 
          "icat",
          "--silent",
          "--sacle",
          filepath
        }
    end


    telescope.extensions.media_files.previewer = previewers.new_termopen_previewer({
        get_bufnr = new_maker,
        get_command = get_command
    })

end

lvim.builtin.telescope.on_config_done = function(telescope)
  -- telescope.setup {
  --   defaults = {
  --       file_previewer = require('telescope.previewers').vim_buffer_cat.new,
  --   },  
    -- extensions = {
    --   media_files = {
    --     filetypes = {"png", "jpg", "mp4", "pdf", "gif"},
    --     file_previewer = require('telescope.previewers').ueberzug_maker({
    --         display_method = 'kitty'
    --     }),
    --     find_cmd = "fd"
    --   }
    -- }
  -- }
    local previewers = require('telescope.previewers')
    local new_maker = function(filepath, bufnr, opts)
      opts = opts or {}

      filepath = vim.fn.expand(filepath)
      job_id = vim.loop.spawn('kitty', {
        args = {'+kitten', 'icat', '--place', opts.x..'%', opts.y..'%', '--silent', filepath},
        detached = true
      }, function(code)
        -- command finished
      end)

      return bufnr
    end

    local get_command = function(filepath)
        return {
          "kitty",
          "+kitten", 
          "icat",
          "--silent",
          "--sacle",
          filepath
        }
    end

    telescope.setup {
      defaults = {
        file_previewer = require('telescope.previewers').vim_buffer_cat.new,

        media_files = {
          file_previewer = previewers.new_termopen_previewer({
            get_bufnr = new_maker,
            get_command = get_command
          })
        }
      },
        extensions = {
          media_files = {
            filetypes = {"png", "jpg", "mp4", "pdf", "gif"},
            find_cmd = "fd"
          }
        }
    }
    telescope.extensions.media_files.use_ueberzug = false
    telescope.extensions.media_files.previewer = previewers.new_termopen_previewer({
        get_bufnr = new_maker,
        get_command = get_command
    })
    telescope.load_extension("media_files") 
end
@rodude123
Copy link
Author

That's what I tried but same thing

@stove-jeebs
Copy link

stove-jeebs commented Sep 16, 2023

duplicate of #46 I still haven't found a fix....

@kamack38
Copy link

kamack38 commented Dec 12, 2023

Looking at the chafa website, it seems to me that this is expected behaviour.

EDIT:
Actually, when running the chafa command inside kitty terminal, images show up normally.

@jchilders
Copy link

This Neovim issue appears related: :term should forward unknown sequences to host

@rodhash
Copy link

rodhash commented Mar 2, 2024

all solutions I tried so far has this same issue of pixelated images, except for yazi that I found out recently.. from my long list of tested alternatives was the first one looking good under tmux

Hope we can have this fixed for telescope extensions .. would be really nice

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

5 participants