Something went wrong. Try again.
dotfiles
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546#!/usr/bin/env ruby# encoding: utf-8
require_relative 'mpc'require_relative 'spotify'
PLAYER = [MPC.new, Spotify.new].find { |p| p.available }
exit unless PLAYER
if ARGV.first case ARGV.first when 'toggle' PLAYER.toggle when 'next' PLAYER.next when 'previous' PLAYER.previous else abort 'Invalid option' end exitend
ICONS = { playing: '', paused: '', stopped: '' }.freezeMODS = { repeat: '', random: '', single: '', consume: '' }.freeze
def copy(s) require 'open3' Open3.popen2('xclip -sel c') { |i, o, w| i << s }end
case ENV['BLOCK_BUTTON'].to_iwhen 2 copy PLAYER.longwhen 3 copy PLAYER.fileend
mods = [:repeat, :random, :single, :consume].map { |m| MODS[m] if PLAYER[m] }.compact.join(' ')
print "#{ICONS[PLAYER.status]} #{PLAYER}"print " #{mods}" if mods.size > 0puts "\n#{ICONS[PLAYER.status]} #{PLAYER.short}"puts '#a0a0a0' if PLAYER.status == :paused