I have created a menu by ... zenity --title="ABC" --text="Date-'date +%d%m%Y-%T'" --list --radiolist --column="select" --column="option" FALSE "1" FALSE "2" FALSE "3" Menu showing date with time when I entered in menu. I was trying to get running clock by watch -t -n 1 date +%T. When I use this command system is not giving any output. Is it possible to show running time in zenity menu by any other way?.

  • I don't think you can do that (a menu that shows the real time) with zenity. You need tools like pyGObject for that. – don_crissti Jan 25 '18 at 14:49

You have a space between - and t remove this and it should work fine:

watch -t -n 1 date +%T
  • Ni it does not work – kalpesh Jan 26 '18 at 6:12
  • Please somebody help – kalpesh Feb 2 '18 at 13:58

You cannot do it with zenity alone in the general case. Using X11 tools you could run a clock in the title bar of your zenity dialog window. Below I used xdotool to find the correct window and set the text in the title bar

date_time=$(date +%d/%m/%Y\ %T)
new_date_time=$(date +%d/%m/%Y\ %T)

zenity --title "${date_time}" --display=:0 \
       --text="Running clock in window title bar" --list --radiolist \
       --column="select" --column="option" FALSE "1" FALSE "2" FALSE "3" &

while true
  sleep 1
  new_date_time=$(date +%d/%m/%Y\ %T)
  xdotool search --name "${date_time}" set_window --name "${new_date_time}"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.