-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from swsnr/globals
Add global shell types
- Loading branch information
Showing
8 changed files
with
62 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type Shell from "@girs/shell-13"; | ||
|
||
declare global { | ||
/** | ||
* Global shell object created by GNOME Shell on startup. | ||
* | ||
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/8a8539ee6766058b39d0a5c0961a08f76799f4da/js/ui/environment.js#L253 | ||
*/ | ||
const global: Shell.Global; | ||
} | ||
|
||
// Gnome shell monkey-patches format into `String` which is the recommended way to use formatting for translatable strings. | ||
// See https://gjs.guide/extensions/development/translations.html#marking-strings-for-translation | ||
interface String { | ||
/** | ||
* Format this string with the given `args`. | ||
* | ||
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/8a8539ee6766058b39d0a5c0961a08f76799f4da/js/ui/environment.js#L355 | ||
* @param args | ||
*/ | ||
format(...args: any[]): string; | ||
} | ||
|
||
interface Math { | ||
/** | ||
* Returns {@link x} clamped to the inclusive range of {@link min} and {@link max}. | ||
* | ||
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/8a8539ee6766058b39d0a5c0961a08f76799f4da/js/ui/environment.js#L357 | ||
* @param x The value to be clamped. | ||
* @param min The lower bound of the result. | ||
* @param max The upper bound of the result. | ||
*/ | ||
clamp(x: number, min: number, max: number): number; | ||
} |