From 868dc619b3be500e020b5d9c92e7d4592ac08974 Mon Sep 17 00:00:00 2001 From: FrostBird347 <39435218+FrostBird347@users.noreply.github.com> Date: Fri, 29 May 2026 18:01:26 +0800 Subject: [PATCH 1/3] Combine default lists exclude_list_default_extra used to take priority over exclude_list_user, this is no longer the case and so there is no reason to keep the list seperate from exclude_list_default Also note that exclude_list_default_extra used to be ignored when running --clone, however that apparently isn't a supported feature anymore according to https://github.com/linuxmint/timeshift/blob/aaff762ce2dc42e799176fff5d6effb8063fcb67/src/AppConsole.vala#L379 and just gets treated as --restore --- src/Core/Main.vala | 61 ++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 40 deletions(-) diff --git a/src/Core/Main.vala b/src/Core/Main.vala index 52c4650e..fd53e00a 100644 --- a/src/Core/Main.vala +++ b/src/Core/Main.vala @@ -60,7 +60,6 @@ public class Main : GLib.Object{ public Gee.ArrayList exclude_list_user; public Gee.ArrayList exclude_list_default; - public Gee.ArrayList exclude_list_default_extra; public Gee.ArrayList exclude_list_home; public Gee.ArrayList exclude_list_restore; public Gee.ArrayList exclude_list_apps; @@ -648,7 +647,6 @@ public class Main : GLib.Object{ exclude_list_user = new Gee.ArrayList(); exclude_list_default = new Gee.ArrayList(); - exclude_list_default_extra = new Gee.ArrayList(); exclude_list_home = new Gee.ArrayList(); exclude_list_restore = new Gee.ArrayList(); exclude_list_apps = new Gee.ArrayList(); @@ -715,7 +713,7 @@ public class Main : GLib.Object{ // add exclude entry for devices mounted to non-standard locations - exclude_list_default_extra.add(entry.mount_point + "/*"); + exclude_list_default.add(entry.mount_point + "/*"); } exclude_list_default.add("/root/.thumbnails"); @@ -732,26 +730,26 @@ public class Main : GLib.Object{ // default extra ------------------ - exclude_list_default_extra.add("/root/.mozilla/firefox/*.default/Cache"); - exclude_list_default_extra.add("/root/.mozilla/firefox/*.default/OfflineCache"); - exclude_list_default_extra.add("/root/.opera/cache"); - exclude_list_default_extra.add("/root/.kde/share/apps/kio_http/cache"); - exclude_list_default_extra.add("/root/.kde/share/cache/http"); - - exclude_list_default_extra.add("/home/*/.mozilla/firefox/*.default/Cache"); - exclude_list_default_extra.add("/home/*/.mozilla/firefox/*.default/OfflineCache"); - exclude_list_default_extra.add("/home/*/.opera/cache"); - exclude_list_default_extra.add("/home/*/.kde/share/apps/kio_http/cache"); - exclude_list_default_extra.add("/home/*/.kde/share/cache/http"); - - exclude_list_default_extra.add("/var/cache/apt/archives/*"); - exclude_list_default_extra.add("/var/cache/pacman/pkg/*"); - exclude_list_default_extra.add("/var/cache/yum/*"); - exclude_list_default_extra.add("/var/cache/dnf/*"); - exclude_list_default_extra.add("/var/cache/eopkg/*"); - exclude_list_default_extra.add("/var/cache/xbps/*"); - exclude_list_default_extra.add("/var/cache/zypp/*"); - exclude_list_default_extra.add("/var/cache/edb/*"); + exclude_list_default.add("/root/.mozilla/firefox/*.default/Cache"); + exclude_list_default.add("/root/.mozilla/firefox/*.default/OfflineCache"); + exclude_list_default.add("/root/.opera/cache"); + exclude_list_default.add("/root/.kde/share/apps/kio_http/cache"); + exclude_list_default.add("/root/.kde/share/cache/http"); + + exclude_list_default.add("/home/*/.mozilla/firefox/*.default/Cache"); + exclude_list_default.add("/home/*/.mozilla/firefox/*.default/OfflineCache"); + exclude_list_default.add("/home/*/.opera/cache"); + exclude_list_default.add("/home/*/.kde/share/apps/kio_http/cache"); + exclude_list_default.add("/home/*/.kde/share/cache/http"); + + exclude_list_default.add("/var/cache/apt/archives/*"); + exclude_list_default.add("/var/cache/pacman/pkg/*"); + exclude_list_default.add("/var/cache/yum/*"); + exclude_list_default.add("/var/cache/dnf/*"); + exclude_list_default.add("/var/cache/eopkg/*"); + exclude_list_default.add("/var/cache/xbps/*"); + exclude_list_default.add("/var/cache/zypp/*"); + exclude_list_default.add("/var/cache/edb/*"); // default home ---------------- @@ -831,14 +829,6 @@ public class Main : GLib.Object{ } } - // add default extra entries --------------------------- - - foreach(string path in exclude_list_default_extra){ - if (!list.contains(path)){ - list.add(path); - } - } - // add entries to exclude **decrypted** contents in $HOME // decrypted contents should never be backed-up or restored // this overrides all other user entries in exclude_list_user @@ -954,15 +944,6 @@ public class Main : GLib.Object{ } } - if (!mirror_system){ - //add default_extra entries - foreach(string path in exclude_list_default_extra){ - if (!exclude_list_restore.contains(path)){ - exclude_list_restore.add(path); - } - } - } - //add app entries foreach(var entry in exclude_list_apps){ if (entry.enabled){ From 39ceb546b00d679cf3a4a24d1ad71c97a6bda2c5 Mon Sep 17 00:00:00 2001 From: FrostBird347 <39435218+FrostBird347@users.noreply.github.com> Date: Fri, 29 May 2026 19:21:58 +0800 Subject: [PATCH 2/3] Ensure defaults take priority over user accounts All other user specified filters are kept at top priority so if a user still wants to back up their cache folder they can still add a specific filter for that. --- src/Core/Main.vala | 87 +++++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/src/Core/Main.vala b/src/Core/Main.vala index fd53e00a..dd02aee5 100644 --- a/src/Core/Main.vala +++ b/src/Core/Main.vala @@ -809,7 +809,47 @@ public class Main : GLib.Object{ log_debug("Main: create_exclude_list_for_backup()"); var list = new Gee.ArrayList(); - + + + // extract user filters from exclude_list_user and add them to exclude_list_home + // if not present we treat the user as if it's excluded + // if we don't do this the default filters within any user account will be ignored + // ------------------------------------------------------- + foreach(var user in current_system_users.values){ + + if (user.is_system){ continue; } + + string exc_pattern = "%s/**".printf(user.home_path); + string inc_pattern = "+ %s/**".printf(user.home_path); + string inc_hidden_pattern = "+ %s/.**".printf(user.home_path); + + if (user.has_encrypted_home){ + inc_pattern = "+ /home/.ecryptfs/%s/***".printf(user.name); + exc_pattern = "/home/.ecryptfs/%s/***".printf(user.name); + } + + bool include_hidden = exclude_list_user.contains(inc_hidden_pattern); + bool include_all = exclude_list_user.contains(inc_pattern); + bool exclude_all = !include_hidden && !include_all; + + if (exclude_all || include_hidden || include_all){ + if (exclude_all){ + // insert at the start to ensure these user entries always take priority over the home defaults added above + exclude_list_home.insert(0, exc_pattern); + exclude_list_user.remove(exc_pattern); + } + if (exclude_list_user.contains(inc_pattern)){ + exclude_list_home.insert(0, inc_pattern); + exclude_list_user.remove(inc_pattern); + } + if (exclude_list_user.contains(inc_hidden_pattern)){ + exclude_list_home.insert(0, inc_hidden_pattern); + exclude_list_user.remove(inc_hidden_pattern); + } + } + } + + // add user entries from current setting // user entry is first since rsync prioritizes the first // inclusion/exclusion patterns seen @@ -820,15 +860,7 @@ public class Main : GLib.Object{ list.add(path); } } - - // add default entries --------------------------- - foreach(string path in exclude_list_default){ - if (!list.contains(path)){ - list.add(path); - } - } - // add entries to exclude **decrypted** contents in $HOME // decrypted contents should never be backed-up or restored // this overrides all other user entries in exclude_list_user @@ -855,36 +887,13 @@ public class Main : GLib.Object{ } } } - - // exclude each user individually if not included in exclude_list_user - - foreach(var user in current_system_users.values){ - - if (user.is_system){ continue; } - - string exc_pattern = "%s/**".printf(user.home_path); - string inc_pattern = "+ %s/**".printf(user.home_path); - string inc_hidden_pattern = "+ %s/.**".printf(user.home_path); - - if (user.has_encrypted_home){ - inc_pattern = "+ /home/.ecryptfs/%s/***".printf(user.name); - exc_pattern = "/home/.ecryptfs/%s/***".printf(user.name); - } - - bool include_hidden = exclude_list_user.contains(inc_hidden_pattern); - bool include_all = exclude_list_user.contains(inc_pattern); - bool exclude_all = !include_hidden && !include_all; - - if (exclude_all){ - if (!exclude_list_user.contains(exc_pattern)){ - exclude_list_user.add(exc_pattern); - } - if (exclude_list_user.contains(inc_pattern)){ - exclude_list_user.remove(inc_pattern); - } - if (exclude_list_user.contains(inc_hidden_pattern)){ - exclude_list_user.remove(inc_hidden_pattern); - } + + + // add default entries --------------------------- + + foreach(string path in exclude_list_default){ + if (!list.contains(path)){ + list.add(path); } } From 50a22f88d8a38d5a9471fc285775128b358bcee3 Mon Sep 17 00:00:00 2001 From: FrostBird347 <39435218+FrostBird347@users.noreply.github.com> Date: Fri, 29 May 2026 19:56:31 +0800 Subject: [PATCH 3/3] Copy to seperate list to prevent values from being reset while using the GUI --- src/Core/Main.vala | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/Core/Main.vala b/src/Core/Main.vala index dd02aee5..0dd0906f 100644 --- a/src/Core/Main.vala +++ b/src/Core/Main.vala @@ -809,11 +809,12 @@ public class Main : GLib.Object{ log_debug("Main: create_exclude_list_for_backup()"); var list = new Gee.ArrayList(); + var home_list = new Gee.ArrayList(); - // extract user filters from exclude_list_user and add them to exclude_list_home - // if not present we treat the user as if it's excluded - // if we don't do this the default filters within any user account will be ignored + // copy user filters from exclude_list_user to home_list + // if no filters are present we treat the user as if it's excluded and add them to exclude_list_user + // if we don't do this the default filters for anything within an account will be ignored while also being impossible to manually add to the user filter list // ------------------------------------------------------- foreach(var user in current_system_users.values){ @@ -832,19 +833,16 @@ public class Main : GLib.Object{ bool include_all = exclude_list_user.contains(inc_pattern); bool exclude_all = !include_hidden && !include_all; - if (exclude_all || include_hidden || include_all){ - if (exclude_all){ - // insert at the start to ensure these user entries always take priority over the home defaults added above - exclude_list_home.insert(0, exc_pattern); - exclude_list_user.remove(exc_pattern); - } - if (exclude_list_user.contains(inc_pattern)){ - exclude_list_home.insert(0, inc_pattern); - exclude_list_user.remove(inc_pattern); - } - if (exclude_list_user.contains(inc_hidden_pattern)){ - exclude_list_home.insert(0, inc_hidden_pattern); - exclude_list_user.remove(inc_hidden_pattern); + if (include_hidden){ + home_list.add(inc_hidden_pattern); + } + if (include_all){ + home_list.add(inc_pattern); + } + if (exclude_all){ + home_list.add(exc_pattern); + if (!exclude_list_user.contains(exc_pattern)) { + exclude_list_user.add(exc_pattern); } } } @@ -853,10 +851,12 @@ public class Main : GLib.Object{ // add user entries from current setting // user entry is first since rsync prioritizes the first // inclusion/exclusion patterns seen + // though we make sure to ignore entries copied to home_list, + // otherwise the defaults under user accounts will always be ignored // ------------------------------------------------------- foreach(string path in exclude_list_user){ - if (!list.contains(path)){ + if (!list.contains(path) && !home_list.contains(path)){ list.add(path); } } @@ -896,6 +896,14 @@ public class Main : GLib.Object{ list.add(path); } } + + // add entries for users -------- + + foreach(string path in home_list){ + if (!list.contains(path)){ + list.add(path); + } + } // add common entries for excluding home folders for all users --------