Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework pages to present views of existing widgets #343

Closed
2q2code opened this issue Feb 13, 2025 · 5 comments
Closed

Rework pages to present views of existing widgets #343

2q2code opened this issue Feb 13, 2025 · 5 comments
Labels
already available The requested functionality already exists feature request

Comments

@2q2code
Copy link
Contributor

2q2code commented Feb 13, 2025

Description

My glance.yml file is a bit chunky atm. I have three pages: Home, Home+, and ScratchPad.

The first is a simplified layout without any social distractions (no hacker news, no reddit, etc). There is only the monitors of my services, bookmarks, and search... weather widget, calendar.

The second one is the same layout with the distractions.

The third one is irrelevant (it's an embedded iFrame to a very simple web notepad - super handy, though).

There is a LOT of config file duplication to achieve this setup. It means I have to add and remove bookmarks and monitor widgets twice every time. Not ideal. Unfortunately, I need to be vigilant, as my ability to focus or relax varies greatly, so I have to have both options available to me.

To the point at hand:

Is there a way to use yaml templating so the bookmarks and monitors need only be defined once, then referenced in the actual page definitions? Or something like this?

@segleaur
Copy link

This sounds like it could be solved with the Environment variables anywhere in the config that was just released in v0.7.0.

You'd declare all of these variables in the docker-compose.yml file or (in a .env file - haven't tested that yet), and then be able to use those variables in the glance.yml so you really only have 1 place to edit and it would propagate to both pages.

Any changes in the docker-compose.yml file would require a restart (so you'd lose the capability to auto reload the glance.yml file on a config change), but might work to reduce the number of places you'd need to edit.

@2q2code
Copy link
Contributor Author

2q2code commented Feb 14, 2025

I'm working with bare metal, but thanks - I'll look into it.

@svilenmarkov
Copy link
Member

You can do this with YAML anchors:

define:
  - &shared-bookmarks
    type: bookmarks
    groups:
      - title: General
        links:
          - title: Github
            url: https://github.com/

  - &shared-videos
    type: videos
    channels:
      - UCXuqSBlHAE6Xw-yeJA0Tunw

pages:
  - name: Home
    columns:
      - size: full
        widgets:
          - *shared-bookmarks
          - *shared-videos
          - type: clock

  - name: Other
    columns:
      - size: full
        widgets:
          - *shared-bookmarks
          - *shared-videos
          - type: search

@svilenmarkov svilenmarkov added the already available The requested functionality already exists label Feb 14, 2025
@2q2code
Copy link
Contributor Author

2q2code commented Feb 14, 2025

Thank you! THIS is what I was after. It would be good to have an example of it in the docs, no?

@2q2code
Copy link
Contributor Author

2q2code commented Feb 14, 2025

P.S. Hah! I kill me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
already available The requested functionality already exists feature request
Projects
None yet
Development

No branches or pull requests

3 participants