+
    & i%~  c                   s   ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
Ht ^ RIHtHt ^ RIHt ^ RIHtHtHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RI H!t!H"t"H t  ^ RI#H$t$ ^ RI%H&t& ^ RI'H(t(H)t) ^ RI*H+t+H,t, ^ RI*H-t. ^ RI/H0t0 ^ RI1H2t2H3t3H4t4 ^ RI5H6t6 ^ RI7H8t8 ^ RI9H:t: ^ RI;H<t<H=t= ^ RI>H?t?H@t@HAtAHBtBHCtCHDtD ^ RIEHFtF ^ RIGHHtH ^ RIIHJtJ ^ RIKHLtL ^ R IMHNtNHOtOHPtPHQtQHRtRHStS R!tT^tU]V]W]W]W3,          tXR" R# ltYR$ R% ltZR& R' lt[R( R) lt\. 3R* R+ llt]R, R- lt^R. R/ lt_R0 R1 lt`R2 R3 ltaR4 R5 ltbR6 R7 ltcR8 R9 ltdR: R; lteR< R= ltfR> R? ltgR@ RA lthRB RC ltiRD RE ltjRF RG ltkR# )Hi    N)CFuncPtr)	Namespace)array)	GeneratorMutableMapping)FutureThreadPoolExecutor)suppress)CDLLc_intc_ulong)ENETUNREACH)chain)Path)getpwuid)match)	token_hex)AF_INET
SOCK_DGRAMsocket)Popen)Any)PoolManagerRetry)MaxRetryErrorNewConnectionError)TimeoutError)Timeout)XXatomdisplay)DisplayConnectionError)GetProperty)Window)__runtime_versions____version__)PR_SET_CHILD_SUBREAPERPROTON_VERBSSTEAM_COMPAT	UMU_LOCALFileLockGamescopeAtom)log)set_env_toml)get_umu_proton)	setup_umu)get_libcget_library_pathshas_umu_setupis_installed_verb
unix_flockxdisplayg      @c                s(    V ^8  d   QhR\         RR/# )   pathreturnN)strZformat   "0/usr/lib/python3.14/site-packages/umu/umu_run.py__annotate__r;   <   s     ) )C )D )    c                s   \        V 4      P                  R4      P                  4       p\        V 4      P                  4       P                  RRR4      p\        \        P
                  ! 4       4      P                  p\        V 4      P                  4       P                  RRV4      p\        P                  P                  R4      R8X  d   R# VP                  4       '       d   VP                  4        VP                  4       '       g9   VP                  \        V 4      P                  4       P                  RR	7      4       \        V 4      P                  R
4      P                  4       P                  4        VP                  4       '       g<   VP                  4       '       g&   VP!                  RR7       VP                  R4       R# VP                  4       '       d*   VP                  4       '       g   VP                  V4       R# VP                  4       '       g,   VP                  4       '       d   VP                  R4       R# R# R# )z(Prepare a Proton compatible WINE prefix.pfxZdrive_cZusersZ	steamuserUMU_NO_PROTON1NTZstrictZtracked_files)parents)r   joinpath
expanduserr   osZgetuidZpw_nameenvirongetZ
is_symlinkZunlinkis_dirZ
symlink_toresolveZtouchZexistsmkdir)r5   r=   ZsteamZuserZwineuser   &    r:   	setup_pfxrK   <   s   T
##E*557Ct*'')229g{SE%--D$Z**,55i$OH	zz~~o&#-
~~

::<<tDz,,.66d6CDJ(335;;= ??U\\^^D!K(			5<<>>__5<<>>K( $2r<   c          	      s    V ^8  d   QhR\         \        \        3,          R\        \        \        3,          R\         \        \        3,          \         \        \
        3,          ,          /# )r4   envsession_poolsr6   )dictr7   tupler   r   r   r8   r9   r:   r;   r;   \   sL     > >	c3h>(-.@+.M(N>	#s(^d38n$>r<   c                s"   \         P                  P                  R4      '       g*   \        P                  ! R4       R\         P                  R&   \         P                  R,          V R&   \         P                  P                  R4      R8X  d   Rp\        V4      h\         P                  P                  R4      R8w  dr   R\         P                  9  d]   \        P                  ! 4       P                  R	R
V R,          4      pVP                  RRR7       \        V4      \         P                  R&   \         P                  P                  R4      R8w  d   \        \         P                  R,          4      P                  4       P                  4       '       gP   \        \         P                  R,          4      pVP                  RRR7       \        V4      \         P                  R&   \         P                  P                  RR4      V R&   \         P                  P                  R4      R8X  d   V # \        P                  ! \         P                  P                  RR4      4      p\         P                  P                  R4      '       d\   VP                  4       '       dF   \        \        P                  ! \         P                  R,          4      4      \         P                  R&   \         P                  P                  R4      R9   d   \        W4       R\         P                  9  d   R\         P                  R&   \        W4       \         P                  R,          V R&   \         P                  R,          '       g   R\         R2p\        V4      hV # )a   Before executing a game, check for environment variables and set them.

GAMEID is strictly required and the client is responsible for setting this.
When the client only sets the GAMEID, the WINE prefix directory will be
created as $HOME/Games/umu/$GAMEID.
GAMEIDz No GAMEID set, using umu-defaultzumu-default
WINEPREFIX z)Environment variable is empty: WINEPREFIXr>   r?   ZGamesumuTrA   Zexist_ok
PROTONPATHzlEnvironment variable not set or is empty: PROTONPATH
Possible reason: GE-Proton or UMU-Proton not found in 'z' or network error   z	GE-Latestz	GE-Protonz
UMU-Latest)rD   rE   rF   r*   info
ValueErrorr   ZhomerB   rI   r7   rC   rG   r&   r,   FileNotFoundError)rL   rM   errr=   r5   s   &&   r:   	check_envr[   \   sg    ::>>(##34,

8JJx(CM	zz~~l#r)>o	zz~~o&#-,bjj2PIIK((%XG		$	.#&s8

<  	

'3.RZZ-.99;BBDDL12		$	.#&s8

< 

|R8C 
zz~~o&#-
 &&rzz~~lB'GHD	zz~~l###&|'<'<RZZ=U'V#W

<  
zz~~l#'OOs*2::%#%

< s*

<0C ::l##FFR^ T   	
  $$Jr<   c                s    V ^8  d   QhR\         \        \        3,          R\        \        \        \        \        ,          3,          ,          R\         \        \        3,          /# )r4   rL   argsr6   )rN   r7   r   rO   listr8   r9   r:   r;   r;      sK     b b	c3hb(5d3i+@@b	#s(^br<   c                s
   \        V R,          4      P                  4       P                  RR7      p\        V R,          4      P                  4       P                  RR7      p\        V\        4      pT;'       d    V^ ,          '       * ;'       g    T;'       d    V^ ,          R8H  pT;'       d    V^ ,          R8H  p\
        P                  P                  R4      \        9   d   \
        P                  R,          V R&   MRV R&   \
        P                  P                  R	R
4      V R	&   V'       d   R
V R&   R
V R	&   EMKV'       dW   \        VRR4      pVP                  4       '       d   \        VP                  RR7      4      MRV R&   V R,          V^,          3pMV'       d    \        V^ ,          4      P                  4       P                  RR7      p\        V4      V R&   V R	,          '       g   \        VP                  4      V R	&   \
        P                  P                  RR
4      T R&   M[\        V R,          4      P                  4       p\        V4      V R&   \        VP                  4      V R	&   V P                  RR
4      V R&   V R,          V R&   RV R&   \
        P                  P                  RR
4      V R&   \        RV R,          4      '       d-   V R,          V R,          P!                  R4      ^,           R V R&   V R,          V R&   V R,          V R&   \#        ^4      V R&   \        V4      V R&   \        V4      V R&   V R,          V R&   V R,           R2V R&   V R,           R\$         R\
        P                  R,           2V R &   V R ,          V R!&   \
        P                  P                  R"4      ;'       g    R
V R"&   \'        V 4       V P                  RR
4      P)                  R4      '       d,   \
        P                  P                  R#4      R)9   d   R
MR$V R%&   \
        P                  P                  R&4      ;'       g    R
V R&&   \
        P                  P                  R'4      ;'       g    R
V R'&   \
        P                  P                  R(4      ;'       g    R
V R(&   \$         R\
        P                  R,           2V R&   V #   \         d/    T^ ,          T R&   \        P                  ! RT R,          4        ELi ; i)*z8Set various environment variables for the Steam Runtime.rQ   Tr@   rU   Zcreateprefix
winetricksPROTON_VERBwaitforexitandrunSTEAM_COMPAT_INSTALL_PATHrR   EXEZprotonfixeszExecutable not found: %sSTORErP   UMU_IDZ0STEAM_COMPAT_APP_IDSteamGameIdUMU_STEAM_GAME_IDz^umu-[\d\w]+$Z-N
SteamAppIdUMU_INVOCATION_IDSTEAM_COMPAT_DATA_PATHz/shadercacheSTEAM_COMPAT_SHADER_PATH:/RUNTIMEPATHSTEAM_COMPAT_TOOL_PATHSSTEAM_COMPAT_MOUNTS
UMU_ZENITYZUMU_LOGr?   ZWINETRICKS_SUPER_QUIETUMU_NO_RUNTIMEUMU_RUNTIME_UPDATEr>   >   r?   debug)r   rC   rH   
isinstancerO   rD   rE   rF   r%   is_filer7   ZparentrY   r*   warningr   Zfindr   r'   enable_steam_game_driveendswith)rL   r\   r=   Z
protonpathZis_cmdZis_createpfxZis_winetricksZexes   &&      r:   set_envrz      sj    S&'224<<D<ICC-.99;CC4CPJdE*F
 
		QKJJV%I%IQ>0I  !<<T!W%<M 
zz~~m$4ZZ6M0M')zz~~6QSU'VC#$ E
+-'(	 ]LA69kkmmSD12E
E
DG$		@ T!W002::$:GCSCJ23336szz?/0
 zz~~gr2GU$//1XE
+.szz?'(www+G MCM!$C!zz~~mR@C s8}--%(]3x=3E3Ec3JQ3N3P%Q!"12C\*C(}C CCJC$'$5C !),-E)F(G|&TC"#|
Qyk2::m+D*EF !" "%%>!?C 

|4::C C  wwub""<00**..+~=B3 	$%
 JJNN+;<BBC "

/C D J JC::>>/:@@bC%;a

=(A'BCCJg ! 	@aCJKK2CJ?	@s   #A%S 5T Tc                st    V ^8  d   QhR\         \        \        3,          R\         \        \        3,          /# r4   rL   r6   )rN   r7   r8   r9   r:   r;   r;     s*      c3h DcN r<   c                s   \        4       p\        R4      p\        V R,          4      P                   Fv  pVP                  4       '       g   K  W28w  g   K#  \        P
                  P                  R4      '       d!   \        P
                  R,           RV 2V R&   M\        V4      V R&    M	  \        P
                  P                  R4      '       d0   \        \        P
                  R,          P                  R4      4      pV R,          '       d   VP                  V R,          4       V\        4       ,          pRP                  V4      V R&   V # )z&Enable Steam Game Drive functionality.rm   ra   STEAM_COMPAT_LIBRARY_PATHSrl   ZLD_LIBRARY_PATHSTEAM_RUNTIME_LIBRARY_PATH)setr   rA   Zis_mountrD   rE   rF   r7   splitaddr/   Zjoin)rL   Zpathsrootr5   s   &   r:   rx   rx     s   eEcD S456>>==??t|zz~~:;;zz">?@$H 01 58I01 ? 
zz~~'((BJJ0177<=
&''		#123 
  E(+C$%Jr<   c          
      s    V ^8  d   QhR\         \        \        3,          R\        R\        \        ,          R\        \        \        ,          R3,          /# )r4   rL   localoptsr6   .)rN   r7   r   r]   rO   r8   r9   r:   r;   r;   !  sI     = =	c3h== s)= 4#:s?	=r<   c           	     s   VP                  R4      p\        V R,          R4      pVP                  R4      pV P                  R4      R8w  d$   VP                  4       '       g   Rp\	        V4      hVP                  4       '       g   RV R	2p\	        V4      hV P                  R
R4      P                  R4      '       d+   V'       d#   VRV R,          RVV R,          V R
,          R.VO5# V P                  R4      R8X  d   VRV R,          RV R
,          .VO5# V P                  R4      R8X  d,   \        P                  ! R4       W@R,          V R
,          .VO5# VRV R,          RVVV R,          V R
,          .VO5# )z!Build the command to be executed.zumu-shimrU   protonrS   r>   r?   z6The following file was not found in PROTONPATH: protonz*_v2-entry-point (umu) cannot be found in 'z1'
Runtime Platform missing or download incompleterb   rR   r^   z--verbr_   z--z-qrr   zRuntime Platform disabled)rB   r   rF   rv   rY   ry   r*   rw   )rL   r   r   Zshimr   Zentry_pointrZ   s   &&&    r:   build_commandr   !  s    
+DL)84Fu-K
ww3&v~~/?/?K$$
   8 @> > 	  $$ wwub""<00T J

 

 
	
 ww3&Xs='94USdSS ww C'/0=)3u:<<< 	MME

 

 
r<   c                sH    V ^8  d   QhR\         \        \        R3,          /# )r4   r6   N)r   intr   r8   r9   r:   r;   r;   a  s!     X X9S#t^, Xr<   c               #   sd   "   R  \        R4      P                  R4       4        Rj  xL
  R#  L5i)c              3   s   "   T F;  qP                   P                  4       '       g   K$  \        VP                   4      x  K=  	  R # 5iN)ZnameZisdigitr   ).0pid   & r:   	<genexpr>Z_get_pids.<locals>.<genexpr>b  s+     W)@#HHDTDTDVCHH)@s
   !AAz/procZ*N)r   Zglob r<   r:   	_get_pidsr   a  s"     Wg););C)@WWWs   %0.0c                sF    V ^8  d   QhR\         R\        \         ,          /# )r4   root_pidr6   )r   r~   r8   r9   r:   r;   r;   e  s      # #c( r<   c                s   \        4       p/ p\        4        Fu  p \        RV R24      pVP                  RRR7      ;_uu_ 4       p\	        R V 4       4      pVP                  R4      P                  4       p\        V4      W#&   RRR4       Kw  	  V .pV'       d^   VP                  4       pVP                  4        F7  w  r9W8X  g   K  W19  g   K  VP                  V4       VP                  V4       K9  	  Ke  \        P                   ! R	W4       V#   + '       g   i     EK  ; i  \        \        \        3 d     EK)  i ; i)
zGet descendent PIDs of a PID./proc//statusrutf-8ZmodeZencodingc              3   sV   "   T F  qP                  R 4      '       g   K  Vx  K!  	  R# 5i)PPid:N)Z
startswith)r   liner   r:   r   Z&get_pstree_from_pid.<locals>.<genexpr>n  s     Q8Ptts   )
)r   NzPID %s descendents: %s)r~   r   r   opennextZremoveprefixstripr   rY   ProcessLookupErrorrX   Zpopitemsr   Zappendr*   rt   )
r   ZdescendantsZpid_to_ppidr   r5   fileZst_ppidZcurrent_pidZcurrentZppid
   &         r:   get_pstree_from_pidr   e  s   EK"$K{	&W-.Dg66$QQQ!..w7==?#&w<  76  'ZK
//#$**,IC3#9$""3' -
 II&># 766 "#5zB 		s/   *D&?DD&D#D&#D&&E Ec                h    V ^8  d   QhR\         P                  R\        \        ,          R,          /# r4   dr6   Nr   Displayr~   r   r8   r9   r:   r;   r;     s&      goo #c(T/ r<   c                sb    V P                  4       P                  \        P                  8X  dL   V P	                  4       P
                  P                  4       P                   Uu0 uF  qP                  kK  	  up#  R# u upi   \         d"   p\        P                  ! T4        Rp?R# Rp?ii ; i)z?Get the list of window ids under the root window for a display.N)Z
next_eventZtyper   ZCreateNotifyscreenr   Z
query_treeZchildrenZid	Exceptionr*   	exception)r   Zchilde   &  r:   get_window_idsr     s    <<>!..0*+((*//*D*D*F*O*OP*OHH*OPP 1
 	 Q as*   A!B #A=7B =B B.B))B.c          	      s    V ^8  d   QhR\         P                  R\        \        ,          R\        \        ,          R,          R\        \        ,          R,          /# )r4   r   pstree
window_idsNr6   r   r8   r9   r:   r;   r;     sD     & && #C&69#ho&X_&r<   c                s   \        4       pV P                  RRR7      pV'       g   R# V\        P                  8X  d   \        P
                  ! R4       R# V F  p V P                  RV4      pVP                  V\        P                  4      pV'       d   VP                  '       g   KR  VP                  P                  4       ^ ,          pW9  d   \        P                  ! RVV4       K  \        P                  ! RWX4       VP                  V4       K  	  V#   \         d"   p	\        P                  ! T	4        Rp	?	K  Rp	?	ii ; i)	z9Get a subset of window ids associated with a set of pids.Z_NET_WM_PIDT)Zonly_if_existsNz/_NET_WM_PID does not exist, skipping window IDswindowzFPID %s is unrelated to app or not a descendent, skipping window ID: %szWindow ID %s has PID: %s)r~   get_atomr   ZNONEr*   rw   create_resource_objectget_full_propertyr   CARDINALvaluetolistrt   r   r   r   )
r   r   r   Zgame_window_idsatom	window_idr   propr   r   s
   &&&       r:   get_pstree_window_idsr     s    !$O::mD:9D
 qvv~EF  		55h	JF++D%..ADtzzz**##%a(C 		\
 II0)A	*  &   	MM!	s%   AD)?D*(DE#D??Ec                s    V ^8  d   QhR\         P                  R\        \        ,          R\        R\         P                  /# )r4   r   r   steam_assigned_appidr6   r   r8   r9   r:   r;   r;     s8      $'HDG__r<   c                s   \         P                  ! RV4       V F  p V P                  RV4      pVP                  V P	                  \
        P                  P                  4      \        P                  ^ V.4       \         P                  ! R\
        P                  P                  V4       K  	  V #   \         dR   p\         P                  ! R\
        P                  P                  T4       \         P                  ! T4        Rp?K  Rp?ii ; i)z1Set Steam's assigned app ID on a list of windows.zSteam app ID: %sr   z.Successfully set %s property for window ID: %sz+Error setting %s property for window ID: %sN)r*   rt   r   Zchange_propertyr   r)   Z	SteamGamer   r   r   r   errorr   )r   r   r   r   r   r   s   &&&   r:   set_steam_game_propertyr     s     II "67		55h	JF""

=22889%&	 II@''--  , H  	II=''--
 MM!	s   BB00D;ADDc                r   r   )r   r   r]   r   r8   r9   r:   r;   r;     s)      	#Yr<   c                s    V P                  4       P                  pV P                  \        P                  P
                  4      pVP                  V\        P                  4      pV'       dM   VP
                  '       d;   \        VP
                  \        4      '       d   VP
                  P                  4       # \        P                  ! R\        P                  P
                  4       R#   \         dQ   p\        P                  ! R\        P                  P
                  4       \        P                   ! T4        Rp?R# Rp?ii ; i)zGGet the GAMESCOPECTRL_BASELAYER_APPID value on the primary root window.z%s property not foundzError getting %s propertyN)r   r   r   r)   ZBaselayerAppIdr   r   r   r   ru   r   r   r*   rt   r   r   r   )r   Zroot_primaryr   r   r   rJ   r:   get_gamescope_baselayer_appidr     s     xxzzz-66<<=#/#A#A$#WDJJJ:djj%#@#@::$$&&		)=+G+G+M+MN
 	  		-}/K/K/Q/QRa	s+   A*C* -C* ?9C* 9/C* *E5AE  Ec                0    V ^8  d   QhR\         R\        /# r{   r   r   r8   r9   r:   r;   r;     s       C r<   c                sz   ^ pV P                  R4      ;p'       dM   \        \        \        4      ;_uu_ 4        \	        \        V4      P                  R,          4      uuRRR4       # V P                  R4      ;p'       dM   \        \        \        4      ;_uu_ 4        \	        \        V4      P                  R	,          4      uuRRR4       # V P                  R4      ;p'       dM   \        \        \        4      ;_uu_ 4        \	        \        V4      P                  R
,          4      uuRRR4       # V P                  R4      ;p'       dM   \        \        \        4      ;_uu_ 4        \	        \        V4      P                  R	,          4      uuRRR4       # \        \        4      ;_uu_ 4        \	        V P                  RR4      4      ^ ,	          uuRRR4       #   + '       g   i     EL; i  + '       g   i     EL3; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     T# ; i)z9Get the Steam app ID from the host environment variables.Z"STEAM_COMPAT_TRANSCODED_MEDIA_PATHNZSTEAM_COMPAT_MEDIA_PATHZSTEAM_FOSSILIZE_DUMP_PATHZDXVK_STATE_CACHE_PATHrg   rR   iii)rF   r   rX   Z
IndexErrorr   r   Zparts)rL   steam_appidr5   r   r:   get_steam_appidr     sz   Kww;<<t<j*--tDz''+, .- ww011t1j*--tDz''+, .- ww233t3j*--tDz''+, .- ww.//t/j*--tDz''+, .- 
*		377.34: 
	 .-- .-- .- .- 
	 s;   %G%G/%H'%H."H)G,	/H 	H	H&	)H:	c                r   r{   r   r8   r9   r:   r;   r;     s      n  r<   c                 s
   R p / p\        4        F  p \        RV R24      pVP                  RRR7      ;_uu_ 4       pV F)  pVP                  R^4      w  rxVP	                  4       W'&   K+  	  RRR4       VR,          V8w  d   Kv  R	V R
,           2P                  4       p	V	\        RV R24      P                  4       9   d   \        V4      u # K  	  K    + '       g   i     Lo; i  \        \        \        3 d     K  i ; i)z	pv-adverbr   r   r   r   r   rl   NZNamezUMU_INVOCATION_ID=ri   z/environ)r   r   r   r   r   ZencodeZ
read_bytesr   rY   r   rX   )
rL   targetZstr   r5   r   r   keyvalZinv_idr   r:   _get_pstree_root_pidr     s    F ;CfSE12YYC'Y::d $#'::c1#5"%))+ !% ; f:'-c2E.F-GHOOQTF3%x"89DDFFs8O G  ;: &'9:F s/   *C(0C.C(AC(C% C((DDc                sH    V ^8  d   QhR\         P                  R\        RR/# )r4   d_secondaryr   r6   N)r   r   r   r8   r9   r:   r;   r;     s*     !D !D !Ds !Dt !Dr<   c                sv   Rp\        \        P                  4      p\        P                  ! RV P                  4       4       V'       g"   \        V \        V4      \        V 4      4      pK)  \        WV4       \        P                  ! RV P                  4       4        \        V \        V4      \        V 4      4      pV'       g   K*  VP                  V4      ;p'       g   KE  \        P                  ! RV4       \        P                  ! RV4       \        P                  ! RV4       W%,          p\        WV4       K  )zNMonitor for new windows for a display and assign them Steam's assigned app ID.Nz-Waiting for new windows IDs for DISPLAY=%s...z/Monitoring for new window IDs for DISPLAY=%s...zNew window IDs detected: %szCurrent tracked windows IDs: %szWindow IDs set difference: %s)r   rD   rE   r*   rt   Zget_display_namer   r   r   r   Z
difference)r   r   r   r   Zcurrent_window_idsZdiffs   &&    r:   monitor_windowsr     s    "&J&rzz2KII7$$&
 *,S1>+3N

 K[AII9$$& .C,S1>+3N/
 "%00<<4<<II35GHII7DII5t<J#K{Cr<   c                r   )r4   procr6   )r   r   r8   r9   r:   r;   r;   B  s     * *5 *S *r<   c                s*   Rp \        R4      ;_uu_ 4       p\        R4      ;_uu_ 4       p\        V4      pV'       d   \        P                  P	                  R4      R8X  d   VP                  4       P                  P                  \        P                  R7       \        P                  ! \        V\        \        P                  4      3R7      pRVn        VP                  4        V P!                  4       uuRRR4       uuRRR4       #   + '       g   i     M; iRRR4       T P!                  4       #   + '       g   i     T P!                  4       # ; i  \"         d0   p\$        P&                  ! T4        Rp?T P!                  4       # Rp?ii ; i)	a  Set properties on gamescope windows when running in steam mode.

Currently, Flatpak apps that use umu as their runtime will not have their
game window brought to the foreground due to the base layer being out of
order.

See https://github.com/ValveSoftware/gamescope/issues/1341
Nz:0z:1r_   r`   )Z
event_mask)r   r\   T)r3   r   rD   rE   rF   r   r   Zchange_attributesr   ZSubstructureNotifyMask	threadingZThreadr   r   ZdaemonZstartwaitr   r*   r   )r   Zgamescope_baselayer_sequenceZ	d_primaryr   Zwindow_threadr   s   &     r:   run_in_steammoder   B  s    6: d^^y(4..K+H+S( -JJNN=15HH""$));; 77 < 
 !* 0 0*%';BJJ'GH! (,$##%99;% +9.^^..^0 99;1 ^0 99; "  	a99;sR   E D6CD	6
D6 
E DD6E 6E	E E F#FFc                s`    V ^8  d   QhR\         \        \        ,          R3,          R\        /# )r4   command.r6   )rO   r   r7   r   r8   r9   r:   r;   r;   o  s'     / /tcz3/ /C /r<   c                s$   ^ p^ p\        4       p\        P                  P                  R4      R8H  ;'       g#    \        P                  P                  R4      R8H  p\        P                  P                  R4      R8H  pT;'       d-    \        P                  P                  R4      R8H  ;'       d    TpV '       g   RV  2p\	        V4      h\        P                  P                  R	R
4      P                  R4      '       d   \        P                  R,           R2pM\        P                  ! 4       p\        V4      P                  p	\        V	n        \        \        \        \        \        .V	n        V	! \        ^^ ^ ^ ^ 4      p\        P                   ! RV4       \#        V RVR7      ;_uu_ 4       p
V'       d   \%        V
4      MV
P'                  4       p\        P                   ! RV
P(                  V4       RRR4       V#   + '       g   i     T# ; i)z9Run the executable using Proton within the Steam Runtime.ZXDG_CURRENT_DESKTOPZ	gamescopeZXDG_SESSION_DESKTOPZ	containerZflatpakZSTEAM_MULTIPLE_XWAYLANDSr?   zCommand list is empty or None: rb   rR   r^   rU   z/protonfixeszprctl exited with status: %sT)Zstart_new_sessioncwdz$Child %s exited with wait status: %sN)r.   rD   rE   rF   rX   ry   r   r   r   prctlr	   Zrestyper
   Zargtypesr$   r*   rt   r   r   r   r   )r   ZretZ	prctl_retZlibcZis_gamescope_sessionZ
is_flatpakZis_steammoderZ   r   r   r   s   &          r:   run_commandr   o  s   
 CI
D


,-< 	@ 	@::>>/0K?  zz~~k2i?J 	 	 	JJNN56#=	 	  4WI>o 
zz~~eR )),77L)*,7hhjJEEMEN ,aAq!<III,i8	w$C	8	8D(4t$$))+		8$((CH 
9 J	 
9	8 Js   .AG>>H	c                sX    V ^8  d   QhR\         \        R3,          R\        R,          /# )r4   runtimes.r6   N)rO   RuntimeVersionr8   r9   r:   r;   r;     s*     # #%(;"< #RVAV #r<   c                s    Rp\         P                  P                  R4      \        \        P
                  ! V 4      4      9   d)   \        P                  ! R4       \        R V  4       4      # \         P                  P                  R4      '       g/   \        P                  ! RV ^ ,          ^,          4       V ^ ,          # \         P                  P                  R4      R9   d/   \        P                  ! RV ^ ,          ^,          4       V ^ ,          # \         P                  P                  R4      '       d/   \        P                  ! R	V ^ ,          ^,          4       V ^ ,          # \        P                  ! R
4       \        P                  ! \         P                  P                  RR4      4      p\         P                  P                  R4      '       d\   VP                  4       '       dF   \        \        P                  ! \         P                  R,          4      4      \         P                  R&   \        \         P                  R,          R4      P                  4       pVP                  4       '       d   \!        W 4      pV# )z5Resolve the required runtime of a compatibility tool.Nrn   z4RUNTIMEPATH is codename, skipping version resolutionc              3   sb   "   T F%  p\         P                  R ,          V9   g   K!  Vx  K'  	  R# 5i)rn   N)rD   rE   )r   memberr   r:   r   Z&resolve_umu_version.<locals>.<genexpr>  s%      
!)vRZZ-F&-PFFs   /
/rU   z$PROTONPATH unset, defaulting to '%s'z*PROTONPATH is codename, defaulting to '%s'r>   z%UMU_NO_PROTON set, defaulting to '%s'z.PROTONPATH set, resolving its required runtimerR   ztoolmanifest.vdfrV   )rD   rE   rF   r~   r   Zfrom_iterabler*   rt   r   r&   rB   rG   r7   r   rH   rv   get_umu_version_from_manifest)r   versionr5   r   r:   resolve_umu_versionr     s   +/G	zz~~m$E,?,?,I(JJ		HI 
!)
 
 	
 ::>>,''		8(1+a.I{ 
zz~~l#'OO		>AO{ 
zz~~o&&		98A;q>J{ II>?&&rzz~~lB'GHD	zz~~l###&|'<'<RZZ=U'V#W

< 

<(*<=EEGD||~~/?Nr<   c                sd    V ^8  d   QhR\         R\        \        R3,          R\        R,          /# )r4   r5   r   .r6   N)r   rO   r   r8   r9   r:   r;   r;     s8     B B
B 34BdBr<   c                s  a RpV Uu0 uF  q3^,          kK  	  ppRoV P                  RRR7      ;_uu_ 4       pV F>  pW&9  d   K  \        P                  ! RV4      ;p'       g   K,  VP                  ! ^4      o M	  RRR4       S'       g   R# SV9  d   R# \	        V3R lV 4       4      # u upi   + '       g   i     L=; i)	zIFind the required runtime from a compatibility tool's configuration file.Zrequire_tool_appidrR   r   r   r   z"require_tool_appid"\s+"(\d+)Nc              3   s:   <"   T F  pSV9   g   K  Vx  K  	  R # 5ir   r   )r   r   appids   & r:   r   Z0get_umu_version_from_manifest.<locals>.<genexpr>  s     AX6&Xs   	
)r   reZsearchZgroupr   )	r5   r   r   r   Zappidsr   r   r   r   s	   &&      @r:   r   r     s     $C089fq		F9E	g	.	.$D		"BDIIuIIA  
/ FAXAAA# : 
/	.s   B-*B2'B22C	c                s~    V ^8  d   QhR\         \        \        \        \        ,          3,          ,          R\        /# )r4   r\   r6   )r   rO   r7   r]   r   r8   r9   r:   r;   r;     s0     Z  Z )eCcN33 Z  Z r<   c                s,
   / RRbRRbRRbRRbRRbRRbR	RbR
RbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRRRRRRRRRRRRRRR/Cp. pRpRp\         P                  ! R\        \        P                  4        \         P
                  ! R4       \        \        \        4      ;_uu_ 4       pVP                  ^4       VP                  R.4       RRR4       R pV'       g   R!p\        V4      h\#        \$        4      pV'       g/   R$\&        P(                  P+                  R4       R%2p\-        V4      hV^,          \&        P(                  R&   \/        \0        4      ;_uu_ 4        ^ RIpVP5                  4        RRR4       \7        \8        R R&7      p	\;        \<        \<        R'7      p
\?        4       ;_uu_ 4       p\A        WR(7      ;_uu_ 4       pW3pVPC                  \D        \F        V^,          ,          WM4      p\I        V \J        4      '       d   \M        W4      w  rMV ^,          p\O        W4       \F        PP                  ! V^,          4      PS                  R R R)7       \U        \F         R*\V        PX                  PZ                   24      ;_uu_ 4        \]        VR,          4       RRR4       \_        W4       VPa                  4        F1  w  pp\         P
                  ! R+VV4       V\&        P(                  V&   K3  	   VPc                  4        RRR4       RRR4       VR,          Pk                  R,4      '       d9   \m        V\o        VR,          4      4      '       d   \        Pp                  ! ^4       \s        V\F        V^,          ,          V4      p\         P
                  ! R-V4       \u        V4      #   + '       g   i     EL; i  \         d:    \        4       '       g   R!p\        T4      h\         P
                  ! R"4       R p EL6\         dW   pTP                  \         8w  d   h \        4       '       g   R!p\        T4      h\         P
                  ! R#4       R p Rp?ELRp?ii ; i  + '       g   i     EL; i  + '       g   i     EL; i  \d        \f        \h        \,        3 d8    \        4       '       g   R!p\        T4      h\         P
                  ! R#4        ELi ; i  + '       g   i     EL; i  + '       g   i     EL; i)/aw  Prepare and run an executable within the Steam Runtime.

The executable will typically be run through Proton, unless configured
otherwise. Will additionally download or auto update an existing Steam
Runtime version 2 (e.g., soldier, sniper) to be installed in
$XDG_DATA_HOME/umu or $HOME/.local/share/umu when invoked.

See umu(1) for details on other configuration options.
rQ   rR   rP   ZPROTON_CRASH_REPORT_DIRz/tmp/umu_crashreportsrU   re   ro   r|   rp   ra   Z STEAM_COMPAT_CLIENT_INSTALL_PATHrj   rk   ZFONTCONFIG_PATHrb   rh   rf   r}   rc   r_   rd   rq   rr   rs   r>   rn   FNzumu-launcher version %s (%s)zConnecting to '1.1.1.1'...TzSumu has not been setup for the user
An internet connection is required to setup umuzRequest timed outzNetwork is unreachablezFailed to match 'z' with a container runtime)ZtotalZredirect)connectZread)timeoutretriesrT   rm   z%s=%sr^   z%s)z1.1.1.1i5   );r*   rW   r#   sysr   rt   r   r   r   Z
settimeoutr   r   r0   ZRuntimeErrorZOSErrorerrnor   r   r"   rD   rE   rF   rX   r   ZModuleNotFoundError
truststoreZinject_into_sslr   NET_RETRIESr   NET_TIMEOUTr   r   Zsubmitr-   r'   ru   r   r+   r[   rB   rI   r2   r(   ZPrefixr   rK   rz   r   Zresultr   r   TimeoutErrorUrllib3ry   r1   r   Zexitr   r   )r\   rL   r   Zprereqr   ZsockrZ   r   r   r   r   Zthread_poolZ	http_poolrM   Zfuturer   r   r   s   &                 r:   umu_runr     s   b" 	"#: 	b	
 	r 	"2 	%b 	r 	$R 	+B 	!" 	#B 	2 	r 	b  	r!" 	%b#$ 	r"b"br3C6 DF%)GHH+[#++F
		./GZ((DOOALL) ) , > 	 3 ""67G

| <==WX 	 o '
BJJ} 
%	&	&""$	 
' t<G{EG 	G55AL@X$++y71:-w
 dI&&$S/IC7Dc)71:&,,TD,I 9+Qx'<'<&=>??c,'( @ 	 		HCIIgsC(!BJJsO $		0MMO= 	6 	T 5z<((->d3|$%. . 	 '4CWQZ9OQU&VGIIdG wU )((  B  s##		%& 
77k!B  s##		*+
: 
'	&	&< @?? 13F
S 	0 ??F  #3''II./	0? 	655 	s   92O +#N7
O #Q18TCS.	R'AS.	 RT7O		O A Q.Q.Q.AQ))Q.1R	R	S.	AS+'S.	*S++S.	.S?9	TT	)lrD   r   r   r   Z_ctypesr    Zargparser   r   Zcollections.abcr   r   Zconcurrent.futuresr   r   Z
contextlibr   Zctypesr   r	   r
   r   r   Z	itertoolsr   Zpathlibr   Zpwdr   r   Zsecretsr   r   r   r   Z
subprocessr   Ztypingr   Zurllib3r   r   Zurllib3.exceptionsr   r   r   r   Zurllib3.utilr   ZXlibr   r   r   Z
Xlib.errorr   ZXlib.protocol.requestr    ZXlib.xobject.drawabler!   rS   r"   r#   Zumu.umu_constsr$   r%   r&   r'   r(   r)   Zumu.umu_logr*   Zumu.umu_pluginsr+   Zumu.umu_protonr,   Zumu.umu_runtimer-   Zumu.umu_utilr.   r/   r0   r1   r2   r3   r   r   rO   r7   r   rK   r[   rz   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r<   r:   <module>r      s   	 	 
     5 9  ' '       . .   & @ B   " " - - ( 1   ( ) %  sC}%)@>BbJD =@X8&R<,64!DH*Z/d#LB2Z r<   