Sorry i say this, but when i read your post i had to laugh a bit ;) You cannot just attack from every position. Patience is the answer, in your example you just weaken your own kingsafety with g4 ?? When you improve you will notice stronger players always play solid games with no real direct/fixed weaknesses and you need to comeup with a long term plan/idea to continue instead of some cheap/quick attack.
In your case you can plan for example to(without calculating anything just ideas) go for more space by pushing b4 or come up with a plan to push d4 or f4 as a break move. Preparing f4 might be a good idea because your Bishop is on c4 pressing f7 so he cannot play f5 as counter directly.
Ofcourse direct b4 and f4 are not good/possible so you need to make a plan to continue. For example first a3 or Rb1 or Nh2(preparing f4). Just look into a game for ideas/theme's what you want to play and from there you think how you can make this a reality.
I usually play the Italian game, but I noticed in a lot of games, if one of the crazy attacks doesn't happen, then I am stuck in this fully developed position and my opponent is secured and there's no real attack unless my opponent blunders/mistakes.
How do you initiate an attack from this, and what's the main idea and principles here?
This is the only way I know how to attack afterwards. Some don't work at all.