Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add screenshot options as application actions to desktop file #450

Closed
simonbcn opened this issue Oct 27, 2020 · 5 comments
Closed

Add screenshot options as application actions to desktop file #450

simonbcn opened this issue Oct 27, 2020 · 5 comments

Comments

@simonbcn
Copy link
Contributor

It would be very useful to add integration with KDE Plasma keyboard shortcuts. Currently this has to be done manually.

If I add the application to keyboard shortcuts but this is the options:
ksnip_20201027-155217

This only serves to launch the program. It does not give options to directly launch a screen/window/area shot.

@DamirPorobic
Copy link
Member

How do does KDE Plasma keyboard shortcuts work? Maybe it's just something supported for KDE applications. Despite the k at the beginning, ksnip doesn't belong to KDE, it just uses Qt like KDE.

@simonbcn
Copy link
Contributor Author

It's using the Desktop Entry Specification. In particular the "Additional applications actions": [Desktop Action .....].
This should also be valid and work with any other desktop environment.

For example, I have modified the desktop file to create these actions:

$ cat ~/.local/share/applications/org.ksnip.ksnip.desktop
[Desktop Entry]
Type=Application
Exec=ksnip
Icon=ksnip
Terminal=false
StartupNotify=false
Name=ksnip
GenericName=ksnip Screenshot Tool
Comment=Cross-platform screenshot tool that provides many annotation features for your screenshots.
Categories=Utility;
Actions=Area;FullScreen;Window;AreaDelay;

[Desktop Action Area]
Exec=ksnip -r
Icon=ksnip
Name=Capture a rectangular area

[Desktop Action FullScreen]
Exec=ksnip -m
Icon=ksnip
Name=Capture a fullscreen

[Desktop Action Window]
Exec=ksnip -a
Icon=ksnip
Name=Capture the focused window

[Desktop Action AreaDelay]
Exec=ksnip -r -d 3
Icon=ksnip
Name=Capture a rectangular area with delay 3s.

Now if I add the application to the KDE shortcuts I see this:
ksnip_20201028-094103

@DamirPorobic
Copy link
Member

That's nice, it looks like it's not directly related to plasma. Can you create a PR with the default actions that ksnip support (excluding for example the one with hardcoded delay)? Nice would be also a wiki entry on how to create your own actions in case someone want to do that.

@simonbcn
Copy link
Contributor Author

Done PR: #451

About wiki entry is easy:

Copy .desktop file from system to user: cp /usr/share/applications/org.ksnip.ksnip.desktop ~/.local/share/applications/
Edit user file (~/.local/share/applications/org.ksnip.ksnip.desktop) and add unique name for the custom action in the Actions= field of the .desktop file and add the new action to the end of the user .desktop file:

...
Actions=Area;LastArea;FullScreen;Window;<NewActionName>;
...
[Desktop Action <NewActionName>]
Exec=ksnip <option to execute>
Icon=ksnip
Name=<Descriptive name of the action>

@DamirPorobic DamirPorobic changed the title To add integration with KDE Plasma keyboard shortcuts Add application actions to desktop file Oct 28, 2020
@DamirPorobic DamirPorobic changed the title Add application actions to desktop file Add screenshot options as application actions to desktop file Oct 28, 2020
@DamirPorobic
Copy link
Member

Wiki entry added https://github.com/ksnip/ksnip/wiki/Desktop-Integration

Thanks again for implementing this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants