+
     i  c                  s    R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHtHtH	t	H
t
Ht ^ RIHt ^ RIHtHt ^ RIHt RtRtR	tR
tR]R/ /t ! R R4      tR# )z@Store which presets should be enabled for which device on login.)annotationsN)UnionListOptionalCallableAny)	PathUtils)loggerVERSION)	UserUtilsZmouseZwheelZbuttonsZnoneZversionautoloadc                  sr    ] tR t^+tRtR tR R ltR R ltR R ltR	 t	R
 R lt
RR R lltR tR tRtR# )GlobalConfigzLConfigures stuff like autoloading in ~/.config/input-remapper-2/config.json.c                	s    \         P                  P                  \        P                  ! 4       R 4      V n        \
        P                  ! \        4      V n        R# )zconfig.jsonN)	ospathZjoinr   Zconfig_pathcopydeepcopyINITIAL_CONFIG_configself   &H/usr/lib/python3.14/site-packages/inputremapper/configs/global_config.py__init__ZGlobalConfig.__init__.   s1    GGLL!6!6!8-H	}}^4    c                   V ^8  d   QhRR/# )   returnstr Zformat   "r   __annotate__GlobalConfig.__annotate__2   s     + + +r   c                sb    \         P                  P                  V P                  4      ^ ,          # )z"The folder containing this config.)r   r   Zsplitr   r   r   get_dirZGlobalConfig.get_dir2   s    ww}}TYY'**r   c                    V ^8  d   QhRRRR/# )r   	group_keyr   r   Optional[str]r   r   r   r   r   r    6   s     F FS F] Fr   c                	sn    \         P                  ! V P                  R ,          P                  V4      4      # )r
   )r   r   r   get)r   r#   s   &&r   get_autoload_presetZ GlobalConfig.get_autoload_preset6   s'     }}T\\*599)DEEr   c               r"   )r   r#   r   presetr$   r   r   r   r   r   r    ;   s      S - r   c                s    Ve   W P                   R,          V&   M+\        P                  ! RV4       V P                   R,          V V P                  4        R# )a7  Set a preset to be automatically applied on start.

Parameters
----------
group_key
    the unique identifier of the group. This is used instead of the
    name to enable autoloading two different presets when two similar
    devices are connected.
preset
    if None, don't autoload something for this device.
Nr
   z+Not injecting for "%s" automatically anmore)r   r   info_save_configr   r#   r'      &&&r   set_autoload_presetZ GlobalConfig.set_autoload_preset;   sG     28LL$Y/KKEyQZ(3r   c                sV    V P                   P                  R/ 4      P                  4       # )zGet tuples of (device, preset).r
   )r   r%   Zitemsr   r   r   iterate_autoload_presetsZ%GlobalConfig.iterate_autoload_presetsO   s"    ||
B/5577r   c               s     V ^8  d   QhRRRR/# )r   r#   r$   r'   r   r   r   r   r   r    S   s     I I} Im Ir   c                s    Ve   Vf   \        R4      hV P                  P                  R/ 4      P                  V4      V8H  # )z+Should this preset be loaded automatically?z,Expected group_key and preset to not be Noner
   )Z
ValueErrorr   r%   r*   r+   r   is_autoloadedZGlobalConfig.is_autoloadedS   s?    KLL||
B/33I>&HHr   Nc               r   )r   r   r$   r   r   r   r   r   r    Z   s     ! ! !r   c           
     s   VeE   \         P                  P                  V4      '       g   \        P                  ! RV4       R# Wn        V P                  4        \         P                  P                  V P                  4      '       gc   \        P                  ! RV P                  4       V P                  4        \        P                  ! \        4      V n
        V P                  4        R# \        V P                  R4      ;_uu_ 4       p V P                  P                  \        P                  ! V4      4       \        P                   ! RV P                  4       RRR4       R#   \        P"                  P$                   d6   p\        P                  ! RT P                  \'        T4      4        Rp?LYRp?ii ; i  + '       g   i     R# ; i)z|Load the config from the file system.
Parameters
----------
path
    If set, will change the path to load from and save to.
NzConfig at "%s" not foundzConfig "%s" doesn't exist yetZrzLoaded config from "%s"z/Failed to parse config "%s": %s. Using defaults)r   r   Zexistsr   error_clear_configdebugr   r   r   r   r)   openZupdatejsonZloadr(   ZdecoderZJSONDecodeErrorr   )r   r   filer/   s   &&  r   load_configZGlobalConfig.load_configZ   s,    77>>$''7>Iww~~dii((LL9499E ==8DL$))S!!T##DIIdO45tyyA "! <<// EIIJ 	 "!!s1   F;
AE$$F8+F3.F;3F88F;;G	c                s   \         P                  R8X  d   \        P                  ! R4       R# \        P
                  ! V P                  4       \        V P                  R4      ;_uu_ 4       p\        P                  ! V P                  V^R7       \        P                  ! RV P                  4       VP                  R4       RRR4       R#   + '       g   i     R# ; i)z#Save the config to the file system.Zrootz/Skipping config file creation for the root userNZw)ZindentzSaved config to %sZ
)r	   Zuserr   r1   r   Ztouchr   r2   r3   Zdumpr   r(   Zwrite)r   r4   s   & r   r)   ZGlobalConfig._save_config   s    >>V#LLJK		"$))S!!TIIdllD3KK,dii8JJt "!!!s   ,ACC	c                s    / V n         R# )z$Remove all configurations in memory.N)r   r   r   r   r0   ZGlobalConfig._clear_config   s	    r   )r   r   )N)Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__r   r!   r&   r,   r-   r.   r5   r)   r0   Z__static_attributes__r   r   r   r   r   +   s5    V5+F
(8I!Jr   r   )r6   Z
__future__r    r   r3   r   Ztypingr   r   r   r   r   Zinputremapper.configs.pathsr   Zinputremapper.logging.loggerr   r   Zinputremapper.userr	   ZMOUSEZWHEELZBUTTONSZNONEr   r   r   r   r   <module>r7      sY   & G "   	 7 7 1 8 (
 wc cr   