You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
586 B

/**
* ScreenModeAware module
*
* @author Deminder <tremminder@gmail.com>
* @copyright 2021
* @license GNU General Public License v3.0
*/
/* exported load, unload */
const Main = imports.ui.main;
let sessionId = null;
/**
*
* @param onSessionModeChange
*/
function load(onSessionModeChange) {
if (sessionId === null) {
sessionId = Main.sessionMode.connect('updated', session =>
onSessionModeChange(session.currentMode)
);
}
}
/**
*
*/
function unload() {
if (sessionId !== null) {
Main.sessionMode.disconnect(sessionId);
sessionId = null;
}
}