Fixing crash when no config permission

This addresse the issue #98
This commit is contained in:
Roman 2024-11-19 14:06:49 +09:00
parent 073626ca91
commit 79ed7fc93c
2 changed files with 7 additions and 3 deletions

View File

@ -625,7 +625,7 @@ class App(Gtk.Window):
# Update the active transition type based on the selected option
if active_index >= 0:
self.cf.swww_transition_type = SWWW_TRANSITION_TYPES[active_index]
print(f"transition type changed to: {self.cf.swww_transition_type}")
print(f"Transition type changed to: {self.cf.swww_transition_type}")
def on_color_set(self, color_button):

View File

@ -210,8 +210,12 @@ class Config:
config.set("Settings", "swww_transition_duration", str(self.swww_transition_duration))
config.set("Settings", "swww_transition_fps", str(self.swww_transition_fps))
config.set("Settings", "use_xdg_state", str(self.use_xdg_state))
with open(self.config_file, "w") as configfile:
config.write(configfile)
try:
with open(self.config_file, "w") as configfile:
config.write(configfile)
except PermissionError:
print("Could not save config file due to permission error.")
# If requested, save the state file:
if not self.use_xdg_state: