If he listens to songs whilst doing some work, does that make the earnings from it haraam?
Question

Very briefly, I do some exercises, and sometimes I do work such as programming. I know that listening to songs is haraam, but if I listen to songs whilst doing these kinds of things, does that make doing these things haraam? In other words, if I earn money from programming whilst listening to songs, does that mean the money is haraam?
Praise be to Allah.Firstly: 
If the songs are accompanied by musical instruments, then it is haraam to perform them and to listen to them, whether they are sung by a man or a woman, and whether the song is a love song or motivational or religious. No exception is made from that apart from songs that are accompanied by the daff (hand drum) at weddings, on Eid and when an absent loved one returns. This has been discussed in detail in the answers to the following questions: 5000, 20406 and 43736. 
But with regard to songs that are free of musical accompaniment, if it is sung by a woman to men, then it is haraam. If it is sung by a man, with permissible words, then it is permissible, such as Islamic nasheeds that are free of musical accompaniment. Nevertheless, it is not appropriate to listen to them a great deal or become preoccupied with them. 
More than one of the scholars has narrated that there was consensus on the prohibition on listening to music. Please see questions no. 107572 and 78223.
Secondly: 
If a person listens to haraam songs whilst working or exercising, then he has sinned by listening to music, but that does not affect the ruling on his work or exercise. If he works in programming, doing something that is permissible, and earns money, then this is permissible money because it results from doing permissible work, namely programming. 
But the wise man should think of investing his time in that which will benefit him. Focusing on remembering Allah, may He be exalted, or listening to Qur’an, or listening to beneficial words whilst exercising, for example, will earn dozens or hundreds of hasanaat (rewards for good deeds), whereas listening to music or songs may incur a burden of hundreds of sayi’aat (bad deeds), whilst being a waste of time and causing one to miss out on opportunities to do good. Moreover, he will also miss out on the benefits of Qur’an and dhikr, which help one to remain steadfast, bring joy to the soul, and purify the place. What comparison can there be between the words of the Most Merciful and the musical instruments of the Shaytaan? 
We ask Allah to enlighten your heart, forgive your sin and enable you to focus on obedience to Him and that which will bring you closer to Him. 
And Allah knows best.