Some motherboards are configured to use Windows as their default boot OS. They look for first efi drive that is normally /dev/sda1 and choose windows boot loader file as default.
There are some ways to get away with that problem, i.e in this post I shared how we can default boot grub instead of windows, but that is not permanent solution. When windows ll be booted the boot menu ll be restored to default.
So how to resolve this problem permanently?
Finally I found a way to permanently fix that problem, it is a kind of trick to deceive mother board. Instead of having one efi drive we need to create two, as motherboard ll always look for first efi drive so we install linux / grub boot into first efi drive and install windows boot files into second efi drive. In that case motherboard ll always find linux boot/grub as default and ll load it.
So after installing windows and linux, create a second efi drive, mount it in fstab as /boot2 this is necessary for bootloader to search for windows when using os prober.
Move windows related entries from first efi drive to second efi drive. You can just move whole /EFI/Microsoft directory to second /efi drive.
Here is how first efi drive should look like
And here is how second efi drive should look like
Mount both efi drives so os prober can find them.
After move windows boot files to second efi update your grub.
grub-mkconfig -o /boot/grub/grub.cfg
Finally your /boot/grub/grub.cfg should look like this
You can edit /boot/grub/grub.cfg file to correct paths for boot files of windows.