├── stylesheet.css
├── po
├── de.po
├── fr.po
├── sv.po
├── commandoutput.mo
├── locale
│ ├── de
│ │ └── LC_MESSAGES
│ │ │ └── commandoutput.mo
│ ├── fr
│ │ └── LC_MESSAGES
│ │ │ └── commandoutput.mo
│ ├── it
│ │ └── LC_MESSAGES
│ │ │ └── commandoutput.mo
│ └── sv
│ │ └── LC_MESSAGES
│ │ └── commandoutput.mo
├── commandoutput.pot
└── it.po
├── make-zip.sh
├── schemas
├── gschemas.compiled
└── org.gnome.shell.extensions.commandoutput.gschema.xml
├── install.sh
├── README.md
├── .gitignore
├── metadata.json
├── settings.js
├── LICENSE
├── prefs.js
└── extension.js
/stylesheet.css:
--------------------------------------------------------------------------------
1 | .co-label {
2 | color: #fff;
3 | font-size: 10px;
4 | }
5 |
6 |
--------------------------------------------------------------------------------
/po/de.po:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elken/gnome-shell-extensions-command-output/HEAD/po/de.po
--------------------------------------------------------------------------------
/po/fr.po:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elken/gnome-shell-extensions-command-output/HEAD/po/fr.po
--------------------------------------------------------------------------------
/po/sv.po:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elken/gnome-shell-extensions-command-output/HEAD/po/sv.po
--------------------------------------------------------------------------------
/po/commandoutput.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elken/gnome-shell-extensions-command-output/HEAD/po/commandoutput.mo
--------------------------------------------------------------------------------
/make-zip.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | UUID=$(grep uuid metadata.json | cut -d "\"" -f4)
3 | rm -f ../${UUID}.zip
4 | zip -r ../${UUID}.zip *
5 |
--------------------------------------------------------------------------------
/schemas/gschemas.compiled:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elken/gnome-shell-extensions-command-output/HEAD/schemas/gschemas.compiled
--------------------------------------------------------------------------------
/po/locale/de/LC_MESSAGES/commandoutput.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elken/gnome-shell-extensions-command-output/HEAD/po/locale/de/LC_MESSAGES/commandoutput.mo
--------------------------------------------------------------------------------
/po/locale/fr/LC_MESSAGES/commandoutput.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elken/gnome-shell-extensions-command-output/HEAD/po/locale/fr/LC_MESSAGES/commandoutput.mo
--------------------------------------------------------------------------------
/po/locale/it/LC_MESSAGES/commandoutput.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elken/gnome-shell-extensions-command-output/HEAD/po/locale/it/LC_MESSAGES/commandoutput.mo
--------------------------------------------------------------------------------
/po/locale/sv/LC_MESSAGES/commandoutput.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elken/gnome-shell-extensions-command-output/HEAD/po/locale/sv/LC_MESSAGES/commandoutput.mo
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | rm -rf ~/.local/share/gnome-shell/extensions/commandoutput@elken.tdos.gmail.com
4 | cp -R ~/build/gnome-shell-extensions-command-output ~/.local/share/gnome-shell/extensions/commandoutput@elken.tdos.gmail.com
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Command Output
2 | =====================================
3 |
4 | Simple widget to provide the output of a specified command every specified interval.
5 |
6 | To access settings, either click the widget itself or access via gnome-tweak-tool.
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # http://www.gnu.org/software/automake
2 |
3 | Makefile.in
4 |
5 | # http://www.gnu.org/software/autoconf
6 |
7 | /autom4te.cache
8 | /aclocal.m4
9 | /compile
10 | /configure
11 | /depcomp
12 | /install-sh
13 | /missing
14 | /stamp-h1
15 |
16 | /build
17 | /test
18 | commandoutput@elken.tdos.gmail.com.zip
19 |
--------------------------------------------------------------------------------
/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "_generated": "Generated by SweetTooth, do not edit",
3 | "description": "Display the output of a shell command at a user-specified interval. \n\nIf there are any issues/requests, please submit them on Github.",
4 | "name": "Command Output",
5 | "shell-version": [
6 | "3.10",
7 | "3.12",
8 | "3.14",
9 | "3.16",
10 | "3.18"
11 | ],
12 | "url": "https://www.github.com/elken/gnome-shell-extensions-command-output",
13 | "uuid": "commandoutput@elken.tdos.gmail.com",
14 | "version": 9
15 | }
16 |
--------------------------------------------------------------------------------
/schemas/org.gnome.shell.extensions.commandoutput.gschema.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2000
5 | Time between each execution
6 | Time (in ms) to rerun each command
7 |
8 |
9 | 'echo It works!'
10 | Command to run
11 | Set to any command that is in $PATH
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/settings.js:
--------------------------------------------------------------------------------
1 | const Gio = imports.gi.Gio;
2 | const GLib = imports.gi.GLib;
3 | const Gettext = imports.gettext;
4 |
5 | const SCHEMA_NAME = "org.gnome.shell.extensions.commandoutput";
6 |
7 | const Keys = {
8 | RATE: 'refresh-rate',
9 | COMMAND: 'command'
10 | };
11 |
12 | function getSchema(extension) {
13 | let schemaDir = extension.dir.get_child('schemas').get_path();
14 |
15 | let schemaSource = Gio.SettingsSchemaSource.new_from_directory(schemaDir, Gio.SettingsSchemaSource.get_default(), false);
16 | let schema = schemaSource.lookup(SCHEMA_NAME, false);
17 | return new Gio.Settings({ settings_schema: schema });
18 | }
19 |
20 | function initTranslations(extension) {
21 | let localeDir = extension.dir.get_child('locale').get_path();
22 | Gettext.bindtextdomain('gnome-shell-extensions', localeDir);
23 | }
24 |
--------------------------------------------------------------------------------
/po/commandoutput.pot:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the PACKAGE package.
4 | # FIRST AUTHOR , YEAR.
5 | #
6 | msgid ""
7 | msgstr ""
8 | "Project-Id-Version: CommandOutput\n"
9 | "Report-Msgid-Bugs-To: \n"
10 | "POT-Creation-Date: 2014-12-25 20:39+0000\n"
11 | "PO-Revision-Date: 2014-12-26 10:26+0100\n"
12 | "Last-Translator: Ellis Kenyo \n"
13 | "Language-Team: elken \n"
14 | "MIME-Version: 1.0\n"
15 | "Content-Type: text/plain; charset=UTF-8\n"
16 | "Content-Transfer-Encoding: 8bit\n"
17 | "X-Generator: Poedit 1.5.4\n"
18 | "Language: English\n"
19 |
20 | #: ../extension.js:57
21 | msgid "Error executing command."
22 | msgstr ""
23 |
24 | #: ../prefs.js:30
25 | msgid "Refresh interval (seconds)"
26 | msgstr ""
27 |
28 | #: ../prefs.js:34
29 | msgid "Command to output"
30 | msgstr ""
31 |
--------------------------------------------------------------------------------
/po/it.po:
--------------------------------------------------------------------------------
1 | # Italian translations for PACKAGE package
2 | # Traduzioni italiane per il pacchetto PACKAGE..
3 | # Copyright (C) 2014 THE PACKAGE'S COPYRIGHT HOLDER
4 | # This file is distributed under the same license as the PACKAGE package.
5 | # elken , 2014.
6 | #
7 | msgid ""
8 | msgstr ""
9 | "Project-Id-Version: CommandOutput\n"
10 | "Report-Msgid-Bugs-To: \n"
11 | "POT-Creation-Date: 2014-12-25 20:39+0000\n"
12 | "PO-Revision-Date: 2014-12-26 10:20+0100\n"
13 | "Last-Translator: Ellis Kenyo \n"
14 | "Language-Team: Italian\n"
15 | "Language: it\n"
16 | "MIME-Version: 1.0\n"
17 | "Content-Type: text/plain; charset=ISO-8859-1\n"
18 | "Content-Transfer-Encoding: 8bit\n"
19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20 | "X-Generator: Poedit 1.5.4\n"
21 |
22 | #: ../extension.js:57
23 | #, fuzzy
24 | msgid "Error executing command."
25 | msgstr "Errore comando di esecuzione"
26 |
27 | #: ../prefs.js:30
28 | #, fuzzy
29 | msgid "Refresh interval (seconds)"
30 | msgstr "Intervallo di aggiornamento in secondi"
31 |
32 | #: ../prefs.js:34
33 | #, fuzzy
34 | msgid "Command to output"
35 | msgstr "Comando per l'uscita"
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014, Ellis kenyo
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | * Neither the name of gnome-shell-extensions-command-output nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 |
--------------------------------------------------------------------------------
/prefs.js:
--------------------------------------------------------------------------------
1 | const GLib = imports.gi.GLib;
2 | const Gio = imports.gi.Gio;
3 | const GObject = imports.gi.GObject;
4 | const Gtk = imports.gi.Gtk;
5 |
6 | const Lang = imports.lang;
7 | const Extension = imports.misc.extensionUtils.getCurrentExtension();
8 | const Settings = Extension.imports.settings;
9 |
10 | const Gettext = imports.gettext.domain('gnome-shell-extensions');
11 | const _ = Gettext.gettext;
12 |
13 | const SCHEMA_NAME = "org.gnome.shell.extensions.commandoutput";
14 |
15 | const CommandOutputPrefs = new GObject.Class({
16 | Name: 'CommandOutput.Prefs',
17 | GTypeName: 'CommandOutputWidget',
18 | Extends: Gtk.Grid,
19 |
20 | _init: function(params) {
21 | Settings.initTranslations(Extension);
22 | this.parent(params);
23 | this.main = new Gtk.Grid({
24 | margin: 10,
25 | row_spacing: 10,
26 | column_spacing: 20,
27 | column_homogeneous: false,
28 | row_homogeneous: true
29 | });
30 |
31 | this.main.attach(new Gtk.Label({label: _("Refresh interval (seconds)"),
32 | hexpand: true,
33 | halign: Gtk.Align.START}), 1, 1, 1, 1);
34 |
35 | this.main.attach(new Gtk.Label({label: _("Command to output"),
36 | hexpand: true,
37 | halign: Gtk.Align.START}), 1, 2, 1, 1)
38 |
39 | this.rate = new Gtk.SpinButton({
40 | adjustment: new Gtk.Adjustment({
41 | lower: 1,
42 | upper: 2147483647,
43 | step_increment: 1
44 | }),
45 | halign: Gtk.Align.END
46 | });
47 |
48 | this.command = new Gtk.Entry();
49 |
50 | this.main.attach(this.rate, 4, 1, 2, 1);
51 | this.main.attach(this.command, 4, 2, 2, 1);
52 |
53 | this._settings = Settings.getSchema(Extension);
54 |
55 | this._settings.bind(Settings.Keys.RATE, this.rate, 'value',Gio.SettingsBindFlags.DEFAULT);
56 | this._settings.bind(Settings.Keys.COMMAND, this.command, 'text', Gio.SettingsBindFlags.DEFAULT);
57 |
58 | this._commandID = this.command.connect('activate', Lang.bind(this, this._save));
59 | this._rateID = this.rate.connect('value-changed', Lang.bind(this, this._save));
60 |
61 | this.main.show_all();
62 | },
63 |
64 | _save: function() {
65 | this._settings.set_string(Settings.Keys.COMMAND, this.command.text);
66 | this._settings.set_int(Settings.Keys.RATE, this.rate.value);
67 | },
68 | });
69 |
70 | function init() {
71 |
72 | }
73 |
74 | function buildPrefsWidget() {
75 | let prefs = new CommandOutputPrefs();
76 |
77 | return prefs.main;
78 | }
79 |
--------------------------------------------------------------------------------
/extension.js:
--------------------------------------------------------------------------------
1 | const St = imports.gi.St;
2 | const GLib = imports.gi.GLib;
3 | const Gio = imports.gi.Gio;
4 |
5 | const Lang = imports.lang;
6 | const Mainloop = imports.mainloop;
7 | const Main = imports.ui.main;
8 | const Util = imports.misc.util;
9 |
10 | const Extension = imports.misc.extensionUtils.getCurrentExtension();
11 | const Settings = Extension.imports.settings;
12 |
13 | const Gettext = imports.gettext;
14 |
15 | const _ = Gettext.gettext;
16 |
17 | const CommandOutput = new Lang.Class({
18 | Name: 'CommandOutput.Extension',
19 |
20 | enable: function() {
21 | this._outputLabel = new St.Label({style_class: "co-label"});
22 | this._output = new St.Bin({reactive: true,
23 | track_hover: true
24 | });
25 |
26 | this._stopped = false;
27 | this._settings = Settings.getSchema(Extension);
28 | this._load();
29 | this._output.set_child(this._outputLabel);
30 | this._outputID = this._output.connect('button-release-event', this._openSettings);
31 |
32 | this._update();
33 | Main.panel._rightBox.insert_child_at_index(this._output, 0);
34 | },
35 |
36 | disable: function() {
37 | this._save();
38 | Main.panel._rightBox.remove_child(this._output);
39 | this._stopped = true;
40 | this._output.disconnect(this._outputID);
41 | },
42 |
43 | _init: function() {
44 | Settings.initTranslations(Extension);
45 | },
46 |
47 | _doCommand: function() {
48 | let [res, out] = GLib.spawn_sync(null, this._toUtfArray(this._command), null, GLib.SpawnFlags.SEARCH_PATH, null);
49 |
50 | if(out == null) {
51 | return _("Error executing command.");
52 | }
53 | else {
54 | return out.toString();
55 | }
56 | },
57 |
58 | _isFound: function(str) {
59 | var f = false;
60 | for(var i=0; i < str.length;i++) {
61 | if(str[i] == "~") {
62 | f = true;
63 | }
64 | }
65 |
66 | if(f) {
67 | let re = /~/gi;
68 | let s = str.replace(re, GLib.get_home_dir());
69 | return [f, s];
70 | }
71 | else {
72 | return [f,str];
73 | }
74 | },
75 |
76 | _toUtfArray: function(str) {
77 | let [f, s2] = this._isFound(str);
78 | let arr = s2.split(" ");
79 |
80 | return arr;
81 | },
82 |
83 | _refresh: function() {
84 | this._load();
85 | let iText = this._doCommand();
86 | this._outputLabel.set_text(iText);
87 | },
88 |
89 | _update: function() {
90 | this._refresh();
91 | if (this._stopped == false) {
92 | Mainloop.timeout_add_seconds(this._refreshRate, Lang.bind(this, this._update));
93 | }
94 | },
95 |
96 | _load: function() {
97 | this._command = this._settings.get_string(Settings.Keys.COMMAND);
98 | this._refreshRate = this._settings.get_int(Settings.Keys.RATE);
99 | },
100 |
101 | _save: function() {
102 | this._settings.set_string(Settings.Keys.COMMAND, this._command);
103 | this._settings.set_int(Settings.Keys.RATE, this._refreshRate);
104 | },
105 |
106 | _openSettings: function () {
107 | Util.spawn(["gnome-shell-extension-prefs", Extension.uuid]);
108 | },
109 | });
110 |
111 | function init() {
112 | return new CommandOutput;
113 | }
114 |
--------------------------------------------------------------------------------