needs some more work

This commit is contained in:
kossLAN 2025-06-10 13:52:54 -04:00
parent 8845996c8c
commit 41ad28610a
Signed by: kossLAN
SSH key fingerprint: SHA256:bdV0x+wdQHGJ6LgmstH3KV8OpWY+OOFmJcPcB0wQPV8
4 changed files with 146 additions and 81 deletions

85
GlassSurface.qml Normal file
View file

@ -0,0 +1,85 @@
import QtQuick
import Quickshell.Widgets
import Qt5Compat.GraphicalEffects
ClippingRectangle {
id: root
color: "transparent"
border.width: 1
border.color: Qt.rgba(1, 1, 1, 0.1)
property var source
property real time: 0.5
property real strength: 0.3
property real speed: 0.25
property real scale: 3.0
property real edgeReflectionStrength: 0.2
property real edgeReflectionWidth: 0
// Blur
ShaderEffectSource {
id: blurredBackground
anchors.fill: parent
sourceItem: root.source
sourceRect: Qt.rect(root.x, root.y, root.width, root.height)
hideSource: false
live: true
}
FastBlur {
id: backgroundBlur
anchors.fill: parent
source: blurredBackground
radius: 16
transparentBorder: true
}
// Liquid glass shader warp
ShaderEffect {
anchors.fill: parent
fragmentShader: "root:shaders/liquid-glass.frag.qsb"
property real time: root.time
property real flowSpeed: root.speed
property real warpStrength: root.strength
property real scale: root.scale
property real edgeReflectionStrength: root.edgeReflectionStrength
property real edgeReflectionWidth: root.edgeReflectionWidth
property variant source: ShaderEffectSource {
sourceItem: backgroundBlur
hideSource: false
live: true
}
}
// Subtle glass overlay
Rectangle {
anchors.fill: parent
color: "transparent"
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 1
height: parent.height * 0.3
radius: parent.radius - 1
gradient: Gradient {
GradientStop {
position: 0.0
color: Qt.rgba(1, 1, 1, 0.08)
}
GradientStop {
position: 0.5
color: Qt.rgba(1, 1, 1, 0.0)
}
GradientStop {
position: 1.0
color: Qt.rgba(1, 1, 1, 0.0)
}
}
}
}
}

View file

@ -63,7 +63,7 @@ void main() {
vec4 glassColor = vec4(r, g, b, 1.0); vec4 glassColor = vec4(r, g, b, 1.0);
// Simple edge reflection - back to what worked // Simple edge reflection
float edgeWidth = ubuf.edgeReflectionWidth; float edgeWidth = ubuf.edgeReflectionWidth;
// Calculate distance from edges // Calculate distance from edges
@ -84,16 +84,16 @@ void main() {
// Simple reflection logic // Simple reflection logic
if (minDistToEdge == distFromLeft) { if (minDistToEdge == distFromLeft) {
// Left edge - flip horizontally // Left edge - flip horizontally
reflectionUV.x = 1.0 - distortedUV.x; reflectionUV.x = 0.5 - distortedUV.x;
} else if (minDistToEdge == distFromRight) { } else if (minDistToEdge == distFromRight) {
// Right edge - keep as is but sample from further right // Right edge - keep as is but sample from further right
reflectionUV.x = distortedUV.x + 0.1; reflectionUV.x = distortedUV.x + 0.1;
} else if (minDistToEdge == distFromTop) { } else if (minDistToEdge == distFromTop) {
// Top edge - flip vertically // Top edge - flip vertically
reflectionUV.y = 1.0 - distortedUV.y; reflectionUV.y = 0.5 - distortedUV.y;
} else { } else {
// Bottom edge - flip vertically // Bottom edge - flip vertically
reflectionUV.y = 1.0 - distortedUV.y + 0.1; reflectionUV.y = 0.5 - distortedUV.y + 0.1;
} }
// Clamp to valid range // Clamp to valid range

Binary file not shown.

134
shell.qml
View file

@ -4,8 +4,6 @@ import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls import QtQuick.Controls
import Quickshell import Quickshell
import Quickshell.Widgets
import Qt5Compat.GraphicalEffects
ShellRoot { ShellRoot {
FloatingWindow { FloatingWindow {
@ -39,91 +37,57 @@ ShellRoot {
anchors.fill: parent anchors.fill: parent
} }
ClippingRectangle { GlassSurface {
id: glassContainer source: backgroundContent
color: "transparent"
radius: 20
anchors.centerIn: parent
width: 400 width: 400
height: 300 height: 300
radius: 20
anchors.centerIn: parent
// Blur // parameters
ShaderEffectSource { time: timeSlider.value
id: blurredBackground speed: speedSlider.value
anchors.fill: parent strength: warpSlider.value
sourceItem: backgroundContent scale: scaleSlider.value
sourceRect: Qt.rect(glassContainer.x, glassContainer.y, glassContainer.width, glassContainer.height) edgeReflectionStrength: edgeReflectionSlider.value
hideSource: false edgeReflectionWidth: edgeWidthSlider.value
live: true }
}
GaussianBlur { RowLayout {
id: backgroundBlur spacing: 40
anchors.fill: parent
source: blurredBackground
radius: 4
samples: 4
// transparentBorder: true
}
// Liquid glass shader warp Repeater {
ShaderEffect { model: ["1", "2", "3"]
anchors.fill: parent delegate: GlassSurface {
fragmentShader: "root:shaders/liquid-glass.frag.qsb" id: surface
required property var modelData
source: backgroundContent
width: 100
height: 100
radius: 40
property real time: timeSlider.value time: timeSlider.value
property real warpStrength: warpSlider.value speed: speedSlider.value
property real flowSpeed: speedSlider.value strength: warpSlider.value
property real scale: 3.0 scale: scaleSlider.value
property real edgeReflectionStrength: edgeReflectionSlider.value edgeReflectionStrength: edgeReflectionSlider.value
property real edgeReflectionWidth: edgeWidthSlider.value edgeReflectionWidth: edgeWidthSlider.value
property real cornerRadius: 0.1
property variant source: ShaderEffectSource { Text {
sourceItem: backgroundBlur text: surface.modelData
hideSource: false color: Qt.rgba(1, 1, 1, 0.2)
live: true font.bold: true
} font.pointSize: 16
} anchors.centerIn: parent
// Subtle glass overlay
Rectangle {
anchors.fill: parent
color: "transparent"
radius: 20
// Subtle inner glow
Rectangle {
anchors.fill: parent
anchors.margins: 1
radius: parent.radius - 1
color: "transparent"
border.width: 1
border.color: Qt.rgba(1, 1, 1, 0.05)
}
border.width: 1
border.color: Qt.rgba(1, 1, 1, 0.15)
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 1
height: parent.height * 0.3
radius: parent.radius - 1
gradient: Gradient {
GradientStop {
position: 0.0
color: Qt.rgba(1, 1, 1, 0.08)
}
GradientStop {
position: 1.0
color: Qt.rgba(1, 1, 1, 0.0)
}
} }
} }
} }
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: 25
}
} }
} }
@ -206,6 +170,22 @@ ShellRoot {
Layout.preferredHeight: 30 Layout.preferredHeight: 30
} }
} }
RowLayout {
Text {
text: "Scale:"
}
Slider {
id: scaleSlider
from: 0.0
to: 20.0
value: 3.0
Layout.fillWidth: true
Layout.preferredHeight: 30
}
}
} }
} }
} }