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

[FR] Force show narrow (or wide) sidebar #156

Closed
denisfrench opened this issue Oct 11, 2024 · 6 comments · Fixed by #160
Closed

[FR] Force show narrow (or wide) sidebar #156

denisfrench opened this issue Oct 11, 2024 · 6 comments · Fixed by #160

Comments

@denisfrench
Copy link

Hello @elchininet; here's a feature request as suggested originally for the Kiosk Mode plugin (NemesisRE/kiosk-mode#281 (comment)).

It would be helpful to have a simple way to force-show the narrow sidebar on devices with screens that may otherwise hide it completely by default (eg RPi touchscreen 800x480).

There may be use cases where the wide sidebar is preferred. Ideally exceptions by user or device could be applied.

Thanks for your work on all these plugins! 🙂

@elchininet
Copy link
Owner

Hi @denisfrench,
Based on some quick tests that I did, that is achievable.
I'll try to see how to implement it. I'll let you know.
Regards

@elchininet
Copy link
Owner

Hi @denisfrench,
A new version of custom-sidebar has been released. Please, test it on your side and report it back.
Regards

@denisfrench
Copy link
Author

Hi @elchininet ; I've got this up and running and it is working great, thank you!

My only hurdle was that implementing sidebar_mode: within exceptions: still requires a non-empty order: within the base level for it to work. So I just moved one of the items that I was happy to apply globally to the base order:.

The following works, but not if I don't have a base order: with something in it (regardless of extend_from_base: setting):

order:
  - item: map
    match: data-panel
    exact: true
    hide: true
exceptions:
  - user: rpi
    sidebar_mode: narrow
    sidebar_editable: false
    extend_from_base: true
    order:
      - item: overview
        hide: true
      - item: mobile
        hide: true
      # - item: map
        # match: data-panel
        # exact: true
        # hide: true
      - item: test
        hide: true
      - item: energy
        hide: true
      - item: logbook
        hide: true
      - item: history
        hide: true
      - item: calendar
        hide: true
      - item: file
        hide: true
      - item: hacs
        hide: true
      - item: terminal
        hide: true
      - item: esphome
        hide: true
      - item: node
        hide: true
      - item: media
        hide: true
      - item: developer
        hide: true
      - item: settings
        hide: true

The readme tells me that the base order: is required, so I'm not surprised. It's just not neccessary for my use case.

There might have been a problem if there wasn't an item that I was happy to apply globally. Really this is an issue with order: being mandatory at the base level even when only using exceptions:, rather than the implementation of sidebar_mode:.

Thanks for your work on this. I hope others too will find it useful 🙂

@elchininet
Copy link
Owner

Hi @denisfrench,

If you don't put an order property in the base or if it is empty you will see an error in the browser console and the plugin will stop working (there is a specific validation to check that).

You can implement your config in the other way around, put everything that you have in the exception in the base and do an exception with not_user and without extending from the base. In that way everybody excluding the user that you have at this moment in the exception will get the exception which is the default sidebar. I will think if that restriction is really necessary, the order property was mandatory in the exceptions in the previous major version and I removed that restriction, now that there are a lot of more options on top of order, it is something that could be deprecated in the next major version.

By the way, it is not released yet but I am preparing a new release with a lot of changes. Just check the current readme because it is already merged, maybe you would find it useful.

Regards and thanks for reporting back 👍🏼

@elchininet
Copy link
Owner

Hi @denisfrench,
FYI, this will be available in the next major release.
Regards

@elchininet
Copy link
Owner

Hi @denisfrench,
The new version is already released.
Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants