• Get app name and hook at runtime

    2
    0 Votes
    2 Posts
    203 Views
    developerbaymanD
    @Plarde Yes, it is possible — though not entirely straightforward — to infer some runtime information like the app's name and the hook that launched it on Ubuntu Touch, particularly if the app is deployed as a click package. Here’s a breakdown of your goals and possible solutions: Goal: Get the App ID or Name from Manifest In Ubuntu Touch click packages, metadata is defined in a manifest.json file, which contains fields like: { "name": "appname.yourname", "version": "1.0.0", "framework": "ubuntu-sdk-20.04", ... } How to get this at runtime? At runtime, this data isn’t directly exposed via traditional environment variables like APP_NAME. However: Environment Variables Available at Runtime: The AppArmor profile and the Ubuntu Touch application launch mechanism set a number of environment variables, including: APP_ID: Often the full app name like appname.yourname APP_PATH: The full installation path to the app APP_BIN: The binary or hook name You can access these using C/C++/SDL via getenv("APP_ID"), etc. Goal: Get the Hook Name (i.e., the launcher binary name) Click packages specify "hooks" (executables, wrappers, or scripts) in the manifest.json under "hooks": "hooks": { "myhook": { "apparmor": "myhook.apparmor", "desktop": "myhook.desktop" } } How to get the hook at runtime? There’s no standard variable like APP_HOOK, but you can infer it from: argv[0] or /proc/self/exe: #include <unistd.h> #include <limits.h> char path[PATH_MAX]; ssize_t len = readlink("/proc/self/exe", path, sizeof(path)-1); if (len != -1) { path[len] = '\0'; printf("Executable Path: %s\n", path); } Then extract the final component to get the executable name — likely the hook. Summary of Techniques What You Want How to Get It App ID (from manifest) getenv("APP_ID") or getenv("APP_NAME") (test both) App Install Path getenv("APP_PATH") Executable Name / Hook Use argv[0] or resolve /proc/self/exe Manifest Contents Parse /opt/click.ubuntu.com/<appid>/manifest.json manually Bonus: Parsing the Manifest Programmatically If you want full manifest access: #include <stdio.h> #include <stdlib.h> #include <json-c/json.h> void print_manifest_field(const char* field) { const char* appid = getenv("APP_ID"); if (!appid) return; char manifest_path[512]; snprintf(manifest_path, sizeof(manifest_path), "/opt/click.ubuntu.com/%s/current/manifest.json", appid); FILE* file = fopen(manifest_path, "r"); if (!file) return; struct json_object *parsed_json; parsed_json = json_object_from_file(manifest_path); if (parsed_json) { struct json_object *value; if (json_object_object_get_ex(parsed_json, field, &value)) { printf("%s: %s\n", field, json_object_get_string(value)); } json_object_put(parsed_json); } fclose(file); } ️ Caveats These variables are set by the Ubuntu Touch application launcher, so they only exist in the app context. Hook names are not exported as a separate variable unless the launcher sets one explicitly. SDL3 libraries should allow injection or configuration of these values from the hosting application (e.g., via init). Final Advice for SDL3 Porting Since SDL3 is a library and shouldn't hardcode values: Consider requiring the host app to pass APP_ID and HOOK_NAME to SDL3 during initialization. You could fallback to the environment and /proc/self/exe as a best-effort fallback. Let me know if you want a ready-made SDL3-compatible utility wrapper function for this.
  • not all distros are equal in the eyes of clickable

    1
    0 Votes
    1 Posts
    115 Views
    No one has replied
  • I have a problem with clickable to compile for Noble.

    3
    1 Votes
    3 Posts
    225 Views
    Vlad NirkyV
    @lduboeuf Thanks for the answer Lionel. Well, i have made some tries but without success. Finally, i have remove the pip3 install of 8.3.1 and reinstall with snap and now it's working. There was something wrong with the blob fdc55cec6c2e
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    10 Views
    No one has replied
  • Resurrection of Indicator Upower

    upower power indicator
    61
    3 Votes
    61 Posts
    7k Views
    paulcarrotyP
    @Eric-H said in Resurrection of Indicator Upower: I can see POWER_SUPPLY_CHARGE_TYPE=Fast in udev battery info, so it seems to be a fast charge. No, I got Fast with low-end 7W charger too. My guess it's POWER_SUPPLY_FASTCHARGE_MODE=1. My device has POWER_SUPPLY_HI_POWER. How much power can your charger deliver? POWER_SUPPLY_POWER_NOW=39764516 looks realistic for 45W. I also tried to find the Fast Charging voltage (9..12V) on BMS and failed, so you can try it too. Probably not being monitored by software. And all of this is very device-specific.
  • What's the best way to store a user password?

    14
    0 Votes
    14 Posts
    858 Views
    arubislanderA
    @adorsaz said in What's the best way to store a user password?: Although, IIRC Ubuntu Touch lets user use phone without password/pin code. Maybe this is the reason such service is not provided to app developpers ? Ubuntu desktop also allows passwordless login. So that in itself is not the reason there is no implementation of libsecret on UT. The real reason is probably simply that none was implemented as yet.
  • Alarm rising sound

    2
    0 Votes
    2 Posts
    241 Views
    K
    @vily I don't think so. Probably something that should be implemented first in the system handling notification sound playback before the app.
  • What do you think of my dutch app

    1
    1 Votes
    1 Posts
    150 Views
    No one has replied
  • Annotate - app to annotate PDF files

    19
    9 Votes
    19 Posts
    2k Views
    P
    @hlbkv Noted! I won't make any promises about the timeframe, but I'll do that when I get a chance
  • tedit development and design discussion

    tedit editor app development features
    200
    5 Votes
    200 Posts
    59k Views
    danfroD
    @domubpkm I am sorry, I forgot to reply. Sadly so far I haven't found a working solution. When setting the TextArea to read-only, we can't navigate in it. So no option. I didn't found time yet to see if some manually added controls allow moving the text in read-only mode. I also tried (after your question, could you please open an issue/feature request so I don't forget about that?) to display the file in a webview. I used that successfully when testing something for weather app and webviews allow pinching and dragging and that. But for some reason simply instantiating a webview component in the code, not even displaying a file, always crashes tedit (of course no error message that might give a direction where to look at). I am totally lost here why that happens. Many apps use webviews for various purposes.
  • OSM Scout Server: offline maps

    32
    13 Votes
    32 Posts
    7k Views
    J
    @Taiga-Woods I experienced that today, too. At the end I deleted and reinstalled OSM Scout Server (rebooted in between). Everything worked again afterwards and the maps I had downloaded were still there. But I'm also interested if there's another solution...
  • Clickable desktop issue in Ubuntu 24.04

    5
    1
    0 Votes
    5 Posts
    487 Views
    ikozI
    @bafora1 The problem is due to the confinement of snaps (the python package works out-of-the-box). Ubuntu Touch apps don't support Wayland anyway, they only work with xwayland / xmir. It works after that command, so no need for troubleshooting.
  • How to retrieve and select available audio outputs

    2
    0 Votes
    2 Posts
    236 Views
    ikozI
    @gwado Ubuntu Touch uses PulseAudio, commands are the same as on other "normal" Linux distros. To list available outputs (sinks): pactl list sinks As the commands are the same as on Ubuntu desktop, you can search for how to do that in Ubuntu, e.g.: change default audio device, and change PulseAudio I/O output
  • problem with gles2

    8
    0 Votes
    8 Posts
    707 Views
    L
    @AppLee https://github.com/VIRalZah/glestest-ut the problem is that either GLES2 does not have the necessary symbols from opengl (I checked glClear and glClearColor work, but everything else is an undefined reference), or for some reason the linker doesn’t see them
  • Need testers Home Screen for Ubuntu Touch

    testing widget development homescreen
    106
    20 Votes
    106 Posts
    41k Views
    DJacD
    Hi Realy good job !! I dream to have it as daily start screen Many good ideas in this app. I install it recently, so i will make suggetion later (after more experiments). Is it already possible ? (i don't have the skills to do it myself...).
  • NFC editor App

    2
    0 Votes
    2 Posts
    325 Views
    lduboeufL
    @AmauryDBZ said in NFC editor App: Hello @lduboeuf , I have this error when trying to use your app. Any idea ? Do you want me to open an issue on github ? Thanks ! [19/12/2024 10:56] library "eglSubDriverAndroid.so" not found [19/12/2024 10:56] Creating a QMirClientScreen now [19/12/2024 10:56] QObject::startTimer: Timers cannot be started from another thread [19/12/2024 10:57] QObject::killTimer: Timers cannot be stopped from another thread [19/12/2024 10:57] QObject::startTimer: Timers cannot be started from another thread [19/12/2024 10:58] targetDetected [19/12/2024 10:58] readNdefMessages true [19/12/2024 10:58] targetDetected [19/12/2024 10:58] readNdefMessages true [19/12/2024 10:58] targetDetected [19/12/2024 10:58] readNdefMessages true [19/12/2024 10:58] QObject::killTimer: Timers cannot be stopped from another thread [19/12/2024 10:58] QObject::startTimer: Timers cannot be started from another thread [19/12/2024 11:00] targetDetected [19/12/2024 11:00] readNdefMessages true [19/12/2024 11:00] QObject::killTimer: Timers cannot be stopped from another thread [19/12/2024 11:00] QObject::startTimer: Timers cannot be started from another thread [19/12/2024 11:02] qt.qpa.mirclient: Attempted to deliver an event to a non-existent window, ignoring. [19/12/2024 11:02] library "eglSubDriverAndroid.so" not found [19/12/2024 11:02] Creating a QMirClientScreen now [19/12/2024 11:02] targetDetected [19/12/2024 11:02] readNdefMessages true [19/12/2024 11:02] QObject::startTimer: Timers cannot be started from another thread I don't see any errors regarding the app in the logs, but maybe i need my glasses. In some situation indeed it fails silently
  • Do you want to talk about G!sForecast?

    32
    1 Votes
    32 Posts
    2k Views
    D
    @Vlad-Nirky good news !
  • New App: Where?

    3
    3 Votes
    3 Posts
    1k Views
    CiberSheepC
    @Charly yep, I know. The issue comes when some one (my friends) share a link to a place from their GoogleMaps app / random iOS/Android app. I have to open the link in the browser, copy the coordinates, paste them in uNav or something similar. With Where? I don't have to do all the editing. Open/share the link in Where? and tap the link that uNav will open.
  • how to install qmlDesigner in qtcreator from clickable 8.2.0 ?

    6
    2
    0 Votes
    6 Posts
    409 Views
    Vlad NirkyV
    @ds2k5 I have used QT Design Studio to create the base UI for GisForecast (was a little bit complicated (for me)) and than i have modified it in Visual Studio Code by hand.
  • 0 Votes
    2 Posts
    502 Views
    E
    I don't know why you couldn't create a config file to run your console application, . I have done this: (/bin/bash in terminal, libertine container) fakeroot apt update fakeroot apt install sway use OpenStore tedit text editor app to write the desktop entry, Version=1.0 Type=Application Terminal=false Exec=libertine-launch -i [container name] sway Name=Sway app window manager, i3 compatible WM X-Lomiri-Touch=true X-Lomiri-Default-Department-ID=accessories X-Ubuntu-Touch=true X-Ubuntu-Default-Department-ID=accessories then cp -v ~/.local/share/tedit.danfro/libertine-application-container-sway.desktop.txt ~/.local/share/applications/libertine-application-container-sway.desktop