Skip to content

Menu options

V0rT3x edited this page Oct 26, 2024 · 9 revisions

FancyServer

FancyServer is a core component of the FancyGotchi ecosystem, designed to link FancyTools with the rest of the system, including the FancyMenu and FancyDisplay components. It acts as a server that listens for commands and processes actions such as managing plugins, controlling the menu, and handling system commands like shutdown or reboot.

How FancyServer Works

The FancyServer runs as a singleton, ensuring only one instance is ever active. It leverages Python’s asyncio and threading libraries to run an asynchronous event loop in a background thread. This allows it to handle multiple commands concurrently without blocking other processes in the system.

How to enable it

It can be enabled in the /etc/pwnagotchi/config.toml file with the option main.plugins.Fancygotchi.fancyserver = True, or by enabling it inside the webUI page with the theme selector.

FancyTools

FancyTools is a command-line tool to manage FancyGotchi settings, plugins, themes, screens, and system commands.

Command Usage

General Options

  • -d, --diagnostic [args]
    Usage: fancytools -d
    Description: Generates a full anonymized system report. Additional arguments can be added for more detailed reports. Logs are stored in /var/log/fancytools/. The directory is created automatically if it doesn't exist.

  • -p, --plugin <plugin>
    Usage: fancytools -p <plugin>
    Description: Toggles the specified plugin. Use --enable to activate the plugin.

  • -e, --enable
    Usage: fancytools -p <plugin> --enable
    Description: Enables the specified plugin. By default, plugins are disabled.

  • -r, --restart [mode]
    Usage: fancytools -r [auto|manu]
    Description: Restarts the system in automatic or manual mode. Defaults to normal if not specified.

  • -b, --reboot [mode]
    Usage: fancytools -b [auto|manu]
    Description: Reboots the system. Defaults to normal if no mode is specified.

  • -s, --shutdown
    Usage: fancytools -s
    Description: Shuts down the system.

Menu Controls

  • -m, --menu <toggle|up|down|left|right|select>
    Usage: fancytools -m toggle
    Description: Controls the menu navigation using specified actions.

Plugin Management

  • -pr, --refresh-plugins
    Usage: fancytools -pr
    Description: Refreshes the list of installed plugins.

Theme Management

  • -ts, --theme-select <name> <rotation>
    Usage: fancytools -ts <theme> <rotation>
    Description: Selects a theme by name and sets screen rotation (0, 90, 180, or 270 degrees).

  • -tr, --theme-refresh
    Usage: fancytools -tr
    Description: Refreshes the currently active theme.

Screen Management

  • -S, --stealth-mode
    Usage: fancytools -S
    Description: Toggles stealth mode.

  • -sw, --switch-screen-mode <next|previous>
    Usage: fancytools -sw next
    Description: Switches between different screen modes.

  • -s2, --second-screen <enable|disable>
    Usage: fancytools -s2 enable
    Description: Enables or disables the second screen.

  • -sc, --screen-saver <next|previous>
    Usage: fancytools -sc next
    Description: Switches between different screen savers.

Script Execution

  • -rb, --run-bash <script-path>
    Usage: fancytools -rb /path/to/script.sh
    Description: Runs the specified bash script.

  • -rp, --run-python <file>
    Usage: fancytools -rp /path/to/script.py
    Description: Runs the specified Python script.

FancyMenu

Menu Theme Options

The menu_theme dictionary can include the following options:

  • width: Width of the menu (default: 100)
  • height: Height of the menu (default: '100%')
  • position: [x, y] coordinates for menu placement
  • bg_color: Background color of the menu (default: transparent)
  • bg_image: Path to background image file
  • bg_mode: Mode for rendering background image (default: 'normal')
  • border_color: Color of the menu border (default: 'black')
  • timeout: Time in seconds before menu auto-closes (0 for no timeout)
  • motion_text: Enable scrolling text for long items (default: True)
  • motion_text_speed: Speed of scrolling text (default: 20)

Title Options

  • title_font_size: Font size for the menu title (default: 'Medium')
  • title_color: Color of the title text (default: 'black')
  • title_position: [x, y] coordinates for title placement

Button Options

  • button_height: Height of each button (default: 15)
  • buttons_width: Width of the button area (default: '90%')
  • buttons_height: Height of the button area (default: '90%')
  • button_spacing: Space between buttons (default: 5)
  • buttons_position: [x, y] coordinates for button area placement
  • button_font_size: Font size for button text (default: 'Medium')
  • button_bg_color: Background colour of normal buttons
  • button_text_color: Text colour of normal buttons (default: 'black')
  • button_bg_image: Name of the background image for normal buttons
  • highlight_color: Background colour of selected button (default: 'black')
  • highlight_text_color: Text colour of selected button (default: 'white')
  • highlight_button_bg_image: Name of the background image for selected button

Custom Menus

Menu options

  • In the FancyMenu system, each menu can have specific options defined, including 'title' and 'back'. These are used to customize the appearance and navigation of the menu:

    • title: The 'title' option allows you to set a custom display name for the menu. This is what users will see at the top of the menu when it's opened. If not specified, the menu key (name) will be used as the title by default.
    • back: The 'back' option determines which menu the user will return to when they navigate back from the current menu. By default, this is set to "Main menu". However, you can specify a different parent menu name to create more complex menu hierarchies.

The following commands can be used in custom menus for Fancygotchi. Each command is associated with a specific action that can be triggered through the menu system.

Menu Navigation

  • submenu: Navigate to a submenu
  • menu_toggle: Toggle the menu on/off

Plugin Management

  • plugin: Enable or disable a specific plugin
    • Parameters:
      • plugin: Name of the plugin
      • enable: Boolean value (true to enable, false to disable)
  • refresh_plugins: Refresh the list of installed plugins

System Operations

  • shutdown: Safely shut down the Fancygotchi device
  • restart: Restart the Pwnagotchi software
    • Parameter: mode (either "auto" or "manu")
  • reboot: Reboot the entire Fancygotchi device
    • Parameter: mode (either "auto" or "manu")

Theme Management

  • theme_select: Select and apply a specific theme
    • Parameters:
      • name: Name of the theme
      • rotation: Rotation angle (0, 90, 180, or 270)
  • theme_refresh: Refresh the current theme

Display Modes

  • stealth_mode: Toggle stealth mode on/off
  • switch_screen_mode: Switch to the next screen mode
  • switch_screen_mode_reverse: Switch to the previous screen mode
  • enable_second_screen: Enable the second screen display
  • disable_second_screen: Disable the second screen display

Screen Saver

  • next_screen_saver: Switch to the next screen saver mode
  • previous_screen_saver: Switch to the previous screen saver mode

Script Execution

  • run_bash: Execute a bash script

    • Parameter: file (path to the script file)
  • run_python: Load and execute a Python module

    • Parameter: file (path to the Python file)
  • Custom menus can be defined in the custom_menus dictionary. Each menu is a dictionary with the following structure:

    • options: Defines menu-specific options
    • btn1, btn2, etc.: Define buttons in the menu
    • action: Specifies the type of action (e.g., "submenu", "plugin", "theme_select")
    • parameters: The command to execute when the button is selected
# Custom menu structure example:
[theme.menu.menu1.options]
title = "My Custom menu"
back = ""

[theme.menu.menu1.btn1]
title = "Enable bt-ether"
action = "plugin"
name = "bt-tether"
enable = true

[theme.menu.menu1.btn2]
title = "Run script1.sh"
action = "run_bash"
file = "script1.sh"

[theme.menu.menu1.btn3]
title = "Run file_writer.py"
action = "run_python"
file = "file_writer.py"

Built-in Menus

The FancyMenu system automatically populates menus for plugins and themes:

  • Plugins menu: Allows enabling/disabling plugins
  • Themes menu: Allows selecting themes and rotations

Navigation

  • Use 'up' and 'down' to navigate menu items
  • Use 'left' to go back to the parent menu
  • Use 'right' to enter a submenu

This configuration system allows for highly customizable menus in your Fancygotchi interface. Adjust the options to fit your specific needs and design preferences.

Main menu

  • The main menu contain three submenus, the plugins, Fancygotchi and System. This is the root menu that users see when they first open the FancyMenu.

webUI

Plugins menu

  • The plugins menu contain an action button and a submenu.
    • Refresh plugins: It is to load the new installed plugins.
    • Plugins toggle: The plugins toggle submenu.

webUI

Plugins toggle menu

  • The plugins toggle contain the list of every installed plugins, sorted alphabetically.

webUI

Submenu plugins toggle menu

  • Each plugin entry leads to a submenu with two options: a. "Enable plugin": Activates the selected plugin. b. "Disable plugin": Deactivates the selected plugin.

webUI

Fancygotchi menu

  • Fancygotchi submenu contain two submenus and two action buttons.
    • Theme Selector: This submenu allows users to choose and apply different visual themes to customize the appearance of their Fancygotchi interface.
    • Second Screen: This submenu leads to the display option for extended functionality.
    • Theme Refresh: This option provides users with the ability to reload or update the current theme, which is useful for applying changes or troubleshooting theme-related issues.
    • Stealth Mode: This is an interesting feature that probably allows users to activate a low-profile or discreet mode of operation for their Fancygotchi device. Every widget sets with a z-axis under 100 will disappear when the Stealth mode is enabled.

webUI

Theme selector

  • Lists all available themes for Fancygotchi, sorted alphabetically.

webUI

Submenu theme selector

  • Each theme has its own submenu with four rotation options: a. "[Theme Name] 0": Applies the theme with 0-degree rotation. b. "[Theme Name] 90": Applies the theme with 90-degree rotation. c. "[Theme Name] 180": Applies the theme with 180-degree rotation. d. "[Theme Name] 270": Applies the theme with 270-degree rotation.

webUI

System menu

  • The system menu contain five action buttons:
    • Restart Auto: Restarts the Pwnagotchi in automatic mode.
    • Restart Manu: Restarts the Pwnagotchi in manual mode.
    • Reboot Auto: Reboots the entire device and starts in automatic mode.
    • Reboot Manu: Reboots the entire device and starts in manual mode.
    • Shutdown: Safely powers off the Fancygotchi device.

webUI

Custom menu...

  • The system allows for the creation of custom menus through the custom_menus parameter.
  • These menus can be configured with custom titles, buttons, actions, and commands.
  • Custom menus are integrated into the main menu structure and can have their own submenus.

webUI