You are not logged in.
Pages: 1
Hello All,
The Xfce Panel's Clock, is there a way to make it justify the text to the centre?
I use the custom format below on a semi transparent background I created so it can be easily seen no matter what desktop background image I use.
%A %n%B %d %Y
As the day and month names change in length the position moves, I can centre it how I like it again by adding or removing spaces but it would be more convenient to have it justify automatically.
Thanks
Last edited by JmaCWQ (2023-05-05 19:12:52)
Offline
Unfortunately it doesn't. It does support Pango Markup, but Pango itself does not support centered text.
The genmon plugin, however, defaults to centered text on the plugin. Perhaps you could use it as an alternative? To give it a try:
create the following script and make it executable:
#!/bin/bash
CALENDAR="yad --calendar --no-buttons --fixed --undecorated --close-on-unfocus --skip-taskbar --geometry +830+0"
DAY="$(date '+%A')"
DATE="$(date '+%B %_d %Y')"
echo -e "<txt>$DAY\n$DATE</txt>"
echo -e "<txtclick>$CALENDAR</txtclick>"
echo "<tool></tool>"
Note: it needs yad installed to display a calendar on click.
.
add the plugin to the panel with the following options:
Command = /path/to/script
Label = unchecked
Period = 60
Font = your choice
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Thanks Toz,
It works though needs a little fine tuning if possible.
It puts the text/plugin all the way to the left of the panel.
I lose the tooltip that the clock has when it's moused over, which I can live without.
Can I change the location of where the text appears on the panel without using separators?
Seems to mess up the background image if I use separators, even with Adjust Size Automatically disabled.
If possible I'd like to get it to always justify centre of the background image, which is 153x40 pixels.
Without separators:
With separators:
Panel Prefs:
Offline
It puts the text/plugin all the way to the left of the panel.
What version of the xfce4-genmon-plugin are you using?
Edit: If that plugin is the only thing on Panel-4, what happens if you decrease the width of the panel?
Also, what tweaks are you using to round the panel corners?
Last edited by ToZ (2023-05-04 22:26:52)
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Genmon 4.1.1.
Yes it is the only thing on Panel 4.
Decreased from 153 to 130 pixels, it removes from the right end of the panel and the plugin/text doesn't move:
It is a .png background image with round corners I made with GIMP, 153x40 pixels, the panel itself is default.
System: Kernel: 5.10.0-22-amd64 [5.10.178-3] x86_64 bits: 64 compiler: gcc v: 10.2.1
parameters: BOOT_IMAGE=/boot/vmlinuz-5.10.0-22-amd64
root=UUID=<filter> ro quiet nosplash consoleblank=0
Desktop: Xfce 4.18.1 tk: Gtk 3.24.24 info: xfce4-panel wm: xfwm 4.18.0 vt: 7
dm: LightDM 1.26.0 Distro: MX-21.3_x64 Wildflower September 18 2022
base: Debian GNU/Linux 11 (bullseye)
Offline
You can use CSS tweaks to push the plugin to the right via padding. To do so, first find the ID of the genmon plugin by right-clicking on the Panel > Panel Preferences > Items tab, and hovering over the genmon plugin. You will see something like "Internal name: genmon-3".
Then add to (or create if it doesn't exist) the file ~/.config/gtk-3.0/gtk.css with the following content:
#genmon-3 .genmon_plugin {padding-left: 15px}
...replace "-3" with the actual ID of the plugin and adjust 15px to suit.
You will need to restart the panel "xfce4-panel -r" for the effect to take place. Note that in genmon plugin 4.2.0, there is an easier way to bind CSS tweaks to the plugin using the <css> tag.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Thanks again Toz, works well.
I will probably leave the genmon plugin version as is until it's updated by the MX devs.
For those interested and might help someone looking to do similar.
I created the folder ~/.local/share/scripts/ and put the script I created and named clock-script in it.
Changed the geometry values in the script to place the calendar right above the panel instead of top centre of the screen, removed the space between the month and date, added a comma after the date:
#!/bin/bash
CALENDAR="yad --calendar --no-buttons --fixed --undecorated --close-on-unfocus --skip-taskbar --geometry +1420-0"
DAY="$(date '+%A')"
DATE="$(date '+%B%_d, %Y')"
echo -e "<txt>$DAY\n$DATE</txt>"
echo -e "<txtclick>$CALENDAR</txtclick>"
echo "<tool></tool>"
Then I added the Generic Monitor plugin to the panel, using in it's Properties the command:
/home/home/.local/share/scripts/clock-script
Label unchecked
Period(s) 60.00
Font Freesans 12
The file ~/.config/gtk-3.0/gtk.css already existed, the line I added to it gets the text in the centre of the panel where I want it:
#genmon-89 .genmon_plugin {padding-left: 27px}
How it looks:
Last edited by JmaCWQ (2023-05-05 19:08:01)
Offline
Pages: 1
[ Generated in 0.012 seconds, 7 queries executed - Memory usage: 552.01 KiB (Peak: 569.29 KiB) ]