Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Shortcuts for Actions can be made global and non-global per config #823

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

Closed
pintassilgo opened this issue Feb 23, 2022 · 12 comments
Closed
Assignees

Comments

@pintassilgo
Copy link

pintassilgo commented Feb 23, 2022

In Actions, it only makes sense for the shortcut to be global if Take capture is checked, because every other action presumes main/Editor window to be active.

Apparently, shortcuts from Actions inherit Enable Global HotKeys state from HotKeys tab in Settings.

For instance, I'd like to use Ctrl+C as action to Copy image to Clipboard + Hide Main Window. But this breaks Ctrl+C for all applications because ksnip set the shortcut as global and there is no per-action setting about this. So I need to uncheck Enable Global HotKeys. But then I can't use global shortcuts like Print Screen to capture rect area.

My current workaround for this is to uncheck Enable Global HotKeys and don't set hotkeys like Print Screen in ksnip. Instead, I have set these global shortcuts through Plasma System Settings. But I just noticed that shortcuts defined that way don't follow ksnip delay, screenshot is always taken immediately (or, as you know, with implicit 200ms).

@DamirPorobic
Copy link
Member

It's not a bug, it was programmed like that but I see you point. As a short therm solution we could add a checkbox that defines if it's a global shortcut or not on the action itself. Binding it to the Capture is kind of hidden and might not be obvious.

But I just noticed that shortcuts defined that way don't follow ksnip delay, screenshot is always taken immediately

Yes, the Plasma shortcuts trigger ksnip via command line and you have to provide a delay there via flag.

@pintassilgo
Copy link
Author

As a short therm solution we could add a checkbox that defines if it's a global shortcut or not on the action itself. Binding it to the Capture is kind of hidden and might not be obvious.

Agreed. For me that's the best solution.

@DamirPorobic
Copy link
Member

Just looking at the code, it looks like the Global Hotkey is only active when Captures are enabled, so actually the one proposal you had :/

@pintassilgo
Copy link
Author

pintassilgo commented Feb 28, 2022

It's not that way, for sure. You can try it. For instance, create an Action with Ctrl+C as shortcut and these two options checked: Copy image to Clipboard and Hide Main Window. Also, make sure Enable Global HotKeys is enabled in HotKeys tab.

Then try to use Ctrl+C to copy something in other window like your web browser. It won't work. Because Ctrl+C is now globally assigned to ksnip.

Then you uncheck Enable Global HotKeys and now Ctrl+C works as it should, running only on ksnip window. without affecting others.

@DamirPorobic
Copy link
Member

Yes, I see it's not work but the code is there. I'm trying to figure out why it's not working.

@DamirPorobic DamirPorobic self-assigned this Feb 28, 2022
@DamirPorobic DamirPorobic changed the title Shortcut for Actions without "Take Capture" shouldn't be global Shortcuts for Actions can be made global and non-global per config Feb 28, 2022
@DamirPorobic
Copy link
Member

Nope, that was just a strangely named variable covering a different use case. I have added a checkbox, next to the shortcut which allows making a shortcut global and non-global. When you test it, have a look if the default setting for existing actions is "Global -> Enabled"

@pintassilgo
Copy link
Author

Thank you. I'll wait the AppImage to try, because building the git is not working for me.

@DamirPorobic
Copy link
Member

What do you think about the position of the checkbox, is it understandable?

@pintassilgo
Copy link
Author

Unfortunately I still couldn't test, AppImage is not available.

https://github.com/ksnip/ksnip/releases/tag/continuous

@DamirPorobic
Copy link
Member

Bummer, I've retriggered the pipeline, let's see if it works now, it needs a couple of minutes.

@pintassilgo
Copy link
Author

Perfect! Thank you. This bug is fixed. Yes, the checkbox is suitable.

Should I close this issue and the other one about 0 delay?

@DamirPorobic
Copy link
Member

Thanks for testing!

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