File: example_gi.lua

package info (click to toggle)
keybinder 0.3.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,880 kB
  • sloc: sh: 11,397; ansic: 602; makefile: 151; python: 10
file content (25 lines) | stat: -rwxr-xr-x 633 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env lua

-- example_gi.lua
--
-- Created in 2011 by Ulrik Sverdrup <ulrik.sverdrup@gmail.com>
-- This work is placed in the public domain.
--
-- requires lgi  http://gitorious.org/lgi

local lgi = require 'lgi'
local Gtk = lgi.require('Gtk', '2.0')
local Keybinder = lgi.require('Keybinder', '0.0')

local function callback(keystring)
  print("In callback for", keystring)
  print("Event time:", Keybinder.get_current_event_time())
  Keybinder.unbind(keystring)
  Gtk.main_quit()
end

Gtk.init()
Keybinder.init()
Keybinder.bind("<Control>A", callback)
print("Press <Control>A to activate keybinding and quit");
Gtk.main()