Bug 487316 - Opened LibreOffice Calc windows from double click are grouped under generic icon
Summary: Opened LibreOffice Calc windows from double click are grouped under generic icon
Status: RESOLVED DOWNSTREAM
Alias: None
Product: plasmashell
Classification: Plasma
Component: Task Manager and Icons-Only Task Manager (show other bugs)
Version: 6.0.4
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-21 10:48 UTC by medin
Modified: 2024-09-03 17:17 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
image1 (84.23 KB, image/png)
2024-05-21 10:48 UTC, medin
Details
Calc instances opened and grouped under LO generic icon (1.04 MB, video/mp4)
2024-08-21 20:39 UTC, medin
Details
it's compressed because the site doesn't allow empty files (124 bytes, application/gzip)
2024-09-02 20:45 UTC, medin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description medin 2024-05-21 10:48:27 UTC
Created attachment 169675 [details]
image1

When I double-click on any .ods files inside Desktop or Dolphin, they are opened and grouped under the generic icon. While opening Calc from Kickoff or pinned icons seems to force it to group under the correct Calc icon. See attached image1.



Running "qdbus org.kde.KWin /KWin queryWindowInfo" on different windows shows:


>>> Calc started from Kickoff or pinned icons

activities: ea074252-adac-4b93-ad1a-4ff778d15031
caption: Untitled 6 — LibreOffice Calc
clientMachine:
desktopFile: libreoffice-calc
desktops: 9e4d830a-ef53-4471-8c9c-3ce37ac65b32
fullscreen: false
height: 736
keepAbove: false
keepBelow: false
layer: 2
localhost: true
maximizeHorizontal: 2
maximizeVertical: 1
minimized: false
noBorder: false
resourceClass: libreoffice-calc
resourceName: soffice.bin
role:
shaded: false
skipPager: false
skipSwitcher: false
skipTaskbar: false
type: 0
uuid: {5b6fea5f-a475-402a-a7f4-063cd47dcbda}
width: 1366
x: 0
y: 0



>>> Calc started from double click inside Desktop of Dolphin

activities: ea074252-adac-4b93-ad1a-4ff778d15031
caption: test.ods — LibreOffice Calc
clientMachine:
desktopFile: libreoffice-startcenter
desktops: 9e4d830a-ef53-4471-8c9c-3ce37ac65b32
fullscreen: false
height: 736
keepAbove: false
keepBelow: false
layer: 2
localhost: true
maximizeHorizontal: 2
maximizeVertical: 1
minimized: false
noBorder: false
resourceClass: libreoffice-startcenter
resourceName: soffice.bin
role:
shaded: false
skipPager: false
skipSwitcher: false
skipTaskbar: false
type: 0
uuid: {387ea3f8-f213-4ee1-9156-77c3f551d88c}
width: 1366
x: 0
y: 0


It seems the double click start Calc with wrong "desktopFile" and "resourceClass" set to "libreoffice-startcenter" instead of "libreoffice-calc".
Comment 1 Nate Graham 2024-05-22 20:11:21 UTC
Cannot reproduce the issue with those steps, FWIW. KDE software is from git master, and LO is: 

Version: 24.2.3.2 (X86_64)
Build ID: 420(Build:2)
CPU threads: 8; OS: Linux 6.8; UI render: default; VCL: kf6 (cairo+wayland)
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 2 TraceyC 2024-08-19 21:38:00 UTC
I'm also not able to reproduce this on 6.1.4 or git-master

Version: 24.2.5.2 (X86_64) / LibreOffice Community
Build ID: 420(Build:2)
CPU threads: 16; OS: Linux 6.9; UI render: default; VCL: kf6 (cairo+wayland)
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

If this is still an issue on your system can you copy the information from About this System into this issue?
Comment 3 medin 2024-08-19 22:09:52 UTC
(In reply to TraceyC from comment #2)
> I'm also not able to reproduce this on 6.1.4 or git-master
> 
> Version: 24.2.5.2 (X86_64) / LibreOffice Community
> Build ID: 420(Build:2)
> CPU threads: 16; OS: Linux 6.9; UI render: default; VCL: kf6 (cairo+wayland)
> Locale: en-US (en_US.UTF-8); UI: en-US
> Calc: threaded
> 
> If this is still an issue on your system can you copy the information from
> About this System into this issue?

It's still happening with:

Version: 24.2.5.2 (X86_64) / LibreOffice Community
Build ID: 420(Build:2)
CPU threads: 2; OS: Linux 6.10; UI render: default; VCL: kf6 (cairo+wayland)
Locale: en-US (en_US.UTF-8); UI: en-US
24.2.5-2
Calc: threaded


Operating System: Manjaro Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.6-1-MANJARO (64-bit)
Graphics Platform: Wayland
Comment 4 Nate Graham 2024-08-20 21:47:52 UTC
Can you maybe attach a screen recording that shows it happening?
Comment 5 medin 2024-08-21 20:39:49 UTC
Created attachment 172830 [details]
Calc instances opened and grouped under LO generic icon
Comment 6 Nate Graham 2024-08-30 23:45:56 UTC
Thanks. It looks like the way your launcher icon on the desktop launches LibreOffice Calc differs from how its standard launcher launches it.

How did you create that launcher, and does it have any customizations, changed environment variables, etc?

I ask because if I create a launcher for Calc by dragging it to the desktop from Kickoff and choose "Copy" or "Link", then opening it from that desktop launcher works as expected.

Can you try creating a new one in this way and seeing if that works? If it does, then you should diff the working and broken desktop files to see what the differences are.
Comment 7 medin 2024-08-31 09:16:11 UTC
(In reply to Nate Graham from comment #6)
> Thanks. It looks like the way your launcher icon on the desktop launches
> LibreOffice Calc differs from how its standard launcher launches it.
> 
> How did you create that launcher, and does it have any customizations,
> changed environment variables, etc?
> 
> I ask because if I create a launcher for Calc by dragging it to the desktop
> from Kickoff and choose "Copy" or "Link", then opening it from that desktop
> launcher works as expected.
> 
> Can you try creating a new one in this way and seeing if that works? If it
> does, then you should diff the working and broken desktop files to see what
> the differences are.

Sorry, I think I poorly reported the problem. Those are not application launchers, but just empty files I added on my desktop.

After some testing, it seems this problem only happens with empty ods files created with desktop contextual menu.

Steps to reproduce:

1. Right click on desktop, Create New> LibreOffice Calc, Name it and click on OK.
2. Double click on that newly created file

That file will be opened under a generic icon instead of LibreOffice Calc one.

This only happened with an empty Calc files created that way, it doesn't happen with Writer, Impress, Draw, Math... and it doesn't happen if you add something inside that ods file then save it to desktop.
Comment 8 Justin Zobel 2024-09-02 09:20:59 UTC
Can confirm this on plasmashell from git master.

Open Libreoffice Calc from Kickoff and it launches with the correct icon.

Open the empty .ods file from the desktop and it will open in an existing Calc window.

Open the empty .ods file from the desktop with no windows open and it shows the generic black(dark grey) LO icon.
Comment 9 Nate Graham 2024-09-02 16:33:19 UTC
Can someone attach an affected empty calc spreadsheet file?
Comment 10 medin 2024-09-02 20:45:56 UTC
Created attachment 173245 [details]
it's compressed because the site doesn't allow empty files

That contextual menu in desktop simply creates an empty textual file (0B) and adds ".ods", ".odt"... extension to it. 

While if you open LibreOffice Calc/Writer/Impress... and create a new empty file then save it to desktop, if you inspect that file with Okteta you will find some identification data stored inside it.
Comment 11 Nate Graham 2024-09-03 04:45:31 UTC
Got it. So here's the problem:

> $ file --mime-type ~/Desktop/foo.ods 
> /home/nate/Desktop/foo.ods: inode/x-empty

Despite the fact that LibreOffice happily opens the file due to the recognized filename extension, it isn't actually recognized as a valid file type by `file`, which means it's not in the MIME database. Which means it must trigger a different codepath in LibreOffice.

Thus, the issue is with the templates; evidently they aren't actually valid files. Now the question is where do these templates come from? I actually don't have them on my Fedora 40 system. These don't come from KDE, do they?
Comment 12 medin 2024-09-03 13:01:08 UTC
(In reply to Nate Graham from comment #11)
> Got it. So here's the problem:
> 
> > $ file --mime-type ~/Desktop/foo.ods 
> > /home/nate/Desktop/foo.ods: inode/x-empty
> 
> Despite the fact that LibreOffice happily opens the file due to the
> recognized filename extension, it isn't actually recognized as a valid file
> type by `file`, which means it's not in the MIME database. Which means it
> must trigger a different codepath in LibreOffice.
> 
> Thus, the issue is with the templates; evidently they aren't actually valid
> files. Now the question is where do these templates come from? I actually
> don't have them on my Fedora 40 system. These don't come from KDE, do they?

The template of Calc uses :
/usr/share/templates/soffice.ods.desktop
/usr/share/templates/.source/soffice.ods

Theses two files come from libreoffice-fresh package (Arch/Manjaro), and if soffice.ods is a 0B file it should be opened and processed based on its extension.

https://bugs.documentfoundation.org/show_bug.cgi?id=123476
https://bugs.documentfoundation.org/show_bug.cgi?id=139962
https://bugs.documentfoundation.org/show_bug.cgi?id=139991
Comment 13 Nate Graham 2024-09-03 14:16:54 UTC
Since the template files some from LibreOffice too, then this is clearly a set of LibreOffice bugs. I see at least two:
1. The template files are broken and aren't identified by shared-mime-date as valid file types ( per the output of `file --mime-type`
2. Despite this, LibreOffice happily opens them anyway, but goes down a different codepath when doing so that ends up showing the wrong icon.

I'd say it's time to report it as a new bug at https://bugs.documentfoundation.org/. Based on the older ones you found, it looks like this has repeatedly been a problem in the past, and keeps breaking.
Comment 15 Nate Graham 2024-09-03 17:17:48 UTC
Thank you!