Intermittent A/C in 1995 Camry

I have a 1995 Toyota Camry. For the past two years or so, the A/C has been running intermittently. If the car has not been operating for a while (like overnight), the A/C will usually turn on at start-up and will run normally for anywhere between 15-40 minutes (on rare occasions, it will not turn on at all at startup, however). Once it fails, it will not be functional again, even if turned off for hours, until usually the next day. My only guesses are that either air is leaking into the system and causing it to freeze up, and/or there is some kind of electrical fault in the system (which would explain why on rare occasions it will not turn on at start-up at all).

I have taken it to two different mechanics, one of whom could not diagnose the problem and the other of whom said the air compressor needed to be replaced. I don’t understand the latter diagnosis, however, as a broken compressor usually sends debris throughout the air conditioning system, leaving the A/C permanently broken, and it will not continue to work for brief durations like mine. Also, the A/C switch itself on the dashboard is still functional even after the system stops blowing cold air (in other words, the compressor will still visibly turn off and on in response to this button even though it is not blowing cold air, making me believe the problem is elsewhere).

Does anyone have any ideas of how this can be resolved?