GoofCord icon indicating copy to clipboard operation
GoofCord copied to clipboard

[REQUEST] Add global keybind/PTT support

Open voyantt opened this issue 1 year ago • 2 comments

Description

Currently the client thinks it's ran in a browser and doesn't allow the use of keybinds.

Use Case

I use keybinds on the daily for muting/unmuting myself while in-game and it's the sole thing that prevents my switch from discord.

Describe alternatives you've considered

Additional context

voyantt avatar May 17 '24 18:05 voyantt

Are you talking about push to talk or Ctrl+Shift+M for toggling mute?

Milkshiift avatar Jun 22 '24 18:06 Milkshiift

Are you talking about push to talk or Ctrl+Shift+M for toggling mute?

I'm talking about this: image

voyantt avatar Jun 26 '24 16:06 voyantt

Hello, I don't mean to necro-bump but since the issue is still open... the folks over at Vesktop got this working recently, see https://github.com/Vencord/Vesktop/pull/326. Maybe that can help with this?

spslabo avatar Mar 08 '25 19:03 spslabo

Yes, it definitely will. This hasn't been implemented because something like Venbind didn't really exist before.

Milkshiift avatar Mar 08 '25 21:03 Milkshiift

It seems keybinds aren't working outside of goofcord like being in Firefox or a video game, is this supposed to be normal behaviour?

pollux78 avatar Apr 16 '25 15:04 pollux78

What OS and CPU architecture are you on?

Milkshiift avatar Apr 16 '25 16:04 Milkshiift

I'm having the same issue, I am on Arch Linux (KDE) and AMD Ryzen 9 5950X 16-Core Processor, x64. I need to have Goofcord selected in order for Push-to-Talk to work.

Edit: In the Shortcuts section in KDE settings I have the below setup:

Image

Goofcord console returns:

VM23 node:events:518  GoofCord   Keybind not found: Push To Talk
Q	@	preload.mjs:1
K	@	preload.mjs:1
(anonymous)	@	preload.mjs:146
emit	@	VM23 node:events:518
onMessage	@	VM113 renderer_init:2

spslabo avatar Apr 16 '25 21:04 spslabo

I am having the same issue with global keybindings. From the error I am seeing, I believe it may be a config error on my end but I am unable to figure out how to fix it: venbind error: ashpd error: Portal request didn't succeed: Cancelled P.S. should we move this into an issue instead of this PR?

OS: Gentoo CPU Arch: Ryzen 7 7700x x86_64

nishiiko avatar Apr 17 '25 00:04 nishiiko

What OS and CPU architecture are you on?

Cachyos, kde plasma, Zen 4/Ryzen 7600, Flatpak goofcord

I'm using shift + fn2 for toggle muting and as you can see when i click outside of the app and try to do it, it wont do it but does it fine within goofcord, i made sure that it created a shortcut in kdes shortcut setting also, i also deleted goofcord fully just to see if it was a config issue and i dont think it is

https://github.com/user-attachments/assets/a2a1dd96-c87a-4709-bb6a-39a7a8d36dcb

Image

pollux78 avatar Apr 17 '25 02:04 pollux78

@polluxau You need to add a shortcut in KDE's Shortcuts window for Toggle Mute. That shortcut is the one that should work outside GoofCord.

Milkshiift avatar Apr 17 '25 07:04 Milkshiift

@polluxau You need to add a shortcut in KDE's Shortcuts window for Toggle Mute. That shortcut is the one that should work outside GoofCord.

oh i see, it works now thank you!

shouldn't it do that by default tho for the user as thats confusing in my opinion

pollux78 avatar Apr 17 '25 07:04 pollux78

shouldnt it do that by default tho for the user as thats confusing in my opinion

That is how it works on Windows and X11. On Wayland, apps can't grab global keys directly to prevent keylogging. For that GoofCord needs to use the GlobalShortcuts portal which allows apps to request shortcuts, which the desktop environment then manages and asks the user to approve.

Milkshiift avatar Apr 17 '25 07:04 Milkshiift

I am having the same issue with global keybindings. From the error I am seeing, I believe it may be a config error on my end but I am unable to figure out how to fix it: venbind error: ashpd error: Portal request didn't succeed: Cancelled P.S. should we move this into an issue instead of this PR?

OS: Gentoo CPU Arch: Ryzen 7 7700x x86_64

@nishiiko Your desktop environment probably doesn't support the GlobalShortcuts portal. If you are using a Wayland compositor, you can bind the desired keybinds to CLI triggers. Quote from 1.9.0 changelog:

If you are on Linux and your desktop environment does not support the GlobalShortcuts portal, you can manually bind your desired keybinds to CLI triggers: goofcord --keybind-up="<keybind id>", goofcord --keybind-down="<keybind id>" . You can get the id by opening DevTools (Ctrl+Shift+I), going to Console tab and modifying/adding a keybind. You should see an Array in the console which contains registered keybind ids. This process is temporary and will be improved in future versions.

Milkshiift avatar Apr 17 '25 07:04 Milkshiift

shouldnt it do that by default tho for the user as thats confusing in my opinion

That is how it works on Windows and X11. On Wayland, apps can't grab global keys directly to prevent keylogging. For that GoofCord needs to use the GlobalShortcuts portal which allows apps to request shortcuts, which the desktop environment then manages and asks the user to approve.

i see, im pretty sure kde plasma is updating their ui for these shortcuts for user approval as it doesnt really do that right now and instead just spawns the shortcut setting page with no context so made it confusing, thanks for the help and context!

https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/368

pollux78 avatar Apr 17 '25 07:04 pollux78

If you are on Linux and your desktop environment does not support the GlobalShortcuts portal, you can manually bind your desired keybinds to CLI triggers: goofcord --keybind-up="", goofcord --keybind-down="" . You can get the id by opening DevTools (Ctrl+Shift+I), going to Console tab and modifying/adding a keybind. You should see an Array in the console which contains registered keybind ids. This process is temporary and will be improved in future versions.

I got it working with this instead, thanks I have a question though, whats the difference between --keybind-down vs --keybind-up? The keybinds seem to only work with --keybind-up for me.

nishiiko avatar Apr 17 '25 07:04 nishiiko

I got it working with this instead, thanks I have a question though, whats the difference between --keybind-down vs --keybind-up? The keybinds seem to only work with --keybind-up for me.

Most Discord keybinds are triggered when you release a keybind, not press it. --keybind-down is only needed for push to talk which activates on key down.

Is this is confusing and you don't use push to talk, GoofCord also accepts just --keybind= which acts as --keybind-up

Milkshiift avatar Apr 17 '25 07:04 Milkshiift

I was able to get it to work by using a key combination (Alt+1) in Goofcord > Keybinds. Then on Global Shortcuts portal, Goofcord>Add the custom shortcut. I would get a "keybind not found" error any other method.

Also I noticed that Push-to-Talk does not seem to be working correctly, the mic does not stay on when holding the key down, it flashes for < 1s on the initial key push.

spslabo avatar Apr 17 '25 10:04 spslabo