Placing toggle controls in title bars

What are the pros and cons of placing controls in menu bars? This is an example from a Linux desktop environment:

enter image description here

enter image description here

I've personally found the placement of the controls in the title bar unexpected, after ~20+ years of Windows/Linux/web usage. Is this style common somewhere? I'd like to learn more about guidance in this area.