[How-To][ROOT] Edit/Swap hardware keys on OOS double tap and long press too. - OnePlus X Themes and Apps

Hi all, i've jumped from OOS to CM12.1 and CM13 (and cm13 based roms) for some time, but today i wanted to give another shot to OOS 2.2.0 (and wanted to try boeffla's kernel as CM isn't official yet).
And i remembered why i could not stay on OOS after a few seconds... i really hate the hardware keys setup (recents-home-back).
I'm used to have Menu-Home-Back (and recents access from long press home, or press home from nova launcher).
I've been reading and then learning many things in the past few weeks, so i though i should try to edit those keys just like we did on CM, even if before switching to CM i've looked around and didn't find anything working to change these.
So, here it is.
What you need:
Rooted phone and file manager with root access (there are many but i love FX file explorer, and the root add-on is free).
You need to go to /system/usr/keylayout
Then make a backup of the Generic.kl file (to make it easier i make an archive of it by long press on the file, then archive, but a simple copy and paste will do).
After that, don't forget to unlock the system partition if needed (tap the little lock and accept to open it on fx file explorer).
Open Generic.kl with file editor.
What you need to know is that left key is key number 139, middle one is number 172 and right one is 158.
Functions that can be affected are: MENU HOME BACK APP_SWITCH VOICE_ASSIST.
But for some obscure reason, MENU acts like APP_SWITCH in oxygen OS, so the trick is to replace MENU with MENU VIRTUAL (this will emulate Menu button from on screen navbar, but you don't need to activate the navbar).
So, if you want for example this layout: Menu-Home-Back
You'll need to edit the Generic.kl and replace the Line
key 139 MENU
with
key 139 MENU VIRTUAL
(key 158 BACK and key 172 HOME don't need to change).
Another interesting point is that if you use xposed installer and Gravity Box LP, you can assign different functions to double press or long press on buttons, but it's working only with on screen navbar buttons... you see where i'm trying to get ?
If you modify the generic.kl file and replace MENU with MENU VIRTUAL and BACK with BACK VIRTUAL... then you'll be able to add custom actions with Gravity Box... like the one I really miss, hold back to kill.
I didn't try to replace HOME with HOME VIRTUAL as i can configure long press and double tap home from oxygen OS, but it may work exactly the same if you want something special from Gravity box.
For exemple, my setup is like that:
Menu-home-back
Menu long press => Switch last app
Home long press => Recent apps
Back long press => Kill foreground app
Double Tap Menu => Google Now
Double Tap Home => Screen off
Double Tap Back => Nothing
To sum up, on the phone, keys are:
key 139 - key 172 - key 158
You can affect different general functions to these, like:
MENU
HOME
BACK
APP_SWITCH
VOICE_ASSIST
and maybe more
You can add VIRTUAL behind the function to emulate the on screen navbar buttons (and it seems required for the menu, as it still calls the recent apps in OOS), and then you can add double tap or long press functions with gravity box.
You don't need to enable the navbar to get them working.
I don't know if i've been clear enough, as i'm not used to this kind of things (i wonder if that's not my first thread on XDA...), but i just hope this will be useful to some of you,
have a great day.
[Edit: Forgot to mention you need to reboot the device when it's done]

Great thread. Will test

Got a bit of an issue... I just experimented with this and it was providing very odd results. So, I copied the backup generic file back to the location... restarted the phone. Now, no buttons do anything. There's no way for me to get home so a restart is the only option I have by forcefully turning off the phone. I'm not sure what to do, the file looks absolutely fine. Any help please? I don't know what to do... I don't want to reflash the rom..

If you restored the original file, at the original place, I don't know why this would not get you back...
Did you try to change the behavior of key in settings?
Envoyé de mon ONE E1003 en utilisant Tapatalk

J0kker said:
If you restored the original file, at the original place, I don't know why this would not get you back...
Did you try to change the behavior of key in settings?
Envoyé de mon ONE E1003 en utilisant Tapatalk
Click to expand...
Click to collapse
Thanks for your help, but unusually it eventually sorted itself out. After 3 reboots the buttons began to work again... weird!

can you change hardware keys to [L-R] Recent Menu Back on CM13 using this method?

sphoenixp said:
can you change hardware keys to [L-R] Recent Menu Back on CM13 using this method?
Click to expand...
Click to collapse
Yes you can, but the file isn't the same, you should edit:
system/usr/keylayout/synaptics-rmi.kl
If you want to swap keys, simply switch the numbers (139 with 158), it's exactly the same as modifying the functions, but easier to type, especially on a phone.

It doesn't work for me. I added virtual at menu and back. Changed gravitybox back long press and double tap to kill foreground app. Single tap of back still not working.
Have i missed out anything? Oss 2.20 here.

J0kker said:
Yes you can, but the file isn't the same, you should edit:
system/usr/keylayout/synaptics-rmi.kl
If you want to swap keys, simply switch the numbers (139 with 158), it's exactly the same as modifying the functions, but easier to type, especially on a phone.
Click to expand...
Click to collapse
Thanks so much it worked.
Saved and rebooted the phone

Tiongkia said:
It doesn't work for me. I added virtual at menu and back. Changed gravitybox back long press and double tap to kill foreground app. Single tap of back still not working.
Have i missed out anything? Oss 2.20 here.
Click to expand...
Click to collapse
Strange, i'm on OSS 2.2.0-X and it's working perfectly.
Maybe try to activate Master switch under Navigation Bar tweaks in gravity box ?
I'm almost sure this won't help, but you need to write it all in uppercase letters.

J0kker said:
Strange, i'm on OSS 2.2.0-X and it's working perfectly.
Maybe try to activate Master switch under Navigation Bar tweaks in gravity box ?
I'm almost sure this won't help, but you need to write it all in uppercase letters.
Click to expand...
Click to collapse
Its already in caps. Don't work
Also try enabling master switch under navigation bar tweaks. Also don't work.
I just updated to 2.2.0-x too

Tiongkia said:
Its already in caps. Don't work
Also try enabling master switch under navigation bar tweaks. Also don't work.
I just updated to 2.2.0-x too
Click to expand...
Click to collapse
I can try to upload my generic.kl file if you want, just to see if it works for you as it does for me (this way we will know if it's this file related or not).
You should have menu-home-recents.
Rename the file (remove the .txt, i could not join a .kl file, invalid).
Maybe check the permissions too.
Envoyé de mon ONE E1003 en utilisant Tapatalk

J0kker said:
I can try to upload my generic.kl file if you want, just to see if it works for you as it does for me (this way we will know if it's this file related or not).
You should have menu-home-recents.
Rename the file (remove the .txt, i could not join a .kl file, invalid).
Maybe check the permissions too.
Envoyé de mon ONE E1003 en utilisant Tapatalk
Click to expand...
Click to collapse
I appreciate it buddy. But don't work

Tiongkia said:
I appreciate it buddy. But don't work
Click to expand...
Click to collapse
Sorry to ear that, if you ever manage to get it working, let us know (and why/how).

Tiongkia said:
I appreciate it buddy. But don't work
Click to expand...
Click to collapse
You should check if A you have a text editor that supports editing in system partition and B if you have root file explorer that supports writing in system partition (and permissions). I would recommend es file explorer, just for this particular task. Afterwards just delete the file explorer.
The easy way is to delete the file in keylayout and write the file (with es file explorer) from OP couple of posts ago in keylayout direction. Reboot and also enable masterswitch in gravitybox. Voila, this method can't go wrong and works always.

I have es explorer and root browser. I am able to change permission too. Also reboot but no effect.
Anyone else tried?

Tiongkia said:
I have es explorer and root browser. I am able to change permission too. Also reboot but no effect.
Anyone else tried?
Click to expand...
Click to collapse
I tried and it worked perfect. Can you look up what your generic file says under 139 and 158 ?

Tiongkia said:
I have es explorer and root browser. I am able to change permission too. Also reboot but no effect.
Anyone else tried?
Click to expand...
Click to collapse
Just wondering, do you have navbar enabled ?
If it is, try to disable it and reboot... i've never tried with navbar enabled, so who knows !

Tried all. Don't work. I give up. Thanks buddies. Appreciate it

Hi,
Applied without problem, just I can't set double tap action on the Home button.
I don't know why double tap doesn't work just for the home button. No problem with menu or back settings or on long press.
I think that Nova breaks this setup.
My conf :
OOS 2.2X, Xposed 80, Gravity Box 5.3.3, Nova lastest release
Edit : When I revert to the original file, the default setting (Settings > Buttons) Double tap for the Home buton is ignored.

Related

[Q] [HELP]problem on my xplay multifunctional key stock/not working

hi,im new here,i just wanna seek some help regarding to my xplay multifunctional key button(the third key beside home button.)its always stock when i wanna use that key.sometimes working and sometimes most of the time not functioning.you need to push it a lot of times until it works again.any idea why its happening in xplays or only just for me?thank for any help
I think you mean the Menu key. Perhaps its broken. If you have root, you can edit the file "/system/usr/keylayout/keypad-zeus.kl" to change the function of each physical buttons. You could for example remap the Search button to Menu.
eksasol said:
I think you mean the Menu key. Perhaps its broken. If you have root, you can edit the file "/system/usr/keylayout/keypad-zeus.kl" to change the function of each physical buttons. You could for example remap the Search button to Menu.
Click to expand...
Click to collapse
thanks buddy i have a root but problem is i dont know how to remap each button.im noob and only basic knowledge iknow regarding that.can you help me how to do that step by step.i check system/usr/keylayout/keypad-zeus.kl using es file xplorer.i dont know what to type and to do.a big help from you is much appreciated.
please i need help.now my home bu
tton stuck also when i try to tap on it.but when my play are open i mean the gamepad is visible,the home button works fine and the menu button also working.is this some kind of hardware issues/malfunction?please any help would be appreciate
Sent from my R800i using Tapatalk 2
By malfunctioning you mean your buttons are broken then yes. Of you want to avoid this issue in the future, buy a Nexus.
Enable root permission for ES File Explorer, copy the file to your sdcard, tap and hold on the file and choose Open As -> Text -> Es text editor. Edit the file to remap the button to how you like it. Copy it back to its original location. Tap and hold on the file again and choose Permission. Set the permission to rw-r-r.
Also if you know how to install custom roms, with Slim Bean rom you can enable onscreen button.
Sent from XDA app
eksasol said:
By malfunctioning you mean your buttons are broken then yes. Of you want to avoid this issue in the future, buy a Nexus.
Enable root permission for ES File Explorer, copy the file to your sdcard, tap and hold on the file and choose Open As -> Text -> Es text editor. Edit the file to remap the button to how you like it. Copy it back to its original location. Tap and hold on the file again and choose Permission. Set the permission to rw-r-r.
Also if you know how to install custom roms, with Slim Bean rom you can enable onscreen button.
Sent from XDA app
Click to expand...
Click to collapse
I DO WHAT YOU TUTORIAL.but it seems its the same thing happened.still doesnt workwhen you slide up the play i mean gaming buttons are visible,the home button is working even i used it for CWM.but also the search menu.but when i close the lid,agin it doesnt work.

[Q] home key wake up

After installing sphinx rom v2 on my e988 i can't wake up my screen by pressing home button any one know how to enable it again ?
mhd.abbas.94 said:
After installing sphinx rom v2 on my e988 i can't wake up my screen by pressing home button any one know how to enable it again ?
Click to expand...
Click to collapse
This will only work if the option was removed from the keylayout, so let's see if the option is there or not:
Use a root file manager and go to System/usr/keylayout
Edit the file "gk-kaypad-8064.kl" (how you edit the file depends on the file manager you are using, so I can't give you exact steps as to how to do this)
You should see stuff like:
key 114 volume_down
key 115 volume_up
etc
look at key 172:
If it was disabled from waking the phone, it will say:
key 172 HOME
If it has the option to wake the phone it should say:
key 172 HOME WAKE
-If it's like this already, then I can't help you further because the button is already set to wake the phone, so something else in the rom is preventing it from working.
-If it isn't already like this, then just add the WAKE (in all caps) part to it after a space and save the file. Make sure the permissions are still 644 (rw-r--r--) after saving. Reboot. Test and hopefully it should work. Again, if not, I can't help you any more because something else is preventing it from working.
BTW, I don't use Sphinx, but I actually hate the Home button waking my phone, so I always disable it after rooting. So I basically just remove the WAKE part.
spexwood said:
This will only work if the option was removed from the keylayout, so let's see if the option is there or not:
Use a root file manager and go to System/usr/keylayout
Edit the file "gk-kaypad-8064.kl" (how you edit the file depends on the file manager you are using, so I can't give you exact steps as to how to do this)
You should see stuff like:
key 114 volume_down
key 115 volume_up
etc
look at key 172:
If it was disabled from waking the phone, it will say:
key 172 HOME
If it has the option to wake the phone it should say:
key 172 HOME WAKE
-If it's like this already, then I can't help you further because the button is already set to wake the phone, so something else in the rom is preventing it from working.
-If it isn't already like this, then just add the WAKE (in all caps) part to it after a space and save the file. Make sure the permissions are still 644 (rw-r--r--) after saving. Reboot. Test and hopefully it should work. Again, if not, I can't help you any more because something else is preventing it from working.
BTW, I don't use Sphinx, but I actually hate the Home button waking my phone, so I always disable it after rooting. So I basically just remove the WAKE part.
Click to expand...
Click to collapse
Thanks a lot man
Does someone has another solution?
i got the same problem but in my file allready was written "WAKE".

[Guide] Disable hard navigation keys (not onscreen buttons)

I have seen a bunch of posts regarding the capacitive buttons and on screen navigation buttons. Love them or hate them, this is how you can turn them off.
I will leave that up to you on how to get onscreen Navy buttons.
As for turning off the capacitive buttons this is how I did it.
1.To eneble onscreen buttons follow this thread http://forum.xda-developers.com/redmi-1s/themes-apps/how-to-onscreen-buttons-redmi-1s-t2950455
2. Download a root file explorer. Root Browser Lite --> http://goo.gl/b9ISW This is what I will use.
3.Load up Root Browser and navigate to system>usr>keylayout. We will be looking for a file called "ft5x06.kl".
4. Select it and hit "Open as..." then "Text file" then "RB Text Editor"
5. Now we see this:
key 139VIRTUAL
key 158 VIRTUAL
key 102 HOME
key 217 SEARCH
All you have to do is option out the keys you don't want to work with a #. So if you are like me and think the home button is fine, it will look like this.
#key 139VIRTUAL
#key 158 VIRTUAL
key 102 HOME
key 217 SEARCH
6. When you have the ones you want optioned out just tap the little disk icon in the top right. It will ask for root rights, grant it, saved.
7. Now just reboot and DONE!
Tested on
1. Redmi 1s(miui, Validus, Pa, mokee,cm11 ROMs)
Sent from my HM 1S using Tapatalk
Hit thanks if this post helped you[emoji106]
Nice guide, works with CM11 too, only the file for editing is different:
/system/usr/keylayout/ft5x06.kl
Don't remember to backup the original file before editing!
philip_petev said:
Nice guide, works with CM11 too, only the file for editing is different:
/system/usr/keylayout/ft5x06.kl
Don't remember to backup the original file before editing!
Click to expand...
Click to collapse
Thanks bro OP updated....:thumbup:
Sent from my HM 1S using Tapatalk
Thanks
It worked awesome on Mokee ROM history version
thanks for useful tips. its a pain operating non backlit capacitive button

[Q] How to remap recent apps button to make it a menu button

Before updating to lollipop, Nova launcher would allow me to remap the button to be a menu button instead of recent apps. It no longer does this and it is killing me...I am so used to it the other way! Is there a way to do this on lollipop?
Have you tried long pressing recent button that is how you can get the menu to pop up its been that way since kk
Sent from my SM-N910P using Tapatalk
Thank you for the response... Even on kitkat when you use Nova launcher it allows you to make the soft key open settings instead of recent apps. With lollipop it no longer works like that.
Dunno which keys were for recent apps but here's a guide to get to it.
Use a root explorer.
Go to
/system/usr/keylayout.
Backup file Generic.kl ( copy it as a .bk or something )
Then find the word RECENT_APPS linking with the code number, change RECENT_APPS to MENU.
I don't know how to change long press home as Recent apps though, I tried finding the key but all "SEARCH" keys were something else entirely when I changed to RECENT_APPS, didn't work on touchwiz.
Spark91 said:
Dunno which keys were for recent apps but here's a guide to get to it.
Use a root explorer.
Go to
/system/usr/keylayout.
Backup file Generic.kl ( copy it as a .bk or something )
Then find the word RECENT_APPS linking with the code number, change RECENT_APPS to MENU.
I don't know how to change long press home as Recent apps though, I tried finding the key but all "SEARCH" keys were something else entirely when I changed to RECENT_APPS, didn't work on touchwiz.
Click to expand...
Click to collapse
I followed your advice and all i can got was my new brand Doogee x30 (Nougat) being bricked! I restored the Generic.kl and nothing!-All buttons were unresponsive except the touchscreen. I lost all my data and the only solution was to flash the stock rom. Thank you very much!

Remap funcionality of POWER-Button to physical CAMERA-Button

Hello everyone,
the Power button of my Sony Z1 Compact is broken and only works when pressed very very intensely. Since I don't use the camera button at all, I would like to use it as my new power button - I'd like to remap the physical camera button to the funcionality of the POWER-Button.
I've read a few posts on this issue, so I started out with rooting my Z1C today (KingRoot and SuperSume). Then I tried a number of possible solutions, all of which have failed so far:
- ButtonRemapper. I read about it on LifeHacker and thought this would be a quick and easy tool. It seems to basically do what I want, BUT it doesn't offer the Camera button as one to connect functionality to. Neither can I add a button ID (I'm pretty sure the camera button is #212).
- Buttons remapper (no root). This program recognizes the button I'd like to use and offers a number of connectible actions - but none equal to what the Power button does (wake up from sleep, go to sleep, Power-Menu on long press). It only offers the Power-Menu-funcionality, but that won't help me with my broken Power-Button.
- Xposed Additions. I installed the Xposed Installer first, then went for Xposed Additions. It seems that I also need the Xposed framework, but since I don't use a custom ROM, as far as I understand, I cannot install it.
- Manual edit of the keymap. There have been a number of tutorials online on how to change the keymap. I'm pretty sure the one I'd have to change is the /system/usr/keylayout/mhl-rcp.kl. When I try to save any edits though, it tells me that I can't. I guess that this is because it's a kind of system file, but I imagined I'd be able to edit it after having rooted my device.
I'm a little frustrated after all this work just for one tiny change that I still couldn't achieve so fat. But if you have a possible solution, I will try it. I would however like to keep my current (non-custom) firmware if possible (never change a running system...).
I'm very thankful for your suggestions!
If you are 100% sure you found the right file to change manually, copy that file to your sd card and modify it there.
After you are done, backup your original file and replace it with the new one. Don't forget to change permissions after copying in!!
Then reboot and try.
thekryz said:
Hello everyone,
the Power button of my Sony Z1 Compact is broken and only works when pressed very very intensely. Since I don't use the camera button at all, I would like to use it as my new power button - I'd like to remap the physical camera button to the funcionality of the POWER-Button.
I've read a few posts on this issue, so I started out with rooting my Z1C today (KingRoot and SuperSume). Then I tried a number of possible solutions, all of which have failed so far:
- ButtonRemapper. I read about it on LifeHacker and thought this would be a quick and easy tool. It seems to basically do what I want, BUT it doesn't offer the Camera button as one to connect functionality to. Neither can I add a button ID (I'm pretty sure the camera button is #212).
- Buttons remapper (no root). This program recognizes the button I'd like to use and offers a number of connectible actions - but none equal to what the Power button does (wake up from sleep, go to sleep, Power-Menu on long press). It only offers the Power-Menu-funcionality, but that won't help me with my broken Power-Button.
- Xposed Additions. I installed the Xposed Installer first, then went for Xposed Additions. It seems that I also need the Xposed framework, but since I don't use a custom ROM, as far as I understand, I cannot install it.
- Manual edit of the keymap. There have been a number of tutorials online on how to change the keymap. I'm pretty sure the one I'd have to change is the /system/usr/keylayout/mhl-rcp.kl. When I try to save any edits though, it tells me that I can't. I guess that this is because it's a kind of system file, but I imagined I'd be able to edit it after having rooted my device.
I'm a little frustrated after all this work just for one tiny change that I still couldn't achieve so fat. But if you have a possible solution, I will try it. I would however like to keep my current (non-custom) firmware if possible (never change a running system...).
I'm very thankful for your suggestions!
Click to expand...
Click to collapse
You can use Xposed on stock with root. You'll need root for sure. Also, button savior pro...
thekryz said:
Hello everyone,
the Power button of my Sony Z1 Compact is broken and only works when pressed very very intensely. Since I don't use the camera button at all, I would like to use it as my new power button - I'd like to remap the physical camera button to the funcionality of the POWER-Button.
!
Click to expand...
Click to collapse
Button savior free from Play Store gives you on-screen power menu functionality. Pro version can remap.
einfachgaer said:
If you are 100% sure you found the right file to change manually, copy that file to your sd card and modify it there.
After you are done, backup your original file and replace it with the new one. Don't forget to change permissions after copying in!!
Then reboot and try.
Click to expand...
Click to collapse
I tried, but it wouldn't let me paste the file back into the system-directory... am I doing something fundamentaly wrong here?
levone1 said:
You can use Xposed on stock with root. You'll need root for sure. Also, button savior pro...
Click to expand...
Click to collapse
How? When I want to download the Xposed framework it gives me the following information:
Code:
xposed*.zip from [url]http://dl-xda.xposed.info/framework/:[/url] Must be flashed with a custom recovery (e.g. TWRP) to install the framework.
SDK21 is Android 5.0 (Lollipop), SDK22 is Android 5.1 (also Lollipop) and SDK23 is Android 6.0 (Marshmallow).
I only support the latest Xposed version!
levone1 said:
You can use Xposed on stock with root. You'll need root for sure. Also, button savior pro...
Click to expand...
Click to collapse
levone1 said:
Button savior free from Play Store gives you on-screen power menu functionality. Pro version can remap.
Click to expand...
Click to collapse
I just tried Button savior Pro - it can remap the buttons to a specified action / app, but not to an internal funcionality like the Power button funcionality, it seems.
thekryz said:
How? When I want to download the Xposed framework it gives me the following information
Click to expand...
Click to collapse
Right, custom recovery, not necessarily custom ROM. If you're rooted, just flash NUT dual recovery pc installer, then download Xposed SDK22 and flash.
Btw - I'm not sure that there is an Xposed module that will remap, but there are some that can provide power button funcionality on-screen.
thekryz said:
I tried, but it wouldn't let me paste the file back into the system-directory... am I doing something fundamentaly wrong here?
Click to expand...
Click to collapse
Seems like the file explorer you are using doesn't have proper root rights. Otherwise you should be able to do that.
You have to set the file system to read/write. If you're using Root Explorer, you can toggle this at the top, with the little "Mount R/W" button.

Categories

Resources