Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Linux support #13

Closed
darkwater opened this issue Dec 3, 2016 · 15 comments
Closed

Linux support #13

darkwater opened this issue Dec 3, 2016 · 15 comments

Comments

@darkwater
Copy link
Contributor

Looks like ONI only supports Windows and macOS right now? Judging by some of the source files it checks whether the OS is "Darwin", and assumes Windows otherwise.

What needs to be done for this to run on Linux?

@bryphe
Copy link
Member

bryphe commented Dec 3, 2016

Yes, unfortunately I do not have a Linux box to test support at the moment, but in theory it should be straightforward to support.

Electron itself is fortunately compatible with Linux, so there shouldn't be much work to make it compatible. It might be sufficient to reverse those checks to check for Windows instead.

I'll flip those checks for now, since there is no harm in that, and potentially it could at least get the Linux build running to test further.

@darkwater
Copy link
Contributor Author

Cool, but you forgot the check in cli/oni. After #15 I can successfully build and run on Linux.

No issues running, though the default font seems unavailable. Not sure how to go about this correctly since available fonts vary wildly between distributions.

On another note, how do I configure the Neovim part? It doesn't seem to use my existing Neovim configuration.

@bryphe
Copy link
Member

bryphe commented Dec 4, 2016

Sweet, thanks for the fix! That's great that it is launching now.

Regarding the font - there's this code in Config.ts:

const MacConfig: any = {
    "editor.fontFamily": "Monaco"
}

const WindowsConfig: any = {
    "editor.fontFamily": "Consolas"
}

That picks some defaults for Mac & Windows. We might need to come up with a set of defaults for Linux - but I'm not sure what a good default font on Linux is. An alternative would be to bundle a default font with the app (like fontawesome is bundled right now).

I opened another issue for sourcing the init.vim - #16

@darkwater
Copy link
Contributor Author

Bundling a default font would probably the most robust method. Alternatively, is a list of fonts possible? ONI could try a couple of common fonts which should cover pretty much every user.

@bryphe
Copy link
Member

bryphe commented Dec 4, 2016

Makes sense. I don't think there is a great way to list the fonts, and then identify which ones are monospace.

We could potentially bundle this font:
https://fonts.google.com/specimen/Inconsolata

It has an open license and is monospace. I'll take a look at bundling it in the next couple days. In the meantime, you might want to manually change the font family to your preferred font.

@define-private-public
Copy link

I was trying to install this on Linux and I got this error at the "npm install..." level:


sh: 1: node: not found
/usr/local/lib
└── (empty)

npm ERR! Linux 4.4.0-51-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "oni-vim"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! electron@1.4.10 postinstall: `node install.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the electron@1.4.10 postinstall script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs electron
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls electron
npm ERR! There is likely additional logging output above.

I'm not familiar at all with node or npm. Is is trying to look for a fil in /usr/local/lib that doesn't exist?

@bryphe
Copy link
Member

bryphe commented Dec 5, 2016

@define-private-public - hmm, seems like npm failed to install electron - maybe related to one of these issues?
electron/electron#7007
electron-userland/electron-prebuilt#186

@define-private-public
Copy link

Okay, I got a little farther by install Node from a different repo, now I'm getting this error:

I find those permission errors odd as I'm running the npm install as sudo.

npm ERR! addLocal Could not install /usr/local/lib/node_modules/oni-vim/vim/vimfiles/bundle/oni-plugin-typescript
npm ERR! Linux 4.4.0-51-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! path /home/ben/.npm/oni-plugin-typescript/0.0.1/package
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/home/ben/.npm/oni-plugin-typescript/0.0.1/package'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, mkdir '/home/ben/.npm/oni-plugin-typescript/0.0.1/package']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/home/ben/.npm/oni-plugin-typescript/0.0.1/package' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/local/lib/node_modules/oni-vim/vim/vimfiles/bundle/oni-plugin-typescript/npm-debug.log

npm ERR! Linux 4.4.0-51-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "install:oni-plugin-typescript"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! oni-vim@0.1.1 install:oni-plugin-typescript: `cd vim/vimfiles/bundle/oni-plugin-typescript && npm install`
npm ERR! Exit status 243
npm ERR! 
npm ERR! Failed at the oni-vim@0.1.1 install:oni-plugin-typescript script 'cd vim/vimfiles/bundle/oni-plugin-typescript && npm install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the oni-vim package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cd vim/vimfiles/bundle/oni-plugin-typescript && npm install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs oni-vim
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls oni-vim
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/local/lib/node_modules/oni-vim/npm-debug.log
npm ERR! Linux 4.4.0-51-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "oni-vim"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! oni-vim@0.1.1 postinstall: `npm run install:oni-plugin-typescript`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the oni-vim@0.1.1 postinstall script 'npm run install:oni-plugin-typescript'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the oni-vim package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run install:oni-plugin-typescript
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs oni-vim
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls oni-vim
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ben/Desktop/npm-debug.log

@keforbes
Copy link
Collaborator

keforbes commented Dec 5, 2016

FWIW, I just installed on Arch Linux with no problems. Using the latest version of node and npm and running the Build directions on the project page.

node v7.2.0
npm v4.0.3

It looks like you're using:

node v4.2.6
npm v3.5.2

Is there a reason why you're using older versions?

@define-private-public
Copy link

@keforbes It must have been from the repo that I pulled it from (I guess they weren't keeping things up to day). I'll try it again and see what happens.

@keforbes
Copy link
Collaborator

keforbes commented Dec 6, 2016

Please excuse my ignorance (I don't know anything about Electron development) but isn't that fontFamily property used like a CSS property? Can't you define multiple fonts as fallbacks? For example, in CSS you could do:

font-family: "Menlo, DejaVu Sans Mono, Lucida Console, monospace"

This would be the order of preferred fonts, where the default monospace font is the final fallback if none of the other fonts are installed.

I just tried changing MacConfig to:

const MacConfig: any = {
    "editor.fontFamily": "Menlo, DejaVu Sans Mono, Lucida Console, monospace",
}

and it seemed to have an effect on Linux (since it's checking for isWindows). Anyway, just a thought.

Edit: My list of fonts was pretty much arbitrary. I found a more comprehensive list of monospace fonts (both Windows and Mac) which is probably better if you take this route:

font-family:"Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace";

@bryphe bryphe mentioned this issue Dec 7, 2016
@bryphe
Copy link
Member

bryphe commented Dec 7, 2016

@keforbes - not ignorant at all, thanks for the suggestion :)

We use the font family to set the font in the canvas. For some reason I thought that you couldn't have font fallbacks in the canvas font, but I could very well be mistaken.

If you're up for it, feel free to send out a pull request with the fallback fonts! Would be helpful to have. DejaVu Sans Mon was just added for Linux by @JakubJecminek , but having additional fallbacks for all the platforms wouldn't hurt.

@darkwater
Copy link
Contributor Author

For some reason I thought that you couldn't have font fallbacks in the canvas font, but I could very well be mistaken.

Yeah, you can set ctx.font to a comma-separated list of fonts of which the first available will be used, just like in CSS. (demo)

@bryphe
Copy link
Member

bryphe commented Dec 7, 2016

@darkwater thanks for the jsfiddle, you're right, good call.

It seems like it would be helpful to have a set of fallback fonts that we append when drawing our text (in ctx.font) regardless of what that value is, so we can at least be guaranteed a monospace font even if the font doesn't exist. I believe this is similiar to how gvim behaves.

Potentially we could add the fallback here, I'm thinking, when we set the font
https://github.com/extr0py/oni/blob/master/browser/src/Renderer/RenderCache.ts

@bryphe
Copy link
Member

bryphe commented Dec 10, 2016

Closed this out since most of the conversation was specific to fonts... I'm sure there are lots of other Linux-specific issues, though. Feel free to log additional issues as they come up (I don't use Linux for development at the moment, so these are the last issues for me to find)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants