plasma6-window-title-applet icon indicating copy to clipboard operation
plasma6-window-title-applet copied to clipboard

HTML Rendering Issue in Window Titles

Open YoganshSharma opened this issue 10 months ago • 4 comments

Version: 0.9.0

Description

The current implementation unexpectedly processes HTML tags.

Example

This title contains the following text <h1>bigg<\h1> The text bigg overflows

YoganshSharma avatar Jan 02 '25 20:01 YoganshSharma

I assume you want kitty to be big? Try doing <h1>%a</h1>. %a replaces application name %w replaces window name And %q for activity name

dhruv8sh avatar Jan 02 '25 22:01 dhruv8sh

Sorry for not being clear, I want the complete opposite. I encountered this issue while using Firefox on certain websites that include HTML tags in the title. Since Firefox updates the window title based on the website’s title, I faced an issue where the window title would render the HTML code, which I didn’t want to happen. Is there a way to escape the HTML tags in the title so that they are displayed as raw HTML in the window title, without being interpreted or rendered by the browser? image

YoganshSharma avatar Jan 03 '25 00:01 YoganshSharma

That definitely is an issue. It would require me to (optionally) scan through each string and escape these tags. I will fix it this weekend, thanks for reporting.

dhruv8sh avatar Jan 03 '25 00:01 dhruv8sh

I can make a pr adding an additional function and using it here https://github.com/dhruv8sh/plasma6-window-title-applet/blob/a6eaf5086a473919ed2fffc5d3b8d98237c2dd41/contents/tools/Tools.js#L10-L15

 function sub(str){ 
     return str 
         .replace("%a", escapeHtml(activeTaskItem?.appName??"")) 
         .replace("%w", escapeHtml(activeTaskItem?.title??""))
         .replace("%q", escapeHtml(fullActivityInfo?.name??""))
 } 

YoganshSharma avatar Jan 03 '25 00:01 YoganshSharma