+
     iW	  c                   s8    R t ^ RIt^ RIt^ RIHt R tR tR tR# )zFunctions to handle numlocks.

For unknown reasons the numlock status can change when starting injections,
which is why these functions exist.
N)loggerc                 s    \         P                  ! RR.\         P                  R7      P                  4       p \        P
                  ! RV 4      pVe   V^,          R8H  # R#   \        \         P                  3 d     R# i ; i)z%Get the current state of the numlock.ZxsetZq)ZstderrzNum Lock:\s+(.+?)\sNonF)
subprocesscheck_outputZSTDOUTZdecodereZsearchFileNotFoundErrorCalledProcessError)Zxset_qZnum_lock_statuss     D/usr/lib/python3.14/site-packages/inputremapper/injection/numlock.pyis_numlock_onr   "   s|    ((SM$$
 &( 	 ))$:FC&"1%--z<<= s   AA! !B ?B c                s    V f   R# RRRR/V ,          p \         P                  ! RV.4       R#   \         P                   d     R# \         d    \        P
                  ! R4        R# i ; i)z2Set the numlock to a given state of True or False.NTr   FZoffZnumlockxznumlockx not found)r   r   r   r   r    Zdebug)ZstateZvalues   & r   set_numlockr	   4   sb    }4&u-E+U 34((  +)*+s   / A+A+A+*A+c                s   a  V 3R lpV# )z?Decorator to reset the numlock to its initial state afterwards.c                  sB   < \        4       pS! V / VB p\        V4       V# )N)r   r	   )ZargsZkwargsZnumlock_beforeZresultfuncs   *,  r   wrappedZensure_numlock.<locals>.wrappedH   s(     't&v&N#     )r
   r   s   f r   ensure_numlockr   E   s    	 Nr   )Z__doc__r   r   Zinputremapper.logging.loggerr    r   r	   r   r   r   r   <module>r      s$   * 
  /$+"r   