How can i get the public key of my segwit address with my extended public key. when i import the xpub into electrum it automatically creates a legacy wallet for me. i'm not with my nano and won't be with it for a while, please how do i go about it, thanks.
You have to convert the xpub into p2wpkh or p2wpkh-p2sh format. You can use this script to do it.
You should change derive path to 49 instead of 44. if you are planning to use bech32 addresses then you should make your path 84 but it's not supported yet on electrum.