Integrate complete display layouts
This commit is contained in:
@@ -15,7 +15,21 @@ ShellRoot {
|
||||
property var homeFavorites: []
|
||||
property bool displayOperationBusy: false
|
||||
property bool displayBlocked: false
|
||||
property var displayGeneration: ({ "DP-2": { mode: "4500x3000@60", scale: 1.5, transform: 0 } })
|
||||
property bool displayApplyAccepted: true
|
||||
property bool displayConfirmationReady: false
|
||||
property var originalDisplays: ({
|
||||
"DP-2": { mode: "4500x3000@60", scale: 1.5, transform: 0, x: 0, y: 0, primary: true },
|
||||
"HDMI-A-1": { mode: "2560x1440@60", scale: 1, transform: 0, x: 3000, y: 0, primary: false }
|
||||
})
|
||||
property var restoredDisplays: ({
|
||||
"DP-2": { mode: "4500x3000@60", scale: 1.5, transform: 0, x: -2560, y: 0, primary: false },
|
||||
"HDMI-A-1": { mode: "2560x1440@60", scale: 1, transform: 0, x: 0, y: 0, primary: true }
|
||||
})
|
||||
property var displayGeneration: originalDisplays
|
||||
property var liveLayout: [
|
||||
{ name: "DP-2", width: 4500, height: 3000, refreshRate: 60, mode: "4500x3000@60", scale: 1.5, transform: 0, x: 0, y: 0, primary: true },
|
||||
{ name: "HDMI-A-1", width: 2560, height: 1440, refreshRate: 60, mode: "2560x1440@60", scale: 1, transform: 0, x: 3000, y: 0, primary: false }
|
||||
]
|
||||
|
||||
function record(name: string): void {
|
||||
const next = root.calls.slice();
|
||||
@@ -45,7 +59,10 @@ ShellRoot {
|
||||
root.homeFavorites = root.homeFavorites.map(favorite =>
|
||||
favorite.id === id ? { id: id, alias: alias } : favorite);
|
||||
};
|
||||
SettingsBackup.reloadDesktop = function() { root.record("desktop.reload"); };
|
||||
SettingsBackup.reloadDesktop = function() {
|
||||
root.record("desktop.reload");
|
||||
root.displayGeneration = JSON.parse(JSON.stringify(root.restoredDisplays));
|
||||
};
|
||||
SettingsBackup.readDisplays = function() { return root.displayGeneration; };
|
||||
SettingsBackup.protectDisplays = function(value) {
|
||||
root.record("display.protect:" + JSON.stringify(value));
|
||||
@@ -53,6 +70,25 @@ ShellRoot {
|
||||
return true;
|
||||
};
|
||||
SettingsBackup.displayBusy = function() { return root.displayOperationBusy; };
|
||||
SettingsBackup.readLiveDisplayLayout = function() {
|
||||
return root.liveLayout.map(record => Object.assign({}, record));
|
||||
};
|
||||
SettingsBackup.applyDisplayLayout = function(layout) {
|
||||
root.record("display.apply:" + JSON.stringify(layout));
|
||||
if (!root.displayApplyAccepted)
|
||||
return false;
|
||||
root.liveLayout = layout.map(record => Object.assign({}, record));
|
||||
root.displayOperationBusy = true;
|
||||
root.displayConfirmationReady = true;
|
||||
return true;
|
||||
};
|
||||
SettingsBackup.displayCanConfirm = function() { return root.displayConfirmationReady; };
|
||||
SettingsBackup.confirmDisplayLayout = function() {
|
||||
root.record("display.confirm");
|
||||
root.displayOperationBusy = false;
|
||||
root.displayConfirmationReady = false;
|
||||
return true;
|
||||
};
|
||||
SettingsBackup.setDisplayBlocked = function(blocked) {
|
||||
root.record("display.block:" + blocked);
|
||||
root.displayBlocked = blocked;
|
||||
@@ -77,7 +113,15 @@ ShellRoot {
|
||||
root.homeFavorites = [];
|
||||
root.displayOperationBusy = false;
|
||||
root.displayBlocked = false;
|
||||
root.displayApplyAccepted = true;
|
||||
root.displayConfirmationReady = false;
|
||||
root.displayGeneration = JSON.parse(JSON.stringify(root.originalDisplays));
|
||||
root.liveLayout = [
|
||||
{ name: "DP-2", width: 4500, height: 3000, refreshRate: 60, mode: "4500x3000@60", scale: 1.5, transform: 0, x: 0, y: 0, primary: true },
|
||||
{ name: "HDMI-A-1", width: 2560, height: 1440, refreshRate: 60, mode: "2560x1440@60", scale: 1, transform: 0, x: 3000, y: 0, primary: false }
|
||||
];
|
||||
SettingsBackup.protectedDisplays = root.displayGeneration;
|
||||
SettingsBackup.protectedDisplayLayout = root.liveLayout;
|
||||
}
|
||||
|
||||
function apply(output: string): bool {
|
||||
@@ -90,6 +134,11 @@ ShellRoot {
|
||||
return SettingsBackup.restore("settings-20260818-010203004.json");
|
||||
}
|
||||
|
||||
function applyDisplayFailure(output: string): bool {
|
||||
root.displayApplyAccepted = false;
|
||||
return SettingsBackup.handleRestoreOutput(output);
|
||||
}
|
||||
|
||||
function status(): string {
|
||||
return JSON.stringify({
|
||||
calls: root.calls,
|
||||
|
||||
Reference in New Issue
Block a user