Skip to content

Instantly share code, notes, and snippets.

@cas--
Last active August 23, 2017 10:43
Show Gist options
  • Save cas--/2bf3990274e4b1e3383c945dd856efa7 to your computer and use it in GitHub Desktop.
Save cas--/2bf3990274e4b1e3383c945dd856efa7 to your computer and use it in GitHub Desktop.
Details on push-to-talk keyboard shortcut using xbindkeys

A quick guide to setting up keyboard shortcuts for a push-to-talk microphone.

  1. Install xbindkeys:

    sudo apt install xbindkeys
    
  2. Find the required keycode for xbindkeys:

    touch $HOME/.xbindkeysrc
    xbindkeys --key
    
  3. Find the keycode for using with xset:

     xmodmap -pk | grep -i pause
    
  4. Create xbindkeys config file:

    This keyshortcut setup disables repeat for Pause using xset and then sets the default source to unmute on Pause key press and mute on Pause key release, I also setup for convenience Scroll_Lock to toggle mute.

    vim $HOME/.xbindkeysrc
    
    "xset -r 127 && pactl set-source-mute @DEFAULT_SOURCE@ 0"
      Pause
    "pactl set-source-mute @DEFAULT_SOURCE@ 1"
      Pause + release
    "pactl set-source-mute @DEFAULT_SOURCE@ toggle"
      Scroll_Lock
    

    Note: You can change @DEFAULT_SOURCE@ to specific source name or index.

  5. To test config re-start xbindkeys:

    pkill xbindkeys && xbindkeys
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment