nix-community / plasma-manager

Manage KDE Plasma with Home Manager
https://nix-community.github.io/plasma-manager/
MIT License
589 stars 67 forks source link

Shortcuts are non-functional #109

Open Titaniumtown opened 5 months ago

Titaniumtown commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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

Titaniumtown commented 5 months ago

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

hotkeys.commands."alacritty" = {
    name = "Launch Alacritty";
    key = "Ctrl+Alt+T";
    command = "alacritty";
   };
SnowyCoder commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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

magnouvean commented 5 months ago

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 commented 5 months ago

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

magnouvean commented 5 months ago

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

magnouvean commented 5 months ago

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

reinux commented 2 weeks ago

Having a similar issue with Alt+`, which I've been using to switch between Japanese/English in IME/fcitx5 for decades.

It's normally bound to "Walk Through Windows of Current Application", and even when I remove it in the UI, it immediately re-binds.

Edit: in my case, it seems plasma-manager works and you can't override it through the UI. So adding this to my nix config worked:

      "kwin"."Walk Through Windows of Current Application" = "none,,Walk Through Windows of Current Application";