Skip to content

Add a way to toggle Android status and navigation bars at runtime #8826

Closed
@sosasees

Description

@sosasees

Describe the project you are working on

a game with

  • pre-game menus
  • a pause menu

Describe the problem or limitation you are having in your project

i want the status bar and navigation bar to hide during gameplay so they don't distract me

but i want to see the system bars during the menus so i can quickly check battery status and switch apps

— user story

the first part is done because the system bars are hidden by default.
but i can't do the second part because i found no way to toggle system bars in GDScript

Describe the feature / enhancement and how it helps to overcome the problem or limitation

adding GDScript methods to

  • show system bars
  • hide system bars

would make it possible to solve the user story.

making separate methods to

  • toggle status bar
  • toggle navigation bar

would be even better because then games could also

  • show navigation bar and status bar if the screen is tall enough
  • show navigation bar but hide status bar if the screen is not so tall (a lot of Samsung apps do this in Landscape mode)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

the GDScript methods would be:

  • OS.set_status_bar_visible( bool value )
  • OS.set_navigation_bar_visible( bool value )

to improve readability of the system bars, we could also set their background color (but that's out-of-scope for this proposal, and as a workaround we could always place ColorRects behind the system bars):

  • OS.set_status_bar_color( Color background_color )
  • OS.set_navigaton_bar_color( Color background_color )

If this enhancement will not be used often, can it be worked around with a few lines of script?

i believe not:
i asked 1 time each across 2 Godot forums and no-one could answer
(no longer official forum, official forum)

Is there a reason why this should be core and not an add-on in the asset library?

this will benefit all paid games (and many free games) because they all have pre-game menus and a pause menu

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions