[GH-ISSUE #1059] Creating a "held down key" hotkey does not work #843

Open
opened 2026-05-05 07:12:41 -06:00 by gitea-mirror · 0 comments
Owner

Originally created by @Azzurite on GitHub (Feb 8, 2021).
Original GitHub issue: https://github.com/debauchee/barrier/issues/1059

Describe the bug

I created a hotkey like this:

keystroke(1) = keyDown(2)
keystroke(1) = ;keyUp(2)

I would expect that when I press down 1, it sends a keyDown 2 event to all screens, and when I release 1, that it sends a keyUp 2 event to all screens. In a text editor for example, I would expect that I could hold down 1 and a lot of 2s would start appearing as long as I hold down the 1 key. Instead, however, only a single 2 is sent and it doesn't look like the key is held at all.

I used a browser to visualize this by running this script:

var count = 0;
document.addEventListener("keypress", function (event) {
    if (event.key === "2") {
      document.body.style.background = `red`;
      document.body.innerHTML = ++count;
    }
});
document.addEventListener("keyup", function (event) {
    if (event.key === "2") {
        document.body.style.background = `white`;
    }
});

it makes the browser window red when the key is held, and shows how often a new keypress is detected. What happens right now is that when I press down 1, the window goes red and shows 1 keypress, and the counter stays at 1. When I release 1, nothing happens, the window stays red.

If I use a physical key (not a hotkey) to do the same, when I press down 2, the window goes red and the counter starts counting up as long as I hold the key. When I release the 2 key, the counter stops incrementing and the window goes white.

Expected behavior

I would expect both the physical key behavior as well as the hotkey behavior when configured like this to be the same.

To Reproduce

  1. Go to 'Server Configuration -> Hotkeys'
  2. Create a new hotkey for key 1
  3. Create a new action for this hotkey
  4. For 'Choose the action to perform', select 'Press a hotkey' and set the key to 2
  5. For 'This action is performed when' , select 'the hotkey is pressed'
  6. Click 'Ok'
  7. Create another new action for this hotkey
  8. For 'Choose the action to perform', select 'Release a hotkey' and set the key to 2
  9. For 'This action is performed when' , select 'the hotkey is released'
  10. Click 'Ok'
  11. Restart barrier

Desktop (please complete the following information):

  • OS: Windows 10
  • Barrier version 2.3.3-release-3395cca9
Originally created by @Azzurite on GitHub (Feb 8, 2021). Original GitHub issue: https://github.com/debauchee/barrier/issues/1059 **Describe the bug** I created a hotkey like this: ``` keystroke(1) = keyDown(2) keystroke(1) = ;keyUp(2) ``` I would expect that when I press down `1`, it sends a keyDown `2` event to all screens, and when I release `1`, that it sends a keyUp `2` event to all screens. In a text editor for example, I would expect that I could hold down `1` and a lot of `2`s would start appearing as long as I hold down the `1` key. Instead, however, only a single `2` is sent and it doesn't look like the key is held at all. I used a browser to visualize this by running this script: ``` var count = 0; document.addEventListener("keypress", function (event) { if (event.key === "2") { document.body.style.background = `red`; document.body.innerHTML = ++count; } }); document.addEventListener("keyup", function (event) { if (event.key === "2") { document.body.style.background = `white`; } }); ``` it makes the browser window red when the key is held, and shows how often a new keypress is detected. What happens right now is that when I press down `1`, the window goes red and shows 1 keypress, and the counter stays at 1. When I release `1`, nothing happens, the window stays red. If I use a physical key (not a hotkey) to do the same, when I press down `2`, the window goes red and the counter starts counting up as long as I hold the key. When I release the `2` key, the counter stops incrementing and the window goes white. **Expected behavior** I would expect both the physical key behavior as well as the hotkey behavior when configured like this to be the same. **To Reproduce** 1. Go to 'Server Configuration -> Hotkeys' 2. Create a new hotkey for key `1` 3. Create a new action for this hotkey 4. For 'Choose the action to perform', select 'Press a hotkey' and set the key to `2` 5. For 'This action is performed when' , select 'the hotkey is pressed' 5. Click 'Ok' 5. Create another new action for this hotkey 4. For 'Choose the action to perform', select 'Release a hotkey' and set the key to `2` 5. For 'This action is performed when' , select 'the hotkey is released' 5. Click 'Ok' 6. Restart barrier **Desktop (please complete the following information):** - OS: Windows 10 - Barrier version 2.3.3-release-3395cca9
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#843
No description provided.