The Shulchan Aruch · Orach Chayim
אורח חיים ב׳Orach Chayim 2
Siman 2 of 697 in Orach Chayim — 6 se'ifim
הלכות הנהגת האדם בבוקרLaws Upon Awakening in the Morning· siman 2
Se’if 1א׳
לֹא יִלְבַּשׁ חֲלוּקוֹ מְיֻשָּׁב (טוּר) אֶלָּא יִקַּח חֲלוּקוֹ וְיַכְנִיס בּוֹ (רֹאשׁוֹ וּ) זְרוֹעוֹתָיו בְּעוֹדֶנּוּ שׁוֹכֵב, וְנִמְצָא כְּשֶׁיָּקוּם שֶׁהוּא מְכֻסֶה.
One should not put on his under-garment from a sitting position (Tur), but should rather take his under-garment and insert into it his (head and) arms while he is still lying down, with the result that when he gets up he is [already] covered.
Se’if 2ב׳
אַל יֹאמַר הִנְנִי בְּחַדְרֵי חֲדָרִים מִי רוֹאֵנִי, כִּי הָקָּבָּ"ה מְלֹא כָל הָאָרֶץ כְּבוֹדוֹ.
One should not say (to oneself): "I am now in an inner room - who can see me?", for the Holy One Blessed Be He, "His glory fills the whole earth" (Isaiah 6:3).
Se’if 3ג׳
יְדַקְדֵּק בַּחֲלוּקוֹ לְלָבְשׁוֹ כְּדַרְכּוֹ שֶׁלֹּא יַהֲפֹךְ הַפְּנִימִי לַחוּץ.
One should be particular to put on the undergarment the way it goes, so that it he should not turn it inside out.
Shulchan Aruch, Orach Chayim — Torat Emet 363 edition, via Sefaria — public domain
English: Shulchan Aruch, Wikisource, via Sefaria — CC BY-SA