plasma-manager icon indicating copy to clipboard operation
plasma-manager copied to clipboard

Cannot assign Spectacle shortcuts to "Print"

Open Vaudrain opened this issue 1 year ago • 9 comments

Been tinkering with my setup for a while and it all seems to be going great! Just ran into one snag.

I am unable to assign any Spectacle shortcuts to "Print", as given as examples in modules/spectacle.nix. If I assign "Print", or any modifier set such as "Meta+Print" or "Shift+Control+Print" to any command (captureActiveWindow, captureCurrentMonitor etc.) it simply ignores it and uses the default value.

This doesn't happen if I use values like "Shift+I" or "Meta+Control+O", so it seems to be an issue with "Print" specifically.

Ideally, I'd like to use the line spectacle.shortcuts.captureRectangularRegion = "Print"; - but it's failing. Is this an issue with how I've been writing my config, or a bug?

Vaudrain avatar Apr 21 '24 10:04 Vaudrain

My guess would be that there are some conflicting keys (that is some other action which is bound to "Print"). That or that "Print" is the wrong value for the print key. If you set it manually, what is shown in kglobalshortcutsrc, and does this differ from what plasma-manager sets?

magnouvean avatar Apr 21 '24 14:04 magnouvean

Oddly, when I set the value manually the file is regenerated but remains exactly the same. In fact, if I manually change it, then change a Spectacle setting, it returns to that initial state regardless of what the change was.

As for the value, when I set a value like "Meta+Control+O" that shows up. When I set the value to "Print" nothing appears - a blank entry. When I don't set a value, "none" appears. For example:

[services][org.kde.spectacle.desktop]
ActiveWindowScreenShot=none
FullScreenScreenShot=Meta+Control+O
RecordRegion=none
RecordScreen=none
RecordWindow=none
RectangularRegionScreenShot=
WindowUnderCursorScreenShot=none
_launch=none

Vaudrain avatar Apr 21 '24 16:04 Vaudrain

Then this sounds like the Print key is used for some other action (it seems like launching spectacle). You will need to unbind this key manually in plasma-manager (for example using the shortcuts module) for other keys to be able to be bound to this key. Sadly there is no way for plasma-manager to unbind keys automatically due to how keybindings are handled in kde.

magnouvean avatar Apr 21 '24 17:04 magnouvean

Alrighty, that sounds reasonable, thank for the help so far! I've tried this, but I'm still running into issues:

shortcuts = {
  "services/org.kde.spectacle.desktop"."_launch" = "Meta+Shift+P";
};

spectacle.shortcuts = {
  captureRectangularRegion = "Print";
};

Is this the correct way to unbind, or does rebinding not also unbind? Notably, this changes the value of _launch in kglobalshortcutsrc, but Print still opens Spectacle rather than the rectangular region selector, and the Spectacle keybinds menu looks to show default values:

image

Vaudrain avatar Apr 21 '24 17:04 Vaudrain

You have done it correct. There is definitely something weird going on here. I don't really know where the problem is though, if it's a plasma-manager or kde issue with it not liking that some files are changed outside the settings app. There doesn't seem to be a good way of unbinding this key without it being reset for some reason. There are other keys which has had similar problems, namely Ctrl+Alt+T.

magnouvean avatar Apr 21 '24 18:04 magnouvean

Hrm, that is unfortunate. Thank you for the help!

Do you know where might be best to look if I try to troubleshoot further?

Vaudrain avatar Apr 21 '24 19:04 Vaudrain

I don't really have that many good places to look sadly :(. One thing to note though is that plasma-manager only really manages config-files, which means that for this to work you would need to find what modifications to the config-files you would need to make to unbind "Print". This could potentially be multiple places. I would suggest tracking differences in config-files when you change the key via the settings app (I have done this via git a couple of times for example).

magnouvean avatar Apr 22 '24 06:04 magnouvean

I can confirm I have a similar issue with Print (it resets every time even if I disable spectacle module) and Meta+R shortcuts (same here, but I set it to one outside of Spectacle module).

I will try troubleshooting it myself too, and write back if I found something new

jilinoleg avatar Apr 27 '24 05:04 jilinoleg

could it be related to https://bugs.kde.org/show_bug.cgi?id=484682?

ccatterina avatar May 12 '24 09:05 ccatterina