All Projects → d093w1z → polybar-now-playing

d093w1z / polybar-now-playing

Licence: other
Script for polybar to display and control media(not only Spotify) using DBus.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to polybar-now-playing

dotfiles
A collection of dotfiles for i3, polybar and more.
Stars: ✭ 25 (-26.47%)
Mutual labels:  i3, i3wm, polybar
i3wm-config
i3wm config files. Updated config files are in the repository below.
Stars: ✭ 13 (-61.76%)
Mutual labels:  i3, i3wm, polybar
hax
Zero-config Hacky Hackpecker setup
Stars: ✭ 16 (-52.94%)
Mutual labels:  i3, i3wm, polybar
dotfiles
collection (and a backup) of my config files
Stars: ✭ 49 (+44.12%)
Mutual labels:  i3, i3wm, polybar
dotfiles
My dotfiles
Stars: ✭ 16 (-52.94%)
Mutual labels:  i3, i3wm, polybar
I3 Polybar Config
My i3 configuration with polybar for HiDPI screen (4k)
Stars: ✭ 84 (+147.06%)
Mutual labels:  spotify, i3, i3wm
dotfiles
A total nord dotfiles used by me. Forever work in progress.
Stars: ✭ 35 (+2.94%)
Mutual labels:  i3, i3wm, polybar
i3-dstatus
Another great statusline generator for i3wm
Stars: ✭ 35 (+2.94%)
Mutual labels:  i3, i3wm
yet-another-spotify-lyrics
Command Line Spotify Lyrics with Album Cover
Stars: ✭ 78 (+129.41%)
Mutual labels:  spotify, i3wm
dotfiles
A place to store config files so I can revert when my entire system crashes from entering the wrong character
Stars: ✭ 25 (-26.47%)
Mutual labels:  i3, polybar
swayinfo
Some goodies for use in Sway and i3 wm
Stars: ✭ 30 (-11.76%)
Mutual labels:  i3, i3wm
dotfiles
My dotfiles, with an out-of-date install-script. Arch, Tiling WM (i3, sway), ZSH, Neovim
Stars: ✭ 20 (-41.18%)
Mutual labels:  i3, i3wm
Dotfiles
🍙 Personal dotfiles repository.
Stars: ✭ 148 (+335.29%)
Mutual labels:  i3wm, polybar
dotfiles
📦 Configuration files for my Arch/KDE/i3-gaps system
Stars: ✭ 41 (+20.59%)
Mutual labels:  i3wm, polybar
polytiramisu
Simple notifications from tiramisu in polybar
Stars: ✭ 31 (-8.82%)
Mutual labels:  polybar, polybar-scripts
i3
Archivos de configuraciones de i3
Stars: ✭ 32 (-5.88%)
Mutual labels:  i3, i3wm
i3blocks-crypto
💵 View your favorite coins' ticker prices with i3blocks.
Stars: ✭ 30 (-11.76%)
Mutual labels:  i3, i3wm
i3-wm-gruvbox-theme
An i3-wm gruvbox theme implementation
Stars: ✭ 229 (+573.53%)
Mutual labels:  i3, i3wm
sway-alttab
Simple Alt-Tab daemon for SwayWM/i3. Switches back to previous focused window on Alt-Tab or SIGUSR1
Stars: ✭ 36 (+5.88%)
Mutual labels:  i3, i3wm
kitti3
Kitty drop-down service for sway & i3wm
Stars: ✭ 73 (+114.71%)
Mutual labels:  i3, i3wm

polybar-now-playing

Script for polybar to display and control media(not only Spotify) using DBus

Python script to display and control current playing media. Includes a way to switch between players. Scrolling text used for metadata(title, artist, album, etc.) and playback button based on spotify-polybar and zscroll.

Demo:

demo

demo

screenshot

Dependencies

Setup & Configuration

  • This script requires a monospace font to work as expected, so adding a monospace font to your polybar config is adviced. After adding the font, update the index in polybar-now-playing file where indicated. Font indices are 1-based so be careful, refer polybar:Fonts.
  • Format of playing track/media details by default is "title - artist". It can be changed by specifying respective field names in metadata_fields list. For more details/ field names, refer mpris sepecification.
# Config options

# (int) : Length of media info string. If length of string exceedes this value,
# the text will scroll. Default value is 20.
message_display_len = 20

# (int) : Font index of polybar. this value should be 1 more than the font
# value specified in polybar config.
font_index = <font index defined in polybar config> + 1


# (float) : Update speed of the text in seconds. Default value 0.3.
update_delay = 0.3

# (list) : list of chars containing previous, play, pause, next glyphs
# for media controls in respective order.
# example:
control_chars = ['','','','']

# (dict) : dict of char icons to display as prefix.
# If player name is available as key, then use the corressponding icon,
# else default.
# example:
display_player_prefix = {
    "spotify":  '',
    "firefox":  '',
    "default":  ''
}

# (list) : list of metadata fields based on mpris sepecification.
metadata_fields = ["xesam:title", "xesam:artist"]

# (char) : separator for metadata fields
metadata_separator = "-"
  • After setting the options, add the following to your polybar config.
[module/now-playing]
type = custom/script
tail = true
;format-prefix = ""
format = <label>
exec = <path/to/script>
click-right = "kill -USR1 $(pgrep --oldest --parent %pid%)"

Warning:

In the click-right field of polybar config, for some setups the given line does not work(#2). It works only when polybar runs custom script exec fields as subprocesses using sh, not if it runs them directly(Refer to this for more info(see the Note): Config#examples). You can make it work by using the following line:

click-right = "kill -USR1 %pid%"

Useful notes:

This project was meant as a quick fix, rather than a permanent solution. As this is a Python script, it requires some time to execute. I wouldn't call it a fast solution but it's speed of execution depends on the hardware and software setup of the indivudual. If in future this is ported to C/C++ then the performance can be improved drastically.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].