mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 06:27:02 +05:30
common: add UrlLauncher
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
a5473af699
commit
b166755afa
5 changed files with 40 additions and 1 deletions
|
@ -0,0 +1,15 @@
|
|||
package dev.msfjarvis.claw.common.urllauncher
|
||||
|
||||
import java.awt.Desktop
|
||||
import java.net.URI
|
||||
|
||||
actual class UrlLauncher {
|
||||
actual fun launch(url: String) {
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
val desktop = Desktop.getDesktop()
|
||||
if (desktop.isSupported(Desktop.Action.BROWSE)) {
|
||||
desktop.browse(URI(url))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue