This repository has been archived on 2026-11-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
dotfiles/mutable_config/quickshell/components/Shared/Surface.qml
T

48 lines
1.7 KiB
QML

import QtQuick
import "."
// Base panel/card chrome shared by menus, pickers, and dialogs: sharp
// corners, a solid 2px border, and a hard offset "shadow" - a flat duplicate
// rectangle displaced down-right, never blurred. `glow` switches the border
// and shadow from the default crust to `tint` (DESIGN.md's "Focused /
// Active" state, also used for danger/selected emphasis). `pressed`
// collapses the shadow and slides the face onto it - the mechanical
// depression press effect. Children declared on a Surface instance attach
// to the face, not the outer Item, so they translate together with it.
Item {
id: surface
default property alias content: face.data
property alias color: face.color
property color tint: Theme.colors.primary
property bool glow: false
property bool pressed: false
readonly property int offset: glow ? Theme.elevation.high : Theme.elevation.low
readonly property color edgeColor: glow ? tint : Theme.colors.crust
Rectangle {
id: shadow
x: surface.offset
y: surface.offset
width: surface.width
height: surface.height
color: surface.edgeColor
visible: !surface.pressed
}
Rectangle {
id: face
x: surface.pressed ? surface.offset : 0
y: surface.pressed ? surface.offset : 0
width: surface.width
height: surface.height
color: Theme.colors.background
border.width: Theme.geometry.borderWidth
border.color: surface.edgeColor
Behavior on x { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.Linear } }
Behavior on y { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.Linear } }
}
}