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

video & images at cli (not in an X terminal) #4479

Closed
mc-butler opened this issue Jun 26, 2023 · 18 comments
Closed

video & images at cli (not in an X terminal) #4479

mc-butler opened this issue Jun 26, 2023 · 18 comments
Assignees
Labels
area: core Issues not related to a specific subsystem prio: low Minor problem or easily worked around
Milestone

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/4479
Reporter glennmcc (glennmcc@….org)

pressing 'enter' on a video or image file does not play or view the file when outside of X but rather at a cli

In the older versions of mc (circa 2010 and before) it worked just fine.

In the newer versions of mc it only works when inside of X running mc within a terminal window.

My currently installed version is 4.8.29

Note

Original attachments:

@mc-butler
Copy link
Author

Changed by glennmcc (glennmcc@….org) on Aug 29, 2024 at 3:09 UTC (comment 1)

Both of these now work perfectly both at the cli and inside of X

@mc-butler
Copy link
Author

Changed by glennmcc (glennmcc@….org) on Aug 29, 2024 at 5:56 UTC (comment 2)

Same problem was happening with sound.sh

xdg-open works OK inside of X but not at the cli outside of X

At the cli, xdg-open is treating the file linked to within mc
just as-if it were a URL and hence sends it to the links or lynx web browser.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Aug 29, 2024 at 6:02 UTC (comment 3)

9	if [ -n "$DISPLAY" ]; then
10	([ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open")
11	fi

Code in the parenthesis is run in the child shell and has no effect in the current one.

$ A=aaa
$ echo $A
aaa
$ (A=bbb)
$ echo $A
aaa
$ A=bbb 
$ echo $A
bbb

@mc-butler
Copy link
Author

Changed by glennmcc (glennmcc@….org) on Aug 29, 2024 at 6:21 UTC (comment 4)

Unless that code is either commented-out all together
or simply only run when inside of X
the result is as I said... the file is sent to links or lynx
instead of to mplayer, or fim

xdg-open simply does not work correctly when running mc completely outside of X

It does work fine running mc in a terminal window _inside_ of X

So, do I simply need to remove the parenthesis from that line ?

@mc-butler
Copy link
Author

Changed by glennmcc (glennmcc@….org) on Aug 29, 2024 at 7:01 UTC (comment 5)

Yep, that fixed it.

With the parenthesis inside of X mplayer was being used even though
xine was set as the default app for mp4 files.

Removed the parenthesis and now xine is used.

And since xdg-open is not coming into play at the cli outside of X
everything works as it should and images, videos and sound files
all get opened with the correct programs and are no-longer getting sent to links or lynx.

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Aug 29, 2024 at 7:38 UTC

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Aug 29, 2024 at 7:38 UTC (comment 6)

Reporter: can you test? Andrew: OK?

@mc-butler
Copy link
Author

Changed by glennmcc (glennmcc@….org) on Aug 29, 2024 at 10:57 UTC (comment 6.7)

Replying to zaytsev:

Reporter: can you test? Andrew: OK?

Line #9 does not work but rather results only in...

/usr/libexec/mc/ext.d/image.sh: line 9: [: -n: binary operator expected

Attempting to compress it all onto one line did not work correctly
and xdg-open was still getting used at the cli outside of X

My original lines 9, 10 & 11 work correctly after removing the parenthesis.

In addition, the " && sleep 10" is needed otherwise the message will not be seen until mc is exited.

echo "Please install either fim or fbi to view this file" && sleep 10

@mc-butler
Copy link
Author

Changed by glennmcc (glennmcc@….org) on Sep 4, 2024 at 18:46 UTC

@mc-butler
Copy link
Author

Changed by glennmcc (glennmcc@….org) on Sep 4, 2024 at 18:47 UTC

@mc-butler
Copy link
Author

Changed by glennmcc (glennmcc@….org) on Sep 4, 2024 at 18:47 UTC

@mc-butler
Copy link
Author

Changed by glennmcc (glennmcc@….org) on Sep 4, 2024 at 18:50 UTC (comment 8)

All 3 scripts without parenthesis have been working perfectly for me for a week so have now been re-uploaded to here.

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Sep 10, 2024 at 8:05 UTC (comment 9)

  • Priority changed from major to minor
  • Status changed from new to accepted
  • Milestone changed from Future Releases to 4.8.33
  • Owner set to zaytsev
  • Branch state changed from no branch to on review

Branch: 4479_console_players
Initial [572312b]

  • Added the blocks to suppress the use of xdg-open to image, audio and video scripts.
  • Added console image viewers.
  • Removed error messages with sleep.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 11, 2024 at 5:31 UTC (comment 10)

Why not use built-in command which is POSIX compatible:
How can I check if a program exists from a Bash script?

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Sep 11, 2024 at 6:47 UTC (comment 11)

Well, I didn't know about it. Thank you for the pointer, looks like a good idea. I have just replaced all occurrences that I could find.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 11, 2024 at 14:25 UTC (comment 12)

  • Branch state changed from on review to approved
  • Votes set to andrew_b

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Sep 18, 2024 at 16:30 UTC (comment 13)

  • Status changed from accepted to testing
  • Resolution set to fixed
  • Branch state changed from approved to merged
  • Votes changed from andrew_b to committed-master

Merged to master: [9e06a50]

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Sep 25, 2024 at 7:00 UTC (comment 14)

  • Status changed from testing to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues not related to a specific subsystem prio: low Minor problem or easily worked around
Development

No branches or pull requests

2 participants