RFE: Add a way to hide Onboard by shell command

Bug #1032042 reported by marmuta
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Onboard
Fix Released
Wishlist
Unassigned

Bug Description

Quoting question https://answers.launchpad.net/onboard/+question/204775:
Trying to show/hide Onboard keyboard from c++ code on linux. I can start it by executing "onboard" asynchronously (system("onboard &");).
Is there a similar way to hide it? Would be nice to spare that extra click on "hide onboard" when the user clearly finished typing.

marmuta (marmuta)
Changed in onboard:
status: New → Confirmed
importance: Undecided → Wishlist
description: updated
Revision history for this message
marmuta (marmuta) wrote :

I've started work on adding a command line option for this. Using g_application's command line handling looked promising, but unfortunately I hit a critical bug there:
https://bugzilla.gnome.org/show_bug.cgi?id=676498
Before we roll our own IPC command line handling, I think we should give that bug report some more time and see it a fix is forthcoming.

Revision history for this message
Gabriel C. Stabel (gstabel) wrote :

Hi marmuta.
Before I read this comments I would suggest to capture SIGUSR1 and SIGUSR2 (like you did with SIGTERM) to implement show and hide capabilities (and maybe others).
But problably using g_application way is better (despite the bug you found).

Revision history for this message
marmuta (marmuta) wrote :

I've been thinking to drop the g_application approach and directly create a D-Bus interface instead. This would give us more control and doesn't touch obscure GIO functions. It may be more awkward to use from command line, but with instructions it's still manageable.

The interface could look like this:
Show()
Hide()
IsLockedVisible()

With Show() having the same effect as manually showing by menu, status icon, floating icon or second instance start, i.e. locking Onboard visible and stopping auto-show until Onboard is hidden again.

IsLockedVisible() would specifically check if Onboard was actively shown, not just transiently by auto-show.

Revision history for this message
marmuta (marmuta) wrote :

I've added some D-Bus methods now, plus documentation and examples in the README.
I kept it simple, there are:
Show()
Hide()
IsVisible()

An example call from command line would be:
dbus-send --type=method_call --dest=org.onboard.Onboard /org/onboard/Onboard org.onboard.Onboard.Hide

Whatever language support there is for direct D-Bus calls can be used too, of course.

I'd like to put this in some of our PPA's but I have yet to figure out how. Francesco is still on holiday for another week or so.

Changed in onboard:
status: Confirmed → Fix Committed
Revision history for this message
Gabriel C. Stabel (gstabel) wrote :

Question: how this D-Bus interface treats two (or more) process running at the same time? For example, two users connected to an server and both using Onboard (i.e. one Onboard for each user).
If we run 'dbus-send' on terminal (with the above parameters) or call the D-Bus inteface from another process, how it will determine which Onboard process will receive the 'signal'?
(as I couldn`t run from source yet I did not test it)

Revision history for this message
marmuta (marmuta) wrote :

If those users each have their own account things should be fine. The interface is on the session bus, users in separate accounts would get their own local bus name org.onboard.Onboard and there should be no ambiguity or interference.

Running multiple instances of Onboard by the same user is not supported very well. Onboard is pretty much single instance at this point. Running multiple instances is still possible with the -m option, but in practice you'd run into trouble, since there is only a single set of settings, most notably for position and size.
The bus name org.onboard.Onboard points to the primary instance only, but I'm thinking of making each instance's bus address available somehow. D-Bus calls could be sent to individual instances then. Perhaps there is a way to query names by pid already, but I haven't found out how to do that yet.

Revision history for this message
Gabriel C. Stabel (gstabel) wrote :

Great. I think this is good enough.

I test it now and It works here on terminal. Now I will try on Qt.

Changed in onboard:
status: Fix Committed → Opinion
status: Opinion → Fix Committed
Revision history for this message
Gabriel C. Stabel (gstabel) wrote :

Sorry. It was a bad click.

Revision history for this message
Gabriel C. Stabel (gstabel) wrote :

This attachment contains an example how to show/hide Onboard from Qt4 using D-Bus interface.

Qt 4.8.1+
Onboard revision 947+

Revision history for this message
marmuta (marmuta) wrote :

Thanks for the example, Gabriel. It worked well here.

Revision history for this message
marmuta (marmuta) wrote :

A heads-up: We've changed the D-bus interface a little from the initial version. The object path is now /org/onboard/Onboard/Keyboard with interface org.onboard.Onboard.Keyboard. Also the IsVisible method has been replaced by the read-only property "Visible". In return you can now connect to the org.freedesktop.DBus.Properties.PropertiesChanged signal and get notified of Onboard hiding/showing.

I've updated the documentation accordingly
http://bazaar.launchpad.net/~onboard/onboard/trunk/view/head:/README

Revision history for this message
Francesco Fumanti (frafu) wrote :
Download full text (3.5 KiB)

The fix is available in the alpha 1 preview release of Onboard 0.99.0. Thus, I am marking this bug as Fix Released. Please, do not hesitate to reopen it or file a new bug if this problem is still an issue for you.

onboard (0.99.0~alpha1~tr1190-0ubuntu1) raring; urgency=low

  * New upstream alpha release. (LP: #1089396)
    + Fix Onboard becoming empty when system font dpi changes

 -- Francesco Fumanti <email address hidden> Wed, 12 Dec 2012 21:33:43 +0100

onboard (0.99.0~alpha1~tr1188-0ubuntu1) raring; urgency=low

  * Sponsorship request for Ubuntu Raring (LP: #1089396)
  * debian/control: raise virtkey run dependency to 0.63.0 or above
  * debian/patches: refresh patch and change default theme
  * Onboard requires now virtkey >= 0.63.0
  * Add example file with system defaults for the nexus7
  * Various changes to get acceptable speeds on the nexus7 (LP: #1070760)
  * Add docking feature (LP: #405034)
  * Add sliding feature for docking and auto-repositioning
  * Add multitouch support
  * Add a toggle to stop listening to touch events in case of many problems
  * Add popup on long press for key variants like diacritics
  * New option to choose popup vs repeat for keys with variants
  * New gsettings key for the popup delay
  * Make move, frame and touch handles work on the nexus7
  * Perform simulated clicks on correct touch position
  * Auto-release pointer grab after timeout in case nexus7 is unresponsive
  * Fix xserver memory leaking
  * Improve speed when typing and moving the pointer (LP: #1055448)
  * Fix rendering being slowed by emboss effect on keycaps (LP: #890221)
  * Fix for not being able to move/resize Onboard on touchscreens (LP: #959035)
  * Have Onboard respect launcher icon size (LP: #1078554)
  * Auto-show Onboard by clicking already selected text entries (LP: #1078602)
  * Make default shortcut for language/layout work from Onboard (LP: #1078629)
  * New design of the Preferences dialog with more options (LP: #1053496)
  * Disable click buttons when mousetweaks is not installed
  * Add D-Bus service to show and hide the keyboard (LP: 1032042)
  * Don't export dbus service for embedded instances
  * Set NumLock's default sticky behavior to LOCK_ONLY
  * Keep state of NumLock across restarts
  * New attribute in layout files for sticky key behaviour
  * New layout tags key_template and keysym_rule defining keysym-specific labels
  * New window tag for color schemes to define border of popups
  * New layout tag for language specific overrides in the layouts
  * Move common key definitions into template for import by layout files
  * Sync modifier states of Onboard with changes by hardware keyboard or tools
  * Fix keys not re-rendered when releasing latched modifiers (LP: #1069990)
  * Send key strokes for all modifiers (LP: #1067797)
  * Blacklist Ctrl-LAlt+Fn keys by default
  * Add alternative key generation by at-spi2
  * Try to improve struts handling for metacity and mutter
  * Fix getpreferredencoding hack, by Matthias Klose
  * Build for all python3 versions, by Matthias Klose
  * Add work arounds for some problems with the search box of firefox
  * Improve startup sequence to fix Onboard showing up so...

Read more...

Changed in onboard:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.