# Detecting Single Modifier Key Presses (Is HighLine Not Able?

**URL:** <https://www.ruby-forum.com/t/detecting-single-modifier-key-presses-is-highline-not-able/187986>\
**Category:** Ruby\
**Created:** [May 3, 2010, 7:44pm UTC](https://www.ruby-forum.com/t/detecting-single-modifier-key-presses-is-highline-not-able/187986 "2010-05-03T19:44:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardfairhurst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@richardfairhurst](https://www.ruby-forum.com/u/richardfairhurst)\
**Post date:** [May 3, 2010, 7:44pm UTC](https://www.ruby-forum.com/t/detecting-single-modifier-key-presses-is-highline-not-able/187986/1 "2010-05-03T19:44:54Z")

</div>

\<2.33GHz MBPC2D, Running OS X 10.6.3, Ruby 1.8.7 (173)\>

Greetings, folks!

Quick question: Is there any way for Ruby to return the state of any of  
the keyboard modifier keys? I thought HighLine might be able to do so,  
but, AFAICT, it only returns keys that would appear in text.

I just need to know if the Caps L., control, shift, option, command,  
etc. keys are pressed as my scripts use that information to determine  
what to do next. (The Caps L. is used most often as I can just set it  
and walk away as the script runs.)

Thoughts?

Thank you!

Richard F.
