Is it possible to hook up macbook build in keyboard to Ubuntu PC?
Have you tried Synergy? They say that it  lets you easily share your mouse and keyboard between multiple computers on your desktop.

There are some videos on Youtube which show how it works.