Normally un- with a verb means to reverse—“undo”—the previously-taken action of the verb. You “unscrew” a jar lid someone previously screwed on; you “unwrap” a package someone previously wrapped.
You can even use un- with verbs signifying actions normally regarded as irreversible—create or kill, for instance—as long as you are speaking or writing in a context where those verbs have non-literal meaning, such as game design.
But it is semantically awkward to use un- with activities or statives — verbs which signify actions without particular goal or existence in a particular state.
“Sleep” is normally a stative, so it can’t be reversed. Unsleep would be acceptable only in cases where sleep was being used transitively, with the sense “put to sleep”, or inchoatively, with the sense “fall asleep” —neither of which is in my experience used.
Programmers, of course, can name variables or methods with any words in any sense they like. They are “communicating” only with compilers, which aren’t encumbered with the linguistic rules which obtain in natural languages.
And of course you can coin unsleep and use it in any sense you like. That’s how the language grows. But if you use such nonce-words in an unconventional way you will run the risk of mis- or non-understanding.
Since you ask about sad: You have considerably more leeway in prefixing un- to adjectives, including adjectives formed from participles, because here un- bears more general negative senses. Unsleeping, for instance, is perfectly conventional: an ‘unsleeping’ watchman is one who is not sleeping, not one who ‘unsleeps’ someone else. An ‘unlicked cub’ is a cub which has not been licked, not one which has been ‘unlicked’. Un- can also be prefixed to nouns with a simple negative sense—unperson, for instance. Verbs can even be formed by prefixing a noun with un- in the sense of ‘deprive of’ (unstate) or ‘remove from’ (unearth).