We have moved to a new Sailfish OS Forum. Please start new discussions there.
18

Using the volume rocker from native Sailfish applications

asked 2014-01-03 12:56:22 +0300

MartinK gravatar image

updated 2015-03-06 09:50:56 +0300

eric gravatar image

It would be good if native Sailfish applications will be able to use the volume rocker for their own actions (or is it already possible? :) ). Thinking about it, the camera app already uses the volume rocker as a shutter.

How it could work

It would be nice if there was a QML interface for grabbing the rocker and mapping application specific actions to the up and down press. Like that, Sailfish applications could easily grab the volume key regardless of what their backend is written in (so that for example Python apps can use the volume rocker without the need to ship C++ code to access some C++ only API).

Also, the rocker should be grabbed by the application only if its window has focus, once the window looses focus, the rocker should automatically revert to system use. Like this, users can easily control system volume even if using an application that grabs the volume keys.

What the volume rocker can be used for in applications

  • map zoom in/out
  • turning pages
  • shutter
  • start/stop/pause something
  • trigger in a game

And I'm sure many many more. :)

edit retag flag offensive close delete

2 Answers

Sort by » oldest newest most voted
3

answered 2014-01-08 15:34:06 +0300

thp gravatar image

See also: https://github.com/nemomobile/libaudioresource/issues/1 (which would provide at least a C/C++ API for grabbing the volume keys).

edit flag offensive delete publish link more

Comments

Yeah, that could be a good start, followed by an API usable from QML/PyOtherSide building on that. :)

MartinK ( 2014-01-09 01:24:03 +0300 )edit

I would also like to see an API that does not require Qt/QML and is usable from SDL application.

smoku ( 2014-07-31 01:22:15 +0300 )edit

Very happy to hear that there is already an API but are the current map applications atleast using them to zoom in and out of the maps. Out of the 3 maps apps I had in N900 I always used to choose the volume button one as it makes map browsing very easy.

pavi ( 2014-11-23 03:13:32 +0300 )edit

@paviModRana already uses the volume button for map zoom on Sailfish OS. :)

MartinK ( 2014-11-23 14:43:56 +0300 )edit
3

answered 2014-11-22 14:19:51 +0300

MartinK gravatar image

So turns out that it is possible to use the volume keys from QML like this:

https://github.com/M4rtinK/modrana/blob/master/modules/gui_modules/gui_qt5/qml/sailfish_specific/MediaKeys.qml

This will probably get you booted out from Harbor like any useful API - but well, whatever. :)

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2014-01-03 12:56:22 +0300

Seen: 642 times

Last updated: Nov 22 '14