You are not logged in.

#1 2022-01-23 07:52:35

John Path
Member
Registered: 2021-10-15
Posts: 57

[SOLVED]Another zone's time on polybar

Hi,

I am using polybar, and i want to use time of 2 different zones.

I want to use it with date-alt on config files of polybar.

I wrote the following in config but it just print the whole lines instead of showing time of different zone.

[module/time]
type = internal/date
interval = 1

format = <label>
format-background = #2a2e36
;format-foreground = #82868e
format-foreground = #a7acb4

date = %I:%M:%S %p%{F-}
date-alt= TZ=Canada/Mountain date +"? %I:%M:%S %p"

label = %date%

I would use some help to solve this problem

Last edited by John Path (2022-02-19 10:29:43)

Offline

#2 2022-01-23 08:33:26

ishaanbhimwal
Member
Registered: 2022-01-21
Posts: 48
Website

Re: [SOLVED]Another zone's time on polybar

You could use the custom/script module for this. For example:

[bar/mybar]
modules-center = time-singapore

[module/time-singapore]
type = custom/script
exec = TZ=Asia/Singapore date +"Singapore: %H:%M"
interval = 30

Offline

#3 2022-01-23 09:55:25

John Path
Member
Registered: 2021-10-15
Posts: 57

Re: [SOLVED]Another zone's time on polybar

ishaanbhimwal wrote:

You could use the custom/script module for this. For example:

[bar/mybar]
modules-center = time-singapore

[module/time-singapore]
type = custom/script
exec = TZ=Asia/Singapore date +"Singapore: %H:%M"
interval = 30

But this will just show both zone time, i just want to see the time of another zone sometimes only (when i click it.)

Offline

#4 2022-01-23 18:55:54

patrickziegler
Member
From: ::1
Registered: 2018-11-02
Posts: 29
Website

Re: [SOLVED]Another zone's time on polybar

There is an example on the polybar wiki for how to write your own script for a two-state date module: https://github.com/polybar/polybar/wiki … t#examples

Offline

#5 2022-02-19 10:29:20

John Path
Member
Registered: 2021-10-15
Posts: 57

Re: [SOLVED]Another zone's time on polybar

I made it to work thanks.

Also sorry for late response i didnot saw your reply.

Offline

#6 2023-06-09 14:21:34

JanusDC
Member
From: Buenos Aires
Registered: 2012-05-20
Posts: 12
Website

Re: [SOLVED]Another zone's time on polybar

John Path wrote:

I made it to work thanks.

Also sorry for late response i didnot saw your reply.

Can you share your module?

Offline

#7 2023-06-09 14:32:25

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,308

Re: [SOLVED]Another zone's time on polybar

Be advised that the original poster on this thread has not been on the forums since last year.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB