forked from Shinonome/dots-hyprland
bar: component loader
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import QtQuick
|
||||
import qs.modules.common as C
|
||||
|
||||
// This is to enable future fancy styles for rectangles. Some ideas:
|
||||
// - normal rounded rect
|
||||
// - osk.sh
|
||||
// - 3d
|
||||
// i hope i actually get to this and not shrimply forget
|
||||
Rectangle {
|
||||
enum ContentLayer { Background, Pane, Group, Subgroup, Control }
|
||||
property var contentLayer: StyledRectangle.ContentLayer.Pane // To appropriately add effects like shadows/3d-ization
|
||||
|
||||
color: switch(contentLayer) {
|
||||
case StyledRectangle.ContentLayer.Background: C.Appearance.colors.colLayer0;
|
||||
case StyledRectangle.ContentLayer.Pane: C.Appearance.colors.colLayer1;
|
||||
case StyledRectangle.ContentLayer.Group: C.Appearance.colors.colLayer2;
|
||||
case StyledRectangle.ContentLayer.Subgroup: C.Appearance.colors.colLayer3;
|
||||
case StyledRectangle.ContentLayer.Control: C.Appearance.colors.colLayer4;
|
||||
default: C.Appearance.colors.colLayer1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import QtQuick
|
||||
import qs.modules.common as C
|
||||
|
||||
FallbackLoader {
|
||||
id: root
|
||||
|
||||
required property string componentName
|
||||
property string context // Path for the builtin component
|
||||
|
||||
readonly property string componentNameWithExt: componentName.endsWith(".qml") ? componentName : `${componentName}.qml`
|
||||
|
||||
source: `${C.Directories.userComponents}/${componentNameWithExt}`
|
||||
fallbacks: [
|
||||
...(context ? [ `${context}/${componentNameWithExt}` ] : []),
|
||||
componentNameWithExt
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user