Update sample project

This commit is contained in:
Melody Becker 2025-03-18 12:02:06 +01:00
parent 3df7a93022
commit da436d5814
3 changed files with 13 additions and 6 deletions

View file

@ -2,7 +2,7 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://cnyljy7e3rf70" uid="uid://b2u3ggnem2sce"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false

View file

@ -3,8 +3,14 @@ extends Node2D
func _on_button_pressed() -> void: func _on_button_pressed() -> void:
print("Starting request in godot") print("Starting request in godot")
$XdgPortals.request_screencast() await $ScreencastRunner.request_capture()
print("awaiting result")
await $ScreencastRunner.screencast_result
func _on_xdg_portals_screencast_sucess(pipewire_node_id: int) -> void: func _on_screencast_runner_screencast_failure(reason: String) -> void:
print("Stream id in godot: ", pipewire_node_id) push_warning("Screencast failed, ", reason)
func _on_screencast_runner_screencast_sucess(pipewire_node_id: int) -> void:
print("Screencast success: ", pipewire_node_id)

View file

@ -10,7 +10,8 @@ offset_right = 8.0
offset_bottom = 8.0 offset_bottom = 8.0
text = "Request" text = "Request"
[node name="XdgPortals" type="XdgPortals" parent="."] [node name="ScreencastRunner" type="ScreencastRunner" parent="."]
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] [connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
[connection signal="screencast_sucess" from="XdgPortals" to="." method="_on_xdg_portals_screencast_sucess"] [connection signal="screencast_failure" from="ScreencastRunner" to="." method="_on_screencast_runner_screencast_failure"]
[connection signal="screencast_sucess" from="ScreencastRunner" to="." method="_on_screencast_runner_screencast_sucess"]