Dashboard Switching (Key Shortcut)

Post Reply
Tommiedw
Posts: 20
Joined: Wed Feb 18, 2026 11:01 am

Dashboard Switching (Key Shortcut)

Post by Tommiedw »

Hi Hudiy

Would it be possible to have a the functionality in Hudiy to have one keyboard stroke. Lets say "d" that will switch between dashboards (well shortcuts at the bottom of the screen).

I have built a few dashboards with different views, one with OBD gauges, another one with Spotify "Now playing" and some other monitoring gauges etc. Currently I have a button that is linked to GPIO headers and if I click the button the front camera comes on. So that I have working and can be mapped to what ever.

It would be really cool to have a single button that switches between the different dashboards views. Instread of getting my keyboard out using the mouse to select another dashboard or using 1 2 and enter.

Just a simple button that can be programmed to the keyboard stroke of "d" as an example that flips between dashboards. Even if you could link a dashboard / shortcut to a keystroke. You can then setup a python script to flip between keystrokes (in this case it will change dashboards) instead of having another button to be mapped to enter.

Anyway, thought it would be a cool function. Thanks Hudiy :D
hudiy
Site Admin
Posts: 560
Joined: Mon Jul 14, 2025 7:42 pm

Re: Dashboard Switching (Key Shortcut)

Post by hudiy »

Hello,

Great idea, thank you! Currently, you can achieve this using the API. You can register your action and toggle selected dashboards whenever the action is triggered. Once registered, this action can be added as a shortcut.

Below is an example script in Python. You could also add, for instance, GPIO pin support to call toggle_dashboard() (GPIO examples: https://github.com/wiboma/hudiy/tree/main/examples/gpio).

Code: Select all

import itertools
import time
import common.Api_pb2 as hudiy_api
from common.Client import Client, ClientEventHandler


class EventHandler(ClientEventHandler):

    def __init__(self):
        self._action = "toggle_dashboards"

        # Dashboards to toggle - actions from dashboards.json
        self._actions = ["hudiy_dashboard", "obd_charts", "obd_blocks", "obd_combined"]
        self._actions_iterator = itertools.cycle(self._actions)
        next(self._actions_iterator)

    def on_hello_response(self, client, message):
        print(
            "received hello response, result: {}, app version: {}.{}, api version: {}.{}"
            .format(message.result, message.app_version.major,
                    message.app_version.minor, message.api_version.major,
                    message.api_version.minor))

        register_action_request = hudiy_api.RegisterActionRequest()
        register_action_request.action = self._action

        client.send(hudiy_api.MESSAGE_REGISTER_ACTION_REQUEST, 0,
                    register_action_request.SerializeToString())

    def on_register_action_response(self, client, message):
        print("register action response, result: {}, action: {}".format(
            message.result, message.action))

        if message.result:
            print("action successfully registered")

    def on_dispatch_action(self, client, message):
        print("dispatch action, action: {}".format(message.action))

        if message.action == self._action:
            self.toggle_dashboard(client)

    def toggle_dashboard(self, client):
        next_dashboard = next(self._actions_iterator)

        dispatch_action = hudiy_api.DispatchAction()
        dispatch_action.action = next_dashboard

        client.send(hudiy_api.MESSAGE_DISPATCH_ACTION, 0,
                    dispatch_action.SerializeToString())
        
        print("toggle dashboard: {}".format(dispatch_action.action))


def main():
    client = Client("dashboard toggle")
    event_handler = EventHandler()
    client.set_event_handler(event_handler)

    try:
        while True:
            try:
                client.connect('127.0.0.1', 44405)
                while True:
                    if not client.wait_for_message():
                        break
            except Exception:
                pass
            time.sleep(2)
    except KeyboardInterrupt:
        pass
    finally:
        client.disconnect()


if __name__ == "__main__":
    main()
shortcuts.json

Code: Select all

{
    "shortcuts": [
        {
            "iconFontFamily": "Material Symbols Rounded",
            "iconName": "cycle",
            "action": "toggle_dashboards"
        }
    ]
}
Hudiy Team
Tommiedw
Posts: 20
Joined: Wed Feb 18, 2026 11:01 am

Re: Dashboard Switching (Key Shortcut)

Post by Tommiedw »

Excellent, thank you!
proteinklumpen
Posts: 11
Joined: Sat Oct 18, 2025 3:35 pm

Re: Dashboard Switching (Key Shortcut)

Post by proteinklumpen »

Hey, I already implemented switchable Dashboards now and I am currently trying to get the widget which is seen on here
https://github.com/wiboma/hudiy/blob/ma ... _wide1.png

I can't find it, I just found '~/.hudiy/OBD/hudiy/examples/api/js/obd_widget.html' which is from your other examples

Can you help me here?
hudiy
Site Admin
Posts: 560
Joined: Mon Jul 14, 2025 7:42 pm

Re: Dashboard Switching (Key Shortcut)

Post by hudiy »

Hello,
The widget on the screenshot is https://github.com/wiboma/hudiy/blob/ma ... auges.html (LARGE_WIDE size)
Hudiy Team
Post Reply