Homebrew Menu

From Nintendo Switch Brew
Revision as of 06:34, 26 December 2019 by Yellows8 (talk | contribs) (→‎Themes)
Jump to navigation Jump to search

The Homebrew Menu (hbmenu) is the menu for launching homebrew applications. Applications are launched using the Homebrew ABI, hence normally nx-hbloader will do the actual launching.

Usage

See Homebrew Applications for SD layout etc.

Controls

Use the D-Pad/joystick to select the app/directory, up/down can be used for faster scrolling. Press A to launch the app. Navigating directories is supported, press A to enter a directory and press B to leave the current directory. Press Y to activate netloader and press B to deactivate netloader.

Press the - button to enter Theme Menu. Press X to (un)star the current menu entry.

Touch controls

To navigate through the list of folders and applications you can swipe left and right on the bottom list. To open an item you can tap on it in the list or with it highlighted tap the Open or Launch button prompt in the bottom right. To go back (a folder) you can swipe up or tap the Back button prompt in the bottom right (the latter is only available when no message-box is shown / netloader isn't active). To activate the netloader you can swipe down on the screen. To enter Theme Menu you can swipe left on the screen.

To (un)star the current menu entry you can touch the (un)star button prompt.

Status

The battery/charge/temperature status can be displayed, however this is only displayed when the required services are available/accessible.

The local-time and network status are also displayed.

Netloader

With netloader activated as described above you can load apps over the network with nxlink. With the toolchain setup run nxlink <nrofile> if your network can handle UDP broadcast messages. If nxlink fails with "No response from Switch!" you can use -a <ip address> before <nrofile> for the address to send the app to. See nxlink help for more options.

Themes

Themes can be optionally loaded from SD "/config/nx-hbmenu/themes/". The theme (or the default) can be selected using the Theme Menu via the - button. This uses libconfig. Default settings will be used for any settings not specified in the theme (including themeInfo).

See Homebrew Themes for a list of themes.

The string used for displaying the buttons/stars can be set with buttonAText, buttonBText, buttonXText, buttonYText, buttonMText, labelStarOnText, and labelStarOffText, but normally these can be left at the defaults. Change the value of the enableWaveBlending field to 1 to enable wave blending.

There's also borderColor, borderTextColor, and progressBarColor fields which can be set like the other color fields.

The color fields are RGBA.

Sample theme file (.cfg file extension):

themeInfo={
    name="Theme Name";
    author="Theme Author Name";
    version="1.0.0";
};

lightTheme={
    textColor=(0,0,0,255);
    frontWaveColor=(255,102,204,255);
    middleWaveColor=(255,51,153,255);
    backWaveColor=(204,0,153,255);
    backgroundColor=(233,236,241,255);
    highlightColor=(255,77,166,255);
    separatorColor=(128,0,128,255);
    enableWaveBlending=0;
};

darkTheme={
    textColor=(255,255,255,255);
    frontWaveColor=(255,51,153,255);
    middleWaveColor=(255,102,204,255);
    backWaveColor=(204,0,153,255);
    backgroundColor=(0,0,0,255);
    highlightColor=(255,77,166,255);
    separatorColor=(255,255,255,255);
    enableWaveBlending=0;
};

layout={ // git-only
    <object name> = {
        visible=true;
        posType=true;
        posStart = (100,400);
        posEnd = (170,0);
        size = (0,680);
    };
    
    // Any other objects here.
    
};

The 'layout' group is optional. Each group within this is for a layout object, these and the settings contained within the objects are all optional (defaults are used when not specified). How each setting in the layout objects' are handled are specific to each object. The 'visible' field controls whether the object is displayed, however this is ignored from config for some objects / unused for certain other objects. posType controls the handling for pos* fields: generally this does nothing, however with some objects this controls whether the pos is absolute (false) / relative to {base-pos} or special-handling (true). When posType is absolute the pos* fields must not be negative. The content of 'size' must not be negative.

Object name Description 'visible' from config ignored / field used Used fields (besides 'visible')
logo Hbmenu logo image. Yes, Yes posStart
hbmenuVersion Hbmenu version text. Yes, Yes posStart
loaderInfo Loader info text (displayed next to hbmenuVersion with the defaults).

When the loader-info string doesn't contain a space, posStart is used directly for the text position, otherwise the right-justified position from posEnd is used.

Yes, Yes posStart, posEnd
attentionText Attention text (Applet Mode text). When posType is relative (the default), the base position is the final position used by 'status'. Yes, Yes posType, posStart
logInfo Logging info for debug enabled via a build define. Yes, Yes posStart
infoMsg Text for NoAppsFound_Msg. Yes, Yes posStart
menuPath Menu path text. No, Yes posStart, size[0]
menuTypeMsg Text for the current type of menu (such as "Theme Menu"). Position is right-justified from posStart. No, Yes posStart
msgBoxSeparator Message-box separator. Position is relative to the bottom of the box. No, No posStart[1]
msgBoxBottomText Message-box text displayed at the bottom below the separator. Position is relative to the bottom of the box. No, No posStart[1]
backWave Back wave. The height is controlled by size[1], relative to the bottom of the screen. No, Yes size[1]
middleWave Middle wave. The height is controlled by size[1], relative to the bottom of the screen. No, Yes size[1]
frontWave Front wave. The height is controlled by size[1], relative to the bottom of the screen. No, Yes size[1]
buttonA Button A, displayed with the string from theme*.buttonAText. With posType=relative (default is absolute) the position is relative to buttonAText. No, Yes posType, posStart
buttonAText Button A text. posType=true is the same as absolute since the base-pos is 0. No, Yes posType, posStart
buttonB Button B, displayed with the string from theme*.buttonBText. With posType=relative the base position is buttonBText. No, Yes posType, posStart
buttonBText Button B text. With posType=relative the base position is buttonA. When buttonA is displayed with non-empty-directory, posStart is used, otherwise posEnd is used (buttonA not displayed). No, Yes posType, posStart
buttonY Button Y, displayed with the string from theme*.buttonYText. With posType=relative the base position is buttonYText. No, Yes posType, posStart
buttonYText Button Y text. With posType=relative the base position is buttonB, or if that's not displayed (menu path is in the root directory) the base is buttonA instead. No, Yes posType, posStart
buttonM Button '-', displayed with the string from theme*.buttonMText. With posType=relative the base position is buttonMText. No, Yes posType, posStart
buttonMText Button '-' text. With posType=relative the base position is buttonY. No, Yes posType, posStart
buttonX Button X, displayed with the string from theme*.buttonXText. With posType=relative the base position is buttonXText. No, Yes posType, posStart
buttonXText Button X text. With posType=relative the base position is buttonM. No, Yes posType, posStart
networkIcon Network status icon. With posType=relative the final position from 'status' is used for the base X-coordinate, however posStart[1] is used directly as the Y-coordinate regardless. No, Yes posType, posStart
batteryCharge Battery charge text. The position from posStart is right-justified. No, Yes posStart
batteryIcon Battery icon. No, Yes posStart
chargingIcon Battery charging icon. No, Yes posStart
status Text displayed for the time. The position from posStart is right-justified. No, Yes posStart
temperature Temperature text. No, Yes posStart
menuList Menu list. posStart is the absolute position for the first tile. posEnd is the relative position for the next tile, relative to the current tile (outline not included). The size doesn't include the outline. No, No posStart, posEnd, size
menuListTiles posEnd[0] is the the maximum number of tile entries to adjust the currently selected entry index by, for example with HID input for DPad Up/Down. No, No posEnd[0]
menuListIcon Menu entry icon. posStart is relative to the current tile entry (see menuList), regardless of posType. No, No posStart
menuListName Menu entry name text. posStart is relative to the current tile entry (see menuList), regardless of posType. No, No posStart, size
menuActiveEntryIcon Icon for the currently active menu entry. No, Yes posStart
menuActiveEntryName Name text for the currently active menu entry. No, Yes posStart, size
menuActiveEntryAuthor Author text for the currently active menu entry. No, Yes posStart
menuActiveEntryVersion Version text for the currently active menu entry. No, Yes posStart

File Associations

File-association cfg files can optionally be loaded from SD "/config/nx-hbmenu/fileassoc/" during startup. There's 1 .cfg file for each app. During normal menu scanning, hbmenu will check for file_extensions/filenames from fileassoc cfg with the dir-list filename, when the file is not recognized otherwise (likewise for directories). This is processed in the same order that the cfg was loaded from SD / same order specified in the cfg file.

When processing directories where no NRO was detected, hbmenu will go through the dir-listing and use the first entry where the filename matches a fileassoc entry where filename is specified (file_extension entries are skipped).

The generated menu entry launches the specified app_path where the first passed argument (argv[1] in the launched app) is the absolute filepath for the associated file. See below regarding the icon used for the menu entry. The author and version fields for the menu entry are loaded from app_path, while the name is the filename (unless a directory is being processed, in this case the directory name is used). When {$FILEPATH with extension changed to .nacp} exists, the aforementioned strings will be loaded from there instead.

The only optional setting is icon_path. All paths are absolute. Icon will attempted to be loaded from the following: {$FILEPATH with extension changed to .jpg} -> icon_path setting if it exists (target setting -> main file_assoc setting) -> icon from app_path.

If you have targets where file_extension and filename both have the same extension, the filename target should be located before that file_extension target in the cfg. Targets which have both file_extension and filename settings are ignored. Each target must have either a file_extension or filename setting.

Sample fileassoc file:

fileassoc={
  app_path="/switch/myapp/app.nro";
  icon_path="/switch/myapp/myicon.jpg";

  targets=(
    {
      file_extension=".ext3";
      icon_path="/switch/myapp/myicon2.jpg";
    },
    {
      file_extension=".ext4";
      icon_path="/switch/myapp/myicon3.jpg";
    },
    {
      filename="main.py";
      icon_path="/switch/myapp/myicon4.jpg";
    }
  );
};