🔧 Tweak migration code
This commit is contained in:
+27
-7
@@ -24,13 +24,22 @@ function migrate() {
|
||||
.then(r => {
|
||||
utils.debug('Starting Burn-My-Windows profile migration!');
|
||||
|
||||
// The default value of this is false, so if it is not present, only normal windows
|
||||
// were affected.
|
||||
const onlyNormalWindows = !r.includes('destroy-dialogs=true');
|
||||
if (onlyNormalWindows) {
|
||||
// The default value of this is false, so not-present is equal to false.
|
||||
const destroyDialogs = r.includes('destroy-dialogs=true');
|
||||
if (!destroyDialogs) {
|
||||
utils.debug('Only normal windows will be burned by the new profile(s).');
|
||||
} else {
|
||||
utils.debug('Normal windows and dialogs will be burned by the new profile(s).');
|
||||
}
|
||||
|
||||
// The default value of this is false, so not-present is equal to false.
|
||||
const disableOnBattery = r.includes('disable-on-battery=true');
|
||||
if (disableOnBattery) {
|
||||
utils.debug('The new profile(s) will not be active on battery.');
|
||||
}
|
||||
|
||||
// The default value of this is false, so not-present is equal to false.
|
||||
const disableOnPowerSave = r.includes('disable-on-power-save=true');
|
||||
if (disableOnPowerSave) {
|
||||
utils.debug('The new profile(s) will not be active in power-save mode.');
|
||||
}
|
||||
|
||||
// Remove some unnecessary lines.
|
||||
@@ -38,6 +47,8 @@ function migrate() {
|
||||
r = r.replace(/^test-mode=.*\n?/gm, '');
|
||||
r = r.replace(/^last-version=.*\n?/gm, '');
|
||||
r = r.replace(/^destroy-dialogs=.*\n?/gm, '');
|
||||
r = r.replace(/^disable-on-battery=.*\n?/gm, '');
|
||||
r = r.replace(/^disable-on-power-save=.*\n?/gm, '');
|
||||
r = r.replace(/^.*-preview-.*\n?/gm, '');
|
||||
r = r.replace('[/]\n', '');
|
||||
r = r.trim();
|
||||
@@ -81,10 +92,19 @@ function migrate() {
|
||||
const profile =
|
||||
lines.filter(l => !l.includes('-close-effect=') && !l.includes('-open-effect='));
|
||||
profile.unshift('[burn-my-windows-profile]');
|
||||
if (onlyNormalWindows) {
|
||||
|
||||
if (!destroyDialogs) {
|
||||
profile.push('profile-window-type=1');
|
||||
}
|
||||
|
||||
if (disableOnBattery) {
|
||||
profile.push('profile-power-mode=2');
|
||||
}
|
||||
|
||||
if (disableOnPowerSave) {
|
||||
profile.push('profile-power-profile=5');
|
||||
}
|
||||
|
||||
if (numProfiles == 1) {
|
||||
openEffects.forEach(e => profile.push(e + '-enable-effect=true'));
|
||||
if (!openEffects.includes('fire')) {
|
||||
|
||||
Reference in New Issue
Block a user