....Hitting things with weapon (or unarmed) attacks restores/builds focus. These attacks can be either melee or ranged. Cipher is not a "pure caster" class.
You also begin each combat with a certain amount of "initial focus" that is determined by what type of Cipher you're playing - Soul Blade's get less, Ascended get more, and Beguilers and no subclass Ciphers get a medium amount.
You can also regain focus by smacking/shooting barrels and the like, so long as its an "attack" (be it weapon or unarmed) and not a "cast". i.e. basic attacks and martial class skills.