Skip to content

Commit 10c24db

Browse files
committed
Refactor README
1 parent 2fefeea commit 10c24db

File tree

1 file changed

+73
-67
lines changed

1 file changed

+73
-67
lines changed

README.md

Lines changed: 73 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# waybar-mediaplayer
2+
> __
3+
## Introduction
24

35
This is a mediaplayer for [waybar](https://github.com/Alexays/Waybar).
46

@@ -26,94 +28,98 @@ It features:
2628
5. Optional notification on song change
2729
6. Click to play/pause, scroll up/down to scroll up/down on the playlist
2830

29-
# Requirements
31+
## Requirements
3032

31-
`playerctl` must be installed.
33+
[playerctl](https://github.com/altdesktop/playerctl) must be installed.
3234

3335
The default configuration use Nerd Fonts, so it requires waybar to use a Nerd Font.
3436

35-
The default configuration use `feh` to open the album art image.
37+
The default configuration use [feh](https://github.com/derf/feh) to open the album art image.
3638

37-
# Install
39+
## Install
3840

39-
Create a virtual environment within which to run waybar. For example, using pyenv this would be:
40-
```
41-
pyenv virtualenv 3.12.0 waybar
42-
pyenv activate waybar
43-
```
41+
1. Create a virtual environment within which to run waybar. For example, using pyenv this would be:
4442

45-
You can create a wrapper script to run waybar inside this virtual environment. For example, always using pyenv:
46-
```
47-
#!/usr/bin/env bash
48-
. ~/.pyenv/versions/waybar/bin/activate
49-
waybar
50-
```
43+
```
44+
pyenv virtualenv 3.12.0 waybar
45+
pyenv activate waybar
46+
```
5147
52-
Run:
48+
1. Create a wrapper script to run waybar inside this virtual environment.
5349
54-
```
55-
git clone https://github.com/raffaem/waybar-mediaplayer "$HOME/.config/waybar/waybar-mediaplayer"
56-
cd "$HOME/.config/waybar/waybar-mediaplayer"
57-
```
50+
For example, always using pyenv, create the file `start_waybar` and put it in your PATH:
51+
```
52+
#!/usr/bin/env bash
53+
. ~/.pyenv/versions/waybar/bin/activate
54+
waybar
55+
```
5856
59-
Install the required python packages inside your virtual environment:
60-
```
61-
pip3 install -r requirements.txt
62-
```
57+
1. Clone this repo:
6358
64-
You need to find the name of your player. To do so, run `playerctl --list-all` while your player is running.
59+
```
60+
git clone https://github.com/raffaem/waybar-mediaplayer "$HOME/.config/waybar/waybar-mediaplayer"
61+
cd "$HOME/.config/waybar/waybar-mediaplayer"
62+
```
6563
66-
Open `"$HOME/.config/waybar/waybar-mediaplayer/src/config.json` and change `player_name` with the name of your player.
64+
1. Install the required python packages inside your virtual environment:
6765
68-
Put the following in `$HOME/.config/waybar/config`:
66+
```
67+
pip3 install -r requirements.txt
68+
```
6969
70-
```
71-
"modules-left": ["image", "custom/mediaplayer"],
72-
```
70+
1. You need to find the name of your player. To do so, run `playerctl --list-all` while your player is running.
7371
74-
```
75-
"image": {
76-
"path": "/tmp/waybar-mediaplayer-art",
77-
"size": 32,
78-
"signal": 4,
79-
"on-click": "feh --auto-zoom --borderless --title 'feh-float' /tmp/waybar-mediaplayer-art"
80-
},
81-
82-
"custom/mediaplayer": {
83-
"exec": "$HOME/.config/waybar/waybar-mediaplayer/src/mediaplayer monitor",
84-
"return-type": "json",
85-
"format": "{}",
86-
"on-click": "$HOME/.config/waybar/waybar-mediaplayer/src/mediaplayer play-pause",
87-
"on-scroll-up": "$HOME/.config/waybar/waybar-mediaplayer/src/mediaplayer next",
88-
"on-scroll-down": "$HOME/.config/waybar/waybar-mediaplayer/src/mediaplayer previous",
89-
"min-length": 20,
90-
"max-length": 20
91-
},
92-
```
72+
1. Open `"$HOME/.config/waybar/waybar-mediaplayer/src/config.json` and change `player_name` with the name of your player.
9373
94-
Put the following in `$HOME/.config/waybar/style.css`:
74+
1. Put the following in `$HOME/.config/waybar/config`:
9575
96-
```
97-
#custom-mediaplayer
98-
{
99-
font-size: 16px;
100-
border-radius: 2%;
101-
}
102-
@import "./waybar-mediaplayer/src/style.css";
103-
```
76+
```
77+
"modules-left": ["image", "custom/mediaplayer"],
78+
```
79+
80+
```
81+
"image": {
82+
"path": "/tmp/waybar-mediaplayer-art",
83+
"size": 32,
84+
"signal": 4,
85+
"on-click": "feh --auto-zoom --borderless --title 'feh-float' /tmp/waybar-mediaplayer-art"
86+
},
87+
88+
"custom/mediaplayer": {
89+
"exec": "$HOME/.config/waybar/waybar-mediaplayer/src/mediaplayer monitor",
90+
"return-type": "json",
91+
"format": "{}",
92+
"on-click": "$HOME/.config/waybar/waybar-mediaplayer/src/mediaplayer play-pause",
93+
"on-scroll-up": "$HOME/.config/waybar/waybar-mediaplayer/src/mediaplayer next",
94+
"on-scroll-down": "$HOME/.config/waybar/waybar-mediaplayer/src/mediaplayer previous",
95+
"min-length": 20,
96+
"max-length": 20
97+
},
98+
```
99+
100+
Put the following in `$HOME/.config/waybar/style.css`:
101+
102+
```
103+
#custom-mediaplayer
104+
{
105+
font-size: 16px;
106+
border-radius: 2%;
107+
}
108+
@import "./waybar-mediaplayer/src/style.css";
109+
```
104110
105-
Restart waybar.
111+
1. Start waybar using the wrapper script `start_waybar`.
106112
107113
The mediaplayer should work. Click on the progress bar to start/stop playing, and scroll on it to change song.
108114
109-
# Update
115+
## Update
110116
111117
```
112118
cd "$HOME/.config/waybar/waybar-mediaplayer"
113119
git pull
114120
```
115121
116-
# Personalization
122+
## Personalization
117123
118124
To disable notifications, put `is_notification=false` in `config.json`.
119125
@@ -123,29 +129,29 @@ In order for the album art to automatically update on song change, it's importan
123129
124130
If you change the colors of the bar in `$HOME/.config/waybar/waybar-mediaplayer/src/config.json`, make sure to apply the changes by running `$HOME/.config/waybar/waybar-mediaplayer/src/mkstyle` and restart waybar.
125131
126-
# Troubleshooting
132+
## Troubleshooting
127133
128-
## Firefox users
134+
### Firefox users
129135
130136
Although Firefox reports MPRIS metadata, the metadata it reports is not sufficient, as it doesn't report song's length. Please install the [Plasma Integration](https://addons.mozilla.org/en-US/firefox/addon/plasma-integration) add-on and use `plasma-browser-integration` as `player_name` in `$HOME/.config/waybar/waybar-mediaplayer/src/config.json`.
131137
132138
To have album art, make sure to set `convert_to_jpeg` to `true` in `$HOME/.config/waybar/waybar-mediaplayer/src/config.json` (this option decreases performance, don't use it if not necessary).
133139
134-
## Me progress bar doesn't work
140+
### Me progress bar doesn't work
135141
136142
It's likely cause by the player not reporting song length or position back to us. Run `$HOME/.config/waybar/waybar-mediaplayer/src/mediaplayer -vvv` to debug.
137143
138-
## Player reports its name with instance number
144+
### Player reports its name with instance number
139145
140146
If the player reports an instance after its name, please provide only the player name without the instance number. For example, [kew](https://github.com/ravachol/kew) may report itself as `kew123456`, where `123456` is an instance number which will change with different runs of `kew`. In this case, we report only `kew` without the instance number. This software will check whether the reported player name _starts_ with the name you provide to bind the correct player.
141147
142-
## Me title and tooltip are empty
148+
### Me title and tooltip are empty
143149
144150
It's likely your song file doesn't contain metadata.
145151
146152
Run `exiftool SONG.mp3` and check the `Title`, `Album` and `Artist` fields.
147153
148-
## Me album art doesn't change on song change
154+
### Me album art doesn't change on song change
149155
150156
Make sure that the `signal` in the `image` module in `$HOME/.config/waybar/config` matches the number provided by `image_signal` in `$HOME/.config/waybar/waybar-mediaplayer/src/config.json`.
151157

0 commit comments

Comments
 (0)