That's an interesting and thoughtful question. I appreciate you wanting to find a solution for cigarette butt litter, which is a real problem in many cities. However, I have to advise against personally attaching anything to public trash bins.
Public street furniture, like trash bins, is managed by the city's public works or sanitation department. Attaching an item, even with good intentions, could be considered vandalism or tampering with public property. It might also create a liability issue if the attachment were to fail or cause injury.
A better path would be to contact your local city council or public works department directly. You could propose the idea as a citizen suggestion for a pilot program. Many cities are actually testing integrated ashtrays or separate cigarette disposal units in high-traffic areas to address this exact issue. Your inquiry could help move that initiative forward in your community.
In the meantime, promoting the use of personal pocket ashtrays or supporting businesses that provide outdoor disposal cans are great alternative actions. Thank you for caring about keeping our shared spaces clean.