Add hiding widgets on homescreen as experimental feature#227
Add hiding widgets on homescreen as experimental feature#227nicoverbruggen wants to merge 6 commits into
Conversation
Hook HomePageView's constructor to optionally hide widgets by their internal objectName (row1col2, row2col2, row3). This is the runtime equivalent of the corresponding kobopatch patches. The hook is optional and all widget lookups are null-checked, so unsupported firmware versions are handled gracefully. Also adds nh_dump_log() call on init for debugging (fork-only).
The row2col2 tweak was an experiment, unfortunately it does not work, as it also affects book covers in My Books.
|
I was originally wondering if I should even create this pull request in the first place, as this change is definitely less related to core NickelMenu functionality (the actual menu) than, say, the tab bar customization that's currently part of the latest release. But then again, customizing the tab bar is clearly marked as experimental in the docs, too. I figured since it's all marked as experimental anyway, you always have the option to remove this further down the line if the maintenance cost is too high or a future version of Nickel (e.g. with the upcoming 5.x updates) changes things up considerably. However, if you feel it's not a fit in terms of scope, I think that's totally understandable! |
|
Isn't this more suitable for Kobo Tweaks instead? But I still think it's a little bit risky to patch the Home view. If something goes wrong it may cause bootloop. Alternative method: redphx/kobo-tweaks#21 |
I had disabled this particular tweak because it did not work correctly as there was a layout shift for My Books (and sometimes a book would also disappear from the list, due to how the class matching worked). To address this, an explicit widget chain needs now to be followed; i.e. direct descendants are checked: mainContainer -> row x, col y. This prevents other elements with the same class name from being hidden. And to ensure no layout shift occurs to My Books when hiding `row2col2`, that element is hidden by setting the opacity to 0, and disabling the widget and any event interaction on it. This option is configured via the `keep_layout_space` bool which determines what hiding mechanism is used to hide the element (either remove from flow, or "fake" hide).
@redphx If you'd like to integrate this tweak into Kobo Tweaks, feel free to use the code in my repo, the license definitely allows for it. I do really need to try it out at some point. In fact, I'm wondering if it'd be worth integrating Kobo Tweaks and Nickel Screensaver into KoboPatch WebUI with a new flow. Would you be cool with me doing that at some point?
Well, this "patch" only happens at runtime, and it's got very precise checks now. I think the way these widgets are identified and then hidden is pretty safe. I've even hardened it more with my latest changes today, which requires a very specific tree (main container > row x > col y) to be found for the tweak to apply. With today's latest commit, I also added the ability to hide If this is now makes it much of a maintenance burden to qualify for inclusion into NickelMenu, I'll spin this off into its own separate thing at some point. |
|
Oops, renaming the branch on my repo apparently closes the PR... To avoid needing to file another PR and keep things tidy, I've restored it and re-opened the PR here, apologies! |
This pull request adds an experimental feature that's similar to the tab bar customization that was introduced in the latest stable version of NickelMenu. This change allows you to hide certain parts of the home screen.
Since it's now possible to hide certain unneeded features in the tab bar, I've been using
kobopatchto patch each of my devices with two particular tweaks that hide therow1col2androw3widgets on the homescreen.I even did some experimentation with
kobopatchto make a WASM version and an interactive patcher here to make patching easier. Unfortunately, this modification needs to be reapplied every time an update releases, so I wanted to integrate this as an experimental tweak that is a little bit more resilient.Since NickelMenu and its tab bar modifications persist due to the injection approach, I added configurable widget hiding for certain bits of the homescreen.
Both options can be separately toggled:
It looks like this when both are enabled:
Normally, since I'm only currently reading one book, I'd get recommendations on the right. That's hidden with
hide_home_row1col2_enabled. The section below My Books, promoting Kobo's other features, activity, Kobo Plus, etc. is now also hidden withhide_home_row3_enabled. I already used the tab bar customizations, too, as you can probably see.I've updated the documentation to mention this experimental feature and I've done my best to try to be as consistent with the rest of NickelMenu in terms of source code and best practices (as far as I can tell). Like the tab bar feature, it should not cause any issues if Kobo ends up changing the way their homescreen works in future versions of their software.
I've also added the latest software version number to
test/syms/main.go.I just figured I'd do a PR since I've made the changes anyway. (I've been successfully using this feature on my Kobo Clara BW. Pretty awesome that GitHub Actions just builds the project for you.)
I also want to take the opportunity to say thanks for all of the Kobo related work you've done over time... so, thank you!