Aylur / ags

A customizable and extensible shell
GNU General Public License v3.0
1.75k stars 94 forks source link

Clock gets out of sync #349

Closed ShadowS0ng closed 3 months ago

ShadowS0ng commented 3 months ago

for some reason the clock gets out of sync and falls behind ,I tried both Sync and Async polling,using a variable and binding it's value with no success:

const Clock = () => Widget.Label({
  useMarkup: true,
  label:  `<span foreground='blue' font_weight='bold'>${Utils.exec("date +%I:%M")}</span>`
  setup: (self) => { 
    Utils.interval(60000,() => {
      self.label = `<span foreground='blue' font_weight='bold'>${Utils.exec("date +%I:%M")}</span>`
    })
  },
  vpack: "end",
});

is this a bug or i am doing something wrong?

Aylur commented 3 months ago

60000ms is 1 minute, it is going to fall behind if its not exactly started at :00 seconds just lower the number to every 10 seconds, or ideally 1 second

ShadowS0ng commented 3 months ago

60000ms is 1 minute, it is going to fall behind if its not exactly started at :00 seconds just lower the number to every 10 seconds, or ideally 1 second

I tested it with 1000ms and also tested with the simple_bar example , the problem is still there , the problem is not just falling behind but it completely stops. that's the message i get : (com.github.Aylur.ags:162058): Gjs-WARNING **: 22:41:21.182: JS ERROR: GLib.Error g-unix-error-quark: Too many open files execAsync/<@resource:///com/github/Aylur/ags/utils/exec.js:14:37 execAsync@resource:///com/github/Aylur/ags/utils/exec.js:4:12 startPoll/this._interval<@resource:///com/github/Aylur/ags/variable.js:40:60 interval/id<@resource:///com/github/Aylur/ags/utils/timeout.js:5:9 _init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34 it repeats on every exec meaning every second.

ShadowS0ng commented 3 months ago

60000ms is 1 minute, it is going to fall behind if its not exactly started at :00 seconds just lower the number to every 10 seconds, or ideally 1 second

I tested it with 1000ms and also tested with the simple_bar example , the problem is still there , the problem is not just falling behind but it completely stops. that's the message i get : (com.github.Aylur.ags:162058): Gjs-WARNING **: 22:41:21.182: JS ERROR: GLib.Error g-unix-error-quark: Too many open files execAsync/<@resource:///com/github/Aylur/ags/utils/exec.js:14:37 execAsync@resource:///com/github/Aylur/ags/utils/exec.js:4:12 startPoll/this._interval<@resource:///com/github/Aylur/ags/variable.js:40:60 interval/id<@resource:///com/github/Aylur/ags/utils/timeout.js:5:9 _init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34 it repeats on every exec meaning every second.

UPDATE: I declared GDK_BACKEND=wayland and used sh -c "date ..." instead of date and it seems the problem is solved i'm not sure if it's because of GDK_BACKEND or the command