Skip to content

Commit

Permalink
fix(Overlay Mode): Focus and Profile Fixes
Browse files Browse the repository at this point in the history
- Fix bug where an app type couldn't be detected if it was started by Steam.
- Only change Steam overlay status if it was the overlay.
- Also ignore window ID 1, Chimera App sets Steam to this for some reason.
  • Loading branch information
pastaq committed Dec 21, 2024
1 parent 9d825ab commit cb818fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/global/launch_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func _init() -> void:
_focused_app_id = to

# If OGUI was focused, set the global gamepad profile
if to in [gamescope.OVERLAY_GAME_ID, 0]:
if to in [gamescope.OVERLAY_GAME_ID, 0, 1]:
set_gamepad_profile("")
return

Expand Down Expand Up @@ -646,6 +646,7 @@ func _make_running_app_from_process(name: String, pid: int, window_id: int) -> R
if _xwayland_game:
display = _xwayland_game.name
var running_app: RunningApp = _make_running_app(launch_item, pid, display)
running_app.app_id = _xwayland_game.get_app_id(window_id)
running_app.window_id = window_id
running_app.state = RunningApp.STATE.RUNNING
running_app.is_ogui_managed = false
Expand Down
8 changes: 6 additions & 2 deletions core/ui/card_ui_overlay_mode/card_ui_overlay_mode.gd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var managed_states: Array[State] = [quick_bar_state, settings_state, gamepad_sta
var xwayland_primary := gamescope.get_xwayland(gamescope.XWAYLAND_TYPE_PRIMARY)
var xwayland_ogui := gamescope.get_xwayland(gamescope.XWAYLAND_TYPE_OGUI)
var overlay_window_id := 0
var set_steam_overlay_focus := false

# Process
var PID: int = OS.get_process_id()
Expand Down Expand Up @@ -300,7 +301,8 @@ func _on_base_state_entered(_from: State) -> void:

# Manage overlay
xwayland_ogui.set_overlay(overlay_window_id, 0)
xwayland_ogui.set_overlay(underlay_window_id, 1)
if self.set_steam_overlay_focus:
xwayland_ogui.set_overlay(underlay_window_id, 1)


## Called when a the base state is exited.
Expand All @@ -315,8 +317,10 @@ func _on_base_state_exited(_to: State) -> void:
logger.error("Unable to set STEAM_INPUT_FOCUS atom!")

# Manage overlay
self.set_steam_overlay_focus = xwayland_ogui.get_overlay(underlay_window_id) == 1
xwayland_ogui.set_overlay(overlay_window_id, 1)
xwayland_ogui.set_overlay(underlay_window_id, 0)
if self.set_steam_overlay_focus:
xwayland_ogui.set_overlay(underlay_window_id, 0)


## Verifies steam is still running by checking for the steam overlay, closes otherwise.
Expand Down

0 comments on commit cb818fd

Please sign in to comment.