sweetbbak / catnip

An Image picker using pure bash (C and Go version in the works) and kittys icat and Chafa's Sixel protocol. Pick and copy an image, or set it as your background using Feh, Swww, Hyprpaper etc... WIP PR's welcome especially on C implementations
25 stars 2 forks source link

Just a question or two so I can get catnip working on my OpenBSD system. #2

Open anoduck opened 1 year ago

anoduck commented 1 year ago

@sweetbbak Working on getting catnip working on OpenBSD for Kitty terminal. Just a few questions...

  1. If cn is the script in it's entirety, then what is catnip?
  2. Stupid Question: Is the bash dir needed at all to run cn?
  3. Another Stupid Question: Y or N, all the other dirs are for renditions of catnip in various languages?

Just FYI: As would be expected with OpenBSD and more than likely FreeBSD as well, head is not gnu head. So, unless installed and aliased, the -C flag is a no go. No biggie, almost expected.

sweetbbak commented 1 year ago

Hey! "catnip" is my current attempt at re-writing the project. I ended up moving really fast at the beginning and things became disorganized. I wanted to optimize the script and make it handle edge cases better.

The bash directory is where I put all of my old testing versions and earlier prototypes, so none of it is needed. If you look at one of the older scripts, its a lot more simple but essentially still does the same thing. It is not needed at all though.

The other directories are all me trying to rewrite it in a compiled language so that it would be faster. But I kept running into problems with lower level IO and terminal functionality.

just the script "cn" should be enough use it. Im thinking about trying to make it work better with sixel and other systems. Its just a little harder since I don't have Mac or BSD. Luckily "head" isn't really doing anything critical so I can just remove it. I meant to do it anyway since its pointless other than it makes it look cool lol

I've been spending a lot of time trying to make something similar over here as well: https://github.com/sweetbbak/fzf-img - this one is in Go and takes a newline separated list of images.

What happens when you run "cn ~/Pictures" (or another directory with images as an argument)?

anoduck commented 1 year ago

@sweetbbak

  1. First, because for some reason my brain is not functioning at this moment, we have cn without any compensation for gnu head. I got a little distracted when I went to record this, so forgive me. Life is stressful, and my brain is tired.

asciicast

  1. Second, we have cn where every instance of head has been replaced with ghead. Ghead being gnu head as it is installed on OpenBSD.

asciicast

I was going to run cn in the bash debugger to see what is preventing it from jiving with my sys.

sweetbbak commented 1 year ago

Can you do me a favor and try the testing version?

curl -sL https://raw.githubusercontent.com/sweetbbak/catnip/main/catnip > catnip && chmod +x catnip
./catnip
anoduck commented 10 months ago

@sweetbbak the error is occurring on line 131 calling the redraw. Is this referring to a function or a command? As there is no redraw command on either the kali linux nor the openbsd system.

sweetbbak commented 10 months ago

Its an internal command. Its kind of late here, so I'll check it out tomorrow. Maybe I'll try it out in a VM. I tried to compile a binary for freebsd and openbsd from the golang version of catnip but it complained about the "term" and "unix" packages "github.com/pkg/term" "golang.org/x/sys/unix" so Im going to have to figure out why that is and what the differences are.

There are a couple of things I need to fix after some changes to icat. Sorry about that, Ive been slacking on it lately... mostly because fzf can finally show images again

like this:

fd . ~/Pictures -e png | fzf --preview='kitty icat --clear --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {}' 

but I'll try to fix it tomorrow and get the bash version to a good/portable state, then I'll probably continue with the Golang version since its far easier to handle some of the major issues.

anoduck commented 10 months ago

The choice is yours. There is no urgency in the matter, everything is good here. If you rather maintain the course of finishing the go version, that works. Go works on OpenBSD too, and I am a pretty flexible dude. It is whatever you want to do. After all, it did take me two months to get back to you. So, no worries.

@sweetbbak If you haven't opened up an issue in your own repository for the go version of catnip, do so, include the error output, and mention my username. I will see if I can help in anyway or get someone else's attention to help.

The experienced error does sound familiar, but I haven't experienced it lately. Just make sure that you install OpenBSD from a snapshot and install go from OpenBSD packages via doas pkg_add -U go go-tools. This will give you the most recent fixes, libraries, and package releases. OpenBSD snapshots are more stable and matured than Debian snapshots and Debian current release for that matter. You also might have to use sudo or doas to build the go packages.