Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

top: Desklet that displays information from the top command #285

Merged
merged 14 commits into from
May 2, 2018
Merged

top: Desklet that displays information from the top command #285

merged 14 commits into from
May 2, 2018

Conversation

RyanNerd
Copy link
Contributor

@RyanNerd RyanNerd commented Mar 21, 2018

Runs the top command every 5 seconds and displays the result in nice desklet grids
See README.md for the TODOs

Screenshot:
image

This is the first iteration and only displays "header" information from `top`.
See `README.md` for the TODOs
@RyanNerd RyanNerd changed the title Desklet that displays information from the top command top: Desklet that displays information from the top command Mar 27, 2018
@jaszhix
Copy link
Contributor

jaszhix commented Apr 14, 2018

Hi Ryan, sorry for the delay. I added this to the desktop on Cinnamon git (3.8) and it wouldn't launch, probably because Cinnamon now uses strict mode.

Cjs-Message: 20:26:43.432: JS LOG: [LookingGlass/error] [TypeError: top.ram.total is undefined]: Failed to evaluate 'main' function on desklet: top@ryannerd/0
Cjs-Message: 20:26:43.432: JS LOG: [LookingGlass/trace] 
<----------------
logError@/usr/share/cinnamon/js/ui/extension.js:119:17
_createDesklets@/usr/share/cinnamon/js/ui/deskletManager.js:316:9
_loadDesklet@/usr/share/cinnamon/js/ui/deskletManager.js:282:23
finishExtensionLoad@/usr/share/cinnamon/js/ui/deskletManager.js:174:14
Extension.prototype._init/<@/usr/share/cinnamon/js/ui/extension.js:246:17
---------------->
Cjs-Message: 20:26:43.433: JS LOG: [LookingGlass/error] 
[top@ryannerd]: Desklet top@ryannerd: Could not create desklet object.
[top@ryannerd]: Error importing desklet.js from top@ryannerd
Cjs-Message: 20:26:43.433: JS LOG: [LookingGlass/trace] 
<----------------
Extension.prototype._init/<@/usr/share/cinnamon/js/ui/extension.js:247:23
---------------->

You can test this way by adding

'use strict';

at the top of extension.js.

@RyanNerd
Copy link
Contributor Author

RyanNerd commented May 1, 2018

@jaszhix I've added the 'use strict'; to desklet.js hopefully this fixes it. I'm running Mint 18.2 which is using version 3.6.7 of Cinnamon. I don't have the time to fork Cinnamon and attempt a build of 3.8 to test this desklet. Hopefully this small change will get the desklet to work. Thanks.

@jaszhix
Copy link
Contributor

jaszhix commented May 1, 2018

@RyanNerd No, Cinnamon 3.8 already prepends all xlets with 'use strict;' before adding them, adding that just lets you see where its having issues on 3.6. Do you see any stack traces in ~/.xsession-errors or ~/.cinnamon/glass.log? The desklet does load - which I didn't notice the first time - but its showing 0 for all RAM values because of this error:

Cjs-Message: 05:06:21.856: JS WARNING: [/usr/share/cinnamon/js/misc/fileUtils.js line 210 > Function 519]: reference to undefined property "total"
Cjs-Message: 05:06:21.857: JS LOG: [LookingGlass/error] top.ram.total is undefined
Cjs-Message: 05:06:21.857: JS LOG: [LookingGlass/trace] 
<----------------
_updateTop@/home/jason/.local/share/cinnamon/desklets/top@ryannerd/desklet.js:519:13
_refresh@/home/jason/.local/share/cinnamon/desklets/top@ryannerd/desklet.js:556:9
on_setting_changed@/home/jason/.local/share/cinnamon/desklets/top@ryannerd/desklet.js:268:9
_init@/home/jason/.local/share/cinnamon/desklets/top@ryannerd/desklet.js:235:13
TopDesklet@/home/jason/.local/share/cinnamon/desklets/top@ryannerd/desklet.js:183:5
main@/home/jason/.local/share/cinnamon/desklets/top@ryannerd/desklet.js:599:12
_createDesklets@/usr/share/cinnamon/js/ui/deskletManager.js:314:19
_loadDesklet@/usr/share/cinnamon/js/ui/deskletManager.js:282:23
finishExtensionLoad@/usr/share/cinnamon/js/ui/deskletManager.js:174:14
Extension.prototype._init/<@/usr/share/cinnamon/js/ui/extension.js:246:17
---------------->

Fixed an undefined variable issue.
@RyanNerd
Copy link
Contributor Author

RyanNerd commented May 2, 2018

@jaszhix The desklet on my machine has non-zeros for Ram (below)
.session-errors indicated one error -- which is now fixed -- please try again -- but I think it is unrelated to top.ram.total as it was an undefined variable of this.deskletId

What version of top is running on Cinnamon 3.6 (perhaps this is a parsing issue). top for me is version 3.3.10

glass.log
-----------
info t=2018-05-02T05:49:07.379Z Loaded desklet top@ryannerd in 266 ms
info t=2018-05-02T05:49:07.384Z Cinnamon took 2213 ms to start

.session-errors (fixed)
--------------------
Cjs-Message: JS WARNING: [/home/ryan/.local/share/cinnamon/desklets/top@ryannerd/desklet.js 204]: reference to undefined property this.deskletId

top

@jaszhix
Copy link
Contributor

jaszhix commented May 2, 2018

I'm using 3.3.12. I think this is just a TypeError, and not necessarily strict mode if you still can't reproduce. I suggested adding it in there to help you debug it without using 3.8, but its likely also has to do with 3.8 using mozjs52, where as 3.6 is on mozjs38. I also didn't catch the compatible version array in metadata.json the first time, wasn't prompted with the usual incompatible notice.

@jaszhix jaszhix merged commit 723546f into linuxmint:master May 2, 2018
@RyanNerd RyanNerd deleted the top-o-the-morning branch May 2, 2018 07:26
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.

None yet

3 participants