You are not logged in.

#1 2016-02-05 20:40:17

timfayz
Member
From: Kazan, Russia
Registered: 2016-01-14
Posts: 59
Website

[SOLVED] How to make cmus as default music player in Thunar

Hello! Recently, I've started to use Arch and the most popular option here as the music player is cmus - so I've installed it! smile After I installed Thunar as my file manager and now I'm trying to configure it to open audio files using cmus. Please, could you help me to understand how to do it properly?

So after reading https://wiki.archlinux.org/index.php/de … plications and https://wiki.archlinux.org/index.php/Desktop_entries, I did the following:
Create .config/mimeapps.list

[Default Applications]
audio/mpeg=cmus.desktop;

Create .local/share/applications/cmus.desktop

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Display=true
Exec=cmus %f
Terminal=true
Name=cmus
Comment=Music player cmus

Then in Thunar I've added association cmus with mp3 track (the cmus successfully appeared in the list of applications), but after trying to open some tracks I always get the following error: "failed to execute child process xterm (no such file or directory)". What's wrong?

Last edited by timfayz (2016-02-06 09:34:50)

Offline

#2 2016-02-06 00:51:54

toz
Member
Registered: 2011-10-28
Posts: 513

Re: [SOLVED] How to make cmus as default music player in Thunar

Use cmus-remote instead of cmus:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Display=true
Exec=cmus-remote -f %f
Terminal=false
Name=cmus-remote
Comment=Music player cmus-remote control

More cmus-remote options at "man cmus-remote".

Offline

#3 2016-02-06 09:08:45

timfayz
Member
From: Kazan, Russia
Registered: 2016-01-14
Posts: 59
Website

Re: [SOLVED] How to make cmus as default music player in Thunar

Hm...Now there is no that error, but still it doesn't play(

EDIT: Good! Actually it plays, but only after I run the cmus itself. Hm.... It's ok? Can I make it run automatically in the different window?

Last edited by timfayz (2016-02-06 09:11:01)

Offline

#4 2016-02-06 09:14:10

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [SOLVED] How to make cmus as default music player in Thunar

timfayz wrote:

Hm...Now there is no that error, but still it doesn't play(

EDIT: Good! Actually it plays, but only after I run the cmus itself. Hm.... It's ok? Can I make it run automatically in the different window?

Which different window? Also note, cmus-remote does need cmus to be running.

Finally, please don't use cmus just because it is popular. Since you are trying to integrate it with a file manager, a GUI music player might be more suitable for you.

Offline

#5 2016-02-06 09:21:17

timfayz
Member
From: Kazan, Russia
Registered: 2016-01-14
Posts: 59
Website

Re: [SOLVED] How to make cmus as default music player in Thunar

x33a wrote:

Which different window? Also note, cmus-remote does need cmus to be running.
Finally, please don't use cmus just because it is popular. Since you are trying to integrate it with a file manager, a GUI music player might be more suitable for you.

I mean when track is running I want to see the player. Anyway I just want to understand how to do it. The first time I thought it will be quite simple, but actually it's awful! Damn mess with countless configuration files!:)

Offline

#6 2016-02-06 09:24:39

timfayz
Member
From: Kazan, Russia
Registered: 2016-01-14
Posts: 59
Website

Re: [SOLVED] How to make cmus as default music player in Thunar

So this is what I place to cmus.desktop:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Display=true
Exec=cmus-remote -f %f
Terminal=false
Name=cmus
Comment=Music player cmus-remote

If cmus isn't running Thunar plays nothing. If I run cmus in advance, it "catch" the track. What do I wrong?

Offline

#7 2016-02-06 09:30:41

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [SOLVED] How to make cmus as default music player in Thunar

You did nothing wrong. As I said, cmus-remote needs cmus to be running first.

So, first launch cmus, then use cmus-remote. As for bringing the cmus window to focus when playing the song, I don't think it is as simple to do. You can write a wrapper script which will first ensure that cmus is running, then load that song in cmus, then use something like xdotool to search for the cmus window and bring it to focus.

Easier option: Cmus has a file browser mode (press number 5 when inside cmus). Use that.

Even easier option: Use a GUI music player.

Offline

#8 2016-02-06 09:34:31

timfayz
Member
From: Kazan, Russia
Registered: 2016-01-14
Posts: 59
Website

Re: [SOLVED] How to make cmus as default music player in Thunar

x33a wrote:

Also note, cmus-remote does need cmus to be running.

Oh...my English! I thought you wrote "doesn't"! No there is no question. Thanks all!

Offline

#9 2016-02-06 10:04:36

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [SOLVED] How to make cmus as default music player in Thunar

@timfayz,

It would be great if you post which option you went with, so that other users with similar questions might be helped.

Offline

#10 2016-02-06 16:01:20

toz
Member
Registered: 2011-10-28
Posts: 513

Re: [SOLVED] How to make cmus as default music player in Thunar

Just to follow up with a solution that meets the OP's requirements, here is a desktop file that will play the file in cmus, starting cmus if it's not already running, and bringing the window to the front (requires wmctrl):

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Display=true
Exec=bash -c "(! pgrep cmus && xfce4-terminal -T cmus -x cmus); sleep 1 && cmus-remote -f %f; wmctrl -a cmus"
Terminal=false
Name=cmus-remote
Comment=Music player cmus-remote control
NoDisplay=true
Icon=cmus

Offline

#11 2016-02-07 14:21:35

timfayz
Member
From: Kazan, Russia
Registered: 2016-01-14
Posts: 59
Website

Re: [SOLVED] How to make cmus as default music player in Thunar

x33a wrote:

@timfayz,

It would be great if you post which option you went with, so that other users with similar questions might be helped.

The solution I stick with is the second post of @toz:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Display=true
Exec=cmus-remote -f %f
Terminal=false
Name=cmus-remote
Comment=Music player cmus-remote control

I just always keep open cmus in separate window, so that's all:)

Offline

Board footer

Powered by FluxBB