Skip to content

Commit

Permalink
Revert "move to ESModules"
Browse files Browse the repository at this point in the history
This reverts commit 500d8c6.
  • Loading branch information
joaophi committed Nov 28, 2023
1 parent c7a7f5e commit c3dc1c5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 24 deletions.
27 changes: 16 additions & 11 deletions [email protected]/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,27 @@
*/

/* exported init */
import Clutter from "gi://Clutter";
import GObject from "gi://GObject";
import Gio from "gi://Gio";
import St from "gi://St";
const { Clutter, GObject, Gio, GLib, St } = imports.gi;

import { Extension, gettext as _ } from "resource:///org/gnome/shell/extensions/extension.js";
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();

import * as Main from "resource:///org/gnome/shell/ui/main.js";
import * as PopupMenu from "resource:///org/gnome/shell/ui/popupMenu.js";
import * as QuickSettings from "resource:///org/gnome/shell/ui/quickSettings.js";
const { Extension } = Me.imports.compat;
const Gettext = imports.gettext;
const Domain = Gettext.domain(Me.metadata.uuid);
const _ = Domain.gettext;
const ngettext = Domain.ngettext;

const Main = imports.ui.main;
const PopupMenu = imports.ui.popupMenu;
const QuickSettings = imports.ui.quickSettings;

// This is the live instance of the Quick Settings menu
const QuickSettingsMenu = Main.panel.statusArea.quickSettings;

import { Tailscale } from "./tailscale.js";
import { clearInterval, clearSources, setInterval } from "./timeout.js";
const { Tailscale } = Me.imports.tailscale;
const { clearInterval, clearSources, setInterval } = Me.imports.timeout;


const TailscaleIndicator = GObject.registerClass(
class TailscaleIndicator extends QuickSettings.SystemIndicator {
Expand Down Expand Up @@ -207,7 +212,7 @@ const TailscaleMenuToggle = GObject.registerClass(
}
);

export default class TailscaleExtension extends Extension {
class TailscaleExtension extends Extension {
enable() {
const icon = Gio.icon_new_for_string(`${this.path}/icons/tailscale.svg`);

Expand Down
3 changes: 2 additions & 1 deletion [email protected]/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"description": "Add Tailscale to GNOME quick settings\n\nMake sure you set your user as tailscale operator:\nsudo tailscale set --operator=$USER",
"uuid": "[email protected]",
"shell-version": [
"45"
"43",
"44"
],
"url": "https://github.com/joaophi/tailscale-gnome-qs",
"gettext-domain": "[email protected]"
Expand Down
12 changes: 6 additions & 6 deletions [email protected]/tailscale.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import GLib from "gi://GLib";
import GObject from "gi://GObject";
import Gio from "gi://Gio";
import Soup from "gi://Soup?version=3.0";
imports.gi.versions.Soup = "3.0";
const { GLib, GObject, Gio, Soup } = imports.gi;

import { setTimeout } from "./timeout.js";
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const { setTimeout } = Me.imports.timeout;

class TailscaleApiClient {
constructor() {
Expand Down Expand Up @@ -55,7 +55,7 @@ class TailscaleApiClient {
}
}

export const Tailscale = GObject.registerClass(
var Tailscale = GObject.registerClass(
{
Properties: {
"running": GObject.ParamSpec.boolean(
Expand Down
12 changes: 6 additions & 6 deletions [email protected]/timeout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GLib from "gi://GLib";
const { GLib } = imports.gi;

const SOURCES = [];

Expand All @@ -24,14 +24,14 @@ const clearSource = (handle) => {
}
}

export const clearSources = () => {
var clearSources = () => {
while (SOURCES.length > 0) {
clearSource(SOURCES[0]);
}
};

export const setTimeout = (func, delay, ...args) => addSource(func, delay, args, true);
export const setInterval = (func, delay, ...args) => addSource(func, delay, args, false);
var setTimeout = (func, delay, ...args) => addSource(func, delay, args, true);
var setInterval = (func, delay, ...args) => addSource(func, delay, args, false);

export const clearTimeout = clearSource;
export const clearInterval = clearSource;
var clearTimeout = clearSource;
var clearInterval = clearSource;

0 comments on commit c3dc1c5

Please sign in to comment.