oae / gnome-shell-minimize-to-tray

Minimize any app to tray
GNU General Public License v2.0
63 stars 4 forks source link

Error when opening settings in gnome-shell 3.36.4 with the old version 3.34 of the extension #13

Closed webmastak closed 3 years ago

webmastak commented 3 years ago

The latest version for 3.36 works crookedly and crashes the shell. I am using extension for 3.34 and it works great. But there is one problem the settings open outside the window where the error log is displayed.

Error: Expected type object for Argument 'widget' but got type 'undefined'

Stack trace:
  _init@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:208:25
  OpenExtensionPrefsAsync/<@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:122:28
  asyncCallback@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:132:13
  run@resource:///org/gnome/Shell/Extensions/js/dbusService.js:175:20
  main@resource:///org/gnome/Shell/Extensions/js/main.js:19:13
  run@resource:///org/gnome/gjs/modules/script/package.js:222:19
  start@resource:///org/gnome/gjs/modules/script/package.js:206:5
  @/usr/share/gnome-shell/org.gnome.Shell.Extensions:1:17

Help fix Expected type object for Argument 'widget' but got type 'undefined' in prefs.js:

....
const Preferences = class Preferences {
  constructor() {
    this.apps = [];
    this.settings = getSettings('org.gnome.shell.extensions.minimize-to-tray');
    this.builder = Gtk.Builder.new_from_file(`${Me.dir.get_path()}/ui/settings.glade`);
    this.builder.connect_signals_full((builder, object, signal, handler) => {
      object.connect(signal, () => {
        this[handler]();
      });
    });

    this.widget = this.builder.get_object('settings-window');
    this.widget.connect('destroy', Gtk.main_quit);
    this.appList = this.builder.get_object('app-list');
    this.newAppPopover = this.builder.get_object('new-app-popover');
    this.newApp = this.builder.get_object('new-app-name');

    this.initValues();
  }
....
oae commented 3 years ago

Which version are you using? extensions.gnome.org is not updated to latest version yet. It is pending approval from reviewers.

webmastak commented 3 years ago

I am using version e4c26c8 and it suits me!

Help me fix Expected type object for Argument 'widget' but got type 'undefined' in prefs.js Here is a piece of code I repeat:

....
const Preferences = class Preferences {
  constructor() {
    this.apps = [];
    this.settings = getSettings('org.gnome.shell.extensions.minimize-to-tray');
    this.builder = Gtk.Builder.new_from_file(`${Me.dir.get_path()}/ui/settings.glade`);
    this.builder.connect_signals_full((builder, object, signal, handler) => {
      object.connect(signal, () => {
        this[handler]();
      });
    });

    this.widget = this.builder.get_object('settings-window');
    this.widget.connect('destroy', Gtk.main_quit);
    this.appList = this.builder.get_object('app-list');
    this.newAppPopover = this.builder.get_object('new-app-popover');
    this.newApp = this.builder.get_object('new-app-name');

    this.initValues();
  }
....
oae commented 3 years ago

To fix it, settings.glade file should be changed. Preferences window was a top-level window widget before and because of that it wouldn't open correctly. I have updated and fixed this problem in the new version.

webmastak commented 3 years ago

The latest version v5 gives:

JS WARNING: [/home/andrew/.local/share/gnome-shell/extensions/minimize-to-tray@elhan.io/extension.js 672]: Requiring Wnck but it has 2 versions available; use imports.gi.versions to pick one

And it crashes the shell or hangs on a dead shell, you have to restart the computer from the button. 😡 Why did you even rewrite the code in typescript? It was possible to understand the old versions, but when building webpack, the devil will break his leg there.

And even when minimized to tray, the indicator in dash-to-dock is active. 11

Help me fix please.

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkPopover" id="new-app-popover">
    <property name="can_focus">False</property>
    <signal name="closed" handler="onPopdown" swapped="no"/>
    <child>
      <object class="GtkBox">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="hexpand">True</property>
        <property name="vexpand">True</property>
        <property name="orientation">vertical</property>
        <property name="spacing">10</property>
        <property name="baseline_position">bottom</property>
        <child>
          <object class="GtkBox">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="margin_left">10</property>
            <property name="margin_right">10</property>
            <property name="margin_top">10</property>
            <property name="margin_bottom">10</property>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">App Name:</property>
                <property name="justify">right</property>
                <property name="width_chars">12</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="new-app-name">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="valign">baseline</property>
                <signal name="activate" handler="onAdd" swapped="no"/>
                <signal name="activate" handler="onPopdown" swapped="no"/>
                <signal name="focus" handler="onFocus" swapped="no"/>
              </object>
              <packing>
                <property name="expand">True</property>
                <property name="fill">True</property>
                <property name="position">1</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkButtonBox" id="actions-container">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="halign">end</property>
            <property name="valign">end</property>
            <property name="margin_right">10</property>
            <property name="margin_bottom">10</property>
            <property name="spacing">10</property>
            <property name="baseline_position">bottom</property>
            <property name="layout_style">end</property>
            <child>
              <object class="GtkButton" id="add-app">
                <property name="label" translatable="yes">Add</property>
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="receives_default">True</property>
                <signal name="clicked" handler="onAdd" swapped="no"/>
                <signal name="clicked" handler="onPopdown" swapped="no"/>
                <style>
                  <class name="suggested-action"/>
                </style>
              </object>
              <packing>
                <property name="expand">True</property>
                <property name="fill">True</property>
                <property name="position">1</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">True</property>
            <property name="fill">True</property>
            <property name="pack_type">end</property>
            <property name="position">2</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
  <object class="GtkApplicationWindow" id="settings-window">
    <property name="can_focus">False</property>
    <property name="resizable">False</property>
    <property name="default_width">480</property>
    <property name="default_height">550</property>
    <property name="show_menubar">False</property>
    <child type="titlebar">
      <object class="GtkHeaderBar">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="title" translatable="yes">Minimize to tray</property>
        <child>
          <object class="GtkButton" id="close-window">
            <property name="label" translatable="yes">Close</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">False</property>
            <property name="image_position">right</property>
            <property name="always_show_image">True</property>
            <signal name="clicked" handler="onClose" swapped="no"/>
            <style>
              <class name="mtt-button"/>
              <class name="mtt-dangerous"/>
            </style>
          </object>
        </child>
        <child>
          <object class="GtkMenuButton">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="receives_default">True</property>
            <property name="tooltip_text" translatable="yes">Add New App</property>
            <property name="popover">new-app-popover</property>
            <child>
              <object class="GtkImage">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="icon_name">list-add-symbolic</property>
              </object>
            </child>
            <style>
              <class name="mtt-button"/>
              <class name="mtt-new-app"/>
            </style>
          </object>
          <packing>
            <property name="pack_type">end</property>
            <property name="position">1</property>
          </packing>
        </child>
      </object>
    </child>
    <child>
      <object class="GtkScrolledWindow">
        <property name="visible">True</property>
        <property name="can_focus">True</property>
        <property name="hscrollbar_policy">never</property>
        <property name="shadow_type">in</property>
        <child>
          <object class="GtkViewport">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <child>
              <object class="GtkListBox" id="app-list">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="selection_mode">none</property>
                <property name="activate_on_single_click">False</property>
              </object>
            </child>
          </object>
        </child>
      </object>
    </child>
  </object>
</interface>
oae commented 3 years ago

The latest version v5 gives:

JS WARNING: [/home/andrew/.local/share/gnome-shell/extensions/minimize-to-tray@elhan.io/extension.js 672]: Requiring Wnck but it has 2 versions available; use imports.gi.versions to pick one

This is just a warning. I will add the version.

And it crashes the shell or hangs on a dead shell, you have to restart the computer from the button. rage

Can you provide some information about this? journalctl /usr/bin/gnome-shell and journalctl /usr/bin/gjs-console should show the logs

Why did you even rewrite the code in typescript? It was possible to understand the old versions, but when building webpack, the devil will break his leg there.

I rewrote the extension in typescript because it is much safer with type definitions and with the added benefit of autocompletion. Also, I am developing this extension in my free time, for my needs. If you don't like what I write or how I write you are free to fork this project and change it as you like.

And even when minimized to tray, the indicator in dash-to-dock is active. 11

I tried this with dash-to-panel, dash-to-dock and gnome-shell's default dock. They all behave correctly. They respect the window's skip_taskbar flag and don't show it.

webmastak commented 3 years ago
-- Logs begin at Thu 2020-08-20 02:03:06 MSK, end at Thu 2020-08-20 16:31:26 MSK. --
авг 20 14:54:52 manjaro gjs[135659]: g_task_return_error: assertion '!task->ever_returned' failed
авг 20 14:54:52 manjaro gjs[135672]: JS WARNING: [resource:///org/gnome/Shell/Extensions/js/extensionsService.js 131]: reference to undefined property "GdkX11Window"
авг 20 14:58:19 manjaro gjs[136106]: g_task_return_error: assertion '!task->ever_returned' failed
авг 20 14:58:20 manjaro gjs[136119]: JS WARNING: [resource:///org/gnome/Shell/Extensions/js/extensionsService.js 131]: reference to undefined property "GdkX11Window"
авг 20 15:00:03 manjaro gjs[136650]: failed to add UI: /home/andrew/.local/share/gnome-shell/extensions/minimize-to-tray@elhan.io/ui/settings.glade:7:61 Invalid signal 'closed' for type 'GtkBox'
авг 20 15:00:03 manjaro audit[136650]: ANOM_ABEND auid=1000 uid=1000 gid=1001 ses=2 pid=136650 comm="gjs" exe="/usr/bin/gjs-console" sig=5 res=1
авг 20 15:00:37 manjaro audit[136744]: ANOM_ABEND auid=1000 uid=1000 gid=1001 ses=2 pid=136744 comm="gjs" exe="/usr/bin/gjs-console" sig=5 res=1
авг 20 15:00:37 manjaro gjs[136744]: failed to add UI: /home/andrew/.local/share/gnome-shell/extensions/minimize-to-tray@elhan.io/ui/settings.glade:7:61 Invalid signal 'closed' for type 'GtkBox'
авг 20 15:00:56 manjaro audit[137005]: ANOM_ABEND auid=1000 uid=1000 gid=1001 ses=2 pid=137005 comm="gjs" exe="/usr/bin/gjs-console" sig=11 res=1
авг 20 15:07:46 manjaro audit[138228]: ANOM_ABEND auid=1000 uid=1000 gid=1001 ses=2 pid=138228 comm="gjs" exe="/usr/bin/gjs-console" sig=11 res=1
авг 20 15:07:58 manjaro gjs[138287]: g_task_return_error: assertion '!task->ever_returned' failed
авг 20 15:07:58 manjaro gjs[138300]: JS WARNING: [resource:///org/gnome/Shell/Extensions/js/extensionsService.js 131]: reference to undefined property "GdkX11Window"
авг 20 15:08:16 manjaro audit[138300]: ANOM_ABEND auid=1000 uid=1000 gid=1001 ses=2 pid=138300 comm="gjs" exe="/usr/bin/gjs-console" sig=11 res=1
авг 20 15:08:22 manjaro gjs[138374]: JS WARNING: [resource:///org/gnome/Shell/Extensions/js/extensionsService.js 131]: reference to undefined property "GdkX11Window"
авг 20 15:14:59 manjaro gjs[139852]: JS WARNING: [/home/andrew/.local/share/gnome-shell/extensions/minimize-to-tray@elhan.io/prefs.js 448]: Requiring Wnck but it has 2 versions available; use imports.gi.versions to pick one
авг 20 15:14:59 manjaro gjs[139852]: JS LOG: [mtt] [prefs] prefs initialized
авг 20 15:14:59 manjaro gjs[139852]: JS LOG: [mtt] [prefs] initialized values
авг 20 15:16:07 manjaro gjs[140246]: JS WARNING: [/home/andrew/.local/share/gnome-shell/extensions/minimize-to-tray@elhan.io/prefs.js 448]: Requiring Wnck but it has 2 versions available; use imports.gi.versions to pick one
авг 20 15:16:07 manjaro gjs[140246]: JS LOG: [mtt] [prefs] prefs initialized
авг 20 15:16:07 manjaro gjs[140246]: JS LOG: [mtt] [prefs] initialized values
-- Reboot --
авг 20 15:33:15 manjaro gjs[5131]: g_task_return_error: assertion '!task->ever_returned' failed
авг 20 15:33:15 manjaro gjs[5144]: JS WARNING: [/home/andrew/.local/share/gnome-shell/extensions/minimize-to-tray@elhan.io/prefs.js 448]: Requiring Wnck but it has 2 versions available; use imports.gi.versions to pick one
авг 20 15:33:15 manjaro gjs[5144]: JS LOG: [mtt] [prefs] prefs initialized
авг 20 15:33:15 manjaro gjs[5144]: JS LOG: [mtt] [prefs] initialized values
авг 20 15:33:15 manjaro gjs[5144]: JS WARNING: [resource:///org/gnome/Shell/Extensions/js/extensionsService.js 131]: reference to undefined property "GdkX11Window"
авг 20 15:44:35 manjaro gjs[6713]: g_task_return_error: assertion '!task->ever_returned' failed
авг 20 15:44:36 manjaro gjs[6726]: JS WARNING: [resource:///org/gnome/Shell/Extensions/js/extensionsService.js 131]: reference to undefined property "GdkX11Window"
авг 20 15:45:15 manjaro audit[6726]: ANOM_ABEND auid=1000 uid=1000 gid=1001 ses=2 pid=6726 comm="gjs" exe="/usr/bin/gjs-console" sig=11 res=1
авг 20 15:45:20 manjaro gjs[6804]: JS WARNING: [resource:///org/gnome/Shell/Extensions/js/extensionsService.js 131]: reference to undefined property "GdkX11Window"
авг 20 15:45:26 manjaro audit[6804]: ANOM_ABEND auid=1000 uid=1000 gid=1001 ses=2 pid=6804 comm="gjs" exe="/usr/bin/gjs-console" sig=11 res=1
авг 20 15:46:31 manjaro audit[7135]: ANOM_ABEND auid=1000 uid=1000 gid=1001 ses=2 pid=7135 comm="gjs" exe="/usr/bin/gjs-console" sig=11 res=1
авг 20 15:46:42 manjaro gjs[7192]: g_task_return_error: assertion '!task->ever_returned' failed
авг 20 15:46:42 manjaro gjs[7205]: JS WARNING: [resource:///org/gnome/Shell/Extensions/js/extensionsService.js 131]: reference to undefined property "GdkX11Window"
авг 20 15:47:15 manjaro audit[7205]: ANOM_ABEND auid=1000 uid=1000 gid=1001 ses=2 pid=7205 comm="gjs" exe="/usr/bin/gjs-console" sig=11 res=1
oae commented 3 years ago

Are you using wayland?

авг 20 15:00:03 manjaro gjs[136650]: failed to add UI: /home/andrew/.local/share/gnome-shell/extensions/minimize-to-tray@elhan.io/ui/settings.glade:7:61 Invalid signal 'closed' for type 'GtkBox'

also from this line, I see that your extension version is old. You can download it from here

webmastak commented 3 years ago

I am using Xorg. The latest version v5 crashes the shell or hangs on a dead shell, you have to restart the computer from the button!!!!!!!!!

Can you help me fix settings.glade or not? If not then close the issue.

oae commented 3 years ago

Your installation has a problem. There are no settings.glade file in the v5 version, yet in your logs, I can see that it's trying to load settings.glade file. You should remove it and install it again.

webmastak commented 3 years ago

settings.glade this is from the old logs.

What happens with a fresh installation of v5 I have already described the problem above!!!! I repeat -> crashes the shell or hangs on a dead shell And even when minimized to tray, the indicator in dash-to-dock is active. 11 On the old version 3.34 e4c26c8 the indicator disappears!

oae commented 3 years ago

I don't have gnome 3.34 environment ready for development. I will check it this weekend.

webmastak commented 3 years ago

gnome 3.34 is not needed! I have gnome 3.36.4 and using the extension v4 and commit e4c26c8

oae commented 3 years ago

Can you try the old_version branch?

webmastak commented 3 years ago

Yes it works thanks. 👍