Can I decompose a component in all layers with a simple script?
Yes; put this in your Macro Window and press Run:
currentGlyph = Layer.parent for thisLayer in currentGlyph.layers: thisLayer.decomposeComponents()
how could this be rewritten, so it could be applied to a selection of glyphs in font view?
Why not select and Glyph > Decompose Components?
because, decomposing all masters at once helps a lot, when working on very master intensive fonts.
and this script could be super helpful if it could be applied to a selection of glyphs in font view…
selectedGlyphs = [l.parent for l in Font.selectedLayers] for glyph in selectedGlyphs: for layer in glyph.layers: layer.decomposeComponents()