Notifications icon

Hola. Una consulta (otra más, jajaja):
¿Cómo hago para tener un icono de notificaciones en tint2? Es para que al hacer click me las muestre, no quiero que desaparezcan en el acto, quiero borrarlas yo mismo, llegado el caso.
Muchas gracias.


Hello. One query (another, hahaha):
How do I get a notifications icon in tint2? It’s so that when I click shows them, I don’t want them to disappear on the spot, I want to delete them by myself, if necessary.
Thank you very much.

:people_hugging: :argentina:

I guess that you want the history of all notifification accessible from tint2.

With this script you collect all notifications. (tested and works)

  • added timestamp for clarity.

script.sh

#!/bin/bash

file=$1

dbus-monitor "interface='org.freedesktop.Notifications'" |\
 grep --line-buffered "string" |\
 grep --line-buffered -e method -e ":" -e '""' -e urgency -e notify -v |\
 grep --line-buffered '.*(?=string)|(?<=string).*' -oPi |\
 grep --line-buffered -v '^\s*$' |\
 while IFS= read -r line; do
     echo "$(date '+%Y-%m-%d %H:%M:%S') $line" >> "$file"
 done

Put script in ~/bin

Add to startup script:

(script.sh /tmp/log_notify.txt) &

$ cat /tmp/log_notify.txt

You will find a way (notify-send, yad or…) to create a button to show the logged txt with all notifications.

If you need help for the tint2 let us know.

:bird:

1 Like

Muchas gracias por la respuesta.

¿Este script haría lo mismo que xfce4? Algo así es lo que necesito.


Thank you very much for the answer.

Would this script do the same as xfce4? Something like that is what I need.

notificaciones

:people_hugging: :argentina:

1 Like

In short No: There is nothing similar like xfce4 notify widget for Openbox tint2.

You have to create a way yourself.

A quick one is the use of editor micro
A fast simple editor (like nano, but kinda stand alone) .

I can’t get micro run from tint2 but from shell no problem.

Install.

yay -S micro

Autostart.

script.sh /tmp/log_notify.txt &

X times this command to collect some data.

notify-send "This is a test"

Manage with.

micro /tmp/log_notify.txt

There are many way’s to show the file with notifications. It’s a personal thing.

:bird:

edit: for a bit more clarity.

Ok, but there’s no any log_notify.txt (or similar) in my /tmp directory.
The script create it?

You can name it what you like.

run the script like this and yes the script creates the log file, because you put the path of the txt file after the script.

yournamescript.sh /path/to/yourlog.txt

For the check.

cat /path/to/yourlog.txt

Finaly with micro.

micro /path/to/yourlog.txt

:bird:

1 Like

Okay, I tried it and it worked, I’ll see how to make it work with zenity or similar.
Thank you very much
:people_hugging: :argentina:

1 Like

Can you share at the time something zenity is running.

:bird:

Of course, but keep in mind that I am a complete ignorant, although very curious: test and error… error… test… error… error… error… smashed head against wall… test… etc.
If I get anything I’ll show it.
.
.
.
.
and error

:laughing:
:people_hugging: :argentina:

2 Likes

Just a suggestion Rofi.

yay -S rofi
cat /tmp/log_notify.txt | rofi -dmenu -i -p "File Content" -lines 20

:bird:

1 Like

Justo terminaba de probar lo que hice:
I just finished trying what I did:

#!/bin/bash
# mostrar-notif.sh
# Crea un cuadro mostrando las notificaciones registradas en /tmp/log_notify.txt
#
###############################################################################
# Muchas gracias a muzqs que proporcionó el script para las notificaciones en #
# https://forum.maboxlinux.org/t/notifications-icon/2101/9                    #
###############################################################################
#
#
#################################################
# Necesita el script de muzqs mencionado arriba #
#################################################
#
# Por supuesto que es mejorable, esto es sólo una prueba hecha por un amateur

# si existe el fichero lo borra
rm -f /tmp/notif-filter.txt

# filtra las líneas indeseadas
cat /tmp/log_notify.txt |grep -v sender-pid>/tmp/notif-filter.txt

# crea la ventana (yad es más bonito)
yad --text-info --title="Notificaciones" --filename="/tmp/notif-filter.txt" --width=400 --height=220

# Una alternativa es usar zenity en lugar de yad
# En ese caso hay que adecuar las medidas de la ventana

notificaciones2

Tu solución es más sencilla y elegante. Muchas gracias
Your solution is simpler and more elegant. Thank you so much.

:people_hugging: :argentina:

1 Like

Your solution is the best :clap: :clap:

:people_hugging: :argentina:

1 Like

Para que muestre primero las más recientes, en vez de “cat” uso “sort -r”

1 Like

Rofi has a theme selector.

yay -S rofi-themes-collection-git

and than run

rofi-theme-selector

A nice thing of rofi could be the search option.

:bird:

I was thinking of YAD too.
Yad has an option to make it a systray item with mouse click options.

I am sorry. :man_facepalming:

It is better to change the /tmp path to another.
At leas if you want to save notifications for ever.

Tmp = temp. It wil be destroid at reboot.


Lo siento. :man_facepalming:

Es mejor cambiar la ruta /tmp por otra.
Al menos si quieres guardar las notificaciones para siempre.

Tmp = temp. Será destroid en el reinicio.

:bird:

1 Like

Zenity option. :wink:

#!/bin/bash

# Edit path to log file.
log_file="PATH/TO/LOG_FILE"

zenity --text-info --filename="$log_file" --title="Notification History" \
    --width=600 --height=400

Mabox_20241212-12-21-11

:bird:

1 Like

Probé las tres opciones, mi preferida es la opción rofi.
La agregué al menú lateral derecho para no sobrecargar tint2.
El directorio /tmp me parece perfecto, no las quiero de manera permanente.
Muchas gracias.


I tried all three options, my favorite is the rofi option.
I added it to the right side menu so as not to overload tint2.
The /tmp directory seems fine to me, I don’t want them permanently.
Thank you very much.

:people_hugging: :argentina:

1 Like