+
     i=5  c                   s   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
t
]
P                  ! RR4       ^ RIHt ^ RIHt ^ RIHt ^ R	IHtHt ^ R
IHt ^ RIHt  ! R R]4      t ! R R]4      t ! R R4      t ! R R4      tR# )z/Control the dbus service from the command line.N)Enum)OptionalGLibz2.0)r   )GlobalConfig)
Migrations)GlobalUInputsFrontendUInput)logger	UserUtilsc                   s.    ] tR t^*tRtRtRtRtRtRt	Rt
R# )	CommandsautoloadZstartZstopzstop-allhelloquit N)__name__
__module____qualname____firstlineno__AUTOLOADSTARTSTOPSTOP_ALLHELLOQUIT__static_attributes__r       M/usr/lib/python3.14/site-packages/inputremapper/bin/input_remapper_control.pyr
   r
   *   s     HEDHEDr   r
   c                   s    ] tR t^3tRtRtRtR# )	Internalszstart-daemonzstart-reader-servicer   N)r   r   r   r   START_DAEMONSTART_READER_SERVICEr   r   r   r   r   r   3   s    !L1r   r   c                   s,   a  ] tR t^9t o V 3R ltRtV tR# )Optionsc                sz   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[;R&   S[ ;R&   S[;R&   S[ ;R&   # )	   command
config_dirpresetdevicelist_devices	key_namesdebugversion)strboolZformat__classdict__   "r   __annotate__ZOptions.__annotate__9   sb     L O  K  K	 
   N  K  L r   r   N)r   r   r   r   Z__annotate_func__r   __classdictcell__r,      @r   r   r   9   s      r   r   c                   sZ  a  ] tR t^Dt o V 3R lR lt]V 3R lR l4       tR tR tV 3R lR lt	R	 t
V 3R
 lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltR  t]V 3R! lR" l4       tR#tV tR$# )%InputRemapperControlBinc                s&   < V ^8  d   QhRS[ RS[/# )r    global_config
migrations)r   r   r+   r-   r   r.   $InputRemapperControlBin.__annotate__E   s     % %#% %r   c                s    Wn         W n        R # N)r3   r4   )selfr3   r4   s   &&&r   __init__Z InputRemapperControlBin.__init__E   s    
 +$r   c                $   < V ^8  d   QhRS[ RR/# )r    optionsreturnNr   r+   r-   r   r.   r5   N   s     :  : g : $ : r   c                s   \        4       p\        \        4      p\        V4      p\	        VV4      pV P
                  '       d   \        P                  ! R 4       V P                  '       d   \        P                  ! 4        R# \        P
                  ! R\        P                  4       VP                  4       p\        P                  R8H  pV P                  \         P"                  8H  pV P$                  RJpV'       d1   V'       g)   V'       d!   V'       g   \        P&                  ! R4       R# V P                  Ee   V P                  \(         U	u. uF  qP*                  NK  	  up	9   d(   VP-                  V P                  V P
                  4       MV P                  \          U	u. uF  qP*                  NK  	  up	9   dg   ^ RIHp
 V
P3                  RR7      pVP5                  V4       VP7                  V P                  V P8                  V P$                  V P:                  4       Mf\        P<                  ! RV P                  4       MDV P>                  '       d   VP?                  4        V P@                  '       d   VPC                  4        V P                  '       d   \        PD                  ! R	4       R# R# u up	i u up	i )
TNzCall for "%s"rootz2Skipping autoload command without a logged in user)DaemonF)ZfallbackzUnknown command "%s"ZDone)#r   r   r   r   r2   r'   r   Zupdate_verbosityr(   Zlog_infosysargvboot_finishedr	   userr!   r
   r   r"   Zwarningr   value	internalsZinputremapper.daemonr>   Zconnect
set_daemoncommunicater$   r#   errorr%   r&   list_key_namesinfo)r:   r3   Zglobal_uinputsr4   Zinput_remapper_controlZboot_finished_Zis_rootZis_autoloadZconfig_dir_setr!   r>   daemons   &           r   mainZInputRemapperControlBin.mainM   s   $&~6/
!8"

 ===##D)???OO_chh//==?..F*oo):):: ++47~'. NNOP??&	"J	W==	"JJ&00'--P($K(w]]($KK77&11&9&22OONN&&NN	 3W__E###&335   &557???KK 1 #K$Ks   J7$J<c                s    \         P                  ! \        P                  4       ^ RIHp V F  p\        VP                  4       K  	  R# )    groupsN)r   ZsetLevelloggingZERRORinputremapper.groupsrN   printkey)r7   rN   group   &  r   r%   Z$InputRemapperControlBin.list_devices   s+    &/E%)) r   c                sb    ^ RI Hp \        RP                  VP	                  4       4      4       R# )rL   )keyboard_layout
N)Z%inputremapper.configs.keyboard_layoutrU   rQ   joinZ
list_names)r7   rU      & r   rH   Z&InputRemapperControlBin.list_key_names   s    Idii22456r   c          
      sF   < V ^8  d   QhRS[ RS[ RS[S[ ,          RS[ RR/# )r    r!   r$   r"   r#   r;   N)r)   r   r+   r-   r   r.   r5      sA     " "" " SM	"
 " 
"r   c                s   V P                   f-   \        P                  ! R4       \        P                  ! ^4       Ve   V P                  V4       V P                  4        V\        P                  P                  8X  d   V P                  V4       V\        P                  P                  8X  d   V P                  W$4       V\        P                  P                  8X  d   V P                  V4       V\        P                  P                  8X  d   V P                   P!                  4        V\        P"                  P                  8X  d   V P%                  4        V\        P&                  P                  8X  d   V P)                  4        R# R# )z'Commands that require a running daemon.NzDaemon missing)rJ   r   rG   r?   exit_load_configensure_migratedr
   r   rC   	_autoloadr   _startr   _stopr   Zstop_allr   _hellor   _quit)r7   r!   r$   r"   r#   s   &&&&&r   rF   Z#InputRemapperControlBin.communicate   s    ;;LL)*HHQK!j)h''---NN6"hnn***KK'hmm)))JJvh''---KK  "hnn***KKMhmm)))JJL *r   c                sj    V P                   P                  R 4      p\        P                  ! RV4       R# )r   zDaemon answered with "%s"N)rJ   r   r   rI   )r7   ZresponserX   r   r_   ZInputRemapperControlBin._hello   s%    ;;$$W-/:r   c                r9   )r    r"   r;   Nr)   r+   r-   r   r.   r5      s     	- 	-s 	-t 	-r   c                s   \         P                  P                  \         P                  P                  \         P                  P	                  VR 4      4      4      p\         P                  P                  V4      '       g.   \        P                  ! RV4       \        P                  ! ^4       \        P                  ! RV4       V P                  P                  V4       R# )zconfig.jsonz"%s" does not existzUsing config from "%s" insteadN)ospathZabspathZ
expanduserrW   Zexistsr   rG   r?   rY   rI   r3   Zload_config)r7   r"   rc      && r   rZ   Z$InputRemapperControlBin._load_config   s    wwGGrww||JFG
 ww~~d##LL.5HHQK4d;&&t,r   c                   < V ^8  d   QhRR/# r    r;   Nr   r+   r-   r   r.   r5      s     & & &r   c                s   ^ RI Hp VP                  R8w  dk   \        P                  P                  V P                  P                  4      pV P                  P                  V4       V P                  P                  4        R# R# )rL   r   r=   N)inputremapper.userr	   rB   rb   rc   Zdirnamer3   rJ   Zset_config_dirr4   Zmigrate)r7   r	   r"   rT   r   r[   Z'InputRemapperControlBin.ensure_migrated   sZ     	1>>V#
 ););)@)@AJKK&&z2OO##% $r   c                r9   r    r$   r;   Nra   r+   r-   r   r.   r5      s     . .C .D .r   c                sr    V P                  V4      pV P                  P                  VP                  4       R # r6   )_require_grouprJ   Zstop_injectingrR   r7   r$   rS   rd   r   r^   ZInputRemapperControlBin._stop   s(    ##F+""599-r   c                re   rf   r   r+   r-   r   r.   r5      s      t r   c                s     V P                   P                  4        R#   \        P                   d   pR \	        T4      9   d    Rp?R# h Rp?ii ; i)ZNoReplyN)rJ   r   r   ZGErrorr)   )r7   rG   rX   r   r`   ZInputRemapperControlBin._quit   s=    	KK{{ 	CJ&	s    AA
	A

Ac                s*   < V ^8  d   QhRS[ RS[ RR/# )r    r$   r#   r;   Nra   r+   r-   r   r.   r5      s"     	7 	7S 	7# 	7$ 	7r   c                s    V P                  V4      p\        P                  ! R VV4       V P                  P	                  VP
                  V4       R# )zStarting injection: "%s", "%s"N)ri   r   rI   rJ   Zstart_injectingrR   )r7   r$   r#   rS      &&& r   r]   ZInputRemapperControlBin._start   sA    ##F+,	
 	##EIIv6r   c                    < V ^8  d   QhRS[ /# )r    r$   ra   r+   r-   r   r.   r5      s      S r   c                sL   ^ RI Hp Vf-   \        P                  ! R4       \        P
                  ! ^4       VP                  R4      '       d   VP                  VR7      pMVP                  VR7      pVf.   \        P                  ! RV4       \        P
                  ! ^4       V# )rL   rM   z--device missingz/dev)rc   )rR   z9Device "%s" is unknown or not an appropriate input device)rP   rN   r   rG   r?   rY   Z
startswithZfind)r7   r$   rN   rS   s   &&  r   ri   Z&InputRemapperControlBin._require_group   s~     	0>LL+,HHQKV$$KKVK,EKKFK+E=LLK HHQKr   c                r9   rh   ra   r+   r-   r   r.   r5   	  s     > > > >r   c                s   Vf5   \         P                  ! R4       V P                  P                  ^
R7       R # V P	                  V4      p\         P                  ! RV4       V P                  P                  VP                  ^R7       R # )NzAutoloading all)Ztimeoutz Asking daemon to autoload for %s)r   rI   rJ   r   ri   Zautoload_singlerR   rj   rd   r   r\   Z!InputRemapperControlBin._autoload	  sg     >KK)* KK   ,''/EKK:FCKK''		1'=r   c                s(   < V ^8  d   QhRS[ RRRR/# )r    r!   r'   Tr;   Nra   r+   r-   r   r.   r5     s"       T d r   c                s    V'       d   RMRpV\         P                  P                  8X  d   RV 2pM'V\         P                  P                  8X  d   RV 2pMR# V R2p\        P
                  ! RV R24       \        P                  ! V4       R# )	zMethods that are needed to get the gui to work and that require root.

input-remapper-control should be started with sudo or pkexec for this.
z -d zinput-remapper-reader-servicez"input-remapper-service --hide-infoNz &z	Running `Z`)r   r   rC   r   r   r'   rb   Zsystem)r7   r!   r'   Zcmdrk   r   rD   Z!InputRemapperControlBin.internals  s}    
 Bi44:::1%9C	..4446ug>C RjyQ'(
		#r   c                rl   r    r;   )Zintr+   r-   r   r.   r5   )  s     M Mc Mr   c                s
   \         P                  ! R.\         P                  R7      P                  P	                  4       p\        VP                  R4       Uu. uF  q"P                  4       R8w  g   K  VNK  	  up4      # u upi )z#Check how many users are logged in.whostdoutrV   rm   )
subprocessrunPIPErq   decodeZlenZsplitZstrip)r7   ro   rB   rT   r   _num_logged_in_usersZ,InputRemapperControlBin._num_logged_in_users)  sY    nneWZ__=DDKKMSYYt_K_T

8JDD_KLLKs   B 3B c                rl   rn   r*   r+   r-   r   r.   r5   .  s      d r   c                s     \         P                  ! R.\         P                  R7      pRTP                  P                  4       9   d   R# R#   \         d     R# i ; i)z"Check if systemd finished booting.zsystemd-analyzerp   TZfinishedF)rr   rs   rt   ZFileNotFoundErrorrq   ru   )r7   Zsystemd_analyzerX   r   _is_systemd_finishedZ,InputRemapperControlBin._is_systemd_finished.  sV    	(nn"#JOOO //6688 ! 	 	s   'A AAc                rl   rn   rw   r+   r-   r   r.   r5   ?  s      t r   c                s    V P                  4       '       d   \        P                  ! R4       R# V P                  4       ^ 8  d   \        P                  ! R4       R# R# )zCheck if booting is completed.zSystem is bootedTzUser(s) logged inF)rx   r   r'   rv   )r7   s   &r   rA   Z%InputRemapperControlBin.boot_finished?  sG     $$&&LL+,$$&*LL,-r   c                s    Wn         R # r6   )rJ   )r7   rJ   s   &&r   rE   Z"InputRemapperControlBin.set_daemonS  s    r   c                rl   rn   r<   r+   r-   r   r.   r5   X  s     H/ H/ H/r   c                 sL   \         P                  ! 4       p T P                  R RRRRP                  \         Uu. uF  qP
                  NK  	  up4       2RRR7       V P                  RRR	R
RRR7       V P                  RRRRRRR7       V P                  RRRRRRR7       V P                  RRRRRR7       V P                  RRRRRR7       V P                  RRRRRRR7       V P                  RR RR!R"RR7       V P                  \        P                  R#,          4      # u upi )$z	--commandZstorer!   z4Communicate with the daemon. Available commands are z, NZNAME)actiondesthelpdefaultZmetavarz--config-dirr"   zpath to the config directory containing config.json, xmodmap.json and the presets folder. defaults to ~/.config/input-remapper/ZPATHz--presetr#   z7The filename of the preset without the .json extension.z--devicer$   z*One of the device keys from --list-devicesz--list-devicesZ
store_truer%   z#List available device keys and exitF)ry   rz   r{   r|   z--symbol-namesr&   z(Print all available names for the presetz-dz--debugr'   z%Displays additional debug informationz-vz	--versionr(   zPrint the version and exit:i   NN)	argparseZArgumentParserZadd_argumentrW   r
   rC   
parse_argsr?   r@   )Zparserr!   s     r   r~   Z"InputRemapperControlBin.parse_argsW  s   ((*F998D8mm8DEFH  	 
	
 	8  	 	
 	J 	 	
 	= 	 	
 	6 	 	
 	; 	 	
 	8 	 	
 	- 	 	
   "..A Es   D!)rJ   r3   r4   N)r   r   r   r   r8   ZstaticmethodrK   r%   rH   rF   r_   rZ   r[   r^   r`   r]   ri   r\   rD   rv   rx   rA   rE   r~   r   r/   r0   r1   r   r2   r2   D   s     % % :  : x7
" "H;	- 	-& &. . 	7 	7 0> > &M M
 " ( H/ H/r   r2   )Z__doc__r}   rO   rb   rr   r?   Zenumr    Ztypingr   ZgiZrequire_versionZgi.repositoryr   Z#inputremapper.configs.global_configr   Z inputremapper.configs.migrationsr   Z&inputremapper.injection.global_uinputsr   r   Zinputremapper.logging.loggerr   rg   r	   r
   r   r   r2   r   r   r   <module>r      sr   ( 6   	  
   	   65 !  < 7 P / (t 2 2 \/ \/r   