Namek Dev
a developer's log
NamekDev

Retake on The Console

February 28, 2016

Some time ago I made this project https://github.com/Namek/TheConsole_POC for Windows OS. It’s usage goes like this: hit CTRL+TILDE and on the top of the screen will open a Quake 3 Arena thingie that’ll enable you to type in some commands. Commands are JavaScript’able and that’s the power of the tool. I did some hacks here and there so I decided to change some techs and remake whole beauty to improve efficiency of use.

Goal

First version of The Console was prototyped to achieve better personal productivity:

  1. script your routines once - process text or files thanks to custom scripting
  2. get your information faster - search wikipedia, open google maps for a query, quickly change currencies, find buses or even make a coffee

So, the core feature was enhancement ability. I’m going to keep it that way. Or maybe I’ll enhance the enhance ability :-)

Techs?

Language

I’m going to use Java - not because I know or like it best, but because of Nashorn API which makes it a lot easier to interpret and execute JavaScript code.

Libraries

UI

Previously I used libgdx to achieve background animation - similiar to the console in Quake 3 Arena. I was thinking about scripting background animations, particles and other effects but:

  1. this doesn’t add value besides eye-catching “uselessability”
  2. in Nashorn, executing JavaScript X frames per second is not really efficient
  3. I already made some hacks around it which disables possibility to port the project to Linux (or whatever else supports Java 8)

Around some other UI libraries I decided to try JavaFX 2.0. It still makes possible to add some animations and is richer and more up to date API than Java Swing or SWT. I don’t have any experience of JavaFX but I do with Java Swing (for example this Entity Tracker app for games and few other) and I’d like to change. Simply: Layouts in Swing sux.

Internals

I used Windows API (through com.sun.jna.platform.win32 package) for following reasons:

  1.  to show and keep application on top of another applications
  2. remove frame of window which was internally initialized by libgdx
  3. position to (0, 0) - top left corner of the screen
  4. resize it to the size of the biggest found screen

The code for it is very ugly, full of hacks and a result of more trial-and-error than logical thinking - mostly around keeping app on top of other apps.

Also used JNativeHook to register global hotkey CTRL+TILDE. This one is probably going to be still there.

Why changing libs?

Among the “hacks” around libgdx there are also reasons such as:

  1. performance because of OpenGL under libgdx while some AAA games are running in the background
  2. difficulties to support drag&drop files
  3. and text non-buggy text copying/pasting

Summary

This retake was started due to occassion of new competition www.dajsiepoznac.pl One of rules is to keep project open sourced which suits the project very well since I’d be happy if there were some users in the future :)

Repository for The Console can be found here -> TheConsole at GitHub.

Daj Się Poznać, the-console
comments powered by Disqus