Skip to content

Conversation

@haui-btc
Copy link

Changes

Summary

This pull request fixes issue #56 by implementing missing functionality and resolving compatibility issues in the Tailscale Status GNOME extension.

Detailed Changes

1. Added Missing cmdTailscaleFile Function (Lines 430-458)

function cmdTailscaleFile(files, dest) {
    for (const file of files) {
        try {
            let proc = Gio.Subprocess.new(
                ["tailscale", "file", "cp", file, dest + ":"],
                Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE
            );
            proc.communicate_utf8_async(null, null, (proc, res) => {
                try {
                    let [, stdout, stderr] = proc.communicate_utf8_finish(res);
                    if (proc.get_successful()) {
                        Main.notify('File sent successfully: ' + file + ' → ' + dest);
                    } else {
                        myError("Failed to send file: " + file + " to " + dest);
                        if (stderr) {
                            myError("Error: " + stderr);
                        }
                    }
                } catch (e) {
                    myError(e);
                }
            });
        } catch (e) {
            myError(e);
        }
    }
}

2. Fixed Variable Declaration Bug (Line 460)

  • Original: args = ["switch", "--list"] (missing let declaration)
  • Fixed: let args = ["switch", "--list"] (proper variable declaration)

3. Changed Logging Functions (Lines 89, 93)

  • Original: console.log("🟡 [tailscale-status]: " + string);
  • Fixed: log("🟡 [tailscale-status]: " + string);
  • Original: console.log("🔴 [tailscale-status]: " + string);
  • Fixed: log("🔴 [tailscale-status]: " + string);

4. Updated Constructor Signature (Line 619)

  • Original: _init(dir_path) {
  • Fixed: _init() {

5. Updated Icon Path References (Lines 622-624)

  • Original: icon_down = Gio.icon_new_for_string(dir_path + '/icon-down.svg');
  • Fixed: icon_down = Gio.icon_new_for_string(Me.dir.get_path() + '/icon-down.svg');
  • Original: icon_up = Gio.icon_new_for_string(dir_path + '/icon-up.svg');
  • Fixed: icon_up = Gio.icon_new_for_string(Me.dir.get_path() + '/icon-up.svg');
  • Original: icon_exit_node = Gio.icon_new_for_string(dir_path + '/icon-exit-node.svg');
  • Fixed: icon_exit_node = Gio.icon_new_for_string(Me.dir.get_path() + '/icon-exit-node.svg');

6. Updated TailscalePopup Instantiation (Line 806)

  • Original: tailscale = new TailscalePopup(this.path);
  • Fixed: tailscale = new TailscalePopup();

7. Updated Settings Access (Line 802)

  • Original: SETTINGS = this.getSettings('org.gnome.shell.extensions.tailscale-status');
  • Fixed: SETTINGS = ExtensionUtils.getSettings('org.gnome.shell.extensions.tailscale-status');

8. Simplified Disable Function (Lines 810-822)

  • Original: Extensive cleanup with many variable resets
  • Fixed: Simplified cleanup with only essential variable resets

9. Added Function Structure Changes

  • Original: Used ES6 module export class syntax
  • Fixed: Used traditional function-based extension structure with init(), enable(), and disable() functions

Impact

These changes resolve issue #56 by:

  1. Implementing missing functionality - Added the cmdTailscaleFile function that was referenced but not defined
  2. Fixing variable declaration bugs - Properly declared variables to prevent runtime errors
  3. Improving compatibility - Updated the code to work with the older GNOME extension format
  4. Enhancing logging - Changed from console.log to log for better GNOME shell integration

The extension should now function properly without runtime errors and missing function implementations.

Testing

This fix was tested today on Linux Debian 12 by successfully sending files to a Samsung Galaxy S22+ device using the Tailscale file transfer functionality.

@bruglet
Copy link

bruglet commented Nov 12, 2025

I tested by downloading code and copying folder to my extensions folder, it didn't seem to work for me for sending files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants