mirror of
https://github.com/imarkoff/Marble-shell-theme.git
synced 2025-10-08 17:28:46 -07:00
Add ability to remove GDM theme
This commit is contained in:
@@ -102,6 +102,12 @@ def main():
|
||||
config.global_gnome_shell_theme, config.gnome_shell_gresource,
|
||||
config.temp_folder, is_filled=args.filled)
|
||||
|
||||
if args.remove:
|
||||
gdm_rm_status = gdm_theme.remove()
|
||||
if gdm_rm_status == 0:
|
||||
print("GDM theme removed successfully.")
|
||||
return 0
|
||||
|
||||
if args.red or args.pink or args.purple or args.blue or args.green or args.yellow or args.gray:
|
||||
for color in colors["colors"]:
|
||||
if getattr(args, color):
|
||||
|
@@ -28,6 +28,7 @@ class GlobalTheme:
|
||||
self.backup_file = f"{self.destination_file}.backup"
|
||||
self.backup_trigger = "\n/* Marble theme */\n" # trigger to check if theme is installed
|
||||
self.extracted_theme = f"{self.temp_folder}/{config.extracted_gdm_folder}"
|
||||
self.gst = f"{self.destination_folder}/{self.destination_file}" # use backup file if theme is installed
|
||||
|
||||
os.makedirs(self.temp_folder, exist_ok=True) # create temp folder
|
||||
|
||||
@@ -147,8 +148,6 @@ class GlobalTheme:
|
||||
:param sat: color saturation
|
||||
"""
|
||||
|
||||
# use backup file if theme is installed
|
||||
self.gst = f"{self.destination_folder}/{self.destination_file}"
|
||||
if self.__is_installed():
|
||||
print("Theme is installed. Reinstalling...")
|
||||
self.gst += ".backup"
|
||||
@@ -177,3 +176,27 @@ class GlobalTheme:
|
||||
f"{self.destination_folder}/{self.destination_file}")
|
||||
|
||||
return 0
|
||||
|
||||
def remove(self):
|
||||
"""
|
||||
Remove installed theme
|
||||
"""
|
||||
|
||||
# use backup file if theme is installed
|
||||
if self.__is_installed():
|
||||
print("Theme is installed. Removing...")
|
||||
|
||||
if os.path.isfile(f"{self.destination_folder}/{self.backup_file}"):
|
||||
subprocess.run(f"sudo mv {self.backup_file} {self.destination_file}",
|
||||
shell=True, cwd=self.destination_folder)
|
||||
|
||||
else:
|
||||
print("Backup file not found. Try reinstalling gnome-shell package.")
|
||||
return 1
|
||||
|
||||
else:
|
||||
print("Theme is not installed. Nothing to remove.")
|
||||
print("If theme is still installed globally, try reinstalling gnome-shell package.")
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
Reference in New Issue
Block a user