WebKit is an open source web browser engine. gtk-webkit-ruby is a Ruby Gem that provides Gtk Webkit bindings for ruby, making it possible to embed a webview (class that has the ability to render a webpage) in a Ruby-GNOME2 application.
In this article we'll see how to install it in any Ubuntu distribution.
Bellow are the main instructions that should be added to a program in order to render a webpage within a Ruby-GNOME2 application. Please note that this is not a runnable example.
require "gtk2"
require "webkit"
webview = WebKit::WebView.new
webview.show
webview.open(url) # url is a string
Note
While I was trying to install the Gem I encountered some errors that were caused by dependencies not being installed in my system: ruby-gnome2-dev and libwebkitgtk-dev. Below I pasted the error messages for future reference.
### ruby-gnome2-dev dependency error
$ sudo gem install gtk-webkit-ruby
Building native extensions. This could take a while...
ERROR: Error installing gtk-webkit-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.8
extconf.rb:2:in `require': no such file to load -- mkmf-gnome2 (LoadError)
from extconf.rb:2
Gem files will remain installed in /var/lib/gems/1.8/gems/gtk-webkit-ruby-0.0.3 for inspection.
Results logged to /var/lib/gems/1.8/gems/gtk-webkit-ruby-0.0.3/ext/webkit/gem_make.out
### libwebkitgtk-dev dependency error
$ sudo gem install gtk-webkit-ruby
Building native extensions. This could take a while...
ERROR: Error installing gtk-webkit-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for GCC... yes
checking for rb_define_alloc_func() in ruby.h... yes
checking for rb_block_proc() in ruby.h... yes
checking for new allocation framework... yes
checking for attribute assignment... yes
checking for gtk+-2.0... yes
checking for webkit-1.0... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.8
--with-pkg-config
--without-pkg-config
--with-override-variables
--without-override-variables
Gem files will remain installed in /var/lib/gems/1.8/gems/gtk-webkit-ruby-0.0.3 for inspection.
Results logged to /var/lib/gems/1.8/gems/gtk-webkit-ruby-0.0.3/ext/webkit/gem_make.out
The Java Development Kit (JDK) is mainly a set of tools for running, compiling and debugging Java applications.
There are a few other JDK, but in this article we'll see how to manually install the Oracle's JDK in any distribution from the Ubuntu family. The process consists of downloading the binary package, extract it and update the system so that the new version is used. By the way, if you installed the JDK via PPA, as described in my previous article, both can work alongside. The command update-alternatives can be used to choose one between them.
Download
The first step is to download the latest binaries package from Oracle's website. On the downloads webpage choose the JDK download button.
On the next page you'll see list of several files, but you should focus your attention on two: The file name ends with i586.tar.gz or x86_64.tar.gz. If your system is 32 bits you should select the first one and select the latter if it's 64 bits. If you're unsure, run the command uname -m on a terminal window. Now download the file you need and take note of its download location.
Install
We've downloaded the package, so now we must install it.
Start by opening a terminal window and changing the current directory, using cd command, to the download destination.
Then extract the package:
sudo tar -zxvf jdk*.tar.gz -C /usr/lib/jvm/
Add the new java alternative to the system:
for alt in java javac; do sudo update-alternatives --install /usr/bin/$alt $alt /usr/lib/jvm/jdk*/bin/$alt 1000; done
Finally, update the java alternatives, typing the selection number of the last choice presented by the command bellow. You'll be prompted twice, once for java and another time for javac.
for alt in java javac; do sudo update-alternatives --config $alt; done
Uninstall
If you want to remove Oracle's JDK, here's how to proceed: Choose another alternative for java and javac, then just remove the JDK directory.
for alt in java javac; do sudo update-alternatives --config $alt; done && sudo rm -rf /usr/lib/jvm/jdk1.7*
Even though Ubuntu has reached Beta 1, there'll be no Beta 1 release for Xubuntu.
The Xubuntu team is working on fitting the image on a single CD, tackling outstanding bugs and fixing some visual regressions. If all of this gets done we'll have access to a Beta 2 release.
Using a Daily Build Image is possible to test the work in progress.
If you wish to also change the text color just edit the file replacing ffffff with the desired color's code (tip: you can use Gcolor2 to help you determine the color code).
For changes take effect either log out and log in or run the command: killall xfdesktop, and wait for xfdesktop restart.
By default VLC ignores keyboard multimedia keys (Play, Next/Prev, Stop). In this article we'll be fixing that by configuring VLC's global hotkeys.
Configure Hotkeys
Open a terminal window and run:
vlcrc="$HOME/.config/vlc/vlcrc"
sed -i 's/#global-key-play-pause=/global-key-play-pause=Media Play Pause/' $vlcrc
sed -i 's/#global-key-next=/global-key-next=Media Next Track/' $vlcrc
sed -i 's/#global-key-prev=/global-key-prev=Media Prev Track/' $vlcrc
sed -i 's/#global-key-stop=/global-key-stop=Media Stop/' $vlcrc
VLC must be restarted for settings take effect.
Alternative method
The same can be accomplished configuring the hotkeys by hand. Open hotkeys preferences: Tools > Preferences > Hotkeys. Then select each action (Play, Next, Prev, Stop) double-clicking the "Global" column and hit the corresponding multimedia key.