Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-12-30 15:55:25

davecs
Member
Registered: 2014-03-21
Posts: 10

DateTime panel applet — a suggestion

Is it possible for the DateTime panel applet to be changed in order to run a user-selected program when it is clicked? This would allow it to launch a more comprehensive calendar app when clicked on.

Offline

#2 2020-12-30 17:53:43

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 7,281

Re: DateTime panel applet — a suggestion

Without an enhancement to the code, no it can't. However, if you want to display the date/time on the panel, and then click on it to bring up some other calendar app, you can use the xfce4-genmon-plugin and a command like this:

bash -c 'echo "<txt>$(date)</txt><txtclick>APP</txtclick>"'

...and change APP to the name of the calendar app you want to use.

You can format the date as well:
Example #1 - Just the time:

bash -c 'echo "<txt>$(date +"%l:%M%P")</txt><txtclick>APP</txtclick>"'

Example #2 - Date and time:

bash -c 'echo "<txt>$(date "+%a %b %d, %l:%M%P")</txt><txtclick>APP</txtclick>"'

In the genmon properties, uncheck the label, set the period cycle (seconds to refresh) and change the font if you desire.

Offline

#3 2020-12-31 17:40:56

davecs
Member
Registered: 2014-03-21
Posts: 10

Re: DateTime panel applet — a suggestion

Yes, I was requesting an enhancement to the code, and I think it would be a very worthwhile enhancement.

I have used genmon before, but I was unaware of the <txtclick> control, so I will look up the latest info on it and see if I can achieve the look I want.

Offline

#4 2020-12-31 18:34:43

davecs
Member
Registered: 2014-03-21
Posts: 10

Re: DateTime panel applet — a suggestion

Thanks for your help, ToZ, I came up with this script:

#!/bin/sh

echo "<txt><b>`date +%H:%M:%S`</b>"
echo "<span size='x-small'>  `date +%d/%m/%Y`</span></txt><txtclick>APP</txtclick>"
echo "<tool>Weekday: `date +%A`"
echo "Week №: `date +%U`"
echo "Day of Year: `date +%j`</tool>"

This lines up nicely with the Font set to Bitstream Vera Sans 12pt. I had to insert spaces on the second echo line. I would have preferred to use a "center" layout command. I tried <span text-align='center'> and it didn't work. Any knowledge here would be helpful.

Offline

#5 2020-12-31 19:01:44

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 7,281

Re: DateTime panel applet — a suggestion

Unfortunately, neither GtkLabel (via css style properties) nor the Pango Markup Language currently support text alignment. Right now spaces are the best you can do.

Offline

#6 2020-12-31 19:19:44

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 7,281

Re: DateTime panel applet — a suggestion

I can set it to default center-justify in the code, and it works:
Screenshot-2020-12-31-14-18-39.png

Just trying to see if there is a downside to this.

If it's a horizontal, one line output, the justification won't matter (widget will size to text length)
If it's a horizontal, multi-line output, or any of single or multi-line vertical/deskbar output, this would be justified as well.

Is there any reason someone wouldn't want it center justified?

Offline

#7 2020-12-31 19:24:47

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 7,281

Re: DateTime panel applet — a suggestion

Okay. You've convinced me. I've pushed a commit to center justify labels by default. I'll see if anyone complains about it.

To test/run it, you'll need to build the git version of the plugin. Let me know if you need any help.

Offline

#8 2021-01-03 16:22:15

davecs
Member
Registered: 2014-03-21
Posts: 10

Re: DateTime panel applet — a suggestion

ToZ wrote:

Okay. You've convinced me. I've pushed a commit to center justify labels by default. I'll see if anyone complains about it.

To test/run it, you'll need to build the git version of the plugin. Let me know if you need any help.

I'll wait until it comes through as an update. I'm using PCLinuxOS which keeps pretty much up to date. Thank you!

Offline

Board footer

Powered by FluxBB