Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Termux:Gui Widget not clickable #1

Open
joshebosh opened this issue Aug 15, 2023 · 1 comment
Open

Termux:Gui Widget not clickable #1

joshebosh opened this issue Aug 15, 2023 · 1 comment

Comments

@joshebosh
Copy link

joshebosh commented Aug 15, 2023

I can update the text on my Widget via bash script, but I'm unable to click the widget to make it update.

I have this code in the script to listen for the click

        if [ "$(tg_event_type "$ev")" = "$tgc_ev_remote_click" ]; then
                printf "widget clicked\n"
        fi

the output never gets printed...
And i'm not seeing any particular function to explicitly make the widget clickable...
am I missing something?

Here's the whole script as is

#!/bin/tgui-bash
set -u
wid="c1fbd68b-1516-47ed-81a3-5393d66548b5"
while true; do
        ev="$(tg_msg_recv_event_blocking)"

        #ev="$(tg_msg_recv_event)"
        if [ "$(tg_event_type "$ev")" = "$tgc_ev_remote_click" ]; then
                printf "widget clicked\n"
        fi

        text="this is a test $RANDOM"
        # Create a remote layout and TextView
        rl="$(tg_remote_create_layout)"
        #printf "rl:$rl\n"
        rt="$(tg_remote_create_text "$rl")"
        #printf "rt:$rt\n"

        #tg_view_bg_color "$rl" "$rt" "FFFFFFFF"

        # Set the text
        tg_remote_text_color "$rl" "$rt" "FFFF0000"
        tg_remote_bg_color "$rl" "$rt" "FFCCCCCC"
        tg_remote_text_size "$rl" "$rt"  "20"
        tg_remote_text "$rl" "$rt" "$text"
        tg_remote_padding "$rl" "$rt" "20" "20" "20" "20"
        # Set the widget layout and destroy the remote layout again
        tg_widget_layout "$rl" "$wid"
        tg_remote_delete_layout "$rl"
        sleep 2
        #exit 0
done
@tareksander
Copy link
Owner

The remote click event isn't triggered by clicking the widget, only by clicking a remote button in the layout. If that also doesn't work, I'll have to look into it further. The widget system needs an overhaul anyways for Android 12 widgets, and was never tested much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants