Giter Site home page Giter Site logo

xlab / matchbox-keyboard Goto Github PK

View Code? Open in Web Editor NEW
65.0 10.0 25.0 298 KB

A mirror of matchbox-keyboard tree + my patches

Home Page: http://kc.vc/projects/matchbox-keyboard.html

License: GNU General Public License v2.0

C 93.87% Shell 0.07% C++ 0.50% Makefile 2.00% M4 3.57%

matchbox-keyboard's Introduction

MATCHBOX KEYBOARD 1.5 FORK

Usage:
   matchbox-keyboard [options] [layout]

Supported options are;
   -xid,--xid               Print window ID to stdout ( for embedding )
   -d,--daemon              Run in 'daemon' mode (for remote control)
   -t, --gestures           Enable gestures

------------------------- UI Tweaks & Positioning --------------------

   -p,--key-padding <px>    Key padding
   -c,--col-spacing <px>    Space between columns
   -r,--row-spacing <px>    Space between rows
   -f,--font-family <name>  Font family (ex: sans, droidsans)
   -s,--font-size <pt>      Font size
   -b,--non-bold            Switch to normal weight
   -v,--override            Absolute positioning on the screen
   -i,--invert              Attach keyboard to the top of the screen
   -g,--geometry <HxW.y.x>  Specify keyboard's geometry 
  (ex: -g 200x800; -g 0x800.200.0; -g 0x0.0.50; zeroes mean "by-default")

matchbox-keyboard 1.5 
Copyright (C) 2007 OpenedHand Ltd.
Modifications (C) 2009 Maxim Kouprianov ( http://kouprianov.com )
Special thanks to Paguro ( http://smartqmid.ru )

New features:

  • Gestures x4
  • Language switching
  • Three great layouts:
    • keyboard -- Original layout, EN-RU
    • keyboard-full -- Full keyboard layout, by 123456 and SeNS, EN-RU
    • keyboard-finger -- Minimalistic keybord for fingers, by 123456, EN-RU
  • UI tweaks (you may adjust spacings)
  • Improved keyboard positioning in matchbox, openbox, etc
  • Keyboard now can shrink neighbour windows - perfect!
  • Custom geometry - scale as you want
  • Performance tweaks...

mbk2

mbk

Matchbox-Keyboard README

Introduction

Matchbox-keyboard is an on screen 'virtual' or 'software' keyboard. It will hopefully work well on various touchscreen devices from mobile phones to tablet PCs running X Windows.

It aims to 'just work' supporting localised, easy to write XML layout configuration files.

Its made available under the GPL.

Rational

I wrote 'xkbd' a few years back which tried to do the same thing. It was the first xlib app I wrote and the first bit of C Id coded in quite a few years. It was a mess but basically worked, though with a few problems.

matchbox-keyboard is my much promised rewrite. The code is cleaner and it hopefully addresses much of the previous short comings of xkbd.

Building

Do the usual autotool jig of ./configure, make, make install. ( If building from SVN you'll need to run ./autogen.sh before this).

matchbox-keyboard needs xlibs, xft, libfakekey and expat to build - The configure script will detect these. Also optionally there is experimental cairo support for rendering the keys and example embedded code.

Running

Do;

matchbox-keyboard [Options..] [optional variant name]

and start typing. The config file will be selected based on locale setting and supplied variant name. The only current option is -xid, used for embedding ( see below ).

The following Environmental Variables are also used, if set;

  • MB_KBD_CONFIG

    Set to full path of a alternate layout file to use overriding any other selection mechanisms.

  • MB_KBD_VARIANT

    Same as the first argument to binary. If both set argument overrides.

  • LANG, MB_KBD_LANG

    The value up to the first '.' ( i.e en_GB ) is used to build up the config file name based on locale. MB_KBD_LANG can be used to override the systems LANG var ( E.g, for the case of a Dutch person wanting a Dutch keyboard but an English locale - or the other way round ).

Embedding

You can embed matchbox-keyboard into other applications with toolkits that support the XEMBED protocol ( GTK2 for example ).

See examples/matchbox-keyboard-gtk-embed.c for how its done.

Making your own keyboard layouts

Keyboard layout files are UTF8 XML files ( Make sure they are saved with this encoding! ). They are loaded from the directory $PREFIX/share/matchbox-keyboard and are named in the format keyboard[-locale][-variant].xml. This can be overridden by setting MB_KBD_CONFIG environment variable to a valid config file path or by creating $HOME/.matchbox/keyboard.xml.

The basic layout of the file looks like;

    <keyboard>

    <options>
    </options>

    <layout>
      <row>
        <key ...>
	  <default .. >
	  <shifted .. >
	  <mod1 .. >
          ....
	<key>
        .... more keys ...
	<space width="1000" />
      </row>
      <row>
      ...
      </row>
    </layout>

    </keyboard>

A number of layouts can be defined ( though currently only 1 is supported ) each with any number of rows of keys, defining the keyboard from top to bottom.

The most important tag to know about is the tag and its children. A key tag can optionally have the following attributes;

  • obey-caps=true|false ( defaults to false if not declared )

    Specifies if the key obeys the Caps Lock key - Its shifted state is shown when the Caps key is held.

  • width=1000th's of a 'base' key width.

    Override the automatically calculated key width in 1000th's of a base key width ( The average width of a key with a single glyph ).

  • fill=true|false ( defaults to false )

    If set, the keys width is set to fill all available free space.

  • extended=true|false ( defaults to false )

    Keys set with this extended attribute set to true will only be shown if the display is landscape, rather than portrait. The rational for this is to better adapt to screen rotations. ( Note: the tag can also use this. )

The then has sub tags specifies the appearance and action for the five possible key states; ,,,,.

There are two possible attributes for each of these state tags;

  • display=UTF8 String|image:

    Sets what is displayed on the key face for the particular case. If this is not set the key will be blank.

    Prefixing the string with 'image:' and then a filename to a valid PNG image will cause that image to be used on that key face. The filename can be absolute or relative to $PREFIX/share/matchbox-keyboard or ~/.matchbox.

  • action=action string.

    The specifies the action of the key. For most (all?) single glyph keys the action is deduced automatically. For 'special' function keys, it can be set to any of the following.

    backspace, tab, linefeed, clear, return, pause, scrolllock,
    sysreq, escape, delete, home, left, up, right, down, prior,
    pageup, next, pagedown, end, begin, space, f1, f2, f3, f4, f5, f6,
    f7, f8, f9, f10, f11, f12
    

    By prefixing the value with 'xkeysym:', a a xkeysym can be defined to be 'pressed' as the action.

    If the key is a 'modifier' key, the action value is prefixed with 'modifier:' and then one of the following;

    Shift, Alt, Ctrl, mod1, mod2, mod3, Caps

Rows can also contain a tags which denote blank space. They simply take a width attribute specifying the base in 1000th's of a base key width.

See the various keyboard.xml files included in the distribution for example setups.

Misc Notes

  • matchbox-keyboard attempts to detect the window manager and set up its window 'hints' based on that. This is experimental, YMMV.

matchbox-keyboard never wants to get keyboard focus itself, if the window manager gives it focus ( matchbox-keyboard requests the w-m doesn't ), it wont work.

  • It shouldn't be too hard to make the keyboard use GTK or another toolkit ( possibly even Non X11 ) just by hacking matchbox-keyboard-ui.c . ( If you do either of these, please send patches ).

  • There is an applet and experimental GTK-IM module included in the source for launching the keyboard. The IM module allows for the keyboard to automatically mapped / unmapped on 'demand'. For this to work;

  • The IM must be added to your gtk setup (See /etc/gtk-2.0/gtk.immodules, gtk-query-immodules-2.0 )

  • Matchbox-keyboard must be run with the '--daemon' option. You can also use the --orientation switch so it is only mapped when the display is in a certain orientation.

Todo

  • Fix layout engine on small on displays.
  • Theming.

Needs thought...

Matthew Allum 2007. [email protected]

matchbox-keyboard's People

Contributors

alepez avatar dfuchss avatar ernstp avatar xlab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matchbox-keyboard's Issues

Daemon Mode and Auto-show Keyboard on Chromium Raspberry Pi

Hi there!

I know this is kind of an old repository, but it is one of few that I found works perfectly for my Kiosk, Raspian Touchscreen setup.

I wanted to ask if developers here have ever tried using matchbox-keyboard along with a chromium-browser.
Using the --daemon flag did not work for me, however I read some people had luck with that on Debian 9

I am trying to have the matchbox-keyboard auto show when selecting a webpage input box. I saw that there is this matchbox-keyboard-toggler, however, I have no idea how the chromium-browser can push events up to a system process or app.

I have actually seen this hot keyboard plugin call a system app successfully so I feel that I can develop a plugin that pushes input events up to the matchbox-keyboard daemon to toggle it.

An alternative would be some kind of gesture, that I can use to toggle the keyboard on my touchscreen. I see mentions of a gesture in the repository but I do not see any mentions of how to use it.

Any input would be greatly appreciated!

error adding symbols: DSO missing from command line

Trying to build the latest version of matchbox, but I'm getting errors when running make.

$ make
make  all-recursive
make[1]: Entering directory '/home/pi/matchbox-keyboard'
Making all in src
make[2]: Entering directory '/home/pi/matchbox-keyboard/src'
/bin/bash ../libtool --tag=CC   --mode=link gcc  -g -O2   -o matchbox-keyboard matchbox-keyboard.o matchbox-keyboard-image.o matchbox-keyboard-layout.o matchbox-keyboard-row.o matchbox-keyboard-key.o matchbox-keyboard-ui.o matchbox-keyboard-xembed.o matchbox-keyboard-remote.o config-parser.o util-list.o util.o matchbox-keyboard-ui-xft-backend.o  -lX11 -lXtst -lfakekey   -lXft   -lexpat  -lpng12   
libtool: link: gcc -g -O2 -o matchbox-keyboard matchbox-keyboard.o matchbox-keyboard-image.o matchbox-keyboard-layout.o matchbox-keyboard-row.o matchbox-keyboard-key.o matchbox-keyboard-ui.o matchbox-keyboard-xembed.o matchbox-keyboard-remote.o config-parser.o util-list.o util.o matchbox-keyboard-ui-xft-backend.o  -lX11 -lXtst -lfakekey -lXft /usr/lib/arm-linux-gnueabihf/libexpat.so -lpng12
/usr/bin/ld: matchbox-keyboard-ui-xft-backend.o: undefined reference to symbol 'XRenderComposite'
//usr/lib/arm-linux-gnueabihf/libXrender.so.1: error adding symbols: DSO missing from command line
collect2: ld returned 1 exit status
Makefile:361: recipe for target 'matchbox-keyboard' failed
make[2]: *** [matchbox-keyboard] Error 1
make[2]: Leaving directory '/home/pi/matchbox-keyboard/src'
Makefile:416: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/pi/matchbox-keyboard'
Makefile:305: recipe for target 'all' failed
make: *** [all] Error 2

Running on a raspberry pi / raspbian.

Any workarounds? Did I miss something?

Daemon mode not working on Raspberry Pi

I'm passing the command line argument --daemon and the keyboard isn't showing up. The README says:

The IM must be added to your gtk setup (See /etc/gtk-2.0/gtk.immodules, gtk-query-immodules-2.0 )

The problem is that I'm not sure how to do this. If more details could be provided, I would greatly appreciate it.

Resize of neighbor windows

Hi all,

Since I started to use the absolute positioning of the keyboard, it seems like the feature of shrinking/resizing the other windows doesn't work. I have a Qt app and my interface is maximize (not fullscreen) and when I start the keyboard, it doesn't shrink my app interface. At first, it worked, but I needed the keyboard to always show on top.

thanks

Allow detection/specification of combined modifier keys

I was trying to use matchbox-keyboard to make a flexible international keyboard, but the shift and alt modifiers don't work as I'd expect them to, and I've run out of modX modifiers (there being only 3) to be able to capitalize accented letters. For example:

  <key obey-caps="true">
    <default display="a"/>
    <shifted display="A"/>
    <mod1 display="á"/>
    <mod2 display="à"/>
    <mod3 display="ä"/>
  </key>

I can turn 'a' into 'A', 'á', 'à', and 'ä', but I'm out of luck for 'Á', 'À', and 'Ä' (unless I put these other variations on an entirely different key, which would be ugly!). Perhaps something like:

  <key obey-caps="true">
    <default display="a"/>
    <shifted display="A"/>
    <mod1 display="á" shifted="Á'"/>
    <mod2 display="à" shifted="À"/>
    <mod3 display="ä" shifted="Ä'"/>
  </key>

...would be great, as well as attributes alted and alt-shifted for even more flexibility. With those extra variations, one could even add Â, â, Ã, ã, Å, and å, all on the one key where they belong.

An even more flexible approach would be the way the MacOS keyboard works, where accented characters are a two-stroke process, first typing a combining accent mark, then the character to which the accent is to be applied.

Making one key write multiple characters

Hello.

I'm trying to make a single key write multiple characters. Example. If i press key, i would like that key to write "Hello". I have set up a hey that show "Hi" and its set to write "Hello", but when I press it it only writes the first letter H of Hello.

If this is possible please help me out. if its not possible on this version, ¿how can I implement this function on matchbox keyboard?

Thank you

cmake support (CMakeLists.txt) would be very nice

Trying to build on a fresh, minimal RaspberryOS (debian) and get a lot of errors. Unclear if I'm missing essential tools/dependencies or if something else is broken.

cmake support would be very nice.

Unable to locate variant

Well, not sure how I managed this but I simply cloned this repo, executed autogen.sh, did "sudo make", "sudo make install" and when trying to execute it just throws this:

matchbox-keyboard: *Warning* Unable to locate variant: �}�vH��~`X�v���v8?�v/home/pi/.matchbox/kb_config
                   falling back to /usr/local/share/matchbox-keyboard/keyboard.xml
matchbox-keyboard: Failed to load '/usr/share/matchbox-keyboard/key-backspace.png'
matchbox-keyboard:/usr/local/share/matchbox-keyboard/keyboard.xml:0: (null)
matchbox-keyboard: *Error*  Error parsing

A path seems to be broken but I have no idea how that got there. Completely fresh flash of the latest Raspbian (04/10).

Any way to disable repeat keystrokes?

By default, when the user presses and holds the button, the keystroke keeps repeating, until the button is let go. I'd like to keep it to just one keypress, is it possible?

Not all unicode characters display correctly

I'm trying to use matchbox-keyboard with a keyboard.xml file that only uses unicode characters in places where a standard keyboard would have text, e.g., ⇱ for HOME. Unfortunately some of the unicode characters I want to use (⎖ ,⎗ and ⎀ ) only appear as the generic box for an unavailable character. The characters are in the font(s) I've tried (I can enter them in a text file with gedit and in a Libre Office Writer file) so I am stymied.

Always on top

Hi,
Could it be possible to add the option to make the keyboard always on top of screen ? To make sure that even a fullscreen app that runs will be overwritten by the keyboard?

Thanks

no icon in taskbar raspberry pi

Hi,
managed to get it installed on my raspberry pi without any issue
only issue i have is when i click the MIN button on bottom right, it vanishes and i cant get it back?
the also doesnt appear to be an icon in the taskbar?
when i look using task manager, i can see its still running in the background tho?
im using the latest raspbian edition out with the new PIXEL desktop

matchbox-keyboard doesn't work in raspberry

I can't install matchbox-keyboard in raspbian for raspberry pi.
I tried: sudo apt-get install matchbox-keyboard, but the instalation gives this error:
Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
I tried with "apt-get update" and "--fix-missing" and neither work.

Thanks

Support libpng16

matchbox-keyboard is being used by kterm (kindle terminal emulator) and a recent kindle update removed libpng12 in favour of libpng16.

It looks like the changes to support libpng15 are quite small: mmoselhy/poky-e100-danny@db07a94, so they may be all that's needed for libpng16 too.

broken in i3wm

the window flickers and doesn't respond to clicks

keyboards like onboard work fine

make the keyboard always on top

I guess the keyboard was made to work with tiling WMs like awesome and stuff. But I don't use those I use GNOME and unity.
other virtual keyboards are able to stay on top of all windows, and that just makes sense. and since the others can do it, then I'm sure it's doable.

I tried to hack on it myself. I don't know much xlib or GUI in general to be honest. I followed this answer but the _NET_WM_STATE_ABOVE thing didn't work (at least on unity).

I asked a question here but got nothing new yet.

so I was wondering since you're more experienced if you could give me a hint on what should be done?

Matchbox mode is not working

In the original version (I'm currently using the one provided by Yocto http://git.yoctoproject.org/cgit.cgi/matchbox-keyboard/) this keyboard is working well with Matchbox.

It fill the width and align at the bottom. The other window (in my case, chromium browser) is resized so it doesn't overlap with the keyboard.

I don't know why, but on commit 5ff3072 that cool feature was commented-out. Do you have any idea about?

See https://github.com/xlab/matchbox-keyboard/blame/matchbox-keyboard-xlab/src/matchbox-keyboard-ui.c#L955

I find this feature useful and I'm going to enable it on my fork and test it.

Images looked up in wrong share directory

I just compiled matchbox-keyboard, on both Raspbian (jessie) and Debian (testing), and in both cases I get the following error:

Failed to load '/usr/share/matchbox-keyboard/key-backspace.png'

Of course it does since make install installed the files in /usr/local/share, but here it is looking in /usr/share. But the entire keyboard fails to load because of that.

The problem seems to be that the keyboard xml layouts hardcode the path to the images.

I'm not sure what would be the best way to fix the path hardcoding: have the images in /usr/share directly, or have the image path somewhere in configurations.

But also, I think the application should not throw an error if the image fails to load. It could default to the action name. At least the keyboard would work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.