OpenGamepadUI icon indicating copy to clipboard operation
OpenGamepadUI copied to clipboard

Exit to Desktop/Switch to Desktop Button

Open Johnnyreyman opened this issue 5 months ago • 6 comments

Is your feature request related to a problem? Please describe.

Not related to any problems.

Describe the solution you'd like

Add a switch to desktop button for Nobara 42.

Describe alternatives you've considered

N/A

Additional context

Add any other context or screenshots about the feature request here.

Johnnyreyman avatar Jun 29 '25 04:06 Johnnyreyman

I created an extra button via plugin in power menu.

extends Plugin

func _ready() -> void:
	OS.set_environment("FULLSCREEN", "1")
	logger = Log.get_logger("DocMAX Custom Plugin", Log.LEVEL.INFO)

	var library: Library = load(plugin_base + "/core/library.tscn").instantiate()
	add_child(library)

	await get_tree().process_frame
	_add_xfce_button()

func _add_xfce_button() -> void:
	var vbox = get_node("/root/CardUI/AlwaysVisibleContent/PowerMenu/PanelContainer/MarginContainer/VBoxContainer")
	var button_scene = load("res://core/ui/components/card_button.tscn")
	var xfce_button = button_scene.instantiate()
	xfce_button.text = "Switch to XFCE"
	var cancel_idx = vbox.get_child_count() - 3    
	vbox.add_child(xfce_button)
	vbox.move_child(xfce_button, cancel_idx)
	xfce_button.button_down.connect(_on_xfce_switch)

func _on_xfce_switch() -> void:
	var output := []
	logger.info("Running XFCE4")
	OS.execute("/usr/local/bin/steamos-session-select", ["plasma"], output)

DocMAX avatar Jul 01 '25 23:07 DocMAX

It seems like it is linked to XFCE. Is that right?

Johnnyreyman avatar Jul 01 '25 23:07 Johnnyreyman

It's my custom script of course. It's just the idea how to add a button to the power menu. I use XFCE4 because i have KISS and lightweight in mind.

DocMAX avatar Jul 01 '25 23:07 DocMAX

Proposed change for testing:

extends Plugin

func _ready() -> void:
    OS.set_environment("FULLSCREEN", "1")
    logger = Log.get_logger("DocMAX Custom Plugin", Log.LEVEL.INFO)

    var library: Library = load(plugin_base + "/core/library.tscn").instantiate()
    add_child(library)

    await get_tree().process_frame
    _add_plasma_button()

func _add_plasma_button() -> void:
    var vbox = get_node("/root/CardUI/AlwaysVisibleContent/PowerMenu/PanelContainer/MarginContainer/VBoxContainer")
    var button_scene = load("res://core/ui/components/card_button.tscn")
    var plasma_button = button_scene.instantiate()
    plasma_button.text = "Switch to Desktop"
    var cancel_idx = vbox.get_child_count() - 3    
    vbox.add_child(plasma_button)
    vbox.move_child(plasma_button, cancel_idx)
    plasma_button.button_down.connect(_on_plasma_switch)

func _on_plasma_switch() -> void:
    var output := []
    logger.info("Switching to Plasma Desktop")
    OS.execute("/usr/local/bin/steamos-session-select", ["plasma"], output)

Johnnyreyman avatar Jul 02 '25 00:07 Johnnyreyman

The proper way to do this would be to add a platform class for Nobara. The specific session path and syntax is fairly OS implementation dependant. There are a few examples here to work from.

https://github.com/ShadowBlip/OpenGamepadUI/tree/main/core/platform/os

pastaq avatar Jul 02 '25 00:07 pastaq

I am not sure how to code for Godot. I will wait for an update. I am willing to provide info to help make the changes tho.

Johnnyreyman avatar Jul 03 '25 06:07 Johnnyreyman