[Vala] Difference between setting "vapidir" and adding a .vapi file (was "Global key shortcuts")



Hi:

Finally I found the library "keybinder". It doesn't work no wayland, but
at least allows me to do what I need in X.

But now I have a problem: the VAPI file isn't available in my system, so
I'm adding it manually. But here comes the odd thing: if I specify the
VAPI file in the command line, it doesn't compile:

    valac -C captura.vala --pkg=gtk+-3.0 --pkg=keybinder-3.0
keybinder-3.0.vapi
    error: Package `keybinder-3.0' not found in specified Vala API
directories or GObject-Introspection GIR directories
    Compilation failed: 1 error(s), 0 warning(s)

But if I just set a "vapidir" with the folder that contains the .vapi
file, everything works fine.

    valac -C captura.vala --pkg=gtk+-3.0 --pkg=keybinder-3.0 --vapidir=.

But with other projects, just adding the .vapi files worked fine (like
the Autovala plugin for Gedit or Scratch, or a plugin for GnomeBuilder
that I'm writing). In both cases the libraries are available system-wide.

So... why does this happen? And what is the difference between just
specifying a .vapi file or putting a --vapidir parameter?

Thanks.

El 20/08/16 a las 04:43, Michael Gratton escribió:
On Sat, Aug 20, 2016 at 4:33 AM, rastersoft <raster rastersoft com>
wrote:
I'm working on a program that needs to respond to an specific key
always, so when I press it, it will show its window. How can I do it
from Vala? Is it possible to do that in a way compatible with wayland?
(let's say: register a DBus method to be called when that key is
pressed, or something like that...)

So even when the window is hidden or not focused or whatnot? That's
more of a desktop integration issue, isn't it? Maybe there is a
FDO/XDG method for registering them.

In any case, I imagine you'll probably want to implement
GApplication/GtkApplication and have you app raise/focus/etc the
window in response to the activate signal. The desktop then just needs
to activate the app in response to the global shortcut, by invoking
that signal via DBus or by executing a new instance of the app, which
would also send the signal to the already running instance.

//Mike


-- 
Nos leemos
                         RASTER    (Linux user #228804)
raster rastersoft com              http://www.rastersoft.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]