What do developers here use to debug gnome-desktop’s javascript code?
I need to step through the file: /usr/share/gnome-shell/extensions/ding(at)rastersoft.com/fileItemMenu.js
(substitute @ for (at) which I put there to defeat a spammer’s email address harvester.)
This js file produces a menu that fails to include an expected menu item. I would like very much to step through it just as can be done with a C, or C++, program using gdbgui to find out why.
Stepping through an extension in the way you describe, amounts to stepping through the gnome-shell process. Presumably something like gdb --args gnome-shell --nested --wayland, and breakpoints set with System.breakpoint() would work, but I’m not aware of anyone going to that length for an extension.
If the code can be extracted or is part of a separate process already, it’s probably easier to step through it with the built-in debugger using gjs --debugger FILE.
Does the gjs command wait for gnome to call up the js file? Or does it execute right away the file it is given? To find out why fileItemMenu.js does not do what I expect I would need to step through it when a desktop icon is right clicked.
Extensions are in no way separate from the gnome-shell process, so if you want to step through an extension with a debugger, it must step through the entire gnome-shell process. You can add breakpoints that a debugger like gdb will catch by adding System.breakpoint() calls to the JavaScript. When you hit a breakpoint, you can call gjs_dumpstack() in the debugger to print the current JavaScript stack.
If you can separate the problem JavaScript into a standalone file, you can run that with gjs --debugger to step through JavaScript, call-by-call.
Of course, you should not attach gdb or another debugger to your live gnome-shell process, because as soon as you hit a breakpoint you will halt GNOME Shell.
The problem I need to solve is in file:
/usr/share/gnome-shell/extensions/ding(at)rastersoft.com/fileItemMenu.js
Where @ is to be substituted for “(at)”.
And in these lines of code that begin at line 200 in that file:
The menu item “Don’t Allow Launching” / “Allow Launching” does not appear when a launch icon is right clicked in my desktop. I am not able to allow launching, in spite of using the gio command: gio set "/home/stephen/Desktop/Flameshot.desktop" metadata::trusted true
That this command worked was verified with the command: gio info -a 'metadata::*' /home/stephen/Desktop/Flameshot.desktop
Group, and Others, can only view this desktop file. The icon is marked executable. All conditions I know to be able to allow launching are met. Yet the desktop icon is still grayed out, and it does not launch. The same is true of any other desktop launcher icon I set up.
So to find out why I now I need to inspect the values of:
I decided the easiest way for me to inspect those variable’s values would be for me to modify the menu to display the variable(s) whose value is preventing the display of the “Don’t Allow Launching” / “Allow Launching” item. Using Gnome’s Builder I modified fileItemMenu.js as shown in the below code snippet:
I am not able to enable launching for any icon on my desktop because the value of : “this._desktopManager.writableByOthers” is true. Right now I do not know how it become true, or how to fix it so it its value is false as it should be. In any documentation I have seen for desktop launchers I have not seen this condition included as a requirement to enable the option to allow launching.
At the time of this posting the link: DevDocs is broken. The error message I get is “Application is not available”. Where is this documentation available?
Sorry, there was a problem with our documentation for a short time. It should be back up now.
This sounds like something you should ask the extension author. Have you reported you problem as an issue with the project?
The code in question seems to be here. This seems to imply the permissions on ~/Desktop allow writing by other users, so launching applications is prohibited for security reasons.
Thank you. That solved it. This permissions requirement on the ~/Documents directory needs to be in user documentation.
I see in the code you linked to there is a text message that indicates the problem’s cause on line 1544. I never saw this message printed out anywhere. Where should I have seen this?