Reply
Thread Tools
Posts: 90 | Thanked: 163 times | Joined on Jan 2012
#1
Kids mode for sailfish OS

This is a patch and application that creates a kids mode. The patch modifies the launcher, eventsview, notifications and switcher code to allows the application to work.

When kids mode is activated for a user only the configured applications can be seen in launcher and launched. Long press is disabled in launcher. In events view notifications are hidden and only the configured switches and actions are available in the pull down menu. Notification pop-upps are shown but can't be clicked.

When the user exits kids modes then the normal user settings are restored. A pin can be set to exit kids mode.

Features:
- Multiple users can be created, each with own configuration for launcher and events view shortcuts.
- Can be activated and deactivated from the cover.
- Pin can be set to exit kids mode.

Notes:
Newly installed applications need to be unselected in settings otherwise they will show in kids mode.
The pin is stored as plain text in dconf and so not secure.
This may conflict with other patches of launcher, switcher, notifications or eventsview.
If the launcher folders aren't restored try a home screen restart. If that doesn't work then copy files in /home/nemo/.config/kids-mode/masterBackUp to /home/nemo/.config/lipstick and restart home screen.

To-dos (time and ability permitting):
- Don't show newly installed applications in kids mode as default behavioir.
- User configurable notification settings.
- Look into whether running applications can be hidden instead of closed.
- User changeable kids-mode ambiences.

How it works:
I have used the blacklisted applications list within launcher. For each user the applications that can't be shown are stored in dconf. Launcher has been patched to read the key and update the blacklisted applications when the kmon dconf key is set to true. Long press is also deactivated. The application.menu and folders are backed up. Folders are removed from application.menu xml and a patch of launchers allows this to be reloaded after km is turned on. Finally the swirther patch allows the application to trigger close all.
For eventsview shortcuts the user settings are stored for the user in dconf and copied to the main events view dconf when kmon is set true.
When kmon is set to false everything is reverted.

File operations are done using python.

For the settings I have reused and adapted qml files from jolla settings for events view.

This may not be the most efficient or elegant solution but it works and meets my needs in only allowing selected applications to be used by the kids. Hopefully others will find it useful. Constructive feedback and any code contributions are welcome.

Available on open repos: https://openrepos.net/content/anig/kids-mode
Source: https://github.com/anigaj/kids-mode
Translations: https://www.transifex.com/x-39/kids-...ish/dashboard/

Last edited by anig; 2018-05-08 at 22:34.
 

The Following 30 Users Say Thank You to anig For This Useful Post:
eson's Avatar
Posts: 362 | Thanked: 1,373 times | Joined on Nov 2015 @ Sweden
#2
Thanks! Should become handy.
 

The Following 3 Users Say Thank You to eson For This Useful Post:
kick's Avatar
Posts: 82 | Thanked: 129 times | Joined on Jan 2017 @ India
#3
my suggestion this should also include something like a low power mode which reduces power consumption by closing things like aliendalvik(and keeping it that way)

anyways thanks,i appreciate the work
__________________
Hello There!
 

The Following 3 Users Say Thank You to kick For This Useful Post:
mosen's Avatar
Community Council | Posts: 1,669 | Thanked: 10,225 times | Joined on Nov 2014 @ Lower Rhine
#4
Great idea!
A killer feature imo would be to control app usage also on time based limit.

Have a custom group/list of apps with all games, yt and other timeburners and define a custom limit, like 1 hour for all those apps.
Whenever any of them is active the granted usage time is decreased until daily limit is reached and a pin is needed for further usage of those apps.

From my experience it is a big difference if parents tell the kids to stop burn time (meeeeh, stupid parents) than the device "itself" setting limits (oh, it's like that, gotta move on).
 

The Following 5 Users Say Thank You to mosen For This Useful Post:
nthn's Avatar
Posts: 764 | Thanked: 2,888 times | Joined on Jun 2014
#5
Great work! It's a bit sad that this seems to be precisely the thing ambiences were made for but Jolla will probably never implement anymore.
 

The Following 10 Users Say Thank You to nthn For This Useful Post:
Posts: 339 | Thanked: 1,623 times | Joined on Oct 2013 @ France
#6
Interesting idea !

That makes me wonder if there is still the problem that sailfish can't run with any other user than nemo ?
Being able to launch lipstick as another user would add to what you already implemented having a custom home directory, so isolating user preferences (history, favorites, games progress, social accounts...).

On the list of related idea, custom firewall rules to limit websites that can be visited to a safe white-list could interest some people, not sure how easy that can be done in sailfish.
 

The Following 6 Users Say Thank You to Zeta For This Useful Post:
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#7
Originally Posted by Zeta View Post
That makes me wonder if there is still the problem that sailfish can't run with any other user than nemo ?
I never understood that. "Hey, we have this wonderful Linux based OS for you, oh and by the way, we are going out of our way to deliberately cripple it for you by removing one of the key features that make Linux Linux."
__________________
Русский военный корабль, иди нахуй!
 

The Following 6 Users Say Thank You to pichlo For This Useful Post:
Posts: 93 | Thanked: 358 times | Joined on Jul 2016 @ Paraguay
#8
Translated to Spanish, waiting your review

Enviado desde mi H3123 mediante Tapatalk
 

The Following 4 Users Say Thank You to meloferz For This Useful Post:
Posts: 90 | Thanked: 163 times | Joined on Jan 2012
#9
Thanks for all the feedback and the translations.
Turning off aliendalvik should be easy to do, will add it as an option. Time limits may be beyond my ability but will have a look. As the on/off status is stored in dconf other app could always be patched to react to kids mode turning on.

Since this is the first time I've used translation I didn't realise that when a translation language doesn't exit it only shows the id. How can I have the source language showing instead?
 

The Following 7 Users Say Thank You to anig For This Useful Post:
Posts: 339 | Thanked: 1,623 times | Joined on Oct 2013 @ France
#10
Originally Posted by anig View Post
Since this is the first time I've used translation I didn't realise that when a translation language doesn't exit it only shows the id. How can I have the source language showing instead?
I took a look at your code and discovered the qsTrId() function you used.

I usually use qsTr(), where you put for example directly the english text, and then it search for translations and if there is none then fallback to this english text.

But qsTrId() is different in that it works with an id to the translated text. I can see how that could be more efficient depending on the magic they put behind the qsTr() function, but means you must somehow define a default language as a fallback.
That is not too difficult from C++ (see http://doc.qt.io/archives/qt-4.8/qtr...or.html#load-2), as the "load" function returns a boolean to tell if the locale was correctly found or not, and then loading the english could be done.
For the translations, the QLocal class provides uiLanguages (the http://doc.qt.io/archives/qt-4.8/qlo...ml#uiLanguages) function which "returns an ordered list of locale names for translation purposes in preference order". There may be a way to add the english language as a low rank choice in there...

Finally, back to the load() function from QTranslator that must be used under the hood in the QML launcher, we see the logic for finding the translations files:
If the file name does not exist, other file names are tried in the following order:
File name without suffix appended.
File name with ui language part after a "_" character stripped and suffix.
File name with ui language part stripped without suffix appended.
File name with ui language part stripped further, etc.
So maybe renaming/symlinking/copying the english translation file as "kids-mode.ts" should be enough. I see this file is already there in your repo, but with "<translation type="unfinished"></translation>" everywhere, which I suppose would not be displayed.
 

The Following 8 Users Say Thank You to Zeta For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 21:28.