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:
parent
3a8fa8abd1
commit
2c29fcc0b6
1 changed files with 42 additions and 8 deletions
|
|
@ -35,6 +35,10 @@ PluginComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: copyProcess
|
||||||
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: statusCheck
|
id: statusCheck
|
||||||
|
|
||||||
|
|
@ -84,6 +88,12 @@ PluginComponent {
|
||||||
toggleProcess.running = true
|
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 {
|
popoutContent: Component {
|
||||||
PopoutComponent {
|
PopoutComponent {
|
||||||
headerText: "Tailscale"
|
headerText: "Tailscale"
|
||||||
|
|
@ -161,16 +171,40 @@ PluginComponent {
|
||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
StyledText {
|
MouseArea {
|
||||||
text: modelData.hostname
|
cursorShape: Qt.PointingHandCursor
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
hoverEnabled: true
|
||||||
color: modelData.online ? Theme.primary : Theme.surfaceVariantText
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
MouseArea {
|
||||||
text: modelData.ip
|
cursorShape: Qt.PointingHandCursor
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
hoverEnabled: true
|
||||||
color: Theme.surfaceVariantText
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue