On the same computer, if I boot into Windows, once I paired the controller by pressing Share + PS button, from next time, I can just press the PS button to reconnect the controller. Retroarch also automatically detected that it is a PS4 controller and set up the input. I had not installed any special software for the PS controller on Windows, so it was just out-of-the-box.
However, if I boot into Gnome Manjaro and pair the controller by pressing Share + PS button. Pressing the PS button next time does not reconnect. I can go to the Bluetooth settings and tick the Connect toggle button, but it immediately goes back to disconnected mode. From my testing, it seems that I have to remove the paired one and reconnect from the beginning by Share + PS button. Of course, I did not boot into Windows or pair the controller to any other device between the Manjaro connections. Why is this so? Is it a bug of Linux?
Also, Retroarch on Linux did not detect that it is a PS 4 controller but just show “Wireless controller” and I had to configure all buttons manually.