Notifications

Francesco edited this page Mar 25, 2018 · 23 revisions

---------- WARNING ----------

Notifications are supported only on Android >= 4.3
You may be lucky, or you may not.

Activation

Use the command
config -set show_notifications true

Restart t-ui with the command
restart

Then, grant the notifications access to t-ui.

Include an application

notifications -inc appName

Exclude an application

notifications -exc appName

Set color

notifications -clr #color appName

Tip: Have a look at Defining Colors

Add a filter

This command:
notifications -add_filter 1 [df]og
will set a filter with id "1" which excludes every notifications whose title matches the regex [df]og.

So, every notifications which contains the word "dog" or the word "fog" won't be shown.

"id" can be any integer value, it's needed to identify the filter and delete it if you want to.

T-UI 6.4+

  • every filter will now be applied to every incoming notification
  • no more text and title filters. a filter will attempt to match the whole printed text (time, package/app name included)
  • incoming notifications will be queued inside a 5-sized list and managed later in a sub-process (this should improve performance)
  • formatting is slightly different (check below)

How to use the new format

The values defining the application name, the package name, the time and the newline (%app, %pkg, %t, %n) remain the same.

The great changes are coming now. Remember those bad "null" inside old notifications? Forget them.

%[length][color]field

  • length is the maximum length of the string
  • color, as you can expect, is the color of the string
  • field can be:

TITLE

  • title -> this is the title of the notification
  • title.big -> this is the title of the notification when shown in expanded form

TEXT

  • text -> this is the main text
  • subText -> an eventual third line of text (below title and text)
  • infoText -> an eventual small piece of additional text
  • summaryText -> this is a line of summary information intended to be shown alongside expanded notifications
  • bigText -> this is the eventual longer text shown in the big form (if it's a BigTextStyle notification)
  • textLines -> those are the lines of text (available only if the notification is an InboxStyle notification)

Example

(%t) %pkg - %[40][#00ff00]title -- %[100][aqua]bigText

Optional values

This is a pretty useful feature to avoid the awful "null" text that appears when the notification doesn't contain the wanted text.

%{value1:value2:no text}

T-UI will try to gather the corresponding text starting from the first element, and will stop immediately if it finds it.

The last value will always be used as placeholder if the text is not found (unless there's only one value inside the curly brackets).

Example

%[40][#660099]{text:bigText:textLines:n/a}

Before T-UI 6.4

Set a filter

This command:
notifications -title_filter 1 [df]og
will set a filter with id "1" which excludes every notifications whose title matches this Regular Expression.

So, every notifications which contains the word "dog" or the word "fog" in its title won't be shown.

"id" can be any integer value, it's needed to create filter groups.

Tip: have a look at the Regular Expressions.

Title filter

notifications -title_filter id regex

Text filter

notifications -text_filter id regex

Filter groups

Filter groups are filters with the same ID that evaluate together a notification.

This is the boolean scheme: (titleFilter1 OR titleFilter2 OR titleFilterN) AND (textFilter1 OR textFilter2 OR textFilterN)

For example, let's take this notification:

  • package: com.whatsapp.android
  • Title: Johnathan
  • Text: Hey man, I love t-ui!
  1. We set a a filter on title with id "2":
    notifications -title_filter 2 Jo.*
    this excludes every notification whose title begins with "Jo"
  2. We set a filter on text with id "2":
    notifications -text_filter 2 ?
    this excludes every notification whose text contains a "?"

Now, we created a filter group. You can see that you only need to set the same id to two or more filters in order to get a group.

Let's analyze the situation:

  1. The first filter matches: the title starts with "Jo" -> true
  2. The second filter doesn't match: the text doesn't contain a question mark -> false
  3. true AND false -> false
  4. the notification is shown

Apply to a single application

You can apply a filter (or a group of filters) to a single app with this command:
notifications -apply_filter id application

For example, this will apply the above filter group only to WhatsApp (and not, for example, to gmail):
notifications -apply_filter 2 WhatsApp

Format notifications

You can customize the format used to show notifications. Check the file notifications.xml.

Values:

  • sender app package: %pkg
  • sender app name: %app
  • notification title: %ttl
  • notification text: %txt
  • time/date: %t
  • newline: %n

Some example

[%t] --> {%pkg}%n%ttl --- %txt

[09.43.50] --> {com.whatsapp.android}
Johnatan --- Hey, do you like t-ui?

%pkg (%t) --> %ttl%n%txt

com.whatsapp.android (09.43.50) --> Johnatan
Hey do you like t-ui?

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.