Fighting for "heads down" time is a worthwhile endeavor. You will never be able to have 100% heads down time, but even a 2-3 hour uninterrupted block in the afternoon is a wonderful thing.
The problem I've had with trying to establish signals that I am heads down (e.g. putting up a sign, headphones are on, hoodie is up, etc etc) is that I will inevitably still get interrupted, and I will be angrier than usual when it happens. An interruption can be small as folks popping their heads over your cubicle wall to "see if you are busy". This drove me crazy, so I stopped doing it.
Another thing I've tried with little to no success: blocking off times on your calendar. People will figure it out and book over it.
Requesting days to work from home or a coffee shop (if possible with your job) is a great option, and I've found that I am way less irritated at interruptions when I regularly take days at home. People are way less likely to pick up a phone and call you.
Another good option, if your office has the available space, is to take over a small conference room every now and then. For this to work, you can't do it every day. Otherwise, folks will start to treat it like an office, and knock or peek through windows to see if you're busy.
But the best advice is to have honest and regular discussions with the offenders. Try not to be angry about it, and try to understand their point of view. If it works, the effect will wear off, and you'll have to remind them every now and then, but I've found this to be the most effective strategy. I usually ask people to Slack me, and promise them that I'll check Slack and respond to them in at least 30 mins. Those incoming messages may break up your heads down time, but you can at least silence them until you finish your current code :)
The problem I've had with trying to establish signals that I am heads down (e.g. putting up a sign, headphones are on, hoodie is up, etc etc) is that I will inevitably still get interrupted, and I will be angrier than usual when it happens. An interruption can be small as folks popping their heads over your cubicle wall to "see if you are busy". This drove me crazy, so I stopped doing it.
Another thing I've tried with little to no success: blocking off times on your calendar. People will figure it out and book over it.
Requesting days to work from home or a coffee shop (if possible with your job) is a great option, and I've found that I am way less irritated at interruptions when I regularly take days at home. People are way less likely to pick up a phone and call you.
Another good option, if your office has the available space, is to take over a small conference room every now and then. For this to work, you can't do it every day. Otherwise, folks will start to treat it like an office, and knock or peek through windows to see if you're busy.
But the best advice is to have honest and regular discussions with the offenders. Try not to be angry about it, and try to understand their point of view. If it works, the effect will wear off, and you'll have to remind them every now and then, but I've found this to be the most effective strategy. I usually ask people to Slack me, and promise them that I'll check Slack and respond to them in at least 30 mins. Those incoming messages may break up your heads down time, but you can at least silence them until you finish your current code :)
Hope this helps!