mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 13:32:50 -05:00
dankbar: add bar get/setPosition IPC
This commit is contained in:
@@ -599,6 +599,39 @@ Item {
|
||||
return barConfig.autoHide ? "BAR_MANUAL_HIDE_SUCCESS" : "BAR_AUTO_HIDE_SUCCESS";
|
||||
}
|
||||
|
||||
function getPosition(selector: string, value: string): string {
|
||||
const {
|
||||
barConfig,
|
||||
error
|
||||
} = getBarConfig(selector, value);
|
||||
if (error)
|
||||
return error;
|
||||
const positions = ["top", "bottom", "left", "right"];
|
||||
return positions[barConfig.position] || "unknown";
|
||||
}
|
||||
|
||||
function setPosition(selector: string, value: string, position: string): string {
|
||||
const {
|
||||
barConfig,
|
||||
error
|
||||
} = getBarConfig(selector, value);
|
||||
if (error)
|
||||
return error;
|
||||
const positionMap = {
|
||||
"top": SettingsData.Position.Top,
|
||||
"bottom": SettingsData.Position.Bottom,
|
||||
"left": SettingsData.Position.Left,
|
||||
"right": SettingsData.Position.Right
|
||||
};
|
||||
const posValue = positionMap[position.toLowerCase()];
|
||||
if (posValue === undefined)
|
||||
return "BAR_INVALID_POSITION";
|
||||
SettingsData.updateBarConfig(barConfig.id, {
|
||||
position: posValue
|
||||
});
|
||||
return "BAR_POSITION_SET_SUCCESS";
|
||||
}
|
||||
|
||||
target: "bar"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user