Code Monkey home page Code Monkey logo

spotify-control-rust's Introduction

spotify-control-rust

A simple CLI to control Spotify via D-bus

It was tested on Linux to control Spotify, but as it uses mpris crate behind the scenes, it could control any player that implements MPRIS.

Installation

$ sudo sh -c "curl https://github.com/welcoMattic/spotify-control-rust/releases/download/v0.1.0/spotify-control -L -o /usr/local/bin/spotify-control && chmod a+x /usr/local/bin/spotify-control"

Usage

Controls Spotify from CLI, retrieve current playing data

USAGE:
    spotify-control [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    help          Prints this message or the help of the given subcommand(s)
    next          send next command to Spotify
    pause         send pause command to Spotify
    play          send play command to Spotify
    play_pause    send play_pause command to Spotify
    previous      send previous command to Spotify
    status        fetch current playing metadata

Polybar

You can use spotify-control to control your Spotify, and display current song in Polybar.

Bar configuration

[bar/main]
modules-center = previous playpause next spotify

Modules configuration (adapt colors to your theme)

[module/previous]
type = custom/script
interval = 86400
format = "%{T3}<label>"
format-padding = 3
exec = echo ""
; Check if spotify is running before displaying the icon
exec-if = "pgrep spotify"
format-underline = #3EC13F
format-foreground = #99D1CE
format-background = #0A0F14
line-size = 1
click-left = "spotify-control previous"

[module/next]
type = custom/script
interval = 86400
format = "%{T3}<label>"
format-padding = 3
; Next song icon
exec = echo ""
; Check if spotify is running before displaying the icon
exec-if = "pgrep spotify"
format-underline = #3EC13F
format-foreground = #99D1CE
format-background = #0A0F14
line-size = 1
click-left = "spotify-control next"

[module/playpause]
type = custom/ipc
hook-0 = echo " "
hook-1 = echo ""
hook-2 = echo ""
initial = 1
format-padding = 4
format-underline = #3EC13F
format-foreground = #99D1CE
format-background = #0A0F14
line-size = 1
click-left = "spotify-control play_pause"

[module/spotify]
type = custom/ipc
hook-0 = echo ""
hook-1 = spotify-control status
initial = 1
format-padding = 3
format-underline = #3EC13F
format-foreground = #99D1CE
format-background = #0A0F14
line-size = 1
; [i3wm only] - Uncomment the below line to focus on Spotify when clicking on the song name (credits to https://github.com/Esya)
click-left = i3-msg '[class="Spotify"] focus'

Resources

Credits

I use the python version of dietervanhoof (https://github.com/dietervanhoof/polybar-spotify-controls) for years, but I wanted an easy-to-install version. Inspired by the C implementation by mihirlad55: https://github.com/mihirlad55/polybar-spotify-module

spotify-control-rust's People

Contributors

welcomattic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

spotify-control-rust's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.