Skip to content

feat: blur, transparency, focus mode & performance optimizations#66

Open
postadelmaga wants to merge 4 commits intoDenysMb:mainfrom
postadelmaga:pr/features-and-perf
Open

feat: blur, transparency, focus mode & performance optimizations#66
postadelmaga wants to merge 4 commits intoDenysMb:mainfrom
postadelmaga:pr/features-and-perf

Conversation

@postadelmaga
Copy link
Copy Markdown
Contributor

@postadelmaga postadelmaga commented Mar 29, 2026

Summary

  • Browser spoofing: Chrome 130 UA + navigator properties for auth page compatibility (Google, Claude, etc.)
  • CSS transparency/blur: heuristic DOM analysis applies layered rgba + backdrop-filter to background elements
  • Focus mode: per-site CSS rules + heuristic fallback hiding nav/aside/sidebar for clean chat view
  • Visual options: accent glow border, header gradient, animation controls, overlay opacity
  • WebEngine lifecycle: keep-alive option for instant reopen, or 5-min idle unload for memory saving
  • Keyboard shortcuts: Enter-to-send for DuckDuckGo, ChatGPT, Gemini, Claude, You
  • Session restore: last visited URL persists across WebView unload/reload
  • Fix: remove ContextMenu.qml — uses PlasmaExtras.Menu/MenuItem which don't exist in Plasma 6; PlasmaComponents3.Menu can't be a root type in a separate file. Context menu is now inline in WebView.qml.

Performance optimizations

Fix Impact
Pre-built JS injection strings (readonly property) Zero string rebuild per page load
Batch DOM reads before writes in blur injection Eliminates layout thrashing (N-1 forced reflows)
MutationObserver replaces setInterval(100ms) for textarea focus From ~50 timer fires/5s to 0
Narrowed focus mode selectors (body > div vs div, section) ~95% fewer elements scanned
Debounced renderChatModel + single-pass customSites parsing Coalesces N config toggles into 1 render
Accent glow wrapped in Loader Zero QML objects when disabled
Header animations gated on enableAnimations && autoHideHeader Zero animation overhead when not needed
Download signal cleanup on Component.onDestruction Prevents connection leaks

Test plan

  • Toggle blur on/off — transparency applies/removes correctly
  • Enable focus mode on ChatGPT, Claude, DuckDuckGo, Gemini — sidebars hidden
  • Focus mode on unknown site — heuristic fallback hides nav/aside elements
  • Auto-hide header — shows on hover, hides on mouse leave, stays during ComboBox interaction
  • Enter key sends message on compatible sites (DuckDuckGo, ChatGPT, Gemini, Claude)
  • Accent glow border toggle on/off
  • Keep WebEngine alive: close widget, reopen — page still loaded
  • Download a file — progress bar works, no console errors on widget close during download
  • Browser spoof: login to Google-auth sites works
  • Right-click context menu works (back, forward, reload, save, open link)

postadelmaga and others added 4 commits March 29, 2026 12:59
Features:
- Browser spoofing (Chrome 130 UA) for auth compatibility
- CSS transparency/blur injection with backdrop-filter
- Focus mode: hide sidebars and non-essential UI per service
- Accent glow border, header gradient, animation controls
- Keep WebEngine alive option for instant reopen
- Enter-to-send keyboard shortcuts for compatible chat services
- Last visited URL persistence across WebView unload/reload

Performance:
- Pre-built JS injection strings as readonly properties (zero rebuild per page load)
- Batch DOM reads before writes in transparency injection (no layout thrashing)
- MutationObserver replaces setInterval polling for textarea focus
- Narrow focus mode heuristic selectors (body > div instead of all divs)
- Debounced renderChatModel with single-pass customSites parsing
- Accent glow wrapped in Loader (zero objects when disabled)
- Header animations gated on enableAnimations + autoHideHeader
- Download signal connections cleanup on Component destruction

Co-Authored-By: Claude <claude@anthropic.com>
ContextMenu.qml uses PlasmaExtras.Menu/MenuItem which do not exist
in Plasma 6. Additionally, PlasmaComponents3.Menu cannot be used as
a root type in a separate QML file (causes "Type cannot be created
in QML" at runtime). The context menu is already implemented inline
in WebView.qml using PlasmaComponents3.Menu, which is the only
working approach on Plasma 6.

Co-Authored-By: Claude <claude@anthropic.com>
The previous commit was missing the performance fixes due to a stash
conflict. This adds all optimizations:
- Pre-built JS strings for blur/keyboard injection
- Batch DOM reads before writes (no layout thrashing)
- MutationObserver replaces setInterval for textarea focus
- Narrowed focus mode selectors
- Debounced renderChatModel with single-pass customSites parsing
- Header animations gated on enableAnimations + autoHideHeader
- Download signal cleanup on Component.onDestruction

Co-Authored-By: Claude <claude@anthropic.com>
Performance:
- Pre-built JS injection strings as readonly properties
- Batch DOM reads before writes in transparency (no layout thrashing)
- MutationObserver replaces setInterval for textarea focus
- Narrowed focus mode selectors (body > div vs all divs)
- Debounced renderChatModel with single-pass customSites parsing
- Accent glow wrapped in Loader (zero objects when disabled)
- Header animations gated on enableAnimations + autoHideHeader
- interactionTimer interval 500ms -> 1000ms
- Download signal cleanup on Component.onDestruction

Feature:
- Configurable new chat shortcut (default Ctrl+Shift+O)
- If customized, intercepts the custom combo and dispatches
  the default Ctrl+Shift+O to the page
- Setting in General config with Reset button

Co-Authored-By: Claude <claude@anthropic.com>
@DenysMb
Copy link
Copy Markdown
Owner

DenysMb commented Apr 2, 2026

Hey! Thank you for the contribution.

I didn't like the idea of this blur feature making changes in the DOM, it can significantly affect the issue of accessibility.
Even if we made it optional by default, it would be very laborious to maintain, as we would have to ensure proper functioning across various services.
In my tests with some services, the result was not good in many of them, with only part of the sites having blur.

Furthermore, the changes to browser spoofing not only failed to resolve the authentication problem with Claude, but also caused several other services to stop working, making it no longer possible to authenticate with Google.

I like the idea of ​​making changes to improve performance and address minor issues we might have, but I didn't like the two I mentioned above.

If you still decide to contribute, I recommend a PR focused solely on performance issues.

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