refactor install desktop icons

I removed some duplicate code and restructured a block statement.