Skip to content

Replace hardcoded gradient rectangles in scrollable widgets with NFadeMask abstraction#2386

Open
BUSTheid wants to merge 8 commits intonoctalia-dev:mainfrom
BUSTheid:nscrolltext-border-fix
Open

Replace hardcoded gradient rectangles in scrollable widgets with NFadeMask abstraction#2386
BUSTheid wants to merge 8 commits intonoctalia-dev:mainfrom
BUSTheid:nscrolltext-border-fix

Conversation

@BUSTheid
Copy link
Copy Markdown
Contributor

@BUSTheid BUSTheid commented Apr 2, 2026

Pull Request

Motivation

Introduction of NFadeMask - reusable mask source component that centralises the fade rectangle + MultiEffect pattern and ports all affected widgets to use it.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring

Testing

  • Tested on niri
  • Tested on Hyprland
  • Tested with different bar positions and density settings
  • Tested at different interface scaling values
  • Tested on sway
  • Tested with multiple monitors (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-reviewed my code
  • No new warnings or errors
  • Documentation or comments updated (if relevant)

@BUSTheid BUSTheid force-pushed the nscrolltext-border-fix branch from 6313e8c to 6ad498e Compare April 3, 2026 05:29
@BUSTheid BUSTheid marked this pull request as draft April 3, 2026 05:51
@BUSTheid BUSTheid force-pushed the nscrolltext-border-fix branch from f53a102 to fda10ac Compare April 3, 2026 05:53
@BUSTheid
Copy link
Copy Markdown
Contributor Author

BUSTheid commented Apr 3, 2026

@ItsLemmy fixed some missing control over the fade in NScrollText, prototyped a pretty ugly solution for NScrollView - I'll try to simplify it if possible. Let me know what you think about the direction.

Maybe we can consider making the fade rectangle its own individual .qml or script to create dynamically everywhere we want on any part of the UI, to minimize boilerplate?

@BUSTheid BUSTheid changed the title refactor(NScrollText): wrap Item around fadeMask refactor NScrollText and NScrollView to use fade masks instead of hardcoded gradient rectangles Apr 3, 2026
@BUSTheid BUSTheid force-pushed the nscrolltext-border-fix branch 2 times, most recently from 3ebff60 to 5fc20f7 Compare April 4, 2026 06:18
BUSTheid added 2 commits April 4, 2026 18:17
Wrapping an Item around the white gradient
rectangle allows vertical control over the masked
content, matching rectangle's sizes, since
maskSource always gets stretched to match the
source size.

That way, the white gradient rectangle itself
does not get stretched, only the Item, so content
drawn outside of its boundaries properly read the
maskSource opacity as 0, vertically as well.

Also fixes the possibility of text rendering over
the border at high Font sizes, which was the
initial purpose of the refactor, but got overseen.
@BUSTheid BUSTheid force-pushed the nscrolltext-border-fix branch from 5fc20f7 to 11385e9 Compare April 4, 2026 16:20
Ported NScrollText
Ported NScrollView
@BUSTheid BUSTheid changed the title refactor NScrollText and NScrollView to use fade masks instead of hardcoded gradient rectangles Replace hardcoded gradient rectangles in scrollable widgets with NFadeMask abstraction Apr 4, 2026
@BUSTheid BUSTheid marked this pull request as ready for review April 4, 2026 21:53
@notiant
Copy link
Copy Markdown
Contributor

notiant commented Apr 5, 2026

If you're working on this maybe you could also address the current fading of the beginning of the text if the text is not scrolling ("Replace" shouldn't be faded here):

Screenshot_2026-04-05 18-14-20

@BUSTheid
Copy link
Copy Markdown
Contributor Author

BUSTheid commented Apr 5, 2026

If you're working on this maybe you could also address the current fading of the beginning of the text if the text is not scrolling ("Replace" shouldn't be faded here):
Screenshot_2026-04-05 18-14-20

I didn't think of that edge case, since I have it always scrolling if it's overflowing. On it!

@BUSTheid
Copy link
Copy Markdown
Contributor Author

BUSTheid commented Apr 5, 2026

@notiant most recent commit should fix this, and added the animation for the fade appearing when the scrolling starts. Let me know if you find anything else, it's SO MANY elements that got refactored indirectly hah

@notiant
Copy link
Copy Markdown
Contributor

notiant commented Apr 5, 2026

@notiant most recent commit should fix this, and added the animation for the fade appearing when the scrolling starts. Let me know if you find anything else, it's SO MANY elements that got refactored indirectly hah

So after testing this a bit more I don't really see any fading mask in NScrollView (like the network or notification history panel)?

@BUSTheid
Copy link
Copy Markdown
Contributor Author

BUSTheid commented Apr 5, 2026

@notiant most recent commit should fix this, and added the animation for the fade appearing when the scrolling starts. Let me know if you find anything else, it's SO MANY elements that got refactored indirectly hah

So after testing this a bit more I don't really see any fading mask in NScrollView (like the network or notification history panel)?

image image

Notification history for me in particular does apply the fade, it's maybe too small on different scale values?

NFadeMask does assign a property that can be used to increase/decrease the size of the fade. API should be there and working, whether it gets changed in N* elements or particularly in a larger scope QML file. (I'm trash at design, but really enjoyed porting into a centralized solution kek)

// NFadeMask.qml
// Fraction of height/width of component that fades on each side
// Value: 0.0 - 0.5
property real fadeExtent: 0.1

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants