Configure grub2 for dual boot with windows

This is how you can add Windows option in grub2 on dual boot. This is for UEFI/GPT only, and linux boot partition must be first on the disk (gpt0)

First navigate and open file 40_custom (as root):

                
vim /etc/grub.d/40_custom                    
                
            

Add the following lines

                
menuentry 'Windows10' {
    insmod part_gpt
    insmod ntfs
    insmod chain
    set root='(hd0,gpt3)' ## in my case, gpt3 here is my windows efi-boot partition, you must set your own
    chainloader ($root)/EFI/Microsoft/Boot/bootx64.efi
    }                       
                
            

Mind this part

                
chainloader ($root)/EFI/Microsoft/Boot/bootx64.efi            
                
            

/EFI/Microsoft/Boot/bootx64.efi is path on Microsoft's efi partition, and it might be different for you. Change it accordingly. You can mount the partition in some folder to view its content.
Finally, execute the following command in the console.

                
grub2-mkconfig -o /boot/grub2/grub.cfg           
                
            

Done! Special thanks to Dragan for this one.