Skip to content

Commit

Permalink
Add a config to disable the main menu button (#173)
Browse files Browse the repository at this point in the history
Closes #127
  • Loading branch information
jmgao authored Nov 17, 2024
1 parent 047c6c4 commit 4b779df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions res/doc
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@
# option, only the first one takes effect.
#
# <key> the option name, one of:
# menu_main_15505_enabled - controls enablement of the NickelMenu button on 4.23.15505+
# menu_main_15505_label - sets the label used for the NickelMenu button on 4.23.15505+
# menu_main_15505_icon - sets the icon used for the NickelMenu button on 4.23.15505+
# menu_main_15505_icon_active - sets the active icon used for the NickelMenu button on 4.23.15505+
# <val> the option value:
# menu_main_15505_enabled - 0 or 1
# menu_main_15505_label - the label to use instead of "NickelMenu"
# menu_main_15505_icon - the path passed to QPixmap
# menu_main_15505_icon_active - the path passed to QPixmap
Expand Down
6 changes: 6 additions & 0 deletions src/nickelmenu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ extern "C" __attribute__((visibility("default"))) void _nm_menu_hook2(MainNavVie
NM_LOG("MainNavView::MainNavView(%p, %p)", _this, parent);
MainNavView_MainNavView(_this, parent);

const char *enabled = nm_global_config_experimental("menu_main_15505_enabled");
if (enabled && strcmp("0", enabled) == 0) {
NM_LOG("Main menu disabled");
return;
}

NM_LOG("Adding main menu button in tab bar for firmware 4.23.15505+.");

if (!MainNavButton_MainNavButton || !MainNavButton_setPixmap || !MainNavButton_setActivePixmap || !MainNavButton_setText || !MainNavButton_setText) {
Expand Down

0 comments on commit 4b779df

Please sign in to comment.