|
From: | Julio C. Neves |
Subject: | Re: [shell-script] Trocar ícone do yad --notification |
Date: | Thu, 9 Jul 2015 16:15:30 -0300 |
A cada click vc executa o cmd correspondente, chama outro notification idêntico ao 1o., porém com o novo ícone e dá quit.
Já estou convencido que não estou conseguindo me expressar
A situação é a seguinte: quero configurar um botãozinho na systray (yad --notification) que, a cada clique, troque o gateway da minha máquina.Eu já tinha esse script:
gw=$(route -n | grep ^0.0.0.0 | grep -oE "192.168.1.1[0-9]?")[ "$gw" == "192.168.1.1" ] && {route del default;route add default gw 192.168.1.10;notify-send -i network-wired " " " "} || {sudo route del default;sudo route add default gw 192.168.1.1;notify-send -i network-offline " " " "}que realiza a troca.
queria adaptar para ele agir a cada vez que eu clicasse no ícone do yad --notification, e, para cada gateway, ele apresentasse um ícone diferente.
É possível?On Wed, Jul 8, 2015 at 8:34 PM 'Julio C. Neves' address@hidden [shell-script] <address@hidden> wrote:Pesquise a opção action: junto com o --listen.Dois exemplos que podem ser úteis:1.$ cat notification1.yad#!/bin/bash# Demo do diálogo notification com#+ o uso das opção --listen e menu:#trap "rm yad.fifo; exit" 0 2 3 15[ -p yad.fifo ] || mkfifo yad.fifoexec 3<> yad.fifoyad --notification --listen <&3 &echo menu:'Calendário!yad --calendar|Escolha de Arquivos!yad --file-selection --width 700 --height 400|Fim!quit' >&32.$ cat notification.yadyad --notification \--text "A hora certa a cada click" \--image gnome-panel-clock \--command "bash -c 'xterm -geometry 30x5+300+200 \-bg darkred -fg lightgray -T Hora \-e cat <(date +%H:%M:%S; sleep 3)'"Em 8 de julho de 2015 18:42, Alfredo Casanova address@hidden [shell-script] <address@hidden> escreveu:Acho que minha dúvida não ficou clara.$ yad --notification --command='echo teste' --image=network-wired --listense vc fizer isso, ele vai colocar um ícone no seu systray, "network-wired" e vai te dar o stdin pra vc passar comandos ao YADse vc digitar:icon:network-offilneo ícone na systray vai mudar.Eu quero fazer essa alteração do ícone acontecer quando eu clicar nele, na systray, após executar alguns comandos no bash.Um exemplo, nesse caso, seria eu setar uma interface como up ou down com o clique no ícone, alterando a imagem de exibição logo depois.No YAD temos os Dialog Options sendo que um deles é o --icons.
- --icons
- Display box with shortcut icons.
- Ai vamos para os General Options que possuem o --image-path.
- --image-path=
PATH
- Add specified path to the standard list of directories for looking for icons. This option can be used multiply times.
- Há dentro de Texte Entry Options a opção --ricon-action.
- --ricon-action=CMD
- Specify a command which will be run when the right icon clicked. Output of command will be set as entry text.
Any extra data specified in command line adds as an items of combo-box entry, except of numeric mode.
If icon specified and icon action is not given, click on icon just clear the entry. Numeric fields will ignore the icons.
Para concluir temos mais duas opções:
Display a box with all of the installed desktop applications
1. yad --icons --read-dir=/usr/share/applications
- 2. YAD icon browser is a graphical tool for discover icons in current or user-specified GTK+ icon theme. Launch it as
- yad-icon-browser [theme]
2015-07-08 17:09 GMT-03:00 Luiz Alberto address@hidden [shell-script] <address@hidden>:
On 08-07-2015 16:38, Alfredo Casanova address@hidden [shell-script] wrote:
Mostra as tuas tentativas, para que se veja onde esta o possível erro.Estava dando uma lida no https://code.google.com/p/yad/wiki/NotificationIcon e vi a opção --notification do Yad.
Tentei aqui e não consegui (pode ser algo simples que eu tenha deixado passar) alterar o ícone da notificação a cada clique, pra fazer uma espécie de switch on-off com shell script, que executasse alguns comandos e, em caso de sucesso, trocasse o ícone.
Alguém pode me dar um help?
--Att,
Osvaldo Filho.Técnico em TI/Redes - Universidade Federal do Ceará.Sócio-fundador do i-TIC Digital Livre - Informação Livre para todos!Twitter i-TIC Digital Livre: @iticdigital
TUX-CE Member.Pós-graduando em MBA em Arquitetura de Redes e Cloud Computing - Instituto BSB.Graduado em Redes de Computadores - Centro Universitário Estácio do Ceará.
Técnico em Conectividade com Extensão em Desenvolvimento de Software - IFCE (Cefet).
Graduando em Telemática - IFCE (Cefet).Novell Datacenter Technical Specialist.
Linux Professional Institute Certified Level 1.
Novell Certified Linux Administrator (CLA).Facebook: Osvaldo Filho
Twitter: @osvaldofilho
[Prev in Thread] Current Thread [Next in Thread]
- Trocar ícone do yad --notification, Alfredo Casanova, 2015/07/08
- Re: [shell-script] Trocar ícone do yad --notification, Osvaldo Filho, 2015/07/08
- Re: [shell-script] Trocar ícone do yad --notification, Luiz Alberto, 2015/07/08
- Re: [shell-script] Trocar ícone do yad --notification, Osvaldo Filho, 2015/07/08
- Re: [shell-script] Trocar ícone do yad --notification, Alfredo Casanova, 2015/07/08
- Re: [shell-script] Trocar ícone do yad --notification, Julio C. Neves, 2015/07/08
- Re: [shell-script] Trocar ícone do yad --notification, Alfredo Casanova, 2015/07/09
- Re: [shell-script] Trocar ícone do yad --notification, Julio C. Neves <=
Re: [shell-script] Trocar ícone do yad --notification, Julio C. Neves, 2015/07/08
- Prev by Date: Re: [shell-script] Trocar ícone do yad --notification
- Next by Date: Bloco de texto
- Previous by thread: Re: [shell-script] Trocar ícone do yad --notification
- Next by thread: Re: [shell-script] Trocar ícone do yad --notification
- Index(es):