@@ -288,16 +288,15 @@ def install_theme(self):
288
288
# Show the dialog and check the user's response
289
289
if dialog .exec ()== QDialog .DialogCode .Accepted :
290
290
try :
291
- subprocess .run (["yasbc" ,"stop" ],creationflags = subprocess .CREATE_NO_WINDOW )
291
+ subprocess .run (["yasbc" ,"stop" ],creationflags = subprocess .CREATE_NO_WINDOW , stdout = subprocess . PIPE , stderr = subprocess . PIPE )
292
292
# Define the URLs for the files
293
293
base_url = f"https://raw.githubusercontent.com/amnweb/yasb-themes/main/themes/{ self .theme_data ['id' ]} "
294
294
config_url = f"{ base_url } /config.yaml"
295
295
styles_url = f"{ base_url } /styles.css"
296
296
297
- # Define the destination paths
298
- home_dir = os .path .expanduser ("~" )
299
- config_path = os .path .join (home_dir ,".config" ,"yasb" ,"config.yaml" )
300
- styles_path = os .path .join (home_dir ,".config" ,"yasb" ,"styles.css" )
297
+ config_home = os .getenv ('YASB_CONFIG_HOME' )if os .getenv ('YASB_CONFIG_HOME' )else os .path .join (os .path .expanduser ("~" ),".config" ,"yasb" )
298
+ config_path = os .path .join (config_home ,"config.yaml" )
299
+ styles_path = os .path .join (config_home ,"styles.css" )
301
300
302
301
# Create the directory if it doesn't exist
303
302
os .makedirs (os .path .dirname (config_path ),exist_ok = True )
@@ -307,13 +306,13 @@ def install_theme(self):
307
306
styles_response .raise_for_status ()
308
307
with open (styles_path ,'wb' )as styles_file :
309
308
styles_file .write (styles_response .content )
310
-
309
+
311
310
# Download and save the config.yaml file
312
311
config_response = requests .get (config_url )
313
312
config_response .raise_for_status ()
314
313
with open (config_path ,'wb' )as config_file :
315
314
config_file .write (config_response .content )
316
- subprocess .run (["yasbc" ,"start" ],creationflags = subprocess .CREATE_NO_WINDOW )
315
+ subprocess .run (["yasbc" ,"start" ],creationflags = subprocess .CREATE_NO_WINDOW , stdout = subprocess . PIPE , stderr = subprocess . PIPE )
317
316
except Exception as e :
318
317
QMessageBox .critical (self ,'Error' ,f"Failed to install theme:{ str (e )} " )
319
318
@@ -349,7 +348,8 @@ def init_ui(self):
349
348
self .placeholder_label .setAlignment (Qt .AlignmentFlag .AlignCenter )
350
349
layout .addWidget (self .placeholder_label )
351
350
352
- self .backup_info = QLabel ("Backup your current theme before installing a new one. You can do this by copying the <b>config.yaml</b> and <b>styles.css</b> files from the <b><i>.config/yasb</i></b> directory to a safe location." )
351
+ config_home = os .getenv ('YASB_CONFIG_HOME' )if os .getenv ('YASB_CONFIG_HOME' )else os .path .join (os .path .expanduser ("~" ),".config" ,"yasb" )
352
+ self .backup_info = QLabel (f"Backup your current theme before installing a new one. You can do this by copying the <b>config.yaml</b> and <b>styles.css</b> files from the <b><i>{ config_home } </i></b> directory to a safe location." )
353
353
self .backup_info .setWordWrap (True )
354
354
self .backup_info .setStyleSheet ("color:#fff; background-color: rgba(166, 16, 48, 0.3);border-radius:6px;border:1px solid rgba(166, 16, 48, 0.5);padding:4px 8px;font-size:11px;font-family:'Segoe UI';margin:14px 20px 0 14px" )
355
355
self .backup_info .hide ()