File: cpu_graph.js

package info (click to toggle)
libdazzle 3.44.0-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,964 kB
  • sloc: ansic: 64,328; xml: 69; javascript: 19; makefile: 12
file content (31 lines) | stat: -rwxr-xr-x 914 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env gjs

imports.gi.versions["Gdk"] = "3.0"
imports.gi.versions["Gtk"] = "3.0"

const GLib = imports.gi.GLib;
const Gdk = imports.gi.Gdk;
const Gtk = imports.gi.Gtk;
const Dazzle = imports.gi.Dazzle;

Gtk.init(null);

/*
 * NOTE: If you are using Dazzle.Application as your base GApplication,
 *       then the following theme loading is handled for you. You need
 *       not manually register CSS.
 */
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
                                         Dazzle.CssProvider.new ("resource:///org/gnome/dazzle/themes"),
                                         Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

let win = new Gtk.Window({title: "Cpu Graph"});
let graph = new Dazzle.CpuGraph({timespan: GLib.TIME_SPAN_MINUTE, max_samples: 120});

win.add(graph);
win.connect('delete-event', function(){
  Gtk.main_quit();
});
win.show_all();

Gtk.main();