<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=7489&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / Right-click extensions for file-managers to play music/video]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=7489</link>
		<description><![CDATA[The most recent posts in Right-click extensions for file-managers to play music/video.]]></description>
		<lastBuildDate>Sun, 26 Oct 2025 18:26:50 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Right-click extensions for file-managers to play music/video]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=58787#p58787</link>
			<description><![CDATA[<p>I&#039;m fond of right-click context menus, makes for an easy way to add some nice<br />functionality to file-managers. These are intended for PcmanFM but most FM&#039;s have<br />some mechanism for adding entries. For reference new .desktop entries for this<br />purpose go into ~/.local/share/file-manager/actions in PcmanFM. Both extensions<br />require ffmpeg, and the music one requires yad as well. Hopefully somebody might<br />find these useful, I like &#039;em a lot.</p><p>Play/Preview song: This one needs a script in addition to a .desktop in order to <br />provide the tiny gui which just gives the name of the file being played and an <br />exit button to stop. </p><p>playsong.desktop:</p><div class="codebox"><pre><code>[Desktop Entry]
Type=Action
Name=Play audio file
Comment=Play entire audio file
Icon=audio-speakers
Profiles=fullsong;

[X-Action-Profile fullsong]
Exec=playsong %f
MimeTypes=audio/aac;audio/ac3;audio/mp2;audio/mp3;audio/mp4;audio/mpeg;audio/ogg;audio/flac;audio/wav;audio/vorbis;audio/3gpp;audio/x-ape;audio/x-musepack;audio/x-wavpack;</code></pre></div><p>The playsong script, make it executable and put it in your $PATH:</p><div class="codebox"><pre class="vscroll"><code>#!/bin/bash

# Script to play a single song using ffplay.
# copyleft (c) greenjeans 2025
# Depends: yad, ffmpeg

# Check if file is provided
if [ -z &quot;$1&quot; ]; then
    echo &quot;Usage: $0 &lt;audio_file&gt;&quot;
    exit 1
fi

file=&quot;$1&quot;
filename=$(basename &quot;$file&quot;)

# Run ffplay in background
ffplay -nodisp -autoexit -loglevel quiet &quot;$file&quot; &amp;
ffplay_pid=$!

# If ffplay fails to start, show error and exit
if ! kill -0 $ffplay_pid 2&gt;/dev/null; then
    yad --title=&quot;Error&quot; --text=&quot;Failed to start playback for $filename.&quot; \
        --window-icon=error --borders=10 --fixed --width=300 --height=100
    exit 1
fi

# Run yad dialog in background
yad --title=&quot;Now Playing&quot; --text=&quot;Playing: $filename&quot; --window-icon=audio-speakers --borders=10 --text-align=center --width=350 --button=&quot;Exit:20&quot; --center &amp;
yad_pid=$!

# Trap to ensure cleanup on script exit
trap &#039;kill $ffplay_pid 2&gt;/dev/null; kill $yad_pid 2&gt;/dev/null; killall yad 2&gt;/dev/null; exit 0&#039; EXIT

# Monitor ffplay process
while kill -0 $ffplay_pid 2&gt;/dev/null; do
    # Check if yad is still running
    if ! kill -0 $yad_pid 2&gt;/dev/null; then
        # Yad closed (e.g., X button), kill ffplay and exit
        kill $ffplay_pid 2&gt;/dev/null
        exit 0
    fi
    sleep 0.5
done

# Ensure yad is closed when ffplay exits
kill $yad_pid 2&gt;/dev/null
killall yad 2&gt;/dev/null
exit 0</code></pre></div><p>For the video player all we need is a .desktop, the video will open and start<br />playing automatically. It will have standard min/max/close buttons in the titlebar,<br />but ffplay also has a number of hotkeys to control the video, esc or q to stop,<br />p for pause/play etc. Check the ffplay man page for a full list.</p><p>playvid.desktop:</p><div class="codebox"><pre><code>[Desktop Entry]
Type=Action
Name=Play video file
Comment=Play entire video file
Icon=emblem-multimedia
Profiles=fullvid;

[X-Action-Profile fullvid]
Exec=ffplay -autoexit -loglevel quiet %f
MimeTypes=video/mp4;video/mpeg;video/ogg;video/quicktime;video/webm;video/x-matroska;video/x-msvideo;video/3gpp</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (greenjeans)]]></author>
			<pubDate>Sun, 26 Oct 2025 18:26:50 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=58787#p58787</guid>
		</item>
	</channel>
</rss>
