Display Music Player Song Title in the Panel

Help for MX Fluxbox
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
purplemoon
Posts: 41
Joined: Fri Apr 16, 2021 6:10 pm

Display Music Player Song Title in the Panel

#1 Post by purplemoon »

Hello Everyone!
I have finally managed to display properly the title of the song played in Clementine on the toolbar. So, if anyone is interested, here is the way I managed to do it. Note that there are probably better ways to do it.
First, I have simplified the "mediaplayer.py script to get rid of the Conky part and made a few modifications.

Code: Select all

#!/usr/bin/env python3
#
#  mediaplayer.py
#
#  Print the metadata of a mediaplayer on conky and control it
#  This can also be used as a stand-alone command line application
#
#  Author : Amish Naidu
#  I release this in the public domain, do with it what you want.

import dbus, argparse, subprocess

#Return a string containing time in HH:MM:SS format from microseconds
def fmt_time(microseconds):
    seconds = microseconds/1000000
    return '{:02}:{:02}:{:02}'.format(int(seconds//360), int((seconds%360)//60), int(seconds%60))

if __name__ == '__main__':

    parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description='''\
Connect to a media player through dbus to get the metadata or control it.
This can be used to output the current track playing (and it's attributes) on *conky*
%(prog)s can print the metadata of the track currently playing and
make the player perform an action
If the bus was not found, 'Not found' will be printed.
If any property is not found, 'Unknown' will be used/printed.
The 'player' must support MPRIS 2.0''',
epilog='''\
Examples of usage:

To display the Artist, Title and Album with Clementine
  $ python3 %(prog)s clementine -atm
To display the Artist, Title, Album and Genre but this time with ${alignr} between the field and it's value
  $ python3 %(prog)s vlc -atmg -r
Using the long form arguments with Audacious
  $ python3 %(prog)s audacious --album --artist --length
To switch track
  $ python3 %(prog)s amarok --action=next
  $ python3 %(prog)s clementine --action=play

Author: Amish Naidu (amhndu --at-- gmail)
Please report any bugs.
''')


    parser.add_argument('-i', '--running', action='store_true', help="print 'yes' if the 'player' is running, 'no' otherwise")
    parser.add_argument('player', action='store',
        help="name of the player e.g. 'clementine', or 'vlc' or 'audacious' or 'xmms2'")
    parser.add_argument('-r', '--conkyalignr', action='store_true', help='Add ${alignr} before values')
    parser.add_argument('-w', '--width', type=int,
            help="Truncate lines upto 'width' characters. No limit if less than zero (default)", default=-1)
    parser.add_argument('-t', '--title', action='store_true', help='title of the track')
    parser.add_argument('-a', '--artist', action='store_true', help='artist name')
    parser.add_argument('-m', '--album', action='store_true', help='album name')
    parser.add_argument('-g', '--genre', action='store_true', help='genre of the current track')
    parser.add_argument('-y', '--year', action='store_true', help='year of the track')
    parser.add_argument('-l', '--length', action='store_true', help='lenght of the track')
    parser.add_argument('-e', '--elapsed', action='store_true', help='elapsed time for the track')
    parser.add_argument('-p', '--progress', action='store_true',
        help='progress of the track as a percent (not formatted)')
    parser.add_argument('-n', '--track', action='store_true', help='track number')
    parser.add_argument('-c', '--cover',  help='Make a (soft) symlink at the specified location to the album art')
    parser.add_argument('--cover_default', help='If the the album art could not be found from the player, make a link to this')
    parser.add_argument('--action', action='store', help='make the player perform an action : next, prev, play, pause, volume up/down by 0.1',
            choices=['next', 'prev', 'pause', 'play', 'playpause', 'volup', 'voldown'])
    args = parser.parse_args()

    try:
        #MPRIS 2.0 Spec http://specifications.freedesktop.org/mpris-spec/latest/index.html
        player = dbus.SessionBus().get_object('org.mpris.MediaPlayer2.' + args.player, '/org/mpris/MediaPlayer2')
        metadata = player.Get('org.mpris.MediaPlayer2.Player', 'Metadata',
                dbus_interface='org.freedesktop.DBus.Properties')
        running = True
    except dbus.exceptions.DBusException:
        running = False

    if args.running:
        print("yes" if running else "no")
    if not running:
        print("")
    else:

        if args.artist:
            print(metadata['xesam:artist'][0] if 'xesam:artist' in metadata else 'Unknown Artist', end="")
        if args.title:
            print(" -", metadata['xesam:title'] if 'xesam:title' in metadata else 'Unknown Title')
        if args.album:
            print("(", metadata['xesam:album'] if 'xesam:album' in metadata else 'Unknown Album',")")
        if args.genre:
            print(metadata['xesam:genre'][0] if 'xesam:genre' in metadata else 'Unknown Genre')
        if args.year:
            print(metadata['xesam:contentCreated'][:4] if 'xesam:contentCreated' in metadata else 'Unknown')
        if args.track:
            print(metadata['xesam:trackNumber'] if 'xesam:trackNumber' in metadata else 'Unknown')


As I use Fbpanel, I added a "genmon" plugin to the panel to display the output of the modified python script. This should work with Tint2 as well or the Xfce panel or any panel? Just remember to use the correct path to your script and to make it executable.

Code: Select all

Plugin {
  type = genmon
  config {
#    Command = python3 mediaplayer.py audacious -at    
    Command = ~/.config/fbpanel/fbp_scripts/mediaplayer_short.py clementine -at
    CharLength = 100
    PollingTime = 5
    TextSize = medium
    TextColor = #e6e6e6
  }
}
For XFCE, simply add the following command to the generic monitor window settings:

Code: Select all

~/path/to/mediaplayer_short.py clementine -at
This should work with Clementine, Audacious, Vlc. Note that as in the original script, the "date" is displayed correctly only with VLC. I can't figure out how to fix this.

Here is the final result, between the desktop indicator and the systray on the right of the panel on fluxbox and xfce.
Image
Image
You do not have the required permissions to view the files attached to this post.

User avatar
CharlesV
Global Moderator
Posts: 7056
Joined: Sun Jul 07, 2019 5:11 pm

Re: Display Music Player Song Title in the Panel

#2 Post by CharlesV »

this is very cool. Thank you. I typically have the playing song listed in conky since my panels are all hidden, but this is nice.
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

User avatar
ceeslans
Posts: 811
Joined: Sun Apr 14, 2019 3:48 am

Re: Display Music Player Song Title in the Panel

#3 Post by ceeslans »

I wrote a ridiculously-simple script to run the audacious output in a tint2 panel.
The executor allows for toggling play/pause [leftcick], stop [rightclick] and scroll through the playlist [wheel up/down]. Middleclick will kill audacious - and the track info display alltogether.

aud-trackinfo

Code: Select all

 #!/bin/bash
#
# simple script to display Audacious' track titles in tint2 panel
# by @ceeslans - aug 2022
#================================================================

STATUS=$(audtool --playback-status)

CURRENT=$(audtool --current-song |cut -c1-65)
TITLE=$(audtool --current-song-tuple-data title |cut -c1-40)
ARTIST=$(audtool --current-song-tuple-data artist |cut -c1-30)
ALBUM=$(audtool --current-song-tuple-data album |cut -c1-40)

ELAPSED=$(audtool --current-song-output-length |cut -c1-8)
LENGTH=$(audtool --current-song-length |cut -c1-8)

if pidof audacious | grep [0-9] > /dev/null; then
	if [[ $STATUS = "playing" ]]; then
		#echo "♫  ${CURRENT} "
		#echo "♫  ${CURRENT}  [${ELAPSED} / ${LENGTH}] "		
		#echo "♫  ${ARTIST} - ${TITLE} "
		echo "♫  ${ARTIST} - ${TITLE}  [${ELAPSED} / ${LENGTH}] "
	elif [[ $STATUS = "paused" ]]; then
		#echo "♯  ${CURRENT} "
		#echo "♯  ${CURRENT}  [${ELAPSED} / ${LENGTH}] "		
		echo "♯  ${ARTIST} - ${TITLE} "
		#echo "♯  ${ARTIST} - ${TITLE}  [${ELAPSED} / ${LENGTH}] "
	elif [[ $STATUS = "stopped" ]]; then
			#echo "⊗ ${CURRENT} "
		echo "⊗ ${ARTIST} - ${TITLE} "
	fi
else
	echo ""
fi

### ▶ ⊗ ◉ ◼ ▣ ≡ ♩ ♪ ♬ ♫ ♭ ♮ ♯  dejavu fonts ### • ※ ⁙ ∎ ⊗ ⋇ ⏣ ■ ▣

# below example tint2 executor configuration allows mouse-click actions:
#   - lclick = toggle pause/play
#   - rclick = stop
#   - mclick = quit audacious (and executor's track display)
#   - uwheel = previous track
#   - dwheel = next track

#----------------------------------
### Executor - Audacious-track-info (example only - modify to your liking)
#----------------------------------
# execp = new
# execp_command = ~/.config/tint2/executors/aud-trackinfo
# execp_interval = 1
# execp_continuous = 1
# execp_has_icon = 0
# execp_cache_icon = 0
# execp_icon_w = 
# execp_icon_h = 
# execp_font = DejaVu Sans 10
# execp_font_color = #ffffff 90
# execp_markup = 0
# execp_background_id = 0
# execp_centered = 0
# execp_padding = 5 0 
# execp_lclick_command = audtool --playback-playpause
# execp_mclick_command = audtool --shutdown
# execp_rclick_command = audtool --playback-stop
# execp_uwheel_command = audtool --playlist-reverse
# execp_dwheel_command = audtool --playlist-advance 
Image
Sony Vaio VPCF23P (2011), Intel Core i7-2670, 6gb RAM, 240gb SSD, MX-Linux 23 based Fluxbox v/1.3.7+
Lenovo Thinkpad L560 (2016), Intel Core i5-6200, 16gb RAM, 240gb SSD, Devuan Daedalus based Fluxbox v/1.3.7+

User avatar
Jerry3904
Administrator
Posts: 23041
Joined: Wed Jul 19, 2006 6:13 am

Re: Display Music Player Song Title in the Panel

#4 Post by Jerry3904 »

Both very nice contributions, you two! Thanks.
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

purplemoon
Posts: 41
Joined: Fri Apr 16, 2021 6:10 pm

Re: Display Music Player Song Title in the Panel

#5 Post by purplemoon »

Here is a more simple version of the script. It only displays (but not limited to) 'artist' and 'track'. It should work on any panel (tested in FB and XFCE)

Code: Select all

#!/usr/bin/env python3

import dbus, subprocess

from tkinter import*
import os


def get_data():
    global song_data
    global running
    player_name = "clementine"
    
    try:
        player = dbus.SessionBus().get_object('org.mpris.MediaPlayer2.' + player_name, '/org/mpris/MediaPlayer2')
        metadata = player.Get('org.mpris.MediaPlayer2.Player', 'Metadata',
                        dbus_interface='org.freedesktop.DBus.Properties')
        running = True
    except dbus.exceptions.DBusException:
        running = False
        
    if not running:
        print("")

    if running:
        song_artist = metadata['xesam:artist'][0] if 'xesam:artist' in metadata else "Unknown"
        song_title = metadata['xesam:title'] if 'xesam:title' in metadata else 'Unknown'

        song_data = song_artist + " - " + song_title
        print(song_data)

get_data()

I also have added another script to the panel so that when listening to web radios, I can save songs titles (and later buy or add them to some playlist on YT for example). Keep in mind that THE FILE PATH (in the code) MUST BE EDITED to suit your needs (colors, player name and file path are provided by other files in the original script for a future global use).

Code: Select all

#!/usr/bin/env python3

import dbus, subprocess

from tkinter import*
#from tkinter import messagebox
import os

# Local data / scripts
#from theme import*
#from settings_data import*

# Theme & local variables
# matching Adwaita Dark theme
btn_bg = "#232729"
btn_fg = "#eeeeec"
btn_sel_bg = "#215d9c"
btn_sel_fg = "#ffffff"
btn_hilite_bg = "#eeeeec"
btn_hilite_tab = "#215d9c"

window_bg = "#33393b"
window_fg = "#eeeeec"

font_default="Sans 10"


# player name: clementine, vlc, audacious
player_name = "clementine"


def get_data():
    global song_data
    global running
    #player_name = "clementine"
    
    try:
        player = dbus.SessionBus().get_object('org.mpris.MediaPlayer2.' + player_name, '/org/mpris/MediaPlayer2')
        metadata = player.Get('org.mpris.MediaPlayer2.Player', 'Metadata',
                        dbus_interface='org.freedesktop.DBus.Properties')
        running = True
    except dbus.exceptions.DBusException:
        running = False
    if running:
        song_artist = metadata['xesam:artist'][0] if 'xesam:artist' in metadata else "Unknown"
        song_title = metadata['xesam:title'] if 'xesam:title' in metadata else 'Unknown'

        song_data = song_artist + " - " + song_title + "\n"
        print(song_data)

get_data()

##############################################################
# locate "wishlist.txt"
# PLEASE, EDIT THE FILE PATH FOR YOUR SYSTEM!!!
file_path = "/home/xxxx/Music/wishlist.txt"
#############################################################



def add_to_file():
    try:
        with open(file_path, "a") as file:
            file.write(song_data)
        
    except FileNotFoundError:
        print("File not found")
    
    top_label.config(text="The song has been added to your wishlist.")
    top_label.pack(fill='both', expand='True')
    song_label.destroy()
    add_btn.destroy()
    cancel_btn.config(text="Close")


if not running:
    
    msg_info = Tk()
    
    msg_info.title("Add Song to Wishlist")
    msg_info.geometry("400x100")
    msg_info.config(background=window_bg)
    
# Info label
    top_label = Label(msg_info,
                text="Clementine is not running!",
                bg=window_bg,
                fg=window_fg,
                font=font_default)
    top_label.pack(padx=10, pady=10)
    
# Cancel button
    cancel_btn = Button(msg_info,
                    text="Cancel",
                    bg=btn_bg,
                    fg=btn_fg,
                    font=font_default,
                    width='12',
                    bd=0,
                    activebackground=btn_sel_bg,
                    activeforeground=btn_sel_fg,
                    highlightbackground= btn_bg,
                    highlightcolor= btn_hilite_tab,
                    command=msg_info.quit)
    cancel_btn.pack(side='left',expand=1)
    
    
    msg_info.mainloop()
    
    
else:
    root = Tk()

    root.title("Add Song to Wishlist")
    root.geometry("600x200")
    root.resizable(width=False, height=False)
    root.config(background=window_bg)

    # Main Frame
    main_frame = Frame(root, bg=window_bg)
    main_frame.pack(fill=BOTH, expand='True')

    bottom_frame = Frame(root, bg=window_bg)
    bottom_frame.pack(fill='x', expand='True')


    top_label = Label(main_frame,
                    text="Add this song to your wishlist?",
                    bg=window_bg,
                    fg=window_fg,
                    font=font_default)
    top_label.pack(padx=10, pady=10)

    song_label = Label(main_frame,
                    text=song_data,
                    bg=window_bg,
                    fg=window_fg,
                    font=font_default,                    
                    )
    song_label.pack()

    add_btn = Button(main_frame,
                    text="Add",
                    bg=btn_bg,
                    fg=btn_fg,
                    font=font_default,
                    width='12',
                    bd=0,
                    activebackground=btn_sel_bg,
                    activeforeground=btn_sel_fg,
                    highlightbackground= btn_bg,
                    highlightcolor= btn_hilite_tab,
                    command=add_to_file)
    add_btn.pack(padx=10, pady=10)

    # Bottom button
    cancel_btn = Button(bottom_frame,
                    text="Cancel",
                    bg=btn_bg,
                    fg=btn_fg,
                    font=font_default,
                    width='12',
                    bd=0,
                    activebackground=btn_sel_bg,
                    activeforeground=btn_sel_fg,
                    highlightbackground= btn_bg,
                    highlightcolor= btn_hilite_tab,
                    command=root.quit)
    cancel_btn.pack(side='left',expand=1)

    root.mainloop()


.
Last edited by purplemoon on Tue Aug 27, 2024 12:58 am, edited 1 time in total.

User avatar
operadude
Posts: 842
Joined: Tue Nov 05, 2019 12:08 am

Re: Display Music Player Song Title in the Panel

#6 Post by operadude »

purplemoon wrote: Mon Aug 26, 2024 12:22 am Here is a more simple version of the script. It only displays (but not limited to) 'artist' and 'track'. It should work on any panel (tested in FB and XFCE)

Code: Select all

#!/usr/bin/env python3

import dbus, subprocess

from tkinter import*
import os


def get_data():
    global song_data
    global running
    player_name = "clementine"
    
    try:
        player = dbus.SessionBus().get_object('org.mpris.MediaPlayer2.' + player_name, '/org/mpris/MediaPlayer2')
        metadata = player.Get('org.mpris.MediaPlayer2.Player', 'Metadata',
                        dbus_interface='org.freedesktop.DBus.Properties')
        running = True
    except dbus.exceptions.DBusException:
        running = False
        
    if not running:
        print("")

    if running:
        song_artist = metadata['xesam:artist'][0] if 'xesam:artist' in metadata else "Unknown"
        song_title = metadata['xesam:title'] if 'xesam:title' in metadata else 'Unknown'

        song_data = song_artist + " - " + song_title
        print(song_data)

get_data()

I also have added another script to the panel so that when listening to web radios, I can save songs titles (and later buy or add them to some playlist on YT for example). Keep in mind that some parts of the code must be edited to suit your needs (colors, player name and file path are provided by other files in the original script for a future global use).

Code: Select all

#!/usr/bin/env python3

import dbus, subprocess

from tkinter import*
#from tkinter import messagebox
import os

# Local data / scripts
#from theme import*
#from settings_data import*

#########################################################
# PLEASE EDIT AND UNCUMMENT THIS SECTION TO YOUR LIKING
#########################################################
# Theme & local variables
#btn_bg = base_color
#btn_fg = window_fg
#btn_sel_bg = sel_bg
#btn_sel_fg = sel_fg
#btn_hilite_bg = window_fg
#btn_hilite_tab = sel_bg

# player name: clementine, vlc, audacious
player_name = "clementine"


def get_data():
    global song_data
    global running
    #player_name = "clementine"
    
    try:
        player = dbus.SessionBus().get_object('org.mpris.MediaPlayer2.' + player_name, '/org/mpris/MediaPlayer2')
        metadata = player.Get('org.mpris.MediaPlayer2.Player', 'Metadata',
                        dbus_interface='org.freedesktop.DBus.Properties')
        running = True
    except dbus.exceptions.DBusException:
        running = False
    if running:
        song_artist = metadata['xesam:artist'][0] if 'xesam:artist' in metadata else "Unknown"
        song_title = metadata['xesam:title'] if 'xesam:title' in metadata else 'Unknown'

        song_data = song_artist + " - " + song_title + "\n"
        print(song_data)

get_data()

##############################################################
# locate "wishlist.txt"
# PLEASE, EDIT THE FILE PATH FOR YOUR SYSTEM!!!
file_path = "/home/xxxx/Music/wishlist.txt"
#############################################################



def add_to_file():
    try:
        with open(file_path, "a") as file:
            file.write(song_data)
        
    except FileNotFoundError:
        print("File not found")
    
    top_label.config(text="The song has been added to your wishlist.")
    top_label.pack(fill='both', expand='True')
    song_label.destroy()
    add_btn.destroy()
    cancel_btn.config(text="Close")


if not running:
    
    msg_info = Tk()
    
    msg_info.title("Add Song to Wishlist")
    msg_info.geometry("400x100")
    msg_info.config(background=window_bg)
    
# Info label
    top_label = Label(msg_info,
                text="Clementine is not running!",
                bg=window_bg,
                fg=window_fg,
                font=font_default)
    top_label.pack(padx=10, pady=10)
    
# Cancel button
    cancel_btn = Button(msg_info,
                    text="Cancel",
                    bg=btn_bg,
                    fg=btn_fg,
                    font=font_default,
                    width='12',
                    bd=0,
                    activebackground=btn_sel_bg,
                    activeforeground=btn_sel_fg,
                    highlightbackground= btn_bg,
                    highlightcolor= btn_hilite_tab,
                    command=msg_info.quit)
    cancel_btn.pack(side='left',expand=1)
    
    
    msg_info.mainloop()
    
    
else:
    root = Tk()

    root.title("Add Song to Wishlist")
    root.geometry("600x200")
    root.resizable(width=False, height=False)
    root.config(background=window_bg)

    # Main Frame
    main_frame = Frame(root, bg=window_bg)
    main_frame.pack(fill=BOTH, expand='True')

    bottom_frame = Frame(root, bg=window_bg)
    bottom_frame.pack(fill='x', expand='True')


    top_label = Label(main_frame,
                    text="Add this song to your wishlist?",
                    bg=window_bg,
                    fg=window_fg,
                    font=font_default)
    top_label.pack(padx=10, pady=10)

    song_label = Label(main_frame,
                    text=song_data,
                    bg=window_bg,
                    fg=window_fg,
                    font=font_default,                    
                    )
    song_label.pack()

    add_btn = Button(main_frame,
                    text="Add",
                    bg=btn_bg,
                    fg=btn_fg,
                    font=font_default,
                    width='12',
                    bd=0,
                    activebackground=btn_sel_bg,
                    activeforeground=btn_sel_fg,
                    highlightbackground= btn_bg,
                    highlightcolor= btn_hilite_tab,
                    command=add_to_file)
    add_btn.pack(padx=10, pady=10)

    # Bottom button
    cancel_btn = Button(bottom_frame,
                    text="Cancel",
                    bg=btn_bg,
                    fg=btn_fg,
                    font=font_default,
                    width='12',
                    bd=0,
                    activebackground=btn_sel_bg,
                    activeforeground=btn_sel_fg,
                    highlightbackground= btn_bg,
                    highlightcolor= btn_hilite_tab,
                    command=root.quit)
    cancel_btn.pack(side='left',expand=1)

    root.mainloop()


.
Thanks so much for this, as I love to learn new Python scripts!

I have successfully run the first ("simple") script you mention:
Here is a more simple version of the script. It only displays (but not limited to) 'artist' and 'track'. It should work on any panel (tested in FB and XFCE):

Code: Select all

#!/usr/bin/env python3

import dbus, subprocess

from tkinter import*
import os


def get_data():
    global song_data
    global running
    player_name = "clementine"
    
    try:
        player = dbus.SessionBus().get_object('org.mpris.MediaPlayer2.' + player_name, '/org/mpris/MediaPlayer2')
        metadata = player.Get('org.mpris.MediaPlayer2.Player', 'Metadata',
                        dbus_interface='org.freedesktop.DBus.Properties')
        running = True
    except dbus.exceptions.DBusException:
        running = False
        
    if not running:
        print("")

    if running:
        song_artist = metadata['xesam:artist'][0] if 'xesam:artist' in metadata else "Unknown"
        song_title = metadata['xesam:title'] if 'xesam:title' in metadata else 'Unknown'

        song_data = song_artist + " - " + song_title
        print(song_data)

get_data()
However, when running this script, it only displays the (correct) output in a Terminal window.

I'm not sure what you mean by:
It should work on any panel (tested in FB and XFCE)
Where should this be showing-up, exactly?

I have a vertical panel, on the left-hand side of the screen/monitor, and nothing shows up there. It probably wouldn't help to show there, since the panel is quite narrow, and, like CharlesV, my panel is almost always hidden.

Should the track info be showing-up in my Conky?

As it is, when Clementine plays a track, there is a brief pop-up showing me the track info.
Is that what is meant by "my Conky"?
Sorry for the super-basic questions.

Maybe I need to somehow add this script to the panel?

Sorry if you already mentioned that and I missed that step :bagoverhead:

Any clarification(s) would be most welcome :cool:

purplemoon
Posts: 41
Joined: Fri Apr 16, 2021 6:10 pm

Re: Display Music Player Song Title in the Panel

#7 Post by purplemoon »

:exclamation: The second script (post #5) has been modified so that only the file path should be modified to your liking to be able to launch it successfully.


@ceeslans
As this script was originally intended for Fbpanel or Xfce panel, it only shows track info. As for (some of) the actions you mentioned, I added a menu (icon left of the track info on the panel screenshot) to perform them. Your script is more suited for Tint2, it is a better option. Nice theme by the way.
sc_wishlist_3.jpg
@CharlesV
When I used Conky, most of the time it was hidden behind opened windows, so it was not very useful, so I chose to display minimal info onto the panel instead.

@operadude
You are very welcome to ask any question. We all started as a beginner sometime.

The first script is a more simple version of the one in post #1. It displays the track info playing in Clementine (or Audacious or Vlc) onto the panel (tested on Tint2, Xfce panel, Fbpanel) via the applet that lets you show the output of a command ( --> screenshots in post #1). It is aimed at horizontal panels, or very, very large vertical ones. ;) You should get the same result as in the terminal.

The second script should be run via a launcher (custom panel button or keyboard shortcut). In the screenshots, the 3 dots after the track info on the right half of the panel. The panel size or position does not matter. When launched, it displays a window / dialog [1] that identifies the current track title ("artist - title") and allows you to save this data to a file of your choice for later use. If the selected music player is not opened [2], it just opens a message box. It is not linked to Conky (the original script "mediaplayer.py" that comes with one of the Conky themes does output to Conky).
[1]
sc_wishlist_1.jpg
[2]
sc_wishlist_2.jpg
I hope this helps. I you need more info, do not hesitate to ask.
You do not have the required permissions to view the files attached to this post.
Last edited by purplemoon on Tue Sep 03, 2024 7:58 pm, edited 1 time in total.

User avatar
operadude
Posts: 842
Joined: Tue Nov 05, 2019 12:08 am

Re: Display Music Player Song Title in the Panel

#8 Post by operadude »

@purplemoon Fantastic :exclamation:

Thanks so much :happy:

Do you have any recommendations about where I can learn more about "dbus"?

I see this, which seems quite informative:

https://dbus.freedesktop.org/doc/dbus- ... rial.html

What do you think?
Is this a good place to start?

:crossfingers:

purplemoon
Posts: 41
Joined: Fri Apr 16, 2021 6:10 pm

Re: Display Music Player Song Title in the Panel

#9 Post by purplemoon »

@operadude
I also would like to learn about dbus, but this seems to be another level. Maybe this tutorial https://rm5248.com/d-bus-tutorial/ would be a good place to start. Hope this will be helpful.

User avatar
operadude
Posts: 842
Joined: Tue Nov 05, 2019 12:08 am

Re: Display Music Player Song Title in the Panel

#10 Post by operadude »

@purplemoon :

YO! Sorry I am seeing this only now!

Thanks for the Link! Took a quick look, and I like what I see! Thanks!


😊

😉

Post Reply

Return to “MX Fluxbox Official Release”