Skip to content

Commit

Permalink
Merge pull request #144 from knowledgejunkie/mediaplayer-playerctl
Browse files Browse the repository at this point in the history
mediaplayer: use playerctl when no instance is specified
  • Loading branch information
denisse-dev authored Oct 22, 2021
2 parents 6e4ed9d + 0d35705 commit 352d75a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions mediaplayer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ use MPRIS DBus Interface Specification

mpd is supported through mpc (music player client).

For MPRIS support you need to have playerctl binary in your path.
For MPRIS support you need to have the playerctl binary in your path.
See: https://github.com/acrisci/playerctl

If you leave the instance empty it will try to find an
active player used on it's own.
If you leave the instance empty playerctl will try to find an
active MPRIS-compatible player on its own.

# Installation

Expand Down
10 changes: 6 additions & 4 deletions mediaplayer/mediaplayer
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# Requires playerctl binary to be in your path (except cmus)
# See: https://github.com/acrisci/playerctl
# For all media players except mpd/cmus/rhythmbox, MPRIS support should be
# enabled and the playerctl binary should be in your path.
# See https://github.com/acrisci/playerctl

# Set instance=NAME in the i3blocks configuration to specify a music player
# (playerctl will attempt to connect to org.mpris.MediaPlayer2.[NAME] on your
# DBus session).
# DBus session). If instance is empty, playerctl will connect to the first
# supported media player it finds.

use Time::HiRes qw(usleep);
use Env qw(BLOCK_INSTANCE);
Expand Down Expand Up @@ -141,7 +143,7 @@ sub rhythmbox {
print($data);
}

if ($player_arg eq '' or $player_arg =~ /mpd/) {
if ($player_arg =~ /mpd/) {
mpd;
}
elsif ($player_arg =~ /cmus/) {
Expand Down

0 comments on commit 352d75a

Please sign in to comment.