os-js / OS.js

OS.js - JavaScript Web Desktop Platform
https://www.os-js.org/
Other
6.84k stars 805 forks source link

[Misc] Questions, submissions, discussions and suggestions #49

Closed andersevenrud closed 8 years ago

andersevenrud commented 9 years ago

This is an issue for general discussion and problem sovling. You can also post your submissions here if you're not into pull requests and such.

Join the official chat room on Gitter :)

FAQ

I'm wondering about [something]

First, look through the documentation and see if you can find anything that might help you :)

I have problems installing OS.js

Make sure you follow the installation documentation to the letter.

I am having problems building OS.js

Make sure dependencies are installed! If you are running on Windows, make sure to run the symlink script (as described in INSTALL).

I am having problems running OS.js client

If something fails, you will get console output of it (press F12 and go to Console). If some files fails to load, chances are building has failed (or you forgot).

I am having problems running OS.js server

If the server fails you will get an error printout (apache users, see error_log).

There does not seem to be any login page ?!

There actually is one, but kind of obscured by its name "example" and the fact I have not found any time to finish it 100% (but it works fine).

http://os.js.org/doc/tutorials/create-handler.html

I want to expand the Client API. How do I do this?

An example, here: https://gist.github.com/andersevenrud/c2e84548a3c0af8c7150

RyanRiffle commented 9 years ago

@andersevenrud First what is the directory structure? Is API intended to be 'subclassed' or is it more on the procedural level, and is there a client and server implementation of each api?

RyanRiffle commented 9 years ago

@andersevenrud I would really love to get started working on the project. (I actually just started basically the same thing until I found this)

andersevenrud commented 9 years ago

@RyanRiffle It's pretty simple. You have:

The server part of OS.js is extremely simple. You pretty much just have to serve the css and js files and have support for calling some sort of API. In this case it is VFS (filesystem functions), Core (like login, logout, etc) and Application (applications have isolated APIs).

The server API is built so you can basically plug-in your own functions. Example (pseudo-code):

# Server code
API::addHandler('MyFunction', callback);
# Frontend code
API::call('MyFunction', args, callback);
andersevenrud commented 9 years ago

@RyanRiffle To further go into serving files. Currently OS.js does this with HTTP, including the Virtual File System (downloading and uploading of files in browser. Like using REST). This is probably completely obvious since it's served via HTML, but I thought I should mention it.

RyanRiffle commented 9 years ago

@andersevenrud Thanks! I am looking over the code now, if I have any questions I'll ask. I might have a few :smile:

andersevenrud commented 9 years ago

@RyanRiffle In case you have not figured it out, look at this wiki document that explains the difference between the dist directories. Using dist-dev is pretty much required if you're going in there with a debugger in your browser to get a feel of things.

Looking forward to any questions you might have :sweat_smile:

RyanRiffle commented 9 years ago

@andersevenrud What is the primary goal of OS.js? Is it to be interfaced with virtual machine, just use the user's dropbox, drive, etc, a desktop environment for X11 or even all of the above?

andersevenrud commented 9 years ago

@RyanRiffle All of the above :) It has a pretty long history but has evolved to do all of this. After the introduction of Broadway (#29) you can run this as an X11 environment or even use it as remote desktop in your browser (ala VNC). Not to toot my own horn, but I think that is pretty cool.

RyanRiffle commented 9 years ago

@andersevenrud That is pretty amazing. I plan on helping as much as I can, but starting January 20th I will be unable to access a computer for a minimum of two months, but I will come back. This is something I have wanted to do for a while now.

andersevenrud commented 9 years ago

@RyanRiffle I wrote VLC in the last comment, but I meant VNC (corrected). This is something I started experimenting with as a teenager (IE5. shudders), but browser tech was not just there yet. So for me; this is pretty exiting too! Just take your time -- I'll be here (unless death himself has me on his list) :smile:

RyanRiffle commented 9 years ago

@andersevenrud What are you thoughts on a toolbar dropdown? I do not see one. The only thing is see that might be a problem is that toolbar.js just handles an object of (title, icon, and toggleable) and puts them in a ul then hooks up the event callbacks. It looks to me that if toolbar handled objects of the prototype OSjs.GUI._Input the toolbar would be more versatile and abstract away the DOM a little better. Thoughts?

andersevenrud commented 9 years ago

@RyanRiffle Actually, you can add whatever you want to the toolbar. Again... my bad on the documentation here.

var self = this;
toolbar.addItem('Name', {

  type: 'custom',
  onCreate: function(toolbarRef, itemName, itemOptions, outerEl, containerEl) {

     // Here you can add DOM elements to `containerEl` 
     // Or just OS.js GUI Elements
     self._addGUIElement(new GUI.Select(...), containerEl);
  }

});
RyanRiffle commented 9 years ago

I see. Thank you. I need to look a little harder :smile:

andersevenrud commented 9 years ago

@RyanRiffle Thank you for this. So many people have contacted me saying they want to (and will) create some apps, but then it goes totally silent. Either my code is too scary, ugly or way to undocumented. AFAIK I'm using relatively well known JS patterns and try to be as explicit as possible. It may be a combination of all the above :p Getting to my point: This really helps me make changes that makes approacing OS.js easier.

RyanRiffle commented 9 years ago

@andersevenrud Not a problem. The documentation is a little of a throw off. My question is what doc generator do you use or want to use on the project (for when I start trying to help add some more documentation)?

andersevenrud commented 9 years ago

@RyanRiffle Basically, there is none. I want to wait unti I have gotten some feedback so I can solidify the API and base code. I don't like re-writing docs -- it's a mess (Frequently occurs at work)!

I have not desided what generator to use yet. To be honest, I don't like any of the ones I have tried. If you know of a good one, let me know. In the past I have just rolled my own.

RyanRiffle commented 9 years ago

@andersevenrud I just looked and I am really not impressed with any either. Poe uses codo, very simple and crude but effective, but it is only for coffeescript.

andersevenrud commented 9 years ago

@RyanRiffle I just commited some docu for 'core.js'. If you look at it I have added some very simple comments that I can easily prase with a script. I might go that way

andersevenrud commented 9 years ago

@RyanRiffle You probably know this, but to get an overview over the entire API, just open your JavaScript console in the browser and type in "OSjs" and press enter. From there you can see the entire API tree. When you enter a class just expand the "prototype" leaf to see all the class methods

RyanRiffle commented 9 years ago

@andersevenrud Yea I know. Thanks anyway

RyanRiffle commented 9 years ago

Is GUI.Select meant to not show the currently selected value? Even with an option having the "selected" attribute it does not show any value.

andersevenrud commented 9 years ago

@RyanRiffle Not sure I understand. GUI.Select.setValue() ?

RyanRiffle commented 9 years ago

No value is show. Image and video hosting by TinyPic I mean using Select.setValue() it doesn't show any value, and then if I use web inspector to set one of the options as selected it doesn't show either. Select.setValue() would be nice if it returned a boolean value also.

andersevenrud commented 9 years ago

I am not using the DOM attribute, but rather "selectedIndex" property. Example code:

select.addItem("myvalue", "My Label");
select.setValue("myvalue");
var val = select.getValue(); // == "myvalue"
RyanRiffle commented 9 years ago

Yes,

@fontSelect = new OSjs.GUI.Select("FontSelect", {onChange: @fontSelectClicked});
for (font in OSjs.API.getHandlerInstance().getConfig('Fonts').list)
        @fontSelect.addItem(font, font);
@fontSelect.setValue(OSjs.API.getHandlerInstance().getConfig('Fonts')['default']);
andersevenrud commented 9 years ago

Maybe it is because it has not been added to DOM at that moment? Kinda puzzled here.

Try:

@fontSelect = window._addGUIElement(new OSjs.GUI.Select("FontSelect", {onChange: @fontSelectClicked}), parentDOMElement);
andersevenrud commented 9 years ago

Where window is a OS.js Windows and not the global

RyanRiffle commented 9 years ago

I have that. I just omitted it. It is in the DOM, it is in the picture. And toolbar.render() is called before even the loop that adds the items.

andersevenrud commented 9 years ago

How does it look inside of the <select>. Does it have <option>s ?

RyanRiffle commented 9 years ago

Yes options are there, that is why I tried to set the selected attribute on one of them. Im puzzled

andersevenrud commented 9 years ago

I'm going to try this for myself now. Hang on!

RyanRiffle commented 9 years ago

Link to my source

andersevenrud commented 9 years ago

Lol. It's because the outer container for GUISelect is too small.

My test:


     var select;
     var toolbar = this._addGUIElement(new GUI.ToolBar('TestToolbar'), root);
     toolbar.addItem('CustomItem', {
       type: 'custom',
       onCreate: function(itemName, itemOptions, outerEl, containerEl) {
         select = self._addGUIElement(new GUI.Select('TestSelect'), containerEl);
         select.addItem('foo', 'Foo');
         select.addItem('bar', 'Bar');
      }
    });
    toolbar.render();

And then in CSS

.Window_ApplicationsupertestWindow  .GUISelect.TestSelect {
  width : 100px;
}
RyanRiffle commented 9 years ago

I wondered about that :) Good that it is all figured out.

andersevenrud commented 9 years ago

I should maybe enforce some rules on minimum sizes of all GUI Elements

RyanRiffle commented 9 years ago

Yea that would work.

PewienTyp commented 9 years ago

Hi all. Its posible to make start menu (Touch friendly) like this?

andersevenrud commented 9 years ago

@PewienTyp Sure. I can do that :smile: Just opened an issue for this: #61

PewienTyp commented 9 years ago

when i run os.js in chromium/nw.js on ubuntu and debian after 5 seconds system lagg and crash. I don't know why. Works only in firefox.

andersevenrud commented 9 years ago

Maybe a bug ? Sounds like a memory leak! I had similar problems with semalt.com in Linux/Chromium!

andersevenrud commented 9 years ago

Chrome bug I mean

andersevenrud commented 9 years ago

@PewienTyp Just tested latest Chromium on Ubuntu 14. No problems here :/

PewienTyp commented 9 years ago

Maybe my testing pc was crazy :)

andersevenrud commented 9 years ago

@PewienTyp Yeah. I've experienced something similar a couple of times, but never found out why. To me it feels like a memory leak or a corruption caused by Webkit (this one time everything just froze and a buzzing sound came out of my speakers... like when a game crashes). If it occurs again, maybe you could take a look in syslog to see if any errors occured and paste it here ? Just if you can and want to, that is :)

MrSchism commented 9 years ago

I'll give this a run through the ringer tonight. If I can spot an issue with it, I'll open an issue. Might be worth trying with gremlins.js

PewienTyp commented 9 years ago

Please add fadeIn effect to notifications

andersevenrud commented 9 years ago

@PewienTyp Thanks! Created new issue: #64

PewienTyp commented 9 years ago

Its possible to make login screen with sessions?

andersevenrud commented 9 years ago

@PewienTyp Yes. There is an example included for this :smile:

src/javascript/handlers/example/handler.js
src/server-php/handlers/example/handler.php
doc/example-handler.txt

http://andersevenrud.github.io/OS.js-v2/doc/tutorials/create-handler.html

andersevenrud commented 9 years ago

@PewienTyp Ops. I had not pushed the latest changes to the tutorial. It has been updated

http://andersevenrud.github.io/OS.js-v2/doc/tutorials/create-handler.html