tut icon indicating copy to clipboard operation
tut copied to clipboard

Documentation request(?): How do users on Macs handle media?

Open jdkruzr opened this issue 2 years ago • 17 comments

By default, (M)edia, (A)vatar, (Y)ank appear to do nothing on Macs; is there some workaround here?

jdkruzr avatar Dec 05 '22 22:12 jdkruzr

Maybe I should make this more OS aware, but it should work if you edit your config.ini and set image-viewer=xdg-open to image-viewer=open instead.

RasmusLindroth avatar Dec 06 '22 08:12 RasmusLindroth

I have changed my config.ini file to use open, but it still is not working. Same for the other media types, too.

[media]
# Your image viewer.
# default=xdg-open
image-viewer=open

# Open the image viewer in the same terminal as toot. Only for terminal based
# viewers.
# default=false
image-terminal=false

# If images should open one by one e.g. "imv image.png" multiple times. If set
# to false all images will open at the same time like this "imv image1.png
# image2.png image3.png". Not all image viewers support this, so try it first.
# default=true
image-single=true

# If you want to open the images in reverse order. In some image viewers this
# will display the images in the "right" order.
# default=false
image-reverse=false

On Monterey 12.6.1 with a 2021 MBP

milofultz avatar Dec 07 '22 22:12 milofultz

@milofultz Just in case - were you attempting to open an image or copy something/open other media (video/audio)?

You'd need to replace the entries for video-viewer and audio-viewer as well. As for the copy/yank, I'm not sure how that would be done on MacOS


Edit: Also, when you exited tut, were there any error messages leftover in the terminal?

ryspace avatar Dec 09 '22 16:12 ryspace

Yeah, I changed the entry for each of those to open with no success. No errors in the terminal on exit either. I'll see if I can make one by changing stuff tho and report back

milofultz avatar Dec 11 '22 03:12 milofultz

Does open work outside of tut? "open test.png'

Unfortunately I don't own a Mac, so I can't test

RasmusLindroth avatar Dec 12 '22 20:12 RasmusLindroth

Yep, open works in the terminal normally. Is there a log or verbose mode I can run to see what messages are happening under the hood as I go?

milofultz avatar Dec 17 '22 16:12 milofultz

Does viewing media on mac work for you @elijahmanor?

RasmusLindroth avatar Dec 18 '22 19:12 RasmusLindroth

Yep, open works in the terminal normally. Is there a log or verbose mode I can run to see what messages are happening under the hood as I go?

I'll try and make a small program that you can test and search the web a bit to see if I can find a solution

RasmusLindroth avatar Dec 18 '22 19:12 RasmusLindroth

I made it work by adding a suffix to the filename, e.g. ".png" and not deleting the temp file. Tested on MacOS and WSL.

iucario avatar Dec 19 '22 03:12 iucario

Hey @iucario, could you elaborate a bit? I'd love to test this on my system to confirm.

milofultz avatar Dec 23 '22 19:12 milofultz

Hey @iucario, could you elaborate a bit? I'd love to test this on my system to confirm.

Sure. You can check my modification to the media.go: https://github.com/RasmusLindroth/tut/compare/master...iucario:tut:media

Be aware that the temp files are kept on the disk. I am creating a temp directory named tut and saving the files in there, so that I can clear the directory easily. Hope that helps.

iucario avatar Dec 24 '22 02:12 iucario

Confirming @iucario's fix works on my machine. I built from their media branch and ran it. On using Media and Avatar, the files are opening using a custom config that uses open instead of the default for all the -viewer options.

milofultz avatar Dec 29 '22 06:12 milofultz

I have now released a new version of tut (1.0.31) that adds extensions to the files. Does it fix the issue?

RasmusLindroth avatar Dec 29 '22 13:12 RasmusLindroth

Hmm, it does trigger the correct open invocation, but it says it can't find the file once it has been opened.

This is what I get when I open using Media Screen Shot 2023-01-02 at 11 12 10 AM

Sometimes when I open something, it's just an empty image.

Screen Shot 2023-01-02 at 11 13 48 AM

I'm going to try and diff @iucario's branch and this one and see if I can sleuth it out

milofultz avatar Jan 02 '23 19:01 milofultz

This is my config:

image-viewer="open -W -a Preview "
link-viewer="open -u "
video-viewer="open -W -a VLC "

AbeEstrada avatar Jan 02 '23 23:01 AbeEstrada

Aa, you must set the -W flag, because open doesn't wait for the application to exit. That will help me in my plan to make tut OS aware

RasmusLindroth avatar Jan 03 '23 13:01 RasmusLindroth

That works! ~~It's kind of funny if you open multiple media files you have to quit Preview for the next one to open, but minor problems. :)~~ I forgot about the image-single config flag! Thanks again!

milofultz avatar Jan 03 '23 19:01 milofultz