This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Global Keyboard Shortcuts for KSnapshot

Tags: ksnapshot ksnapshot ksnapshot
(comma "," separated)
User avatar
fakd
Registered Member
Posts
203
Karma
0
OS
Hello,
I want to configure global shortcuts for KSnapshot:
  • Print Screen: Take screenshot of whole screen
  • Ctrl+Print Screen: Take screenshot of current/active window

How can I do this?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Fortunately KSnapshot supports arguments which allow it's behaviour to be changed easily.
You can create a key binding for Control + Print Screen by opening System Settings > Shortcuts & Gestures > Custom Shortcuts.

The options available to you for KSnapshot are:
Code: Select all
Options:
  -c, --current             Captures the window under the mouse on startup (instead of the desktop)
  --fullscreen              Captures the desktop
  --region                  Captures a region
  --freeregion              Captures a free region (not rectangular)
  --child                   Captures a part of windows


Setting the "Command/URL" on the "Action" tab to "ksnapshot <argument>" should suffice for both options you want to achieve.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
fakd
Registered Member
Posts
203
Karma
0
OS
Thanks, this worked. :)

bcooksley wrote:Fortunately KSnapshot supports arguments which allow it's behavior to be changed easily.
You can create a key binding for Control + Print Screen by opening System Settings > Shortcuts & Gestures > Custom Shortcuts.
...then make sure you do not have highlighted anything in the list (otherwise it will be created in there), hit Edit > New Group: KSnapshot, mark this group, hit Edit > New > Global Shortcut > Command/URL. Double Click the new entry to name it "Fullscreen", enter comment "Capture fullscreen", go to trigger tab, set Print as button, go to command enter "ksnapshot --fullscreen" and don't be confused that there is no auto completion for ksnapshot. Repeat for capture current window, *sweat* uh, done.
Here is the outcome:
Code: Select all
[Data]
DataCount=1

[Data_1]
Comment=Comment
DataCount=2
Enabled=true
Name=KSnapshot
SystemGroup=0
Type=ACTION_DATA_GROUP

[Data_1Conditions]
Comment=
ConditionsCount=0

[Data_1_1]
Comment=Capture fullscreen
Enabled=true
Name=Fullscreen
Type=SIMPLE_ACTION_DATA

[Data_1_1Actions]
ActionsCount=1

[Data_1_1Actions0]
CommandURL=ksnapshot --fullscreen\s
Type=COMMAND_URL

[Data_1_1Conditions]
Comment=
ConditionsCount=0

[Data_1_1Triggers]
Comment=Simple_action
TriggersCount=1

[Data_1_1Triggers0]
Key=Print
Type=SHORTCUT
Uuid={905ec94e-2b83-4a25-a1c0-8d72f3648f60}

[Data_1_2]
Comment=Capture active window
Enabled=true
Name=Window
Type=SIMPLE_ACTION_DATA

[Data_1_2Actions]
ActionsCount=1

[Data_1_2Actions0]
CommandURL=ksnapshot --current
Type=COMMAND_URL

[Data_1_2Conditions]
Comment=
ConditionsCount=0

[Data_1_2Triggers]
Comment=Simple_action
TriggersCount=1

[Data_1_2Triggers0]
Key=Ctrl+Print
Type=SHORTCUT
Uuid={10d739f5-1fb0-4d1d-a9e6-5cde503d4d56}

[Main]
AllowMerge=false
Version=2

If you save this code you should be able to import this directly in the custom shortcuts.

Also note I actually wanted to use Alt + Print (which I'm used to from Windoze), but apparently this isn't supported by Qt :-/ ...


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]