Linux Apps PTT

OP
E

e_playssss

Member
Joined
Jun 1, 2023
Messages
64
Reaction score
0
Credits
381
Yes, you can use the following configuration to set push-to-talk in Discord using the Control_R key:

Code:
#Push-to-talk in Discord using Control_R
ctrl + Control_R
    xdotool search --class discord keydown Control_R
ctrl + Control_R + Release
    xdotool search --class discord keyup Control_R

This configuration binds the Control_R key to both keydown and keyup events for the push-to-talk keybinding in Discord.

Remember to save the changes you make to the ~/.config/sxhkd/sxhkdrc file and apply them by restarting sxhkd or typing the command pkill -USR1 -x sxhkd in the terminal.

I hope this works for you! Let me know if you have any other questions.
So I used the pkill -USR1 -x sxhkd command after I wrote it what do I do now?
Do I restart Discord?
 


TuxBot

Well-Known Member
Staff member
Joined
Mar 26, 2023
Messages
1,136
Reaction score
234
Credits
14,065
So I used the pkill -USR1 -x sxhkd command after I wrote it what do I do now?
Do I restart Discord?
After you use the pkill -USR1 -x sxhkd command to reload the sxhkd configuration file, the new keybinding should be active in Discord immediately.

You don't need to restart Discord or any other application for the new keybinding to take effect. Just press the Control_R key in Discord to test if the push-to-talk function is working as expected.

If it's not working, make sure that the Discord window is active and in focus when you press the Control_R key. You can also try modifying the keybinding by using a different key or a combination of keys.

Let me know if you have any other questions or issues!
 
OP
E

e_playssss

Member
Joined
Jun 1, 2023
Messages
64
Reaction score
0
Credits
381
After you use the pkill -USR1 -x sxhkd command to reload the sxhkd configuration file, the new keybinding should be active in Discord immediately.

You don't need to restart Discord or any other application for the new keybinding to take effect. Just press the Control_R key in Discord to test if the push-to-talk function is working as expected.

If it's not working, make sure that the Discord window is active and in focus when you press the Control_R key. You can also try modifying the keybinding by using a different key or a combination of keys.

Let me know if you have any other questions or issues!
So the command works when I have the discord window open but I need it to work when it's minimized.
 

TuxBot

Well-Known Member
Staff member
Joined
Mar 26, 2023
Messages
1,136
Reaction score
234
Credits
14,065
So the command works when I have the discord window open but I need it to work when it's minimized.
If you want to use the push-to-talk keybinding in Discord even when the window is minimized or inactive, you can use a different tool called xdotool that allows you to manipulate windows and keystrokes at the X11 level.

Here's an example of a modified keybinding for push-to-talk in Discord that uses xdotool to send the keystrokes to the Discord window even when it's minimized or inactive:

Code:
#Push-to-talk in Discord using Control_R with xdotool
ctrl + Control_R
	xdotool search --class Discord windowactivate --sync key Control_R

In this configuration, the keybinding uses the xdotool command to first activate the Discord window by the window class name (Discord) and then simulate the keypress of the Control_R key.

Note that this configuration requires the xdotool package to be installed on your system. You can install it using your package manager, for example, on Ubuntu or Debian, you can use the following command:

Code:
sudo apt-get install xdotool

With this configuration, the push-to-talk keybinding should work even when the Discord window is minimized or inactive.

Let me know if you have any other questions or issues!
 
OP
E

e_playssss

Member
Joined
Jun 1, 2023
Messages
64
Reaction score
0
Credits
381
If you want to use the push-to-talk keybinding in Discord even when the window is minimized or inactive, you can use a different tool called xdotool that allows you to manipulate windows and keystrokes at the X11 level.

Here's an example of a modified keybinding for push-to-talk in Discord that uses xdotool to send the keystrokes to the Discord window even when it's minimized or inactive:

Code:
#Push-to-talk in Discord using Control_R with xdotool
ctrl + Control_R
    xdotool search --class Discord windowactivate --sync key Control_R

In this configuration, the keybinding uses the xdotool command to first activate the Discord window by the window class name (Discord) and then simulate the keypress of the Control_R key.

Note that this configuration requires the xdotool package to be installed on your system. You can install it using your package manager, for example, on Ubuntu or Debian, you can use the following command:

Code:
sudo apt-get install xdotool

With this configuration, the push-to-talk keybinding should work even when the Discord window is minimized or inactive.

Let me know if you have any other questions or issues!
So I wrote it like this
Screenshot 2023-06-01 14.08.54.png
It's still not working when minimized
 

TuxBot

Well-Known Member
Staff member
Joined
Mar 26, 2023
Messages
1,136
Reaction score
234
Credits
14,065
So I wrote it like this View attachment 15896 It's still not working when minimized
The sxhkd configuration that you have written seems to be correct. However, if the push-to-talk keybinding is still not working when Discord is minimized, it's possible that Discord is running in a minimized state that may not be detected by xdotool.

You can try adding the search --name option to the xdotool command in your sxhkd configuration to search for the Discord window by its name, instead of its class, like this:

Code:
#Push-to-talk in Discord using Control_R with xdotool
ctrl + Control_R
    xdotool search --name "Discord" windowactivate --sync key Control_R

This configuration should activate the Discord window by its name, regardless of its current state or focus, and then simulate the keypress of the Control_R key.

Also, make sure that the Discord window title is set to "Discord" and not something else, as this may affect the window detection by name.

Let me know if this works for you or if you have any other questions or issues!
 
OP
E

e_playssss

Member
Joined
Jun 1, 2023
Messages
64
Reaction score
0
Credits
381
The sxhkd configuration that you have written seems to be correct. However, if the push-to-talk keybinding is still not working when Discord is minimized, it's possible that Discord is running in a minimized state that may not be detected by xdotool.

You can try adding the search --name option to the xdotool command in your sxhkd configuration to search for the Discord window by its name, instead of its class, like this:

Code:
#Push-to-talk in Discord using Control_R with xdotool
ctrl + Control_R
    xdotool search --name "Discord" windowactivate --sync key Control_R

This configuration should activate the Discord window by its name, regardless of its current state or focus, and then simulate the keypress of the Control_R key.

Also, make sure that the Discord window title is set to "Discord" and not something else, as this may affect the window detection by name.

Let me know if this works for you or if you have any other questions or issues!
Screenshot 2023-06-01 14.14.38.png
It's still not working???
 

TuxBot

Well-Known Member
Staff member
Joined
Mar 26, 2023
Messages
1,136
Reaction score
234
Credits
14,065
View attachment 15897It's still not working???
If the xdotool option to activate the Discord window by name is not working when Discord is minimized, you can try adding a small delay between the window activation and the keypress simulation. This can give Discord enough time to fully restore its window and input handling.

Here's an example of a modified keybinding that adds a delay of 500 milliseconds between window activation and keypress simulation:

Code:
#Push-to-talk in Discord using Control_R with xdotool and delay
ctrl + Control_R
    xdotool search --name "Discord" windowactivate --sync sleep 0.5 key Control_R

In this configuration, the sleep option adds a delay of 500 milliseconds (0.5 seconds) before simulating the keypress of the Control_R key.

Note that the delay value can be adjusted based on your system performance and Discord settings. You can increase or decrease the delay value to optimize the keybinding for your system.

Let me know if this works for you or if you have any other questions or issues!
 
OP
E

e_playssss

Member
Joined
Jun 1, 2023
Messages
64
Reaction score
0
Credits
381
If the xdotool option to activate the Discord window by name is not working when Discord is minimized, you can try adding a small delay between the window activation and the keypress simulation. This can give Discord enough time to fully restore its window and input handling.

Here's an example of a modified keybinding that adds a delay of 500 milliseconds between window activation and keypress simulation:

Code:
#Push-to-talk in Discord using Control_R with xdotool and delay
ctrl + Control_R
    xdotool search --name "Discord" windowactivate --sync sleep 0.5 key Control_R

In this configuration, the sleep option adds a delay of 500 milliseconds (0.5 seconds) before simulating the keypress of the Control_R key.

Note that the delay value can be adjusted based on your system performance and Discord settings. You can increase or decrease the delay value to optimize the keybinding for your system.

Let me know if this works for you or if you have any other questions or issues!
Screenshot 2023-06-01 14.16.51.png
Still not working could it be because I installed discord on linux???
 

TuxBot

Well-Known Member
Staff member
Joined
Mar 26, 2023
Messages
1,136
Reaction score
234
Credits
14,065
View attachment 15898Still not working could it be because I installed discord on linux???
It's possible that the issue is related to your installation of Discord on Linux. You can try reinstalling Discord or checking if there are any updates available for your distribution.

Alternatively, you can try using a different tool to simulate keystrokes in Discord, such as AutoKey or xte. These tools may have better compatibility with Discord or your specific system configuration.

Here's an example of a keybinding for push-to-talk in Discord using xte:

Code:
#Push-to-talk in Discord using Control_R with xte
ctrl + Control_R
    sh -c "xte 'keydown Control_R' 'keyup Control_R'"

In this configuration, the keybinding uses the xte command to simulate the keypress of the Control_R key, regardless of the current state or focus of the Discord window.

Note that the sh -c option is used to execute the xte command in a new shell instance, in case there are any environment or permission issues.

Let me know if this works for you, or if you have any other issues or questions!
 
OP
E

e_playssss

Member
Joined
Jun 1, 2023
Messages
64
Reaction score
0
Credits
381
It's possible that the issue is related to your installation of Discord on Linux. You can try reinstalling Discord or checking if there are any updates available for your distribution.

Alternatively, you can try using a different tool to simulate keystrokes in Discord, such as AutoKey or xte. These tools may have better compatibility with Discord or your specific system configuration.

Here's an example of a keybinding for push-to-talk in Discord using xte:

Code:
#Push-to-talk in Discord using Control_R with xte
ctrl + Control_R
    sh -c "xte 'keydown Control_R' 'keyup Control_R'"

In this configuration, the keybinding uses the xte command to simulate the keypress of the Control_R key, regardless of the current state or focus of the Discord window.

Note that the sh -c option is used to execute the xte command in a new shell instance, in case there are any environment or permission issues.

Let me know if this works for you, or if you have any other issues or questions!
Still not working.
 

TuxBot

Well-Known Member
Staff member
Joined
Mar 26, 2023
Messages
1,136
Reaction score
234
Credits
14,065
Still not working.
If the keybinding is not working with xte either, it's possible that Discord is not properly receiving the key events or that there is some configuration issue.

You can try using the xev tool to monitor the X events generated by the Control_R key and see if they are properly received by Discord.

Here's how you can use xev to monitor the events:

1. Open a terminal window and run the command xev
2. Move the cursor to the xev window and press the Control_R key
3. Check the output in the xev window for any errors or ignored events
4. If the events are properly received by xev, then Discord may have some configuration or compatibility issues.

If the events are not properly received by xev, then the issue may be related to your system or hardware.

Let me know the output of xev or if you have any other questions or issues!
 
OP
E

e_playssss

Member
Joined
Jun 1, 2023
Messages
64
Reaction score
0
Credits
381
If the keybinding is not working with xte either, it's possible that Discord is not properly receiving the key events or that there is some configuration issue.

You can try using the xev tool to monitor the X events generated by the Control_R key and see if they are properly received by Discord.

Here's how you can use xev to monitor the events:

1. Open a terminal window and run the command xev
2. Move the cursor to the xev window and press the Control_R key
3. Check the output in the xev window for any errors or ignored events
4. If the events are properly received by xev, then Discord may have some configuration or compatibility issues.

If the events are not properly received by xev, then the issue may be related to your system or hardware.

Let me know the output of xev or if you have any other questions or issues!
So the PTT works when I have the xev window open but when I minimize it it no longer activates..
 

TuxBot

Well-Known Member
Staff member
Joined
Mar 26, 2023
Messages
1,136
Reaction score
234
Credits
14,065
So the PTT works when I have the xev window open but when I minimize it it no longer activates..
If the PTT keybinding works when the xev window is open but not when it's minimized, it's possible that the xev window is preventing Discord from receiving the key events when it's not focused.

You can try using the xdotool command to focus the Discord window along with the xte command to simulate the key events, like this:

Code:
# Push-to-talk in Discord using Control_R with xdotool and xte
ctrl + Control_R
    xdotool search --name "Discord" windowactivate --sync \
        key Control_R || true
    sleep 0.1 && \
        sh -c "xte 'keydown Control_R' 'keyup Control_R'" &

In this configuration, the keybinding uses the xdotool command to activate the Discord window and then uses the xte command to simulate the key events of the Control_R key.

Note that the sleep command is added to allow some time for the window activation to complete. The || true option is added to ignore the error if the Discord window is not found.

Let me know if this works for you, or if you have any other issues or questions!
 
OP
E

e_playssss

Member
Joined
Jun 1, 2023
Messages
64
Reaction score
0
Credits
381
If the PTT keybinding works when the xev window is open but not when it's minimized, it's possible that the xev window is preventing Discord from receiving the key events when it's not focused.

You can try using the xdotool command to focus the Discord window along with the xte command to simulate the key events, like this:

Code:
# Push-to-talk in Discord using Control_R with xdotool and xte
ctrl + Control_R
    xdotool search --name "Discord" windowactivate --sync \
        key Control_R || true
    sleep 0.1 && \
        sh -c "xte 'keydown Control_R' 'keyup Control_R'" &

In this configuration, the keybinding uses the xdotool command to activate the Discord window and then uses the xte command to simulate the key events of the Control_R key.

Note that the sleep command is added to allow some time for the window activation to complete. The || true option is added to ignore the error if the Discord window is not found.

Let me know if this works for you, or if you have any other issues or questions!
Screenshot 2023-06-01 14.26.13.png
Is this written correctly??
If so it's still not working when the xev window is minimize.
 

TuxBot

Well-Known Member
Staff member
Joined
Mar 26, 2023
Messages
1,136
Reaction score
234
Credits
14,065
View attachment 15899Is this written correctly??
If so it's still not working when the xev window is minimize.
Yes, the keybinding configuration using xdotool and xte that I provided should be correct. If it's still not working when the xev window is minimized, there may be some other configuration or compatibility issue.

You can try a few more troubleshooting steps:

1. Make sure that the Discord window is fully restored and focused when you try to use the PTT keybinding. If the window is not fully restored, the key events may not be processed properly.

2. Try running Discord with administrative privileges using the sudo command, in case there are any permission or security issues that are preventing the key events from being processed.

3. Try using a different key combination for the PTT keybinding, in case the Control_R keybinding is conflicting with another application or system function.

Let me know if any of these steps works for you, or if you have any other questions or issues!
 
OP
E

e_playssss

Member
Joined
Jun 1, 2023
Messages
64
Reaction score
0
Credits
381
Yes, the keybinding configuration using xdotool and xte that I provided should be correct. If it's still not working when the xev window is minimized, there may be some other configuration or compatibility issue.

You can try a few more troubleshooting steps:

1. Make sure that the Discord window is fully restored and focused when you try to use the PTT keybinding. If the window is not fully restored, the key events may not be processed properly.

2. Try running Discord with administrative privileges using the sudo command, in case there are any permission or security issues that are preventing the key events from being processed.

3. Try using a different key combination for the PTT keybinding, in case the Control_R keybinding is conflicting with another application or system function.

Let me know if any of these steps works for you, or if you have any other questions or issues!
I tried both 1 and 3 what's the sudo command for discord??
 

TuxBot

Well-Known Member
Staff member
Joined
Mar 26, 2023
Messages
1,136
Reaction score
234
Credits
14,065
I tried both 1 and 3 what's the sudo command for discord??
You can use the following command to run Discord with administrative privileges using the sudo command:

Code:
sudo -H discord

The -H option is used to set the HOME environment variable to the home directory of the targeted user (in this case, the root user).

Note that running Discord with administrative privileges is not recommended for security reasons, as it can potentially expose your system to security risks. You should only use this as a temporary troubleshooting step and make sure to revert back to regular user privileges once the issue is resolved.

Let me know if this helps or if you have any other issues or questions!
 
OP
E

e_playssss

Member
Joined
Jun 1, 2023
Messages
64
Reaction score
0
Credits
381
You can use the following command to run Discord with administrative privileges using the sudo command:

Code:
sudo -H discord

The -H option is used to set the HOME environment variable to the home directory of the targeted user (in this case, the root user).

Note that running Discord with administrative privileges is not recommended for security reasons, as it can potentially expose your system to security risks. You should only use this as a temporary troubleshooting step and make sure to revert back to regular user privileges once the issue is resolved.

Let me know if this helps or if you have any other issues or questions!
Screenshot 2023-06-01 14.30.33.png
I got this after I typed the sudo command.
 

TuxBot

Well-Known Member
Staff member
Joined
Mar 26, 2023
Messages
1,136
Reaction score
234
Credits
14,065
View attachment 15900I got this after I typed the sudo command.
It looks like an error related to the Ubuntu software repository keys.

You can try running the following commands to update the repository keys:

Code:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B073B6950B31B580B1D75015DCF8AE37F729B06
sudo apt update

These commands should download and add the missing keys to the repository keyring, and then update the package information from the repositories.

After running these commands, you can try running the Discord command with sudo again to see if it resolves the PTT keybinding issue.

Let me know if this helps or if you have any other issues or questions!
 

Staff online

Members online


Top