feat: add click-to-copy for peer hostname and IP (#6)\n\n- Use Process (copyProcess) instead of unimported Quickshell.execDetached\n- MouseArea on hostname and IP in peer list delegate\n- Toast confirmation on copy

This commit is contained in:
Vybe (Coding Agent) 2026-05-17 23:00:22 +00:00
parent 3a8fa8abd1
commit 2c29fcc0b6

View file

@ -35,6 +35,10 @@ PluginComponent {
}
}
Process {
id: copyProcess
}
Process {
id: statusCheck
@ -84,6 +88,12 @@ PluginComponent {
toggleProcess.running = true
}
function copyToClipboard(text) {
copyProcess.command = ["sh", "-c", "printf '%s' '" + text.replace(/'/g, "'\\''") + "' | wl-copy"]
copyProcess.running = true
ToastService.showInfo("tailscalectl", "Copied: " + text)
}
popoutContent: Component {
PopoutComponent {
headerText: "Tailscale"
@ -161,13 +171,36 @@ PluginComponent {
spacing: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
MouseArea {
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
anchors.verticalCenter: parent.verticalCenter
width: peerHostnameText.implicitWidth
height: peerHostnameText.implicitHeight
onClicked: {
root.copyToClipboard(modelData.hostname)
}
StyledText {
id: peerHostnameText
text: modelData.hostname
font.pixelSize: Theme.fontSizeSmall
color: modelData.online ? Theme.primary : Theme.surfaceVariantText
}
}
MouseArea {
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
anchors.verticalCenter: parent.verticalCenter
width: peerIpText.implicitWidth
height: peerIpText.implicitHeight
onClicked: {
root.copyToClipboard(modelData.ip)
}
StyledText {
id: peerIpText
text: modelData.ip
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
@ -178,6 +211,7 @@ PluginComponent {
}
}
}
}
MouseArea {
anchors.fill: parent