2nv2u / gnome-shell-extension-syncthing-indicator

Put an indicator on the panel signalling the Syncthing daemon status using SystemD
https://extensions.gnome.org/extension/1070/syncthing-indicator/
GNU General Public License v3.0
59 stars 10 forks source link

Error: Unrecognized parameter "append_to" #39

Open babb0 opened 6 months ago

babb0 commented 6 months ago

fresh install Ubuntu 24.04 extension-manager shows this error (syncthin indicator version 35): Error: Unrecognized parameter "append_to"

Bazulenkov commented 6 months ago

I have the same problem.

smiffy6969 commented 6 months ago

Same problem here

Screenshot from 2024-05-27 21-09-43

Brand new fresh install (after the upgrade to 24.04 borked my machine)

System Details Report


Report details

Hardware Information:

Software Information:

MarkJaroski commented 6 months ago

I have the same result.

MarkJaroski commented 6 months ago

I've managed to find a stack trace in the systemd journal

Stack trace:
                                            parse@resource:///org/gnome/shell/misc/params.js:24:23
                                            _init@resource:///org/gnome/shell/ui/animation.js:20:25
                                            Animation@resource:///org/gnome/shell/ui/animation.js:17:1
                                            SyncthingPanelIcon@file:///home/mark/.local/share/gnome-shell/extensions/syncthing@gnome.2nv2u.com/extension>
                                            _init@file:///home/mark/.local/share/gnome-shell/extensions/syncthing@gnome.2nv2u.com/extension.js:456:15
                                            ButtonBox@resource:///org/gnome/shell/ui/panelMenu.js:12:1
                                            PanelMenuButton@resource:///org/gnome/shell/ui/panelMenu.js:97:4
                                            SyncthingIndicator@file:///home/mark/.local/share/gnome-shell/extensions/syncthing@gnome.2nv2u.com/extension>
                                            enable@file:///home/mark/.local/share/gnome-shell/extensions/syncthing@gnome.2nv2u.com/extension.js:546:20
                                            _callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:267:38
                                            loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:479:32
                                            async*_loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:795:24
                                            async*_enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:801:48
                                            _sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:836:20
                                            async*init@resource:///org/gnome/shell/ui/extensionSystem.js:77:14
                                            _initializeUI@resource:///org/gnome/shell/ui/main.js:313:22
                                            start@resource:///org/gnome/shell/ui/main.js:185:11
                                            @resource:///org/gnome/shell/ui/init.js:12:47
                                            @resource:///org/gnome/shell/ui/init.js:21:20
MarkJaroski commented 6 months ago

So I suppose the issue seems to happen when gnome-shell tries to parse the syncthing-working.svg image file.

smiffy6969 commented 6 months ago

Well gnome extensions are not my forte but i do know js very well....

extension.js

change line 32... i changes it for a static icon instead of the animation and its starting now, so Animation.Animation func is the culprit

`class SyncthingPanelIcon {

constructor(iconPath) {
    // this._workingIcon = new Animation.Animation(
    //  Gio.File.new_for_path(iconPath + 'syncthing-working.svg'), 20, 20, 80
    // );
    this._workingIcon = new St.Icon({
        gicon: Gio.icon_new_for_string(iconPath + 'syncthing-working.svg'),
        icon_size: 20
    });`
smiffy6969 commented 6 months ago

turn off ext.. alter file log out and into gnome and turn on will see if i can find out whats up with that func if i can find a resource somewhere

MarkJaroski commented 6 months ago

That's an excellent workaround, and I may very well wind up doing just that, but I want to find out what changed to make this fail first, so I'm checking out:

https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/animation.js

smiffy6969 commented 6 months ago

sweet... i have it running now fine, so will look further... i had a borked upgrade at weekend to 24.04 and had to reload my machine ready for work today so was in a rush to get it synched from my server. Theres so much not working with 24.04 (openvpn3, pgadmin4) its a real PITA

smiffy6969 commented 6 months ago

You know it may not be animation... it could be Gio.icon_new_for_string... any ideas where the hell you find these files?

MarkJaroski commented 6 months ago

They're in the C source. For example the super._init that gets called in animation.js line 20 seems to refer to st_bin

https://github.com/GNOME/gnome-shell/blob/main/src/st/st-bin.c

How exactly the JavaScript to C bindings work it a mystery to me at the moment, but I'm a quick study.

MarkJaroski commented 6 months ago

It's something called GObjectIntrospection: https://gi.readthedocs.io/en/latest/index.html

smiffy6969 commented 6 months ago

ok... introsepction would possibly fit with the top of the stack trace... which points to params.js

`/**

smiffy6969 commented 6 months ago

Thi ssuggests its trying to auto create a property append_to then?

smiffy6969 commented 6 months ago

if you trace that back... St.Bin through to animation.... the top of the tree is spanwing the error but the issue may be due to a parameter thats trying to be created?

MarkJaroski commented 6 months ago

There are just the file and the three integers there, and only height and width are supposed to be passed to St.Bin._init(), so I'm a little stumped right now.

MarkJaroski commented 6 months ago

Well, hold on, that looks a lot like css, doesn't it?

        super._init({
            style: `width: ${width}px; height: ${height}px;`,
        });
MarkJaroski commented 6 months ago

So params.js is providing inline parameters for string interpolation !

MarkJaroski commented 6 months ago

Anyway @smiffy6969, I'm going to apply your fix for now and call it a night. I'll see how far you get, and if @2nv2u has a look at this by morning.

smiffy6969 commented 6 months ago

I think params just loads params onto an object... its a bit misleading, i think... you can see where params is being used to parse and load the objects further down... but the stack trace points to line 20... which is hte super init of St.Bin

2nv2u commented 6 months ago

Hi guys, thanks for debugging, I already tried to figure out why this happens in this already closed issue (which was for gnome 46 compat), it seems to be there is something wrong in the gnome shell animation lib packaged with Ubuntu which I couldn't test (running Fedora):

I did a fresh install of Ubuntu 24.04 (Gnome 46) and the extension is not working. Error: Unrecognized parameter "append_to"

Screenshot from 2024-04-27 08-03-41 https://github.com/2nv2u/gnome-shell-extension-syncthing-indicator/issues/36#issuecomment-2080617715

I'll check if your fix in initiating the animation class won't break in Fedora and probably patch it that way.

MarkJaroski commented 6 months ago

Thank you, @2nv2u. That's fantastic to know. I'll file a bug with the package maintainer, and add a link here. I suppose it would be good to keep this one open so other experiencing the issue can find the Ubuntu bug report, and go bug the package maintainer.

MarkJaroski commented 6 months ago

@2nv2u For clarity in my downstream bug report, was the issue with the Animate class, or with Gio.File ?

MarkJaroski commented 6 months ago

I've just filed this with Ubuntu

https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/2067494

smiffy6969 commented 6 months ago

@2nv2u For clarity in my downstream bug report, was the issue with the Animate class, or with Gio.File ?

I couldn't say for sure sorry. But guessing that similar lines calling the same Gio.File are ok, I'm guessing animation

MarkJaroski commented 6 months ago

That's what I thought too.

On Wed, 29 May 2024 at 18:22, Paul Smith @.***> wrote:

@2nv2u https://github.com/2nv2u For clarity in my downstream bug report, was the issue with the Animate class, or with Gio.File ?

I couldn't say for sure sorry. But guessing that similar lines capping the same Gio.File are ok, I'm guessing animation

— Reply to this email directly, view it on GitHub https://github.com/2nv2u/gnome-shell-extension-syncthing-indicator/issues/39#issuecomment-2137807332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATLBSXENASXK666UHNRVTZEX6D5AVCNFSM6AAAAABHMM6752VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZXHAYDOMZTGI . You are receiving this because you commented.Message ID: <2nv2u/gnome-shell-extension-syncthing-indicator/issues/39/2137807332@ github.com>

vanvugt commented 6 months ago

append_to is a method of GFileIface, so maybe somebody is using append-like syntax on a GFile and that's getting implicitly converted to a call to append_to?

some_gfile + ...

That wouldn't mean "append_to" is the unrecognized parameter, but would mean "append_to" is the function that's been given an unrecognized parameter.

MarkJaroski commented 6 months ago

I tried this, but there's no error:

var foobar = Gio.File.new_for_path(iconPath + 'syncthing-working.svg');

I think this means that we can rule out Gio.

MarkJaroski commented 6 months ago

Of course there's the possibility that using the Gio.File object causes the error.

smiffy6969 commented 5 months ago

So not usre how fast this fix is going to be... so i have made something a little more permenant.

Screenshot from 2024-06-03 07-29-59

I made a new icon with a play symbol on it, so i can telling when its working.... it uses this on sync/refresh and then drops back to the idle one when done.

I have also removed a few lines of code to ensurewe dont try and play the the icon as it is no longer animated and that was breaking it.

syncthing-running

add that svg to the icons folder... or copy one of the others and make your own...

extension.js (~/.local/share/gnome-shell/extensions/

remove line 18 import * as Animation from 'resource:///org/gnome/shell/ui/animation.js';

line 29 the function wants to be this

class SyncthingPanelIcon {

    constructor(iconPath) {
        this._workingIcon = new St.Icon({
            gicon: Gio.icon_new_for_string(iconPath + 'syncthing-running.svg'),
            icon_size: 20
        });
        this._idleIcon = new St.Icon({
            gicon: Gio.icon_new_for_string(iconPath + 'syncthing-idle.svg'),
            icon_size: 20
        });
        this._pausedIcon = new St.Icon({
            gicon: Gio.icon_new_for_string(iconPath + 'syncthing-paused.svg'),
            icon_size: 20
        });
        this._disconnectedIcon = new St.Icon({
            gicon: Gio.icon_new_for_string(iconPath + 'syncthing-disconnected.svg'),
            icon_size: 20
        });
        this.actor = new St.Bin();
        this.actor.set_child(this._disconnectedIcon);
    }

    setState(state) {
        switch (state) {
            case Syncthing.State.SYNCING:
            case Syncthing.State.SCANNING:
                this.actor.set_child(this._workingIcon);
                break
            case Syncthing.State.PAUSED:
                this.actor.set_child(this._pausedIcon);
                break;
            case Syncthing.State.UNKNOWN:
            case Syncthing.State.DISCONNECTED:
                this.actor.set_child(this._disconnectedIcon);
                break;
            default:
                this.actor.set_child(this._idleIcon);
                break
        }
    }

}

All is functioning now bar any animation when working, just a static play icn which is totally fine by me as all i want to do is see that its synching or not. ;)

Once ht eextension is changed, you will need to turn off and on, then log out and back in or restart.

gyuris commented 5 months ago

@2nv2u, what do you think about using native svg animations? Like this:

<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
  <circle cx="50" cy="50" r="50" fill="black">
    <animate
      attributeName="fill-opacity"
      values="0.1;1;0.1"
      dur="5s"
      repeatCount="indefinite" />
  </circle>
  <circle cx="150" cy="50" r="50" fill="black">
    <animate
      attributeName="fill-opacity"
      values="1;0.1;1"
      dur="5s"
      repeatCount="indefinite" />
  </circle>
</svg>
gyuris commented 4 months ago

Just for fun: a native animated SVG Syncthing logo.

Syncthing_Logo_Animate

<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 117.3 117.3" version="1.1" viewBox="0 0 117.3 117.3" xmlns="http://www.w3.org/2000/svg">
  <linearGradient id="SVGID1" x1="58.666" x2="58.666" y1="117.33" gradientUnits="userSpaceOnUse">
    <stop stop-color="#0882C8" offset="0"/>
    <stop stop-color="#26B6DB" offset="1"/>
  </linearGradient>
  <circle cx="58.7" cy="58.7" r="58.7" fill="url(#SVGID1)"/>
    <path id="arc1" fill="none" stroke="#fff" stroke-width="6" d="m16.326 69.185a43.7 43.7 0 0 1-1.3265-10.685 43.7 43.7 0 0 1 43.7-43.7 43.7 43.7 0 0 1 39.149 24.282">
        <animate begin="start.begin+1s" attributeName="stroke-width" values="6;7;6" dur="1s" repeatCount="4" />
    </path>
    <path id="arc2" fill="none" stroke="#fff" stroke-width="6" d="m97.849 39.082a43.7 43.7 0 0 1 4.5513 19.418 43.7 43.7 0 0 1-15.862 33.685">
        <animate begin="start.begin+6s" attributeName="stroke-width" values="6;7;6" dur="1s" repeatCount="4" />
    </path>
    <path id="arc3" fill="none" stroke="#fff" stroke-width="6" d="m86.538 92.185a43.7 43.7 0 0 1-27.838 10.015 43.7 43.7 0 0 1-42.374-33.015"/>
    <line id="line1" fill="none" stroke="#fff" stroke-width="6" x1="16.6" x2="67.5" y1="69.1" y2="64.4"/>
    <line id="line2" fill="none" stroke="#fff" stroke-width="6" x1="97.6" x2="67.5" y1="39.4" y2="64.4">
        <animate begin="start.begin+6s" attributeName="stroke-width" values="6;7;6" dur="1s" repeatCount="4" />
    </line>
    <line id="line3" fill="none" stroke="#fff" stroke-width="6" x1="86.5" x2="67.5" y1="91.8" y2="64.4">
        <animate begin="start.begin+6s" attributeName="stroke-width" values="6;7;6" dur="1s" repeatCount="4" />
    </line>
    <circle id="circle1" fill="#fff" stroke="#fff" stroke-width="4" stroke-opacity="0" cx="16.6" cy="69.1" r="8.941">
        <animate begin="0s;start.begin+12s" attributeName="r" values="8.941;10;8.941" dur="1s" repeatCount="4" id="start" />
        <animate begin="0s;start.begin+12s" attributeName="stroke-opacity" values="1;0;1" dur="1s" repeatCount="4" />
    </circle>
    <circle id="circle2" fill="#fff" stroke="#fff" stroke-width="4" stroke-opacity="0" cx="97.6" cy="39.3" r="8.941">
        <animate begin="start.begin+1s" attributeName="r" values="8.941;10;8.941" dur="1s" repeatCount="4" />
        <animate begin="start.begin+1s" attributeName="stroke-opacity" values="1;0;1" dur="1s" repeatCount="4" />
        <animate begin="start.begin+5s" attributeName="r" values="8.941;10;8.941" dur="1s" repeatCount="4" />
        <animate begin="start.begin+5s" attributeName="stroke-opacity" values="1;0;1" dur="1s" repeatCount="4" />
    </circle>
    <circle id="circle3" fill="#fff" stroke="#fff" stroke-width="4" stroke-opacity="0" cx="86.6" cy="91.8" r="8.941">
        <animate begin="start.begin+6s" attributeName="r" values="8.941;10;8.941" dur="1s" repeatCount="4" />
        <animate begin="start.begin+6s" attributeName="stroke-opacity" values="1;0;1" dur="1s" repeatCount="4" />
    </circle>
    <circle id="circle4" fill="#fff" stroke="#fff" stroke-width="4" stroke-opacity="0" cx="67.55" cy="64.45" r="8.941">
        <animate begin="start.begin+6s" attributeName="r" values="8.941;10;8.941" dur="1s" repeatCount="4" />
        <animate begin="start.begin+6s" attributeName="stroke-opacity" values="1;0;1" dur="1s" repeatCount="4" />
    </circle>
</svg>
2nv2u commented 1 month ago

Is still an issue with the new Ubuntu?

StorageB commented 1 month ago

I am still having the issue on Ubuntu 24.04. I have been using the fix by @smiffy6969 to just display a static icon when syncing.

I have not tested it on Ubuntu 24.10 (running GNOME 47).

razcore-rad commented 1 month ago

Yes, I can also confirm that I still have the issue on Ubuntu 24.04.1 LTS Gnome 46

2nv2u commented 1 week ago

I would like to close this if 24.10 has fixed this, I cannot do anything about the implementation in 24.04.

fengbainuo commented 1 week ago

I can confirm that it's still an issue on 24.10 image

razcore-rad commented 1 week ago

Still an issue in 24.10 Gnome v47

2nv2u commented 1 week ago

Ok, I'll see if I can catch the error and us the fix of @smiffy6969 when it happens and I'll investigate if I can use animated svg's in the future

2nv2u commented 1 week ago

Can someone test this before I release a new version? I added a try catch to it, hopefully it will gracefully fail like this

StorageB commented 1 week ago

To get the fix of @smiffy6969 to work in the recent version 37 release of this extension, it is also required remove the following lines:

this._workingIcon.stop();
this._workingIcon.play();

The catch you added does allow the extension to load, but shows the disconnected icon unless the this._workingIcon.stop(); line is removed.

Is it possible to include the "syncthing-running.svg" icon @smiffy6969 created or something similar so we can see when it is syncing? Editing the catch statement and adding the icon is working for me:

} catch (e) {
    this._workingIcon = new St.Icon({
        gicon: Gio.icon_new_for_string(iconPath + 'syncthing-running.svg'),
        icon_size: 20
    });
}
2nv2u commented 1 week ago

Should be fixed now, please test it again, if it works I'll make a new release

razcore-rad commented 1 week ago

I haven't experienced any bugs yet, although the change in the play/working icon is probably too small to even see so I updated it a bit to hopefully change that for the better :) in #46

StorageB commented 1 week ago

Extension loads fine now, but doesn't ever display the new icon when syncing. In the catch statement, is it meant to have this._workingIcon instead of this._idleIcon?