Hacking/Modding System

Long-time Android user recently switched to Sailfish, thanks to excellent port to Sony Xperia X Compact. As always, my first thoughts turn to hacking and modding, (nothing illegal, just personalization...). So far, I haven't figured out too much, except that the generous devs here do a great job with apps and patches for us, which I've been making use of, but I can't help but want to know more...

With Android, most UI functions are controlled by app packages, (apk files), which are made up of 2 parts: resources, and smali, (code). Apk files can be decompiled, have contents edited, then recompiled, and pushed back to the file system. Resources are pretty easy to mod, and smali is trickier, (different language), and even Java framework files can be modded, to bypass security, etc, if you really know what you're doing, (or have a guide to follow), but all of it is easily accessible in the file system, (with root).

Maybe I just haven't looked hard enough yet, but I haven't found the equivalent of this is Sailfish yet. I've dug around in the file system a bit, and found a few things that seem like they might be in this realm, but I have a feeling I'm missing something, like maybe these types of files are in a different partition, which has to be mounted, or maybe they are only moddable during app building, and not after, or... ???

So, what is the equivalent structure here, if any, for modifying apps, (particularly system apps)? For example, (what really got me started on this), I was wanting to set the time it takes for the power menu to pop up while long-pressing the power button, to be much shorter, (it's about a full 3 seconds - way too long). In android, I might find it in framework-res.apk/res/values..., or maybe in smali code. Where would it be here?

Thanks

edit retag close delete

Welcome to SailfishOS! Most of the apps ship their qml files as in-exe resources. Which makes customization hard.

( 2018-04-22 07:33:04 +0300 )edit
6

You can find the qml files in de directory usr/share/. The names of harbour apps will start with harbour, the official apps will start with jolla or sailfish. Be aware that changes can disappear after each update... You can find a simple example in this how-to

( 2018-04-22 10:27:28 +0300 )edit

@rgrnetalk - So, in Settings qml file, for example, (/usr/share/jolla-settings/settings.qml), there is a reference to a 'path' at /com/jolla/settings/ui. Where is that?

( 2018-04-23 05:10:41 +0300 )edit

@tortoisedoc Well, if the app is open source (and many/most native Sailfish OS apps are) you can rebuild the app yourself with any changes, even if it ships with QML in resources by default. :)

( 2018-04-25 14:22:42 +0300 )edit
1

@Levone1 this is about [dbus adapter and some internal handling of jolla.

( 2018-05-07 21:41:23 +0300 )edit

Sort by » oldest newest most voted

Update 12/11 - files and folders are a little different with SF3, but most of this can still be used as a general guide. I've done most of these mods on my X Compact running 3.0.0.8.

So, after messing around here and there, I thought maybe a good idea to post some easily-attained examples of helpful discoveries, (probably academic/old news to many here, but maybe some other newbs will appreciate...). Feel free to add other examples.

1. Since launcher patches don't work on my community port, (v. 2.1.3.7), I wanted to tweak my launcher background, etc. Starting with /usr/share/lipstick-jolla-home-qt5/launcher/Launcherview.qml, and using Tinyedit Root app from Openrepos, I found a line that said 'color: (I think the entry was 'black', but can't remember for sure)'. I changed it to '#d9121518', which is hex code for a semi-transparent dark blue-grey. This is the launcher background, but there's another layer which manifests over that, when you open the app drawer, so to deal with that,
2. go to /usr/share/lipstick-jolla-home-qt5/layers/LauncherLayer.qml, and add the line 'opaque: false', (credit to this thread for the tip - https://together.jolla.com/question/124262/how-to-make-the-launcher-transparent/). Now, your launcher bg is customized,

but now the issue is that, for whatever reason, when opacity is removed from launcher layer, it activates an overlay, which covers the top row of apps in the launcher with some kind of Android back-button rectangle. The overlay actually doesn't cause any function, and if you press the space where your app icon is, (hidden by the overlay), the app will still launch, you just have to know where the icon is.

3. I discovered the code for this at the bottom of /usr/share/lipstick-jolla-home-qt5/launcher/launcher.qml. There is code for a rectangle which says a bunch of stuff about 'back' function, etc. Delete the whole code for that rectangle, and it disappears from the launcher.

Update - I Figured out how to get scroll-without-pages:

1. Go to /usr/share/lipstick-jolla-home-qt5/launcher/launcher.qml, and find 'snapMode: ListView.SnapOneItem' and 'highlightRangeMode: ListView.StrictlyEnforceHighlight', (there were 3 instances of each in mine).
2. Change them to 'snapMode: ListView.NoSnap', and 'highlightRangeMode: ListView.NoHighlightRange'. I Think that's all needed. I did also add a line, but I'm pretty sure it didn't do anything. Let me know if not working for you.

Also...

• Keyboard/Covers

I tend to prefer things dark/dull/flat, so, even though I like the Sailfish UI overall, there are certain things that are just too bright and shiny for me. I found 2 files called GlassBackground.qml - one of them is in /usr/share/lipstick-jolla-home-qt5/compositor/, and one is in /usr/lib/qt5/qml/Sailfish/Silica. I found that if you change any value that says 'highlightBackgroundColor' to 'highlightDimmerColor', you will get dimmer, darker colors. Also changing the opacity levels, (like from 0.7 to 0.1, or something - experiment), helps. This seems to mainly affect the keyboard and the minimized cards, (covers), (so, if you have a blue highlight color set for your ambience, the minimized cards are usually bright blue, but this can make them more like a dark, shadowy color, accented by your wallpaper.

Also, the GlassBackground file uses 2 png files, noise.png, (found in /usr/lib/qt5/qml/Sailfish/Silica), and graphic-shader-effect.png, (found in /usr/share/Themes/Meegotouch/Sailfish-default/icons/). Both of these cause the glassy/blurry type of look in different areas. I replaced both of them with a flat, solid color image. This makes the keyboard solid-looking, and seems to make the general glassy-ui more like a blur-ui, (you can't see the little bumpy marks). Of course this is all varying depending on opacity levels in different files, etc, so...)

Also,

• Solid Background for apps, (no glass)

go to /usr/share/lipstick-jolla-home-qt5/compositor/ApplicationWallpaper.qml, and find the line that says '... 0,0,0,0.5)', and change it to '... 0,0,0,1.0), (note - since SF3, there are 2 of thos lines, one for dark and one for light ambience). 0.5 indicates opacity halfway to solid, so changing it to 1.0 makes it totally solid. I thought the 0,0,0 would be rgb color, but when I attempted to change it to something else, the whole screen whited-out. Maybe there's only certain allowed range values or something... Update - figured it out... You need the rgb values to have decimals. So my color, hex #121518, is rgb 18,21,24, so I need to enter .18,.21,.24,1.0.

• Cool neon dialer

Follow instructions above to get solid app background, then go to /usr/lib/qt5/qml/Sailfish/Silica/keypad.qml. Find 'property color textColor: Theme.primaryColor', and change it to 'property color textColor: Theme.highlightColor'. Tjen set a bright loud color in your ambience...

• Transparent Covers

Go to /usr/lib/qt5/qml/Sailfish/Silica/CoverBackground.qml, and change 'transparent: true' to 'transparent: false', and the covers become transparent, (strange but true).

• Solid Lock Screen (no vignette)

files are in /usr/share/lipstick-jolla-home-qt5/lockscreen/. Mainly 'lockscreen' and 'vignette' files. Look for value called 'open radius', and change it to 0.0. Also interesting is a value called 'frag color' at the end of 'vignette' file. It says 'vec4', followed by parentheses with 3 rgb decimals inside. Change the values similarly to described above to change the color of the screen lock overlay. Changing vec4 to vec(any other number) results in a solid, hot-pink screen overlay. I'm not sure what that value means.

• Totally flat keyboard

Open /usr/share/maliit/plugins/com/jolla/keySeparator.qml, and add 'opacity: 0.0'. Then go to 'functionKey.qml' in the same directory, and change opacity values. See lines 47 and 54 in my screenshot for example.

I was able to get this effect by messing around with /usr/lib/qt5/qml/Sailfish/Silica/opacityRampEffectBase.qml:

• Remove highlight color from events pulley

Go to /usr/share/lipstick-jolla-home-qt5/eventsview/EventsView.qml, and change any 'Theme.highlightBackgroundColor' to 'Theme.highlightDimmerColor', then change opacities how you like. For example, in my screenshot you see the '0.4' number- that was originally '0.8', etc...

• Show how many pages deep in page stack

I think this is an older feature that got phased out, but I find it helpful sometimes- Go to /usr/lib/qt5/qml/Sailfish/Silica/private/pageStackIndicator.qml, and replace the whole code with this: https://github.com/dm8tbr/sailfishsilica-qt5/blob/master/usr/lib/qt5/qml/Sailfish/Silica/private/PageStackIndicator.qml

• Change Ambience color to anything you want

Like I said, I like dark and dim, but Ambience highlight color is always bright. Change primary and secondary highlight colors with second commands found in @ssahla 's updated answer here- https://together.jolla.com/question/11949/black-and-white-ambiences/ You can use ShellEx app to make a one-click method, so you don't have to type the commands every time, and Google's built-in hex color picker comes in handy for finding color codes. Just type 'hex color' into url bar in a Google search, and it shows up in search result screen.

• dark buttons with light text

Go to /usr/lib/qt5/qml/Sailfish/Silica/button.qml. The first entries are a bunch of bool / properties. 3 of them say color. Anything that says 'Theme.(whatever)... change it to 'Theme.highlightDimmerColor'. Then, near the end of the file, is a section called 'label', with an entry of 'color'. Change the color value to 'Theme.primaryColor'.

• Bigger cover icons

Go to /usr/share/lipstick-jolla-home-qt5/switcher/SwitcherItem.qml, and down about line 310 or so, you'll see a few code entries called 'image' and 'rectangle' that have values of iconSizeSmall and iconSizeMedium. Change those to iconSizeLarge.

• # of columns in events view shortcuts

Go to Go to /usr/share/lipstick-jolla-home-qt5/eventsview/Eventsview.qml, and look for 'columns'. There are 2 of them. One is for shortcuts and one is for actions. I changed mine to 5 and 3.

• Smooth blur-like effect throughout, instead of the bumpy 'glass', (affects most elements).

Replace 2 png files - /usr/share/themes/sailfish-default/meegotouch/icons/graphic-shader-texture.png, and /usr/lib/qt5/qml/Sailfish/Silica/private/noise.png - with the same semi-transparent png image, (easily found in Googke). Adjust appearance by editing 'GlassBackground' and 'OpacityRampEffectBase' files, as described above.

• Nice-looking rounded buttons

... button qml file; find 'radius', and change whatever it says to, 'radius: 45', then change opacity levels similar to above tweaks, or however you like ...

Note: Always have files backed up, and/or know how to get back to where you started if things get messed up.

Handy tips for emergencies:

• If the phone boots ok, but your app drawer is gone, go to events page, and click on a Storeman notification. Storeman opens, and go to Fingerterm, and select 'launch' from pulley menu, then use vim with root to edit files. Or, add lock screen shortcuts...
• To edit files of the phone doesn't boot, get into recovery mode, and use vi in shell.. On my Xperia, rootfs is automatically mounted, so cd to rootfs works fine to access file system. On Jolla phone, need to mount mmcblk0p28. Use instructions from @Till here - https://together.jolla.com/question/138839/how-to-run-command-from-recovery-mode/

I can add more specific code lines, etc., if anyone wants, but it's just a general example. I think code will probably vary from version-to-version, device-to-device, etc. The idea is that you can poke around, and figure different things out. If you're too unsure to test without specifics, you might want to stay away...

more

2

interesting, thanks for sharing :)

( 2018-08-10 20:16:43 +0300 )edit

"I was wanting to set the time it takes for the power menu to pop up while long-pressing the power button"

In this particular case no patching / modding is needed. Power key is handled by mce service and there is a setting for the long-press duration.The setting is not visible in ui, but you can tweak it from command line with mcetool utility. For example down to 250 ms:

mcetool --set-powerkey-long-press-delay=250


The default is 1500 ms. And keep it below well below 5000 ms (another system service "dsme" is also monitoring power key and will initiate shutdown if it is kept pressed > 5 seconds).

The setting can be changed as a regular user, but you need root privileges/developer mode for installing the utility itself:

pkcon refresh
pkcon install mce-tools

more

Nice, thanks. I think 750 is probably more than enough for me, since I don't use it for anything else but a quick tap for screen-off. That's the kind of stuff I like knowing about; going to install mce tools. By the way, someone here indicated that modding rpms is tricky. Do you find that to be the case? What's the best method?

( 2018-04-23 00:01:12 +0300 )edit

Testing som mce commands found here - https://reviewjolla.blogspot.com/2015/09/customizing-sailfish-os-mce-tools-by.html?m=1 - and working well. I like the glance setting...

( 2018-04-23 00:28:16 +0300 )edit

Take a look at PatchManager in OpenRepos. It lets you apply/unapply changes to files after you've modded them.

more

Have been using patchmanager. I was more in the realm of wanting to know what the patch makers know - how the app files work, and how to know what to change...

( 2018-04-23 05:13:43 +0300 )edit
1

hmm @Levone1 you can look at the patches themselves to see how the magic is made; they are really patches.

( 2018-04-23 15:03:31 +0300 )edit

Good idea... Also, I found an app calles 'rpm repackager' or something. Is it necessary to modify and repackage rpm, then install, or can I just edit already-installed files and reboot? (I'm planning on testing and experimenting either way, but trial and error goes quicker with input from those who know...) Thanks

( 2018-04-23 18:44:12 +0300 )edit
1

Just modify the files with your favorite editor and reboot. Don't forget to backup them first. In case something goes horribly wrong you can use recovery cconsole.

( 2018-04-24 09:15:57 +0300 )edit

Android user lately just moved to Sailfish, thanks to outstanding port to Sony Xperia X Compact.They have this facility of custom essay writing service. Our first thoughts moves to hacking and modding and many people have not sorted out too much, excluding that the generous devs here do a great job with applications and patches for us.

( 2019-01-21 08:56:08 +0300 )edit

Stats

Seen: 3,539 times

Last updated: Mar 15