GithubHelp home page GithubHelp logo

Comments (7)

xalexalex avatar xalexalex commented on August 22, 2024 2

Okay, the help is accessible with termux-notification --help-actions (in termux-api-package v0.46). Please feel free to reopen this issue or draft a pull request to change the text!

from termux-api-package.

spiral009 avatar spiral009 commented on August 22, 2024

also

from termux-api-package.

spiral009 avatar spiral009 commented on August 22, 2024

No it's work fine check the running programs
execute 'ps' or 'top'

from termux-api-package.

pawamoy avatar pawamoy commented on August 22, 2024

Yes, it works fine. I never said it was not working though 😉

I'm just saying that it should be explained that the action is a string, executed as a command in a subprocess when the user taps on the notification. That its output will not be displayed. Things like that.

from termux-api-package.

andb0t avatar andb0t commented on August 22, 2024

Related to this: how could I make a tap on the notification focus the termux window? Is there an example somewhere?

By the way, great work with the termux-api. I love it :)

from termux-api-package.

xalexalex avatar xalexalex commented on August 22, 2024

@pawamoy I agree that some info on the quirks of --action may help many users. The things that are worth documenting, in my opinion, are at least these:

  • you should use actions that do things outside of the terminal, like --action "termux-toast hello". Anything that outputs to the terminal is useless, so the output should either be redirected (--action "ls > ~/ls.txt") or shown to the user in a different way (--action "ls|termux-toast").
  • The argument to --action is fed to dash -c, so you don't need escaping or wizardry to run more than one command, it's as easy as --action "this; that; another" or --action "if [ -e file ]; then termux-toast yes; else termux-toast no; fi".
  • for anything more complex, you should put your script in a file, make it executable, and just --action ~/bin/script.
  • --action invokes dash in a different environment (not a subshell). Thus your environment is lost (most notably $PATH), and ~/.profile is not sourced either. So if you need your $PATH you should either
    • set it explicitly in the script (e.g. export PATH="$HOME/bin:$PATH")
    • or use something like --action "bash -l -c 'this; that'")

Apologies for any mistakes (it's 1AM here).

Feel free to add something (even in French).

Later we'll decide on the appropriate place for this info. I would like to avoid cluttering termux-notification -h, so I'd either put it in the wiki or in termux-notification --action-help.

from termux-api-package.

pawamoy avatar pawamoy commented on August 22, 2024

@xalexalex it's exactly the kind of info I was looking for 😀 I think it would be perfect to have an --action-help or --help-action flag, mirrored in the wiki of course.

from termux-api-package.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.