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

Shortcuts are non-functional #109

Open
Titaniumtown opened this issue Apr 1, 2024 · 15 comments
Open

Shortcuts are non-functional #109

Titaniumtown opened this issue Apr 1, 2024 · 15 comments

Comments

@Titaniumtown
Copy link

Titaniumtown commented Apr 1, 2024

I can't get shortcuts to work at all, I have this in the plasma config:

  shortcuts = {
    "services/org.kde.konsole.desktop"."_launch" = [];
    "services/Alacritty.desktop"."New" = "Ctrl+Alt+T";
    "services/Alacritty.desktop"."_launch" = "Ctrl+Alt+T";
  };

(I put both "New" and "_launch" and tried just either or, same result)

Inside of .config/kglobalshortcutsrc it results in:

[services][Alacritty.desktop]
New=
_launch=

[services][org.kde.konsole.desktop]
_launch=

I've deleted all kde/plasma configs and regenerated from home manager, I can't get this to work. I'm on plasma 6.

I've also tried:

  hotkeys.commands."alacritty" = {
    name = "Launch Alacritty";
    key = "Ctrl+Alt+T";
    command = "alacritty";
  };

...and I try doing "Ctrl+Alt+T", nothing happens, or sometimes konsole opens.

@magnouvean
Copy link
Collaborator

Are you sure this is an issue with all shortcuts. One thing which may cause this could be that Ctrl+Alt+T is bound by kde beforehand, so it might be unset by kde for some reason due to it being a colliding keybinding. Have you also tried to add [$i] to the end of your keys, i.e. New[$i] and _launch[$i]. The shortcuts should in general be functional. I have them functional on my system (though I have overrideConfig enabled, so that could also impact the situation).

@Titaniumtown
Copy link
Author

Titaniumtown commented Apr 1, 2024

It seems to be an issue with only Ctrl+Alt+T, but this is the script I'm using to test: rm -frv .config/plasma* .config/k* .local/share/plasma* .gtkrc-2.0 && home-manager switch && systemctl reboot.
This should result in fresh plasma configs that plasma-manager modifies. This should work by default.

Testing your [$i] suggestion now...

@Titaniumtown
Copy link
Author

Titaniumtown commented Apr 1, 2024

Nope, [$i] doesn't work. I'm truly stumped. I can disable plasma-manager and then manually set the shortcut in system settings, but then that defeats the purpose of using this. It just opens konsole now

@magnouvean
Copy link
Collaborator

Yeah I tried a bit as well. There seems to be some weird behavior with this keybinding specifically which makes kde even ignore the fact that the keybinding is supposed to be immutable (that's what the $i is supposed to do). If this is the case I'm afraid it's difficult to do something about it as the problem is more on the kde side. I'll leave this issue open if someone finds some solution for this though.

@ChocolateLoverRaj
Copy link

ChocolateLoverRaj commented Apr 2, 2024

It works for me (but there are some extra commas, I'm not sure if the commas as ok). After deleting the file and running home-manager switch, these are the contents of the file:

[services][dev.warp.Warp.desktop]
_launch=Ctrl+Alt+T,,

[services][org.kde.konsole.desktop]
_launch=none,,

my config:

shortcuts = {
      "services/dev.warp.Warp.desktop"."_launch" = "Ctrl+Alt+T";
      "services/org.kde.konsole.desktop"."_launch" = [ ];
    };

I'm also on Plasma 6 btw

@Titaniumtown
Copy link
Author

...Somehow it works now. baffled. but im not complaining

@Titaniumtown
Copy link
Author

Nope, was a fluke.
Using this in the meantime:

hotkeys.commands."alacritty" = {
    name = "Launch Alacritty";
    key = "Ctrl+Alt+T";
    command = "alacritty";
   };

@Titaniumtown Titaniumtown reopened this Apr 2, 2024
@SnowyCoder
Copy link

Same problem here

Nope, was a fluke. Using this in the meantime:

hotkeys.commands."alacritty" = {
    name = "Launch Alacritty";
    key = "Ctrl+Alt+T";
    command = "alacritty";
   };

This does not work for me as Konsole always overwrites Ctrl+Alt+T.

I also tried to set shortcuts."services/org.kde.konsole.desktop"."_launch" = [ ]; but it doesn't stop Konsole

@bb010g
Copy link

bb010g commented Apr 2, 2024

The kdeglobalshortsrc services/* groups can't have trailing commas. Those either need to be special-cased in config.programs.plasma.shortcuts by plasma-manager or moved to under config.programs.plasma.configFile."kglobalshortcutsrc" in user configs. See also #108. Here's a snippet from my current config:

{
  config.programs.plasma.configFile = [
    "kglobalshortcutsrc"."services/org.kde.krunner.desktop"."_launch".value = builtins.concatStringsSep "\t" [ "Meta+F2" "Meta+D" ];
  ];
}

I don't know if a leading \t would be preferred here (I didn't see documentation explaining why plasma-manager currently uses one), but I haven't seen systemsettings write a config value with one, so this matches that.

Personally, I'd like to see services/* groups be handled under programs.plasma.shortcuts by plasma-manager.

@magnouvean
Copy link
Collaborator

magnouvean commented Apr 2, 2024

We could handle that. Does this fix the problem at hand though? From my experience kde usually corrects this automatically on login. Another difficulty is that the shortcuts module needs to be able to write to services and non-services groups, though handling them differently (like not adding a comma when in the services group) shouldn't be very hard.

Note: handling services/* should already be possible, just use services/your_group as the group for the shortcuts module

@ChocolateLoverRaj
Copy link

My Ctrl+Alt+T stopped working btw. I think it's because of those extra commas.

@magnouvean
Copy link
Collaborator

We can fix the commas issue easily (I'll do it when I get time), but I haven't seen much that indicates that this would allow us to bind Ctrl+Alt+T to whatever we want (after all the configFile solution doesn't insert extra commas at all and it still doesn't work)

@ChocolateLoverRaj
Copy link

Why won't it work? It works for me if I change settings with the KDE GUI

@magnouvean
Copy link
Collaborator

Don't really know from my testing. Could be something more the gui does than just write those lines to file

@magnouvean
Copy link
Collaborator

OK the trailing commas problem for the shortcuts module at least is fixed after #110. This probably still won't work though. If someone could find out what keys need to be set manually by only editing kglobalshortcutsrc or some other file to fix this we could take some actions, but if not this is probably on the kde side

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

No branches or pull requests

5 participants