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

Implement an emit command (#4937) #8497

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Tert0
Copy link

@Tert0 Tert0 commented Dec 11, 2024

Closes #4937

Command Syntax: emit <press|release|press-release> <criteria> <keys>

Parameters

  • action: specifies whether to press, release the keys or do both
  • criteria: first window that matches the criteria will get the key input
  • keys: modifiers and keys separated by +

Examples

  • emit press-release [app_id=com.obsproject.Studio] ALT+F8
  • bindsym --no-repeat Ctrl+T emit press [app_id=wev] Ctrl+A
  • bindsym --no-repeat --release Ctrl+T emit release [app_id=wev] Ctrl+A

Test

  1. Open wev -f wl_keyboard with a terminal
  2. Move the wev window into another workspace
  3. Run
swaymsg 'bindsym --no-repeat Ctrl+T emit press [app_id=wev] Ctrl+A'
swaymsg 'bindsym --no-repeat --release Ctrl+T emit release [app_id=wev] Ctrl+A'
  1. Press and hold Ctrl+T
    -> The terminal running wev should show that Ctrl+A was pressed
  2. Release Ctrl+T
    -> The terminal running wev should show that Ctrl+A was released

Code Structure

I am not sure if I should move the code (for converting xkb keysym to key codes), that I copied from the sway/commands/bind.c, to common/utils.c or maybe somewhere else.

Command Syntax: emit <press|release|press-release> <criteria> <keys>
* action: specifies whether to press, release the keys or do both
* criteria: first window that matches the criteria will get the key input
* keys: modifiers and keys separated by +
Examples:
* emit press-release [app_id=com.obsproject.Studio] ALT+F8
* bindsym --no-repeat Ctrl+T emit press [app_id=wev] Ctrl+A
* bindsym --no-repeat --release Ctrl+T emit release [app_id=wev] Ctrl+A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] Allow forwarding of key events
1 participant