Bug 451242

Summary: "Could not take a screenshot" error
Product: [Applications] Spectacle Reporter: Lyubomir <liubomirwm>
Component: GeneralAssignee: Boudhayan Gupta <me>
Status: RESOLVED FIXED    
Severity: normal CC: kde, nate
Priority: NOR    
Version First Reported In: 21.12.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Lyubomir 2022-03-07 14:32:04 UTC
SUMMARY
I have this orange-background error "Could not take a screenshot". I've used previously the firejail firecfg command, but has since then restored using `firecfg --clean` and rebooted so that now there is no AppArmor profile loaded. It might not be connected to this...

STEPS TO REPRODUCE
1. Press PrtScrn button

OBSERVED RESULT
"Could not take a screenshot"

EXPECTED RESULT
Screenshot

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.2
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3
Kernel Version: 5.16.12-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i5-8250U CPU @ 1.60GHz
Memory: 7,6 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620
Comment 1 Lyubomir 2022-03-07 14:36:05 UTC
FWIW launching from terminal gives

Screenshot request failed: "The process is not authorized to take a screenshot"
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
QPixmap::scaled: Pixmap is a null pixmap
Comment 2 Nate Graham 2022-03-22 15:40:20 UTC
So you're running Spectacle in Firejail or something? If so that might cause it. There is special code in Spectacle and KWin to communicate with one another, but only if the Spectacle binary can be correctly identified. It's quit possible that the sandboxing method you're using is interfering with that.

Does it work if you stop sandboxing it with Firejail?
Comment 3 Lyubomir 2022-03-22 18:57:57 UTC
That's the issue, I don't see it being sandboxed. I launch it from the terminal with ./spectacle from the /usr/bin folder. spectacle file there is an executable, not some link or shell script. Also in the System activity, I don't see it launched with some options. I don't think it is sandboxed, I removed the AppArmor profile from firejail and it is neither loaded nor active. AFAIK AppArmor profile and changing of executables with links to firejail executable is how it works. I've disabled this and still I have this issue. Is there some way (say a log...) I could diagnose what's blocking it?
Comment 4 Lyubomir 2022-03-22 19:08:14 UTC
I've opened this discussion about FireJail: https://github.com/netblue30/firejail/discussions/5063
Comment 5 Lyubomir 2022-03-23 19:55:27 UTC
Removing the .desktop file that was converted by Firejail fixed it! Strange as I was not using the .desktop but was launching directly using the terminal, I think the command inside the .desktop file should not have been executed...
Comment 6 Nate Graham 2022-03-23 22:56:22 UTC
I had a feeling it was going to be something like that. :)