mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge pull request #1305 from anthonyhab/feat/bar-margin-percentage-to-pixel
feat: convert bar margins from percentages to pixels
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import QtQuick
|
||||
import qs.Commons
|
||||
|
||||
QtObject {
|
||||
function migrate(adapter, logger, rawJson) {
|
||||
logger.i("Migration38", "Migrating bar margins from percentages to integers");
|
||||
|
||||
// Use rawJson to read original values, adapter to write new values (following migration patterns)
|
||||
const rawVertical = rawJson?.bar?.marginVertical;
|
||||
const rawHorizontal = rawJson?.bar?.marginHorizontal;
|
||||
|
||||
// Only migrate if values exist and are percentages (<= 1.0)
|
||||
if (rawVertical !== undefined && typeof rawVertical === 'number' && rawVertical <= 1.0) {
|
||||
const marginXL = 18; // Standard value of Style.marginXL
|
||||
adapter.bar.marginVertical = Math.round(rawVertical * marginXL);
|
||||
logger.d("Migration38", "Converted marginVertical from " + rawVertical + " to " + adapter.bar.marginVertical + "px");
|
||||
}
|
||||
|
||||
if (rawHorizontal !== undefined && typeof rawHorizontal === 'number' && rawHorizontal <= 1.0) {
|
||||
const marginXL = 18; // Standard value of Style.marginXL
|
||||
adapter.bar.marginHorizontal = Math.round(rawHorizontal * marginXL);
|
||||
logger.d("Migration38", "Converted marginHorizontal from " + rawHorizontal + " to " + adapter.bar.marginHorizontal + "px");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,8 @@ QtObject {
|
||||
33: migration33Component,
|
||||
35: migration35Component,
|
||||
36: migration36Component,
|
||||
37: migration37Component
|
||||
37: migration37Component,
|
||||
38: migration38Component
|
||||
})
|
||||
|
||||
// Migration components
|
||||
@@ -24,4 +25,5 @@ QtObject {
|
||||
property Component migration35Component: Migration35 {}
|
||||
property Component migration36Component: Migration36 {}
|
||||
property Component migration37Component: Migration37 {}
|
||||
property Component migration38Component: Migration38 {}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ Singleton {
|
||||
- Default cache directory: ~/.cache/noctalia
|
||||
*/
|
||||
readonly property alias data: adapter // Used to access via Settings.data.xxx.yyy
|
||||
readonly property int settingsVersion: 37
|
||||
readonly property int settingsVersion: 38
|
||||
readonly property bool isDebug: Quickshell.env("NOCTALIA_DEBUG") === "1"
|
||||
readonly property string shellName: "noctalia"
|
||||
readonly property string configDir: Quickshell.env("NOCTALIA_CONFIG_DIR") || (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/" + shellName + "/"
|
||||
@@ -200,8 +200,8 @@ Singleton {
|
||||
|
||||
// Floating bar settings
|
||||
property bool floating: false
|
||||
property real marginVertical: 0.25
|
||||
property real marginHorizontal: 0.25
|
||||
property int marginVertical: 4
|
||||
property int marginHorizontal: 4
|
||||
|
||||
// Bar outer corners (inverted/concave corners at bar edges when not floating)
|
||||
property bool outerCorners: true
|
||||
|
||||
Reference in New Issue
Block a user