Kamil Pomykała | Glance Widgets
Glance Widgets

Glance Widgets

Init date: April 12, 2024

html css go

Glance Widgets is a collection of widgets for the Glance - self-hosted dashboard.

It provides a variety of widgets that can be used to display different types of information on the dashboard.

Widgets

Last.FM Recently Played

Github link

This widget displays the last 5 tracks played on Last.FM. It uses the Last.FM API to fetch the data and displays it in a simple list format. It can also be expanded to show 5 more tracks.

The widget is designed to be simple and easy to use, with a clean and modern design.

Last.fm widget preview

Here is the code for the widget:

- type: custom-api
  title: Last.fm
  cache: 60s
  url: http://ws.audioscrobbler.com/2.0/
  parameters:
    method: user.getRecentTracks
    user: ${LASTFM_USERNAME}
    api_key: ${LASTFM_API_KEY}
    format: json
    limit: 10
  template: |
    <ul class="list list-gap-10 collapsible-container" data-collapse-after="5">
      {{ range .JSON.Array "recenttracks.track" }}
        <li class="flex items-center gap-10">
          <img src={{ .String "image.2.#text" }} style="border-radius: 5px; min-width: 5rem; max-width: 5rem;" class="card">
          <div class="flex-1">
            <p class="color-positive size-h5">{{ .String "artist.#text" }}</p>
            <p class="size-h5">{{ .String "name" }}</p>
            <p class="size-h6">
              {{ if .String "@attr.nowplaying" }}
                <span class="color-positive">Now playing</span>
              {{ else }}
                <span class="color-subdue" {{ .String "date.#text" | parseRelativeTime "02 Jan 2006, 15:04" }}></span>
              {{ end }}
            </p>
          </div>
        </li>
      {{ end }}
    </ul>

Hardcover Currently Reading

This widget showcases the currently reading book from Hardcover app. It uses the Hardcover GraphQL API to fetch the data and displays it in a simple list format.

This widget is currently in a Pull Request and will be available soon.