mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: move OSC8 URL view to right if mouse is over it
This commit is contained in:
@ -49,6 +49,9 @@ extension Ghostty {
|
|||||||
// Maintain whether our window has focus (is key) or not
|
// Maintain whether our window has focus (is key) or not
|
||||||
@State private var windowFocus: Bool = true
|
@State private var windowFocus: Bool = true
|
||||||
|
|
||||||
|
// True if we're hovering over the left URL view, so we can show it on the right.
|
||||||
|
@State private var isHoveringURLLeft: Bool = false
|
||||||
|
|
||||||
@EnvironmentObject private var ghostty: Ghostty.App
|
@EnvironmentObject private var ghostty: Ghostty.App
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@ -146,19 +149,35 @@ extension Ghostty {
|
|||||||
.ghosttySurfaceView(surfaceView)
|
.ghosttySurfaceView(surfaceView)
|
||||||
|
|
||||||
// If we have a URL from hovering a link, we show that.
|
// If we have a URL from hovering a link, we show that.
|
||||||
// TODO
|
|
||||||
if let url = surfaceView.hoverUrl {
|
if let url = surfaceView.hoverUrl {
|
||||||
let padding: CGFloat = 3
|
let padding: CGFloat = 3
|
||||||
HStack {
|
ZStack {
|
||||||
VStack(alignment: .leading) {
|
HStack {
|
||||||
Spacer()
|
VStack(alignment: .leading) {
|
||||||
|
Spacer()
|
||||||
|
|
||||||
Text(verbatim: url)
|
Text(verbatim: url)
|
||||||
.padding(.init(top: padding, leading: padding, bottom: padding, trailing: padding))
|
.padding(.init(top: padding, leading: padding, bottom: padding, trailing: padding))
|
||||||
.background(.background)
|
.background(.background)
|
||||||
|
.opacity(isHoveringURLLeft ? 0 : 1)
|
||||||
|
.onHover(perform: { hovering in
|
||||||
|
isHoveringURLLeft = hovering
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
HStack {
|
||||||
|
Spacer()
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Text(verbatim: url)
|
||||||
|
.padding(.init(top: padding, leading: padding, bottom: padding, trailing: padding))
|
||||||
|
.background(.background)
|
||||||
|
.opacity(isHoveringURLLeft ? 1 : 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user