Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/gnome-shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,17 @@
}
},
"./ui/ripples/ambient": "./dist/ui/ripples-ambient.d.ts",
"./ui/screenShield": {
"import": {
"types": "./dist/ui/screenShield.d.ts",
"default": "./dist/ui/screenShield.js"
},
"require": {
"types": "./dist/ui/screenShield.d.ts",
"default": "./dist/ui/screenShield.cjs"
}
},
"./ui/screenShield/ambient": "./dist/ui/screenShield-ambient.d.ts",
"./ui/search": {
"import": {
"types": "./dist/ui/search.d.ts",
Expand All @@ -732,6 +743,17 @@
}
},
"./ui/searchController/ambient": "./dist/ui/searchController-ambient.d.ts",
"./ui/sessionMode": {
"import": {
"types": "./dist/ui/sessionMode.d.ts",
"default": "./dist/ui/sessionMode.js"
},
"require": {
"types": "./dist/ui/sessionMode.d.ts",
"default": "./dist/ui/sessionMode.cjs"
}
},
"./ui/sessionMode/ambient": "./dist/ui/sessionMode-ambient.d.ts",
"./ui/slider": {
"import": {
"types": "./dist/ui/slider.d.ts",
Expand Down
17 changes: 12 additions & 5 deletions packages/gnome-shell/src/ui/main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import { LayoutManager, UiActor } from './layout.js';
import { NotificationDaemon } from './notificationDaemon.js';
// import * as WindowAttentionHandler from './windowAttentionHandler.js';
// import * as Screenshot from './screenshot.js';
// import * as ScreenShield from './screenShield.js';
import { ScreenShield } from './screenShield.js';
// import * as Scripting from './scripting.js';
// import * as SessionMode from './sessionMode.js';
import { SessionMode } from './sessionMode.js';
// import * as ShellDBus from './shellDBus.js';
// import * as ShellMountOperation from './shellMountOperation.js';
// import * as TimeLimitsManager from '../misc/timeLimitsManager.js';
Expand Down Expand Up @@ -68,7 +68,7 @@ export declare const wm: WindowManager;

export declare const messageTray: MessageTray;

export declare const screenShield: any;
export declare const screenShield: ScreenShield;

export declare const notificationDaemon: NotificationDaemon;

Expand All @@ -82,7 +82,7 @@ export declare const osdWindowManager: any;

export declare const osdMonitorLabeler: any;

export declare const sessionMode: any;
export declare const sessionMode: SessionMode;

export declare const screenshotUI: any;

Expand All @@ -100,7 +100,14 @@ export declare const modalCount: any;

export declare const actionMode: Shell.ActionMode.NONE;

export declare const modalActorFocusStack: any[];
export declare const modalActorFocusStack: {
actor: Clutter.Actor;
grab: Clutter.Grab;
destroyId: number;
prevFocus: Clutter.Actor | null;
prevFocusDestroyId: number | undefined;
actionMode: Shell.ActionMode;
}[];

export declare const screenTimeDBus: any;

Expand Down
150 changes: 150 additions & 0 deletions packages/gnome-shell/src/ui/screenShield.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/screenShield.js

import Clutter from 'gi://Clutter';
import Gio from '@girs/gio-2.0';
import Meta from 'gi://Meta';
import St from 'gi://St';

import * as Signals from '../misc/signals.js';

import * as GnomeSession from '../misc/gnomeSession.js';
// import * as OVirt from '../gdm/oVirt.js';
import * as LoginManager from '../misc/loginManager.js';
import * as Lightbox from './lightbox.js';
import * as Main from './main.js';
import * as MessageTray from './messageTray.js';
// import * as ShellDBus from './shellDBus.js';
// import * as SmartcardManager from '../gdm/smartcardManager.js';

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/screenShield.js#L50
* @version 51
*/
export namespace ScreenShield {
interface SignalMap {
'active-changed': [];
'locked-changed': [];
'lock-screen-shown': [];
'wake-up-screen': [];
}
}

/**
* If you are setting org.gnome.desktop.session.idle-delay directly in dconf,
* rather than through System Settings, you also need to set
* org.gnome.settings-daemon.plugins.power.sleep-display-ac and
* org.gnome.settings-daemon.plugins.power.sleep-display-battery to the same value.
* This will ensure that the screen blanks at the right time when it fades out.
* https://bugzilla.gnome.org/show_bug.cgi?id=668703 explains the dependency.
*
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/screenShield.js#L50
* @version 51
*/
export class ScreenShield<S extends Signals.SignalMap<S> = ScreenShield.SignalMap> extends Signals.EventEmitter<S> {
actor: typeof Main.layoutManager.screenShieldGroup;
idleMonitor: Meta.IdleMonitor;

_lockScreenState: MessageTray.State;
_lockScreenGroup: St.Widget;
_lockDialogGroup: St.Widget;
_presence: Gio.DBusProxy & GnomeSession.PresenceIface;
_screenSaverDBus: any;
_smartcardManager: any;
_credentialManagers: { [key: string]: any };
_loginManager: LoginManager.LoginManagerSystemd | LoginManager.LoginManagerDummy;
_loginSession: Gio.DBusProxy | null;
_settings: Gio.Settings;
_lockSettings: Gio.Settings;
_grab: Clutter.Grab | null;
_isGreeter: boolean;
_isActive: boolean;
_isLocked: boolean;
_inUnlockAnimation: boolean;
_inhibited: boolean;
_activationTime: number;
_becameActiveId: number;
_lockTimeoutId: number;
/**
* The "long" lightbox is used for the longer (20 seconds) fade from session
* to idle status.
*/
_longLightbox: Lightbox.Lightbox;
/**
* The "short" lightbox is used for quickly fading to black when locking
* manually.
*/
_shortLightbox: Lightbox.Lightbox;
_cursorTracker: Meta.CursorTracker;
_motionListener: Clutter.MotionController;

_getLoginSession(): Promise<void>;

_setActive(active: boolean): void;

_setLocked(locked: boolean): void;

_activateDialog(): void;

_maybeCancelDialog(): void;

_becomeModal(): void;

_syncInhibitor(): Promise<void>;

_prepareForSleep(loginManager: LoginManager.LoginManagerSystemd | LoginManager.LoginManagerDummy, aboutToSuspend: boolean): void;

_onStatusChanged(status: GnomeSession.PresenceStatus): void;

_activateFade(lightbox: Lightbox.Lightbox, time: number): void;

_onUserBecameActive(): void;

_onLongLightbox(lightBox: Lightbox.Lightbox): void;

_onShortLightbox(lightBox: Lightbox.Lightbox): void;

showDialog(): void;

_hideLockScreenComplete(): void;

_showPointer(): void;

_hidePointer(): void;

_hidePointerUntilMotion(): void;

_hideLockScreen(animate: boolean): void;

_ensureUnlockDialog(allowCancel: boolean): boolean;

_onUnlockFailed(): void;

_resetLockScreen(params: { animateLockScreen: boolean; fadeToBlack: boolean }): void;

_lockScreenShown(params: { animateFade: boolean; fadeToBlack: boolean }): void;

_wakeUpScreen(): void;

get locked(): boolean;

get active(): boolean;

get activationTime(): number;

deactivate(animate: boolean): void;

_continueDeactivate(animate: boolean): void;

_completeDeactivate(): void;

activate(animate: boolean): void;

addCredentialManager(serviceName: string, credentialManager: any): void;

removeCredentialManager(serviceName: string): void;

lock(animate: boolean): void;

/** If the previous shell crashed, and gnome-session restarted us, then re-lock */
lockIfWasLocked(): void;
}
129 changes: 129 additions & 0 deletions packages/gnome-shell/src/ui/sessionMode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/sessionMode.js

import St from 'gi://St';
import * as Signals from '../misc/signals.js';

declare type Modes = {
restrictive: {
parentMode: null;
stylesheetName: 'gnome-shell.css';
colorScheme: 'prefer-dark';
themeResourceName: 'gnome-shell-theme.gresource';
hasOverview: false;
showCalendarEvents: false;
showWelcomeDialog: false;
allowSettings: false;
allowScreencast: false;
enabledExtensions: [];
hasRunDialog: false;
hasWorkspaces: false;
hasWindows: false;
hasNotifications: false;
hasWmMenus: false;
isLocked: false;
isGreeter: false;
isPrimary: false;
unlockDialog: null;
components: [];
panel: {
left: [];
center: [];
right: [];
};
panelStyle: null;
};

gdm: {
hasNotifications: true;
isGreeter: true;
isPrimary: true;
unlockDialog: St.Widget;
components: ['networkAgent', 'polkitAgent'] | ['polkitAgent'];
panel: {
left: [];
center: ['dateMenu'];
right: ['dwellClick', 'keyboard', 'quickSettings'];
};
panelStyle: 'login-screen';
};

'unlock-dialog': {
isLocked: true;
unlockDialog: undefined;
components: ['networkAgent', 'polkitAgent'] | ['polkitAgent'];
panel: {
left: [];
center: [];
right: ['dwellClick', 'a11y', 'keyboard', 'quickSettings'];
};
panelStyle: 'unlock-screen';
};

user: {
hasOverview: true;
showCalendarEvents: true;
showWelcomeDialog: true;
allowSettings: true;
allowScreencast: true;
hasRunDialog: true;
hasWorkspaces: true;
hasWindows: true;
hasWmMenus: true;
hasNotifications: true;
isLocked: false;
isPrimary: true;
unlockDialog: St.Widget;
components: ['polkitAgent', 'keyring', 'autorunManager', 'automountManager', 'networkAgent'?];
panel: {
left: ['activities'];
center: ['dateMenu'];
right: ['screenRecording', 'screenSharing', 'dwellClick', 'a11y', 'keyboard', 'quickSettings'];
};
};
};

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/sessionMode.js#L139
* @version 51
*/
export function listModes(): void;

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/sessionMode.js#L154
* @version 51
*/
export namespace SessionMode {
interface SignalMap {
updated: [];
}
}

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/sessionMode.js#L154
* @version 51
*/
export class SessionMode<Mode extends string = keyof Modes, S extends Signals.SignalMap<S> = SessionMode.SignalMap> extends Signals.EventEmitter<S> {
_modeStack: Mode[];

pushMode(mode: Mode): void;

popMode(mode: Mode): void;

switchMode(to: Mode): void;

get currentMode(): Mode;

// Merges the fields of currentMode into this.
_sync(): void;
}

type ModeFields = Modes[keyof Modes];
type SessionModeFields = {
[K in keyof ModeFields]: ModeFields[K];
};

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/sessionMode.js#L154
* @version 51
*/
export interface SessionMode extends SessionModeFields {}