Make Spectacle launch faster

After pressing the PrtSc key, Spectacle takes about 1.5-2 s to launch. On the contrary, when I used Mint as my daily driver (X11), Flameshot launched almost instantly.

Can the startup time be improved somehow?

P.S. I am using Fedora KDE 42 on Wayland.

2 Likes

Mine starts up almost instantly, on my 2017 -i5 thin client PC (intel graphics)

It opens with the same speed in X11. Say ~.5 seconds, probably less. Measuring is hard without correct tools.

Even though it opens fairly quickly imo, I can’t unsee the tiny pause now :frowning:

I thought that animation speed might be a factor here, but it is not for Spectacle.

1 Like

Was flameshot not permanently running in the tray?

But yes, spectacle is known for having some startup time - which might be critical for capturing moving targets (video, gaming or whatever). I think mine’s taking about 1/3s up to 1so there’s obviously some significant loading headroom - possibly something to do with loading fonts or opengl.

that does seem overly long,

mine is not instant either but its well under 1000ms, probably more in the 200-500ms range.

and now i can’t unsee it either, thanks.

1 Like

Normally, for static screens, it’s not a big deal.

However, you can get it faster; I have an issue that my PrScr in a Fn key (Fn_PgUp) so to do Meta with Fn key will lock my Meta key (can’t adjust that)…

So I made Meta Alt PgDn snap the screen and give me a cursor to select a region. Now THAT is instant… and there are options to capture the screenshot with no interaction at all, so you can just snap the whole desk, or current window, without any interference - then edit later.

No, I made sure to check if the process is running in System Monitor before pressing the key. I had mapped the PrtSc key to open Flameshot in Mint. In fact, I’d like to reconsider my statement: it didn’t launch “almost instantly”, it was instant.

As a workaround we also can use –dbus command line flag and a systemd service. For example:

[Unit]
Description=Run spectacle in background
PartOf=graphical-session.target
After=graphical-session.target
Requisite=graphical-session.target

[Service]
Type=simple
ExecStart=/usr/bin/spectacle --dbus
Restart=always

[Install]
WantedBy=graphical-session.target

Restart=always is necessary because spectacle exits every time screenshot was taken. On the other hand, it’s 200MiB of used RAM (well, at least on my machine). Now it opens and takes screenshots instantly

1 Like

Well, after some time using it I noticed that Plasma cannot properly log out of session with this service enabled and running. Just change graphical-session.target to plasma-workspace.target and logout should work properly.

it’s 200MiB of used RAM (well, at least on my machine)

It is less than 50MiB, actually

1 Like

can you elaborate some on this option?

where does this text file go?

does it go in /etc/systemd/

with a name like something_you_will_remember.conf

and that will start spectacle upon login and keep it open by restarting it if it’s closed?

$HOME/.config/systemd/user/spectacle.service

and that will start spectacle upon login and keep it open by restarting it if it’s closed?

Yes.

1 Like

i have a folder already named

~/.config/systemd/user/graphical-session.target.wants

should the spectacle.service file go in there, or does it matter?

It does matter.

graphical-session.target.wants usually contains user level services, which depends on graphical-session.target. It is kinda dependency resolver for systemd.

Speaking of spectacle.service, any user written services should be in the root of user level systemd folder, AKA $HOME/.config/systemd/user/<my_unit>.<service|timer|mount|whatever>, so spectacle.service must be in there

as so?

[Unit]
Description=Run spectacle in background
PartOf=plasma-workspace.target
After=plasma-workspace.target
Requisite=plasma-workspace.target

[Service]
Type=simple
ExecStart=/usr/bin/spectacle --dbus
Restart=always

[Install]
WantedBy=plasma-workspace.target