Skip to content

Commit

Permalink
Improve README
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfm committed Dec 11, 2023
1 parent a5a62e2 commit 8af3df6
Showing 1 changed file with 82 additions and 51 deletions.
133 changes: 82 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,46 +24,76 @@ Connect feature.

## Installation

(Requires Emacs 27.1+)
Smudge requires Emacs 27.1+.

### Vanilla Emacs

`package.el` is the built-in package manager in Emacs.

Smudge is available on the two major package.el community maintained repos - MELPA Stable and MELPA.
Smudge is available on the two major package.el community maintained repos MELPA Stable and MELPA.

You can install Smudge with the following command:

M-x package-install [RET] smudge [RET]
<kbd>M-x</kbd> package-install <kbd>[RET]</kbd> smudge <kbd>[RET]</kbd>

To manually install Smudge instead, just clone this project somewhere in your
disk, add that directory in the `load-path`, and require the `smudge` module:
Or put the following snippet into your Emacs configuration:

````el
(add-to-list 'load-path "<smudge-dir>")
(require 'smudge)
````
```el
(use-package smudge
:bind-keymap ("C-c ." . smudge-command-map)
:config
(setq smudge-oauth2-client-secret "..."
smudge-oauth2-client-id "..."))
```

### Doom Emacs

Add the following to the `packages.el` file:

```el
(package! smudge) ; from MELPA
;; From GitHub
(package! smudge
:recipe (:host github :repo "danielfm/smudge")) ; from GitHub
```

Add the following to the `config.el` file:

``` el
(use-package! smudge
:bind-keymap ("C-c ." . smudge-command-map)
:config
(setq smudge-oauth2-client-secret "..."
smudge-oauth2-client-id "..."))
```

## Configuration

````el
;; Settings
```el
(setq smudge-oauth2-client-secret "<spotify-app-client-secret>")
(setq smudge-oauth2-client-id "<spotify-app-client-id>")
(define-key smudge-mode-map (kbd "C-c .") 'smudge-command-map)
````
That keymap prefix is just a suggestion, following the conventions suggested for minor modes as
defined in the Emacs manual [Key Binding
Conventions](https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html#Key-Binding-Conventions). Previous
versions of this package used "M-p"

In order to get the the client ID and client secret, you need to create
[a Spotify app](https://developer.spotify.com/my-applications), specifying
<http://localhost:8080/smudge-api-callback> as the redirect URI (or whichever port you have specified via customize).
The OAuth2 exchange is handled by `simple-httpd`. If you are not already using this package for something else, you should not need to customize this port. Otherwise, you'll want to set it to whatever port you are running on.

To use the "Spotify Connect" transport (vs. controlling only your local instance - though you can
also control your local instance as well), set `smudge-transport` to `'connect` as follows. This
feature requires a Spotify premium subscription.
(define-key smudge-mode-map (kbd "C-c .") 'smudge-command-map)
```

That <kbd>C-c .</kbd> keymap prefix is just a suggestion, following the
conventions suggested for minor modes as defined in the Emacs manual
[Key Binding Conventions](https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html#Key-Binding-Conventions).
Previous versions of this package used <kbd>M-p</kbd>.

In order to get the client ID and client secret, you need to create a
[Spotify app](https://developer.spotify.com/my-applications), specifying
<http://localhost:8080/smudge-api-callback> as the redirect URI (or whichever
port you have specified via customize). The OAuth2 exchange is handled by
`simple-httpd`. If you are not already using this package for something else,
you should not need to customize this port. Otherwise, you'll want to set it
to whatever port you are running on.

To use the "Spotify Connect" transport (vs. controlling only your local
instance - though you can also control your local instance as well), set
`smudge-transport` to `'connect` as follows. **This feature requires a Spotify
premium subscription.**

````el
(setq smudge-transport 'connect)
Expand Down Expand Up @@ -94,24 +124,24 @@ At this point, the client ID and the client secret are available, so set those v
Whenever you enable the `global-smudge-remote-mode` minor mode you get the following
key bindings:

| Key | Function | Description |
|:---------------------|:---------------------------------------|:-------------------------------------------|
| <kbd>C-c . M-s</kbd> | `smudge-controller-toggle-shuffle` | Turn shuffle on/off [1] |
| <kbd>C-c . M-r</kbd> | `smudge-controller-toggle-repeat` | Turn repeat on/off [1] |
| <kbd>C-c . M-p</kbd> | `smudge-controller-toggle-play` | Play/pause |
| <kbd>C-c . M-f</kbd> | `smudge-controller-next-track` | Next track |
| <kbd>C-c . M-b</kbd> | `smudge-controller-previous-track` | Previous track |
| <kbd>C-c . p m</kbd> | `smudge-my-playlists` | Show your playlists |
| <kbd>C-c . p f</kbd> | `smudge-featured-playlists` | Show the featured playlists |
| <kbd>C-c . p s</kbd> | `smudge-playlist-search` | Search for playlists |
| <kbd>C-c . p u</kbd> | `smudge-user-playlists` | Show playlists for the given user |
| <kbd>C-c . p c</kbd> | `smudge-create-playlist` | Create a new playlist |
| <kbd>C-c . t r</kbd> | `smudge-recently-played` | List of recently played tracks |
| <kbd>C-c . t s</kbd> | `smudge-track-search` | Search for tracks |
| <kbd>C-c . v u</kbd> | `smudge-controller-volume-up` | Increase the volume [2] |
| <kbd>C-c . v d</kbd> | `smudge-controller-volume-down` | Decrease the volume [2] |
| <kbd>C-c . v m</kbd> | `smudge-controller-volume-mute-unmute` | Alternate the volume between 0 and 100 [2] |
| <kbd>C-c . d</kbd> | `smudge-select-device` | Select a playback device [2] |
| Key | Function | Description |
|:------------------------|:---------------------------------------|:-------------------------------------------|
| <kbd>[prefix] M-s</kbd> | `smudge-controller-toggle-shuffle` | Turn shuffle on/off [1] |
| <kbd>[prefix] M-r</kbd> | `smudge-controller-toggle-repeat` | Turn repeat on/off [1] |
| <kbd>[prefix] M-p</kbd> | `smudge-controller-toggle-play` | Play/pause |
| <kbd>[prefix] M-f</kbd> | `smudge-controller-next-track` | Next track |
| <kbd>[prefix] M-b</kbd> | `smudge-controller-previous-track` | Previous track |
| <kbd>[prefix] p m</kbd> | `smudge-my-playlists` | Show your playlists |
| <kbd>[prefix] p f</kbd> | `smudge-featured-playlists` | Show the featured playlists |
| <kbd>[prefix] p s</kbd> | `smudge-playlist-search` | Search for playlists |
| <kbd>[prefix] p u</kbd> | `smudge-user-playlists` | Show playlists for the given user |
| <kbd>[prefix] p c</kbd> | `smudge-create-playlist` | Create a new playlist |
| <kbd>[prefix] t r</kbd> | `smudge-recently-played` | List of recently played tracks |
| <kbd>[prefix] t s</kbd> | `smudge-track-search` | Search for tracks |
| <kbd>[prefix] v u</kbd> | `smudge-controller-volume-up` | Increase the volume [2] |
| <kbd>[prefix] v d</kbd> | `smudge-controller-volume-down` | Decrease the volume [2] |
| <kbd>[prefix] v m</kbd> | `smudge-controller-volume-mute-unmute` | Alternate the volume between 0 and 100 [2] |
| <kbd>[prefix] d</kbd> | `smudge-select-device` | Select a playback device [2] |

The current song being played by Smudge is displayed in the mode
line along with the player status (playing, paused). The interval in which the
Expand Down Expand Up @@ -258,11 +288,11 @@ playlists from Spotify en_US.
Change the following variables in order to customize the locale and region for
the featured playlists endpoint:

````el
```el
;; Spanish (Mexico)
(setq smudge-api-locale "es_MX")
(setq smudge-api-country "MX")
````
```

All these commands will display results in a separate buffer with the following
key bindings:
Expand Down Expand Up @@ -314,20 +344,21 @@ By default, the player status (playing, paused, track name, time, shuffle, repea
in the modeline. If you want to display the status in the title bar when using a graphical display,
you can set the following:

````el
```el
(setq smudge-status-location 'title-bar)
````
```

Valid values include `'title-bar`, `'modeline` and `nil`, where nil turns off the display of the
player status completely. If the value is set to `title-bar` but you are not using a graphical
display, the player status will be displayed in the mode line instead.

If you want to customize the separator between the existing title bar text and the player status,
you can set the following, i.e.:
````el

```el
(setq smudge-title-bar-separator "----")
````
```

Otherwise, it defaults to 4 spaces.

## License
Expand Down

0 comments on commit 8af3df6

Please sign in to comment.