feat: make AGS colorshell configuration fully declarative

- Add complete colorshell v2.0.3 configuration to home/ags-config/
- Disable runner plugin and NightLight tile (incompatible with NixOS)
- Customize SCSS with full opacity (no transparency)
- Add dark pale blue color scheme in home/pywal-colors/
- Configure Papirus-Dark icon theme via home-manager
- Make ~/.config/ags/ immutable and managed by Nix store
- Auto-deploy pywal colors to ~/.cache/wal/colors.json

All AGS configuration is now reproducible and version controlled.
This commit is contained in:
2025-11-04 21:36:38 +00:00
parent 593735370a
commit b2ae32a078
240 changed files with 1024921 additions and 3 deletions

View File

@@ -0,0 +1,980 @@
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://AccountsService?version=1.0' {
// Module dependencies
import type Gio from 'gi://Gio?version=2.0';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
export namespace AccountsService {
/**
* AccountsService-1.0
*/
/**
* Type of user account
*/
/**
* Type of user account
*/
export namespace UserAccountType {
export const $gtype: GObject.GType<UserAccountType>;
}
enum UserAccountType {
/**
* Normal non-administrative user
*/
STANDARD,
/**
* Administrative user
*/
ADMINISTRATOR,
}
/**
* Various error codes returned by the accounts service.
*/
class UserManagerError extends GLib.Error {
static $gtype: GObject.GType<UserManagerError>;
// Static fields
/**
* Generic failure
*/
static FAILED: number;
/**
* The user already exists
*/
static USER_EXISTS: number;
/**
* The user does not exist
*/
static USER_DOES_NOT_EXIST: number;
/**
* Permission denied
*/
static PERMISSION_DENIED: number;
/**
* Operation not supported
*/
static NOT_SUPPORTED: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
/**
* Mode for setting the user's password.
*/
/**
* Mode for setting the user's password.
*/
export namespace UserPasswordMode {
export const $gtype: GObject.GType<UserPasswordMode>;
}
enum UserPasswordMode {
/**
* Password set normally
*/
REGULAR,
/**
* Password will be chosen at next login
*/
SET_AT_LOGIN,
/**
* No password set
*/
NONE,
}
function user_manager_error_quark(): GLib.Quark;
namespace User {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
changed: () => void;
'sessions-changed': () => void;
'notify::account-type': (pspec: GObject.ParamSpec) => void;
'notify::automatic-login': (pspec: GObject.ParamSpec) => void;
'notify::email': (pspec: GObject.ParamSpec) => void;
'notify::home-directory': (pspec: GObject.ParamSpec) => void;
'notify::icon-file': (pspec: GObject.ParamSpec) => void;
'notify::is-loaded': (pspec: GObject.ParamSpec) => void;
'notify::language': (pspec: GObject.ParamSpec) => void;
'notify::local-account': (pspec: GObject.ParamSpec) => void;
'notify::location': (pspec: GObject.ParamSpec) => void;
'notify::locked': (pspec: GObject.ParamSpec) => void;
'notify::login-frequency': (pspec: GObject.ParamSpec) => void;
'notify::login-history': (pspec: GObject.ParamSpec) => void;
'notify::login-time': (pspec: GObject.ParamSpec) => void;
'notify::nonexistent': (pspec: GObject.ParamSpec) => void;
'notify::password-hint': (pspec: GObject.ParamSpec) => void;
'notify::password-mode': (pspec: GObject.ParamSpec) => void;
'notify::real-name': (pspec: GObject.ParamSpec) => void;
'notify::shell': (pspec: GObject.ParamSpec) => void;
'notify::system-account': (pspec: GObject.ParamSpec) => void;
'notify::uid': (pspec: GObject.ParamSpec) => void;
'notify::user-name': (pspec: GObject.ParamSpec) => void;
'notify::x-session': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
account_type: number;
accountType: number;
automatic_login: boolean;
automaticLogin: boolean;
email: string;
home_directory: string;
homeDirectory: string;
icon_file: string;
iconFile: string;
is_loaded: boolean;
isLoaded: boolean;
language: string;
local_account: boolean;
localAccount: boolean;
location: string;
locked: boolean;
login_frequency: number;
loginFrequency: number;
login_history: GLib.Variant;
loginHistory: GLib.Variant;
login_time: number;
loginTime: number;
nonexistent: boolean;
password_hint: string;
passwordHint: string;
password_mode: number;
passwordMode: number;
real_name: string;
realName: string;
shell: string;
system_account: boolean;
systemAccount: boolean;
uid: number;
user_name: string;
userName: string;
x_session: string;
xSession: string;
}
}
/**
* Represents a user account on the system.
*/
class User extends GObject.Object {
static $gtype: GObject.GType<User>;
// Properties
get account_type(): number;
get accountType(): number;
get automatic_login(): boolean;
get automaticLogin(): boolean;
get email(): string;
get home_directory(): string;
get homeDirectory(): string;
get icon_file(): string;
get iconFile(): string;
get is_loaded(): boolean;
get isLoaded(): boolean;
/**
* The users locale, in the format
* `language[_territory][.codeset][`modifier]``, where `language` is an
* ISO 639 language code, `territory` is an ISO 3166 country code, and
* `codeset` is a character set or encoding identifier like `ISO-8859-1`
* or `UTF-8`; as specified by [`setlocale(3)`](man:setlocale(3)).
*
* The locale may be the empty string, which means the user is using the
* system default locale.
*
* The property may be %NULL if it wasnt possible to load it from the
* daemon.
*/
get language(): string;
get local_account(): boolean;
get localAccount(): boolean;
get location(): string;
get locked(): boolean;
get login_frequency(): number;
get loginFrequency(): number;
get login_history(): GLib.Variant;
get loginHistory(): GLib.Variant;
get login_time(): number;
get loginTime(): number;
get nonexistent(): boolean;
get password_hint(): string;
get passwordHint(): string;
get password_mode(): number;
get passwordMode(): number;
get real_name(): string;
get realName(): string;
get shell(): string;
get system_account(): boolean;
get systemAccount(): boolean;
get uid(): number;
get user_name(): string;
get userName(): string;
get x_session(): string;
get xSession(): string;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: User.SignalSignatures;
// Constructors
constructor(properties?: Partial<User.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect<K extends keyof User.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, User.SignalSignatures[K]>,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after<K extends keyof User.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, User.SignalSignatures[K]>,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit<K extends keyof User.SignalSignatures>(
signal: K,
...args: GObject.GjsParameters<User.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* Organize the user by login frequency and names.
* @param user2 a user
* @returns negative if @user1 is before @user2, zero if equal or positive if @user1 is after @user2
*/
collate(user2: User): number;
/**
* Retrieves the account type of `user`.
* @returns a #ActUserAccountType
*/
get_account_type(): UserAccountType;
/**
* Returns whether or not #ActUser is automatically logged in at boot time.
* @returns %TRUE or %FALSE
*/
get_automatic_login(): boolean;
/**
* Retrieves the email address set by `user`.
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
*/
get_email(): string;
/**
* Retrieves the home directory for `user`.
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
*/
get_home_dir(): string;
/**
* Returns the path to the account icon belonging to `user`.
* @returns a path to an icon
*/
get_icon_file(): string;
/**
* Returns the value of #ActUser:language.
* @returns the users language, or the empty string if they are using the system default language, or %NULL if there is no connection to the daemon
*/
get_language(): string | null;
/**
* Returns the value of #ActUser:languages.
* @returns the users preferred languages, or the empty string if they are using the system default language, or %NULL if there is no connection to the daemon
*/
get_languages(): string[] | null;
/**
* Retrieves the location set by `user`.
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
*/
get_location(): string;
/**
* Returns whether or not the #ActUser account is locked.
* @returns %TRUE or %FALSE
*/
get_locked(): boolean;
/**
* Returns the number of times `user` has logged in.
* @returns the login frequency
*/
get_login_frequency(): number;
/**
* Returns the login history for `user`.
* @returns a pointer to GVariant of type "a(xxa{sv})" which must not be modified or freed, or %NULL.
*/
get_login_history(): GLib.Variant;
/**
* Returns the last login time for `user`.
* @returns the login time
*/
get_login_time(): number;
/**
* Get the number of sessions for a user that are graphical and on the
* same seat as the session of the calling process.
* @returns the number of sessions
*/
get_num_sessions(): number;
/**
* Get the number of sessions for a user on any seat of any type.
* See also act_user_get_num_sessions().
*
* (Currently, this function is only implemented for systemd-logind.
* For ConsoleKit, it is equivalent to act_user_get_num_sessions.)
* @returns the number of sessions
*/
get_num_sessions_anywhere(): number;
/**
* Returns the user accounts service object path of `user,`
* or %NULL if `user` doesn't have an object path associated
* with it.
* @returns the object path of the user
*/
get_object_path(): string;
/**
* Get the password expiration policy for a user.
*
* Note this function is synchronous and ignores errors.
*/
get_password_expiration_policy(): [number, number, number, number, number, number];
/**
* Retrieves the password hint set by `user`.
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
*/
get_password_hint(): string;
/**
* Retrieves the password mode of `user`.
* @returns a #ActUserPasswordMode
*/
get_password_mode(): UserPasswordMode;
/**
* Returns the id of the primary session of `user,` or %NULL if `user`
* has no primary session. The primary session will always be
* graphical and will be chosen from the sessions on the same seat as
* the seat of the session of the calling process.
* @returns the id of the primary session of the user
*/
get_primary_session_id(): string;
/**
* Retrieves the display name of `user`.
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
*/
get_real_name(): string;
/**
* Returns whether or not the #ActUser account has retained state in accountsservice.
* @returns %TRUE or %FALSE
*/
get_saved(): boolean;
/**
* Returns the path to the configured session for `user`.
* @returns a path to an icon
*/
get_session(): string;
/**
* Returns the type of the configured session for `user`.
* @returns a path to an icon
*/
get_session_type(): string;
/**
* Retrieves the shell assigned to `user`.
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
*/
get_shell(): string;
/**
* Retrieves the ID of `user`.
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
*/
get_uid(): never;
/**
* Retrieves the login name of `user`.
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
*/
get_user_name(): string;
/**
* Returns the path to the configured X session for `user`.
* @returns a path to an icon
*/
get_x_session(): string;
/**
* Retrieves whether the user is a local account or not.
* @returns %TRUE if the user is local
*/
is_local_account(): boolean;
/**
* Returns whether or not #ActUser is currently graphically logged in
* on the same seat as the seat of the session of the calling process.
* @returns %TRUE or %FALSE
*/
is_logged_in(): boolean;
/**
* Returns whether or not #ActUser is currently logged in in any way
* whatsoever. See also act_user_is_logged_in().
*
* (Currently, this function is only implemented for systemd-logind.
* For ConsoleKit, it is equivalent to act_user_is_logged_in.)
* @returns %TRUE or %FALSE
*/
is_logged_in_anywhere(): boolean;
/**
* Retrieves whether the user is nonexistent or not.
* @returns %TRUE if the user is nonexistent
*/
is_nonexistent(): boolean;
/**
* Returns whether or not #ActUser represents a 'system account' like
* 'root' or 'nobody'.
* @returns %TRUE or %FALSE
*/
is_system_account(): boolean;
/**
* Changes the account type of `user`.
*
* Note this function is synchronous and ignores errors.
* @param account_type a #ActUserAccountType
*/
set_account_type(account_type: UserAccountType | null): void;
/**
* If enabled is set to %TRUE then this user will automatically be logged in
* at boot up time. Only one user can be configured to auto login at any given
* time, so subsequent calls to act_user_set_automatic_login() override previous
* calls.
*
* Note this function is synchronous and ignores errors.
* @param enabled whether or not to autologin for user.
*/
set_automatic_login(enabled: boolean): void;
/**
* Assigns a new email to `user`.
*
* Note this function is synchronous and ignores errors.
* @param email an email address
*/
set_email(email: string): void;
/**
* Assigns a new icon for `user`.
*
* Note this function is synchronous and ignores errors.
* @param icon_file path to an icon
*/
set_icon_file(icon_file: string): void;
/**
* Assigns a new locale for `user,` setting #ActUser:language.
*
* Note this function is synchronous and ignores errors.
* @param language a locale (for example, `en_US.utf8`), or the empty string to use the system default locale
*/
set_language(language: string): void;
/**
* Assigns preferred languages for `user,` setting #ActUser:languages, and
* overriding #ActUser:language with the first item in the list if there is one.
*
* Note this function is synchronous and ignores errors.
* @param languages an array of locale (for example, `en_US.utf8`), or the empty string to use the system default locale
*/
set_languages(languages: string[]): void;
/**
* Assigns a new location for `user`.
*
* Note this function is synchronous and ignores errors.
* @param location a location
*/
set_location(location: string): void;
/**
* Note this function is synchronous and ignores errors.
* @param locked whether or not the account is locked
*/
set_locked(locked: boolean): void;
/**
* Changes the password of `user` to `password`.
* `hint` is displayed to the user if they forget the password.
*
* Note this function is synchronous and ignores errors.
* @param password a password
* @param hint a hint to help user recall password
*/
set_password(password: string, hint: string): void;
/**
* Set the password expiration policy for a user.
*
* Note this function is synchronous and ignores errors.
* @param min_days_between_changes location to write minimum number of days needed between password changes.
* @param max_days_between_changes location to write maximum number of days password can stay unchanged.
* @param days_to_warn location to write number of days to warn user password is about to expire.
* @param days_after_expiration_until_lock location to write number of days account will be locked after password expires.
*/
set_password_expiration_policy(
min_days_between_changes: number,
max_days_between_changes: number,
days_to_warn: number,
days_after_expiration_until_lock: number,
): void;
set_password_hint(hint: string): void;
/**
* Changes the password of `user`. If `password_mode` is
* ACT_USER_PASSWORD_MODE_SET_AT_LOGIN then the user will
* be asked for a new password at the next login. If `password_mode`
* is ACT_USER_PASSWORD_MODE_NONE then the user will not require
* a password to log in.
*
* Note this function is synchronous and ignores errors.
* @param password_mode a #ActUserPasswordMode
*/
set_password_mode(password_mode: UserPasswordMode | null): void;
/**
* Assigns a new name for `user`.
*
* Note this function is synchronous and ignores errors.
* @param real_name a new name
*/
set_real_name(real_name: string): void;
/**
* Assigns a new session for `user`.
*
* Note this function is synchronous and ignores errors.
* @param session a session (e.g. gnome)
*/
set_session(session: string): void;
/**
* Assigns a type to the session for `user`.
*
* Note this function is synchronous and ignores errors.
* @param session_type a type of session (e.g. "wayland" or "x11")
*/
set_session_type(session_type: string): void;
/**
* Set the user expiration policy for a user.
*
* Note this function is synchronous and ignores errors.
* @param expiration_time location to write users expires timestamp
*/
set_user_expiration_policy(expiration_time: number): void;
/**
* Assigns a new username for `user`.
*
* Note this function is synchronous and ignores errors.
* @param user_name a new user name
*/
set_user_name(user_name: string): void;
/**
* Assigns a new x session for `user`.
*
* Note this function is synchronous and ignores errors.
* @param x_session an x session (e.g. gnome)
*/
set_x_session(x_session: string): void;
}
namespace UserManager {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
'user-added': (arg0: User) => void;
'user-changed': (arg0: User) => void;
'user-is-logged-in-changed': (arg0: User) => void;
'user-removed': (arg0: User) => void;
'notify::exclude-usernames-list': (pspec: GObject.ParamSpec) => void;
'notify::has-multiple-users': (pspec: GObject.ParamSpec) => void;
'notify::include-usernames-list': (pspec: GObject.ParamSpec) => void;
'notify::is-loaded': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
exclude_usernames_list: any;
excludeUsernamesList: any;
has_multiple_users: boolean;
hasMultipleUsers: boolean;
include_usernames_list: any;
includeUsernamesList: any;
is_loaded: boolean;
isLoaded: boolean;
}
}
/**
* A user manager object.
*/
class UserManager extends GObject.Object {
static $gtype: GObject.GType<UserManager>;
// Properties
get exclude_usernames_list(): any;
set exclude_usernames_list(val: any);
get excludeUsernamesList(): any;
set excludeUsernamesList(val: any);
get has_multiple_users(): boolean;
set has_multiple_users(val: boolean);
get hasMultipleUsers(): boolean;
set hasMultipleUsers(val: boolean);
get include_usernames_list(): any;
set include_usernames_list(val: any);
get includeUsernamesList(): any;
set includeUsernamesList(val: any);
get is_loaded(): boolean;
get isLoaded(): boolean;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: UserManager.SignalSignatures;
// Constructors
constructor(properties?: Partial<UserManager.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect<K extends keyof UserManager.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, UserManager.SignalSignatures[K]>,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after<K extends keyof UserManager.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, UserManager.SignalSignatures[K]>,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit<K extends keyof UserManager.SignalSignatures>(
signal: K,
...args: GObject.GjsParameters<UserManager.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Static methods
/**
* Returns the user manager singleton instance. Calling this function will
* automatically being loading the user list if it isn't loaded already.
* The #ActUserManager:is-loaded property will be set to %TRUE when the users
* are finished loading and then act_user_manager_list_users() can be called.
*/
static get_default(): UserManager;
// Virtual methods
vfunc_user_added(user: User): void;
vfunc_user_changed(user: User): void;
vfunc_user_is_logged_in_changed(user: User): void;
vfunc_user_removed(user: User): void;
// Methods
/**
* Activate the session for a given user.
* @param user the user to activate
* @returns whether successfully activated
*/
activate_user_session(user: User): boolean;
/**
* Caches a user account so it shows up via act_user_manager_list_users().
* @param username a user name
* @returns user object
*/
cache_user(username: string): User;
/**
* Asynchronously caches a user account so it shows up via
* act_user_manager_list_users().
*
* For more details, see act_user_manager_cache_user(), which
* is the synchronous version of this call.
* @param username a unix user name
* @param cancellable optional #GCancellable object, %NULL to ignore
*/
cache_user_async(username: string, cancellable?: Gio.Cancellable | null): globalThis.Promise<User>;
/**
* Asynchronously caches a user account so it shows up via
* act_user_manager_list_users().
*
* For more details, see act_user_manager_cache_user(), which
* is the synchronous version of this call.
* @param username a unix user name
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
cache_user_async(
username: string,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback<this> | null,
): void;
/**
* Asynchronously caches a user account so it shows up via
* act_user_manager_list_users().
*
* For more details, see act_user_manager_cache_user(), which
* is the synchronous version of this call.
* @param username a unix user name
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
cache_user_async(
username: string,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback<this> | null,
): globalThis.Promise<User> | void;
/**
* Finishes an asynchronous user caching.
*
* See act_user_manager_cache_user_async().
* @param result a #GAsyncResult
* @returns user object
*/
cache_user_finish(result: Gio.AsyncResult): User;
/**
* Check whether the user can switch to another session.
* @returns whether we can switch to another session
*/
can_switch(): boolean;
/**
* Creates a user account on the system.
* @param username a unix user name
* @param fullname a unix GECOS value
* @param accounttype a #ActUserAccountType
* @returns user object
*/
create_user(username: string, fullname: string, accounttype: UserAccountType | null): User;
/**
* Asynchronously creates a user account on the system.
*
* For more details, see act_user_manager_create_user(), which
* is the synchronous version of this call.
* @param username a unix user name
* @param fullname a unix GECOS value
* @param accounttype a #ActUserAccountType
* @param cancellable optional #GCancellable object, %NULL to ignore
*/
create_user_async(
username: string,
fullname: string,
accounttype: UserAccountType | null,
cancellable?: Gio.Cancellable | null,
): globalThis.Promise<User>;
/**
* Asynchronously creates a user account on the system.
*
* For more details, see act_user_manager_create_user(), which
* is the synchronous version of this call.
* @param username a unix user name
* @param fullname a unix GECOS value
* @param accounttype a #ActUserAccountType
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
create_user_async(
username: string,
fullname: string,
accounttype: UserAccountType | null,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback<this> | null,
): void;
/**
* Asynchronously creates a user account on the system.
*
* For more details, see act_user_manager_create_user(), which
* is the synchronous version of this call.
* @param username a unix user name
* @param fullname a unix GECOS value
* @param accounttype a #ActUserAccountType
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
create_user_async(
username: string,
fullname: string,
accounttype: UserAccountType | null,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback<this> | null,
): globalThis.Promise<User> | void;
/**
* Finishes an asynchronous user creation.
*
* See act_user_manager_create_user_async().
* @param result a #GAsyncResult
* @returns user object
*/
create_user_finish(result: Gio.AsyncResult): User;
/**
* Deletes a user account on the system.
* @param user an #ActUser object
* @param remove_files %TRUE to delete the users home directory
* @returns %TRUE if the user account was successfully deleted
*/
delete_user(user: User, remove_files: boolean): boolean;
/**
* Asynchronously deletes a user account from the system.
*
* For more details, see act_user_manager_delete_user(), which
* is the synchronous version of this call.
* @param user a #ActUser object
* @param remove_files %TRUE to delete the users home directory
* @param cancellable optional #GCancellable object, %NULL to ignore
*/
delete_user_async(
user: User,
remove_files: boolean,
cancellable?: Gio.Cancellable | null,
): globalThis.Promise<boolean>;
/**
* Asynchronously deletes a user account from the system.
*
* For more details, see act_user_manager_delete_user(), which
* is the synchronous version of this call.
* @param user a #ActUser object
* @param remove_files %TRUE to delete the users home directory
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
delete_user_async(
user: User,
remove_files: boolean,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback<this> | null,
): void;
/**
* Asynchronously deletes a user account from the system.
*
* For more details, see act_user_manager_delete_user(), which
* is the synchronous version of this call.
* @param user a #ActUser object
* @param remove_files %TRUE to delete the users home directory
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
delete_user_async(
user: User,
remove_files: boolean,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback<this> | null,
): globalThis.Promise<boolean> | void;
/**
* Finishes an asynchronous user account deletion.
*
* See act_user_manager_delete_user_async().
* @param result a #GAsyncResult
* @returns %TRUE if the user account was successfully deleted
*/
delete_user_finish(result: Gio.AsyncResult): boolean;
/**
* Retrieves a pointer to the #ActUser object for the login `username`
* from `manager`. Trying to use this object before its
* #ActUser:is-loaded property is %TRUE will result in undefined
* behavior.
* @param username the login name of the user to get.
* @returns #ActUser object
*/
get_user(username: string): User;
/**
* Retrieves a pointer to the #ActUser object for the user with the
* given uid from `manager`. Trying to use this object before its
* #ActUser:is-loaded property is %TRUE will result in undefined
* behavior.
* @param id the uid of the user to get.
* @returns #ActUser object
*/
get_user_by_id(id: never): User;
/**
* Switch the display to the login manager.
* @returns whether successful or not
*/
goto_login_session(): boolean;
/**
* Get a list of system user accounts
* @returns List of #ActUser objects
*/
list_users(): User[];
/**
* Check whether or not the accounts service is running.
* @returns whether or not accounts service is running
*/
no_service(): boolean;
/**
* Releases all metadata about a user account, including icon,
* language and session. If the user account is from a remote
* server and the user has never logged in before, then that
* account will no longer show up in ListCachedUsers() output.
* @param username a user name
* @returns %TRUE if successful, otherwise %FALSE
*/
uncache_user(username: string): boolean;
uncache_user_async(username: string, cancellable?: Gio.Cancellable | null): globalThis.Promise<boolean>;
uncache_user_async(
username: string,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback<this> | null,
): void;
uncache_user_async(
username: string,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback<this> | null,
): globalThis.Promise<boolean> | void;
/**
* Finishes an asynchronous user uncaching.
*
* See act_user_manager_uncache_user_async().
* @param result a #GAsyncResult
* @returns %TRUE if the user account was successfully uncached
*/
uncache_user_finish(result: Gio.AsyncResult): boolean;
}
type UserClass = typeof User;
type UserManagerClass = typeof UserManager;
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default AccountsService;
}
declare module 'gi://AccountsService' {
import AccountsService10 from 'gi://AccountsService?version=1.0';
export default AccountsService10;
}
// END

3286
home/ags-config/@girs/astal-3.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

1922
home/ags-config/@girs/astal-4.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

1214
home/ags-config/@girs/astalio-0.1.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

10953
home/ags-config/@girs/atk-1.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

6908
home/ags-config/@girs/atspi-2.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

536
home/ags-config/@girs/cairo-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,536 @@
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://cairo?version=1.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
export namespace cairo {
/**
* cairo-1.0
*/
export namespace Status {
export const $gtype: GObject.GType<Status>;
}
enum Status {
SUCCESS,
NO_MEMORY,
INVALID_RESTORE,
INVALID_POP_GROUP,
NO_CURRENT_POINT,
INVALID_MATRIX,
INVALID_STATUS,
NULL_POINTER,
INVALID_STRING,
INVALID_PATH_DATA,
READ_ERROR,
WRITE_ERROR,
SURFACE_FINISHED,
SURFACE_TYPE_MISMATCH,
PATTERN_TYPE_MISMATCH,
INVALID_CONTENT,
INVALID_FORMAT,
INVALID_VISUAL,
FILE_NOT_FOUND,
INVALID_DASH,
INVALID_DSC_COMMENT,
INVALID_INDEX,
CLIP_NOT_REPRESENTABLE,
TEMP_FILE_ERROR,
INVALID_STRIDE,
FONT_TYPE_MISMATCH,
USER_FONT_IMMUTABLE,
USER_FONT_ERROR,
NEGATIVE_COUNT,
INVALID_CLUSTERS,
INVALID_SLANT,
INVALID_WEIGHT,
INVALID_SIZE,
USER_FONT_NOT_IMPLEMENTED,
DEVICE_TYPE_MISMATCH,
DEVICE_ERROR,
INVALID_MESH_CONSTRUCTION,
DEVICE_FINISHED,
JBIG2_GLOBAL_MISSING,
}
export namespace Content {
export const $gtype: GObject.GType<Content>;
}
enum Content {
COLOR,
ALPHA,
COLOR_ALPHA,
}
export namespace Operator {
export const $gtype: GObject.GType<Operator>;
}
enum Operator {
CLEAR,
SOURCE,
OVER,
IN,
OUT,
ATOP,
DEST,
DEST_OVER,
DEST_IN,
DEST_OUT,
DEST_ATOP,
XOR,
ADD,
SATURATE,
MULTIPLY,
SCREEN,
OVERLAY,
DARKEN,
LIGHTEN,
COLOR_DODGE,
COLOR_BURN,
HARD_LIGHT,
SOFT_LIGHT,
DIFFERENCE,
EXCLUSION,
HSL_HUE,
HSL_SATURATION,
HSL_COLOR,
HSL_LUMINOSITY,
}
export namespace Antialias {
export const $gtype: GObject.GType<Antialias>;
}
enum Antialias {
DEFAULT,
NONE,
GRAY,
SUBPIXEL,
FAST,
GOOD,
BEST,
}
export namespace FillRule {
export const $gtype: GObject.GType<FillRule>;
}
enum FillRule {
WINDING,
EVEN_ODD,
}
export namespace LineCap {
export const $gtype: GObject.GType<LineCap>;
}
enum LineCap {
BUTT,
ROUND,
SQUARE,
}
export namespace LineJoin {
export const $gtype: GObject.GType<LineJoin>;
}
enum LineJoin {
MITER,
ROUND,
BEVEL,
}
export namespace TextClusterFlags {
export const $gtype: GObject.GType<TextClusterFlags>;
}
enum TextClusterFlags {
BACKWARD,
}
export namespace FontSlant {
export const $gtype: GObject.GType<FontSlant>;
}
enum FontSlant {
NORMAL,
ITALIC,
OBLIQUE,
}
export namespace FontWeight {
export const $gtype: GObject.GType<FontWeight>;
}
enum FontWeight {
NORMAL,
BOLD,
}
export namespace SubpixelOrder {
export const $gtype: GObject.GType<SubpixelOrder>;
}
enum SubpixelOrder {
DEFAULT,
RGB,
BGR,
VRGB,
VBGR,
}
export namespace HintStyle {
export const $gtype: GObject.GType<HintStyle>;
}
enum HintStyle {
DEFAULT,
NONE,
SLIGHT,
MEDIUM,
FULL,
}
export namespace HintMetrics {
export const $gtype: GObject.GType<HintMetrics>;
}
enum HintMetrics {
DEFAULT,
OFF,
ON,
}
export namespace FontType {
export const $gtype: GObject.GType<FontType>;
}
enum FontType {
TOY,
FT,
WIN32,
QUARTZ,
USER,
}
export namespace PathDataType {
export const $gtype: GObject.GType<PathDataType>;
}
enum PathDataType {
MOVE_TO,
LINE_TO,
CURVE_TO,
CLOSE_PATH,
}
export namespace DeviceType {
export const $gtype: GObject.GType<DeviceType>;
}
enum DeviceType {
DRM,
GL,
SCRIPT,
XCB,
XLIB,
XML,
COGL,
WIN32,
INVALID,
}
export namespace SurfaceType {
export const $gtype: GObject.GType<SurfaceType>;
}
enum SurfaceType {
IMAGE,
PDF,
PS,
XLIB,
XCB,
GLITZ,
QUARTZ,
WIN32,
BEOS,
DIRECTFB,
SVG,
OS2,
WIN32_PRINTING,
QUARTZ_IMAGE,
SCRIPT,
QT,
RECORDING,
VG,
GL,
DRM,
TEE,
XML,
SKIA,
SUBSURFACE,
COGL,
}
export namespace Format {
export const $gtype: GObject.GType<Format>;
}
enum Format {
INVALID,
ARGB32,
RGB24,
A8,
A1,
RGB16_565,
RGB30,
}
export namespace PatternType {
export const $gtype: GObject.GType<PatternType>;
}
enum PatternType {
SOLID,
SURFACE,
LINEAR,
RADIAL,
MESH,
RASTER_SOURCE,
}
export namespace Extend {
export const $gtype: GObject.GType<Extend>;
}
enum Extend {
NONE,
REPEAT,
REFLECT,
PAD,
}
export namespace Filter {
export const $gtype: GObject.GType<Filter>;
}
enum Filter {
FAST,
GOOD,
BEST,
NEAREST,
BILINEAR,
GAUSSIAN,
}
export namespace RegionOverlap {
export const $gtype: GObject.GType<RegionOverlap>;
}
enum RegionOverlap {
IN,
OUT,
PART,
}
function image_surface_create(): void;
class Context {
static $gtype: GObject.GType<Context>;
// Constructors
_init(...args: any[]): void;
}
class Device {
static $gtype: GObject.GType<Device>;
// Constructors
_init(...args: any[]): void;
}
class Surface {
static $gtype: GObject.GType<Surface>;
// Constructors
_init(...args: any[]): void;
}
class Matrix {
static $gtype: GObject.GType<Matrix>;
// Constructors
_init(...args: any[]): void;
}
class Pattern {
static $gtype: GObject.GType<Pattern>;
// Constructors
_init(...args: any[]): void;
}
class Region {
static $gtype: GObject.GType<Region>;
// Constructors
_init(...args: any[]): void;
}
class FontOptions {
static $gtype: GObject.GType<FontOptions>;
// Constructors
_init(...args: any[]): void;
}
class FontFace {
static $gtype: GObject.GType<FontFace>;
// Constructors
_init(...args: any[]): void;
}
class ScaledFont {
static $gtype: GObject.GType<ScaledFont>;
// Constructors
_init(...args: any[]): void;
}
class Path {
static $gtype: GObject.GType<Path>;
// Constructors
_init(...args: any[]): void;
}
class Rectangle {
static $gtype: GObject.GType<Rectangle>;
// Fields
x: number;
y: number;
width: number;
height: number;
// Constructors
constructor(
properties?: Partial<{
x: number;
y: number;
width: number;
height: number;
}>,
);
_init(...args: any[]): void;
}
class RectangleInt {
static $gtype: GObject.GType<RectangleInt>;
// Fields
x: number;
y: number;
width: number;
height: number;
// Constructors
constructor(
properties?: Partial<{
x: number;
y: number;
width: number;
height: number;
}>,
);
_init(...args: any[]): void;
}
class Glyph {
static $gtype: GObject.GType<Glyph>;
// Fields
index: number;
x: number;
y: number;
// Constructors
constructor(
properties?: Partial<{
index: number;
x: number;
y: number;
}>,
);
_init(...args: any[]): void;
}
class TextCluster {
static $gtype: GObject.GType<TextCluster>;
// Fields
num_bytes: number;
num_glyphs: number;
// Constructors
constructor(
properties?: Partial<{
num_bytes: number;
num_glyphs: number;
}>,
);
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default cairo;
}
declare module 'gi://cairo' {
import Cairo10 from 'gi://cairo?version=1.0';
export default Cairo10;
}
// END

845
home/ags-config/@girs/cairo.d.ts vendored Normal file
View File

@@ -0,0 +1,845 @@
declare module 'cairo' {
// Cairo 1.0
import Cairo from 'gi://cairo?version=1.0';
import type GObject from 'gi://GObject?version=2.0';
namespace giCairo {
// Re-export enums directly from Cairo
export import Status = Cairo.Status;
export import Content = Cairo.Content;
export import Operator = Cairo.Operator;
export import Antialias = Cairo.Antialias;
export import FillRule = Cairo.FillRule;
export import LineCap = Cairo.LineCap;
export import LineJoin = Cairo.LineJoin;
export import TextClusterFlags = Cairo.TextClusterFlags;
export import FontSlant = Cairo.FontSlant;
export import FontWeight = Cairo.FontWeight;
export import SubpixelOrder = Cairo.SubpixelOrder;
export import HintStyle = Cairo.HintStyle;
export import HintMetrics = Cairo.HintMetrics;
export import FontType = Cairo.FontType;
export import PathDataType = Cairo.PathDataType;
export import DeviceType = Cairo.DeviceType;
export import SurfaceType = Cairo.SurfaceType;
export import Format = Cairo.Format;
export import PatternType = Cairo.PatternType;
export import Extend = Cairo.Extend;
export import Filter = Cairo.Filter;
export import RegionOverlap = Cairo.RegionOverlap;
/**
* Describes the metrics of a string of text
*/
export interface TextExtents {
/** The horizontal distance from the origin to the leftmost part of the text */
xBearing: number;
/** The vertical distance from the origin to the topmost part of the text */
yBearing: number;
/** The width of the text */
width: number;
/** The height of the text */
height: number;
/** The distance to advance horizontally after drawing the text */
xAdvance: number;
/** The distance to advance vertically after drawing the text */
yAdvance: number;
}
/**
* The main Cairo drawing context
*
* A Cairo context is used to draw to surfaces and perform drawing operations.
* When you're done with a context, you must call $dispose() to free memory.
*/
export class Context extends Cairo.Context {
/**
* Creates a new Cairo context for drawing to the given surface
* @param surface The surface to draw on
*/
constructor(surface: Surface);
/**
* Free a Cairo.Context and all associated memory
*
* Unlike other objects in GJS, Cairo contexts must be explicitly disposed
* to avoid memory leaks.
*/
$dispose(): void;
/**
* Adds a circular arc of the given radius to the current path
* @param xc X coordinate of the center of the arc
* @param yc Y coordinate of the center of the arc
* @param radius Radius of the arc
* @param angle1 Starting angle in radians
* @param angle2 End angle in radians
*/
arc(xc: number, yc: number, radius: number, angle1: number, angle2: number): void;
/**
* Adds a circular arc of the given radius to the current path, but draws
* the arc in the opposite direction from arc()
* @param xc X coordinate of the center of the arc
* @param yc Y coordinate of the center of the arc
* @param radius Radius of the arc
* @param angle1 Starting angle in radians
* @param angle2 End angle in radians
*/
arcNegative(xc: number, yc: number, radius: number, angle1: number, angle2: number): void;
/**
* Adds a cubic Bézier spline to the current path
* @param x1 X coordinate of the first control point
* @param y1 Y coordinate of the first control point
* @param x2 X coordinate of the second control point
* @param y2 Y coordinate of the second control point
* @param x3 X coordinate of the end point
* @param y3 Y coordinate of the end point
*/
curveTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void;
/**
* Establishes a new clip region by intersecting the current clip region
* with the current path, then clearing the current path
*/
clip(): void;
/**
* Like clip() but preserves the current path
*/
clipPreserve(): void;
/**
* Returns the current clip extents as [x1, y1, x2, y2]
* @returns An array with [x1, y1, x2, y2] clip extents
*/
clipExtents(): [number, number, number, number];
/**
* Closes the current path by drawing a line to the beginning of the current subpath
*/
closePath(): void;
/**
* Emits the current page, but doesn't clear it
*/
copyPage(): void;
/**
* Transforms a coordinate from device space to user space
* @param x X coordinate
* @param y Y coordinate
* @returns An array with [x, y] transformed coordinates
*/
deviceToUser(x: number, y: number): [number, number];
/**
* Transforms a distance vector from device space to user space
* @param x X component of the distance vector
* @param y Y component of the distance vector
* @returns An array with [x, y] transformed distance vector
*/
deviceToUserDistance(x: number, y: number): [number, number];
/**
* Fills the current path using the current fill rule, then clears the path
*/
fill(): void;
/**
* Fills the current path using the current fill rule, but doesn't clear the path
*/
fillPreserve(): void;
/**
* Returns the current fill extents as [x1, y1, x2, y2]
* @returns An array with [x1, y1, x2, y2] fill extents
*/
fillExtents(): [number, number, number, number];
/**
* Gets the current antialiasing mode
* @returns The current antialiasing mode
*/
getAntialias(): Antialias;
/**
* Gets the current point of the current path
* @returns An array with [x, y] coordinates of the current point
*/
getCurrentPoint(): [number, number];
/**
* Gets the current dash count
* @returns The number of elements in the current dash pattern
*/
getDashCount(): number;
/**
* Gets the current fill rule
* @returns The current fill rule
*/
getFillRule(): FillRule;
/**
* Gets the current line cap style
* @returns The current line cap style
*/
getLineCap(): LineCap;
/**
* Gets the current line join style
* @returns The current line join style
*/
getLineJoin(): LineJoin;
/**
* Gets the current line width
* @returns The current line width
*/
getLineWidth(): number;
/**
* Gets the current miter limit
* @returns The current miter limit
*/
getMiterLimit(): number;
/**
* Gets the current compositing operator
* @returns The current compositing operator
*/
getOperator(): Operator;
/**
* Gets the current source pattern
* @returns The current source pattern
*/
getSource(): Pattern;
/**
* Gets the surface the Cairo context is drawing on
* @returns The target surface
*/
getTarget(): Surface;
/**
* Gets the current tolerance value
* @returns The current tolerance value
*/
getTolerance(): number;
/**
* Checks if there is a current point defined
* @returns True if there is a current point
*/
hasCurrentPoint(): boolean;
/**
* Resets the current transformation matrix to the identity matrix
*/
identityMatrix(): void;
/**
* Tests whether the given point is inside the area filled by the current path
* @param x X coordinate of the point to test
* @param y Y coordinate of the point to test
* @returns True if the point is inside the path
*/
inFill(x: number, y: number): boolean;
/**
* Tests whether the given point is inside the area that would be inked
* by the current path with the current line width and stroke parameters
* @param x X coordinate of the point to test
* @param y Y coordinate of the point to test
* @returns True if the point would be inked
*/
inStroke(x: number, y: number): boolean;
/**
* Adds a line to the current path from the current point to the given point
* @param x X coordinate of the end point
* @param y Y coordinate of the end point
*/
lineTo(x: number, y: number): void;
/**
* Sets the current mask pattern used for painting operations
* @param pattern A pattern to use as mask
*/
mask(pattern: Pattern): void;
/**
* Sets the current mask to a surface
* @param surface A surface to use as mask
* @param x X coordinate at which to place the origin of the surface
* @param y Y coordinate at which to place the origin of the surface
*/
maskSurface(surface: Surface, x: number, y: number): void;
/**
* Begins a new subpath at the given point
* @param x X coordinate of the new position
* @param y Y coordinate of the new position
*/
moveTo(x: number, y: number): void;
/**
* Clears the current path and begins a new path
*/
newPath(): void;
/**
* Begins a new subpath without changing the current point
*/
newSubPath(): void;
/**
* Paints the current source everywhere within the current clip region
*/
paint(): void;
/**
* Paints the current source everywhere within the current clip region
* using the given alpha value
* @param alpha Alpha value to use, between 0 and 1
*/
paintWithAlpha(alpha: number): void;
/**
* Returns the current path extents as [x1, y1, x2, y2]
* @returns An array with [x1, y1, x2, y2] path extents
*/
pathExtents(): [number, number, number, number];
/**
* Terminates the current pattern group and returns a new pattern
* representing everything drawn to the group
* @returns A new pattern representing the group
*/
popGroup(): Pattern;
/**
* Terminates the current pattern group and makes it the current source pattern
*/
popGroupToSource(): void;
/**
* Temporarily redirects drawing to an intermediate surface
*/
pushGroup(): void;
/**
* Temporarily redirects drawing to an intermediate surface with the given content
* @param content The content type for the group
*/
pushGroupWithContent(content: Content): void;
/**
* Adds a rectangle to the current path
* @param x X coordinate of the top-left corner
* @param y Y coordinate of the top-left corner
* @param width Width of the rectangle
* @param height Height of the rectangle
*/
rectangle(x: number, y: number, width: number, height: number): void;
/**
* Adds a cubic Bézier spline to the current path using relative coordinates
* @param dx1 X offset to the first control point from current point
* @param dy1 Y offset to the first control point from current point
* @param dx2 X offset to the second control point from current point
* @param dy2 Y offset to the second control point from current point
* @param dx3 X offset to the end point from current point
* @param dy3 Y offset to the end point from current point
*/
relCurveTo(dx1: number, dy1: number, dx2: number, dy2: number, dx3: number, dy3: number): void;
/**
* Adds a line to the current path relative to the current point
* @param dx X offset from the current point
* @param dy Y offset from the current point
*/
relLineTo(dx: number, dy: number): void;
/**
* Begins a new subpath relative to the current point
* @param dx X offset from the current point
* @param dy Y offset from the current point
*/
relMoveTo(dx: number, dy: number): void;
/**
* Resets the current clip region to its original, unrestricted state
*/
resetClip(): void;
/**
* Restores the context state from the stack
*/
restore(): void;
/**
* Rotates the current transformation matrix
* @param angle Angle of rotation in radians
*/
rotate(angle: number): void;
/**
* Saves the current context state to the stack
*/
save(): void;
/**
* Scales the current transformation matrix
* @param sx Scale factor for the X dimension
* @param sy Scale factor for the Y dimension
*/
scale(sx: number, sy: number): void;
/**
* Selects a font face
* @param family A font family name
* @param slant A font slant
* @param weight A font weight
*/
selectFontFace(family: string, slant: number, weight: number): void;
/**
* Sets the antialiasing mode
* @param antialias The new antialiasing mode
*/
setAntialias(antialias: Antialias): void;
/**
* Sets the dash pattern to be used by stroke()
* @param dashes Array of dash lengths
* @param offset Offset into the dash pattern
*/
setDash(dashes: number[], offset: number): void;
/**
* Sets the current font size in user space units
* @param size Font size in user space units
*/
setFontSize(size: number): void;
/**
* Sets the current fill rule
* @param fillRule The new fill rule
*/
setFillRule(fillRule: FillRule): void;
/**
* Sets the current line cap style
* @param lineCap The new line cap style
*/
setLineCap(lineCap: LineCap): void;
/**
* Sets the current line join style
* @param lineJoin The new line join style
*/
setLineJoin(lineJoin: LineJoin): void;
/**
* Sets the current line width
* @param width The new line width
*/
setLineWidth(width: number): void;
/**
* Sets the current miter limit
* @param limit The new miter limit
*/
setMiterLimit(limit: number): void;
/**
* Sets the current compositing operator
* @param op The new compositing operator
*/
setOperator(op: Operator): void;
/**
* Sets the current source pattern
* @param pattern The new source pattern
*/
setSource(pattern: Pattern): void;
/**
* Sets the source pattern to an RGB opaque color
* @param red Red component, between 0 and 1
* @param green Green component, between 0 and 1
* @param blue Blue component, between 0 and 1
*/
setSourceRGB(red: number, green: number, blue: number): void;
/**
* Sets the source pattern to an RGBA color
* @param red Red component, between 0 and 1
* @param green Green component, between 0 and 1
* @param blue Blue component, between 0 and 1
* @param alpha Alpha component, between 0 and 1
*/
setSourceRGBA(red: number, green: number, blue: number, alpha: number): void;
/**
* Sets the source pattern to the given surface
* @param surface The new source surface
* @param x X coordinate where to place the surface origin
* @param y Y coordinate where to place the surface origin
*/
setSourceSurface(surface: Surface, x: number, y: number): void;
/**
* Sets the tolerance used when converting paths to trapezoids
* @param tolerance The new tolerance value
*/
setTolerance(tolerance: number): void;
/**
* Emits the current page and clears it
*/
showPage(): void;
/**
* Draws text at the current position
* @param utf8 A string of text encoded in UTF-8
*/
showText(utf8: string): void;
/**
* Strokes the current path using the current line width, line join,
* line cap, and dash settings, then clears the path
*/
stroke(): void;
/**
* Like stroke() but preserves the current path
*/
strokePreserve(): void;
/**
* Returns the current stroke extents as [x1, y1, x2, y2]
* @returns An array with [x1, y1, x2, y2] stroke extents
*/
strokeExtents(): [number, number, number, number];
/**
* Gets the extents of the given text if it were drawn at the current point
* @param utf8 A string of text encoded in UTF-8
* @returns Text extents information
*/
textExtents(utf8: string): TextExtents;
/**
* Translates the current transformation matrix
* @param tx Translation in the X direction
* @param ty Translation in the Y direction
*/
translate(tx: number, ty: number): void;
/**
* Transforms a coordinate from user space to device space
* @param x X coordinate
* @param y Y coordinate
* @returns An array with [x, y] transformed coordinates
*/
userToDevice(x: number, y: number): [number, number];
/**
* Transforms a distance vector from user space to device space
* @param x X component of the distance vector
* @param y Y component of the distance vector
* @returns An array with [x, y] transformed distance vector
*/
userToDeviceDistance(x: number, y: number): [number, number];
/**
* Creates a copy of the current path and returns it
* @returns A copy of the current path
*/
copyPath(): Path;
/**
* Appends a path to the current path
* @param path A path to append
*/
appendPath(path: Path): void;
}
/**
* Base class for all Cairo surfaces
*/
export abstract class Surface extends Cairo.Surface {
/**
* Gets the device scale of the surface
* @returns An array with [x, y] device scale
*/
getDeviceScale(): [number, number];
/**
* Sets the device scale of the surface
* @param x X scale factor
* @param y Y scale factor
*/
setDeviceScale(x: number, y: number): void;
/**
* Gets the device offset of the surface
* @returns An array with [x, y] device offset
*/
getDeviceOffset(): [number, number];
/**
* Sets the device offset of the surface
* @param x X offset
* @param y Y offset
*/
setDeviceOffset(x: number, y: number): void;
/**
* Performs all pending drawing operations
*/
flush(): void;
/**
* Finishes the surface and drops all references to external resources
*/
finish(): void;
}
/**
* A surface that uses in-memory image data buffers
*/
export class ImageSurface extends Surface {
/**
* Creates a new image surface
* @param format The format of pixels in the surface
* @param width Width of the surface in pixels
* @param height Height of the surface in pixels
*/
constructor(format: Format, width: number, height: number);
/**
* Creates a new image surface from a PNG file
* @param filename Path to a PNG file
* @returns A new image surface
*/
static createFromPNG(filename: string): ImageSurface;
/**
* Gets the format of the surface
* @returns The format of the surface
*/
getFormat(): Format;
/**
* Gets the width of the surface in pixels
* @returns The width of the surface
*/
getWidth(): number;
/**
* Gets the height of the surface in pixels
* @returns The height of the surface
*/
getHeight(): number;
/**
* Writes the contents of the surface to a PNG file
* @param filename Path to the PNG file to write
*/
writeToPNG(filename: string): void;
}
/**
* A surface that produces output in the PDF format
*/
export class PDFSurface extends Surface {
/**
* Creates a new PDF surface
* @param filename Path to the PDF file to write to
* @param width Width of the surface in points (1 point = 1/72 inch)
* @param height Height of the surface in points (1 point = 1/72 inch)
*/
constructor(filename: string, width: number, height: number);
}
/**
* A surface that produces output in the PostScript format
*/
export class PSSurface extends Surface {
/**
* Creates a new PostScript surface
* @param filename Path to the PostScript file to write to
* @param width Width of the surface in points (1 point = 1/72 inch)
* @param height Height of the surface in points (1 point = 1/72 inch)
*/
constructor(filename: string, width: number, height: number);
}
/**
* A surface that produces output in the SVG format
*/
export class SVGSurface extends Surface {
/**
* Creates a new SVG surface
* @param filename Path to the SVG file to write to
* @param width Width of the surface in points (1 point = 1/72 inch)
* @param height Height of the surface in points (1 point = 1/72 inch)
*/
constructor(filename: string, width: number, height: number);
}
/**
* Base class for all Cairo patterns
*/
export class Pattern extends Cairo.Pattern {}
/**
* Base class for all gradient patterns
*/
export class Gradient extends Pattern {
/**
* Adds a color stop to the gradient at the given offset
* @param offset Offset position of the stop, between 0 and 1
* @param red Red component, between 0 and 1
* @param green Green component, between 0 and 1
* @param blue Blue component, between 0 and 1
* @param alpha Alpha component, between 0 and 1
*/
addColorStopRGBA(offset: number, red: number, green: number, blue: number, alpha: number): void;
/**
* Adds an opaque color stop to the gradient at the given offset
* @param offset Offset position of the stop, between 0 and 1
* @param red Red component, between 0 and 1
* @param green Green component, between 0 and 1
* @param blue Blue component, between 0 and 1
*/
addColorStopRGB(offset: number, red: number, green: number, blue: number): void;
}
/**
* A pattern for linear gradients
*/
export class LinearGradient extends Gradient {
/**
* Creates a new linear gradient pattern
* @param x0 X coordinate of the start point
* @param y0 Y coordinate of the start point
* @param x1 X coordinate of the end point
* @param y1 Y coordinate of the end point
*/
constructor(x0: number, y0: number, x1: number, y1: number);
}
/**
* A pattern for radial gradients
*/
export class RadialGradient extends Gradient {
/**
* Creates a new radial gradient pattern
* @param cx0 X coordinate of the start circle
* @param cy0 Y coordinate of the start circle
* @param radius0 Radius of the start circle
* @param cx1 X coordinate of the end circle
* @param cy1 Y coordinate of the end circle
* @param radius1 Radius of the end circle
*/
constructor(cx0: number, cy0: number, radius0: number, cx1: number, cy1: number, radius1: number);
}
/**
* A pattern that uses a surface as its source
*/
export class SurfacePattern extends Pattern {
/**
* Creates a new pattern for the given surface
* @param surface The surface to use
*/
constructor(surface: Surface);
}
/**
* A pattern for solid colors
*/
export class SolidPattern extends Pattern {
/**
* Creates a new solid pattern with an opaque color
* @param red Red component, between 0 and 1
* @param green Green component, between 0 and 1
* @param blue Blue component, between 0 and 1
* @returns A new solid pattern
*/
static createRGB(red: number, green: number, blue: number): SolidPattern;
/**
* Creates a new solid pattern with a transparent color
* @param red Red component, between 0 and 1
* @param green Green component, between 0 and 1
* @param blue Blue component, between 0 and 1
* @param alpha Alpha component, between 0 and 1
* @returns A new solid pattern
*/
static createRGBA(red: number, green: number, blue: number, alpha: number): SolidPattern;
}
export class Path extends Cairo.Path {}
/**
* A rectangle
*/
export class Rectangle extends Cairo.Rectangle {}
/**
* A rectangle integer
*/
export class RectangleInt extends Cairo.RectangleInt {}
/**
* A region object used for representing a set of pixels
*/
export class Region extends Cairo.Region {}
/**
* A matrix object used for transforming coordinates
*/
export class Matrix extends Cairo.Matrix {}
/**
* A font face object used for storing and manipulating font faces
*/
export class FontFace extends Cairo.FontFace {}
/**
* A scaled font object used for storing and manipulating scaled fonts
*/
export class ScaledFont extends Cairo.ScaledFont {}
/**
* A glyph object used for storing and manipulating glyphs
*/
export class Glyph extends Cairo.Glyph {}
/**
* A text cluster object used for storing and manipulating text clusters
*/
export class TextCluster extends Cairo.TextCluster {}
/**
* A font options object used for storing and manipulating font options
*/
export class FontOptions extends Cairo.FontOptions {}
/**
* A device object used for storing and manipulating devices
*/
export class Device extends Cairo.Device {}
}
export default giCairo;
}

23
home/ags-config/@girs/console.d.ts vendored Normal file
View File

@@ -0,0 +1,23 @@
declare module 'console' {
/**
* @param logDomain the GLib log domain this Console should print
* with. Defaults to 'Gjs-Console'.
*/
export function setConsoleLogDomain(logDomain: string): void;
/**
* @param logDomain the GLib log domain this Console should print
* with. Defaults to 'Gjs-Console'.
*/
export function getConsoleLogDomain(): string;
export const DEFAULT_LOG_DOMAIN: string;
const Console: {
setConsoleLogDomain: typeof setConsoleLogDomain;
getConsoleLogDomain: typeof getConsoleLogDomain;
DEFAULT_LOG_DOMAIN: typeof DEFAULT_LOG_DOMAIN;
};
export default Console;
}

89
home/ags-config/@girs/dbus-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,89 @@
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://DBus?version=1.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
export namespace DBus {
/**
* DBus-1.0
*/
export namespace BusType {
export const $gtype: GObject.GType<BusType>;
}
enum BusType {
SESSION,
SYSTEM,
STARTER,
}
class Connection {
static $gtype: GObject.GType<Connection>;
// Constructors
_init(...args: any[]): void;
}
class Error {
static $gtype: GObject.GType<Error>;
// Constructors
_init(...args: any[]): void;
}
class Message {
static $gtype: GObject.GType<Message>;
// Constructors
_init(...args: any[]): void;
}
class MessageIter {
static $gtype: GObject.GType<MessageIter>;
// Constructors
_init(...args: any[]): void;
}
class PendingCall {
static $gtype: GObject.GType<PendingCall>;
// Constructors
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default DBus;
}
declare module 'gi://DBus' {
import DBus10 from 'gi://DBus?version=1.0';
export default DBus10;
}
// END

112
home/ags-config/@girs/dbusglib-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,112 @@
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://DBusGLib?version=1.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
export namespace DBusGLib {
/**
* DBusGLib-1.0
*/
namespace Proxy {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {}
}
class Proxy extends GObject.Object {
static $gtype: GObject.GType<Proxy>;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Proxy.SignalSignatures;
// Constructors
constructor(properties?: Partial<Proxy.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect<K extends keyof Proxy.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Proxy.SignalSignatures[K]>,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after<K extends keyof Proxy.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Proxy.SignalSignatures[K]>,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit<K extends keyof Proxy.SignalSignatures>(
signal: K,
...args: GObject.GjsParameters<Proxy.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
}
class Connection {
static $gtype: GObject.GType<Connection>;
// Constructors
_init(...args: any[]): void;
}
class MethodInvocation {
static $gtype: GObject.GType<MethodInvocation>;
// Constructors
_init(...args: any[]): void;
}
class ProxyClass {
static $gtype: GObject.GType<ProxyClass>;
// Constructors
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default DBusGLib;
}
declare module 'gi://DBusGLib' {
import DBusGLib10 from 'gi://DBusGLib?version=1.0';
export default DBusGLib10;
}
// END

306
home/ags-config/@girs/dom.d.ts vendored Normal file
View File

@@ -0,0 +1,306 @@
/// <reference path="./glib-2.0.d.ts" />
/**
* Gjs has implemented some functionality from the DOM API,
* this leads to a conflict when all DOM (`lib.dom.d.ts`) should be used.
* This should normally not be the case, since the other - not yet reimplemented - API's cannot be used in GJS anyway.
*
* If for some reason the entire DOM types should still be used,
* this file can be ignored and `lib.dom.d.ts` used instead, otherwise this file should be imported in your project.
*
* See also https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts
*/
import type GLib from 'gi://GLib?version=2.0';
import type GObject from 'gi://GObject?version=2.0';
declare global {
interface ImportMeta {
/**
* The absolute file: or resource: URL of the module.
*
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/ESModules.md#importmetaurl
*/
url: string; // with readonly this type is incompatible with e.g. https://github.com/vitejs/vite/blob/main/packages/vite/types/importMeta.d.ts
}
// Timers
// See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/esm/_timers.js
/**
* @version Gjs 1.71.1
* @param callback a callback function
* @param delay the duration in milliseconds to wait before running callback
* @param args arguments to pass to callback
*/
function setTimeout(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source;
/**
* @version Gjs 1.71.1
* @param callback a callback function
* @param delay the duration in milliseconds to wait between calling callback
* @param args arguments to pass to callback
*/
function setInterval(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source;
/**
* @version Gjs 1.71.1
* @param timeout the timeout to clear
*/
function clearTimeout(timeout: GLib.Source): void;
/**
* @version Gjs 1.71.1
* @param timeout the timeout to clear
*/
function clearInterval(timeout: GLib.Source): void;
interface Console {
/**
* Logs a critical message if the condition is not truthy.
* {@link console.error()} for additional information.
*
* @param condition a boolean condition which, if false, causes
* the log to print
* @param data formatting substitutions, if applicable
* @returns
*/
assert(condition: boolean, ...data: any[]): void;
/**
* Resets grouping and clears the terminal on systems supporting ANSI
* terminal control sequences.
*
* In file-based stdout or systems which do not support clearing,
* console.clear() has no visual effect.
*
*/
clear(): void;
/**
* Logs a message with severity equal to {@link GLib.LogLevelFlags.DEBUG}.
*
* @param {...any} data formatting substitutions, if applicable
*/
debug(...data: any[]): void;
/**
* Logs a message with severity equal to {@link GLib.LogLevelFlags.CRITICAL}.
* Does not use {@link GLib.LogLevelFlags.ERROR} to avoid asserting and
* forcibly shutting down the application.
*
* @param data formatting substitutions, if applicable
*/
error(...data: any[]): void;
/**
* Logs a message with severity equal to {@link GLib.LogLevelFlags.INFO}.
*
* @param data formatting substitutions, if applicable
*/
info(...data: any[]): void;
/**
* Logs a message with severity equal to {@link GLib.LogLevelFlags.MESSAGE}.
*
* @param data formatting substitutions, if applicable
*/
log(...data: any[]): void;
// 1.1.7 table(tabularData, properties)
table(tabularData: any, _properties: never): void;
/**
* @param data formatting substitutions, if applicable
*/
trace(...data: any[]): void;
/**
* @param data formatting substitutions, if applicable
*/
warn(...data: any[]): void;
/**
* @param item an item to format generically
* @param [options] any additional options for the formatter. Unused
* in our implementation.
*/
dir(item: object, options: never): void;
/**
* @param data formatting substitutions, if applicable
*/
dirxml(...data: any[]): void;
// 1.2 Counting functions
// https://console.spec.whatwg.org/#counting
/**
* Logs how many times console.count(label) has been called with a given
* label.
* {@link console.countReset()} for resetting a count.
*
* @param label unique identifier for this action
*/
count(label: string): void;
/**
* @param label the unique label to reset the count for
*/
countReset(label: string): void;
// 1.3 Grouping functions
// https://console.spec.whatwg.org/#grouping
/**
* @param data formatting substitutions, if applicable
*/
group(...data: any[]): void;
/**
* Alias for console.group()
*
* @param {...any} data formatting substitutions, if applicable
*/
groupCollapsed(...data: any[]): void;
/**
*/
groupEnd(): void;
// 1.4 Timing functions
// https://console.spec.whatwg.org/#timing
/**
* @param label unique identifier for this action, pass to
* console.timeEnd() to complete
*/
time(label: string): void;
/**
* Logs the time since the last call to console.time(label) where label is
* the same.
*
* @param label unique identifier for this action, pass to
* console.timeEnd() to complete
* @param data string substitutions, if applicable
*/
timeLog(label: string, ...data: any[]): void;
/**
* Logs the time since the last call to console.time(label) and completes
* the action.
* Call console.time(label) again to re-measure.
*
* @param label unique identifier for this action
*/
timeEnd(label: string): void;
// Non-standard functions which are de-facto standards.
// Similar to Node, we define these as no-ops for now.
/**
* @deprecated Not implemented in GJS
*
* @param _label unique identifier for this action, pass to
* console.profileEnd to complete
*/
profile(_label: string): void;
/**
* @deprecated Not implemented in GJS
*
* @param _label unique identifier for this action
*/
profileEnd(_label: string): void;
/**
* @deprecated Not implemented in GJS
*
* @param _label unique identifier for this action
*/
timeStamp(_label: string): void;
}
interface TextDecodeOptions {
// As of Gjs 1.73.2 stream mode is not supported yet.
// stream?: boolean
}
interface TextDecoderOptions {
/** Indicates whether the error mode is fatal. */
fatal?: boolean;
/** Indicates whether whether the byte order mark is ignored. */
ignoreBOM?: boolean;
}
/**
* The TextDecoder interface represents a decoder for a specific text encoding.
* It takes a stream of bytes as input and emits a stream of code points.
*
* @version Gjs 1.69.2
*/
interface TextDecoder {
/** A string containing the name of the decoder, that is a string describing the method the TextDecoder will use. */
readonly encoding: TextDecoderEncoding;
/** A Boolean indicating whether the error mode is fatal. */
readonly fatal: boolean;
/** A Boolean indicating whether the byte order mark is ignored. */
readonly ignoreBOM: boolean;
/**
* Returns a string containing the text decoded with the method of the specific TextDecoder object.
*
* If the error mode is "fatal" and the encoder method encounter an error it WILL THROW a TypeError.
*
* @param input Buffer containing the text to decode
* @param options Object defining the decode options
*/
decode(input?: ArrayBufferView | ArrayBuffer, options?: TextDecodeOptions): string;
}
interface TextEncoderEncodeIntoResult {
read?: number;
written?: number;
}
/**
* TextEncoder takes a stream of code points as input and emits a stream of bytes.
*
* @version Gjs 1.69.2
*/
interface TextEncoder {
readonly encoding: 'utf-8';
/**
* Takes a string as input, and returns a buffer containing the text given in parameters encoded with the UTF-8 method.
*
* @param input Text to encode.
*/
encode(input?: string): Uint8Array;
/**
* Takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into,
* and returns a dictionary object indicating the progress of the encoding.
*
* This is potentially more performant than the older encode() method.
*
* @param source Text to encode.
* @param destination Buffer where to place the resulting UTF-8 encoded text into.
*/
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
}
const console: Console;
const TextDecoder: {
prototype: TextDecoder;
new (label?: TextDecoderEncoding, options?: TextDecoderOptions): TextDecoder;
};
const TextEncoder: {
prototype: TextEncoder;
new (): TextEncoder;
};
}
export {};

View File

@@ -0,0 +1,65 @@
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://fontconfig?version=2.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
export namespace fontconfig {
/**
* fontconfig-2.0
*/
function init(): void;
class Pattern {
static $gtype: GObject.GType<Pattern>;
// Constructors
_init(...args: any[]): void;
}
class CharSet {
static $gtype: GObject.GType<CharSet>;
// Constructors
_init(...args: any[]): void;
}
class Config {
static $gtype: GObject.GType<Config>;
// Constructors
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default fontconfig;
}
declare module 'gi://fontconfig' {
import Fontconfig20 from 'gi://fontconfig?version=2.0';
export default Fontconfig20;
}
// END

View File

@@ -0,0 +1,65 @@
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://freetype2?version=2.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
export namespace freetype2 {
/**
* freetype2-2.0
*/
class Bitmap {
static $gtype: GObject.GType<Bitmap>;
// Constructors
_init(...args: any[]): void;
}
class Face {
static $gtype: GObject.GType<Face>;
// Constructors
_init(...args: any[]): void;
}
class Library {
static $gtype: GObject.GType<Library>;
// Constructors
_init(...args: any[]): void;
}
type Int32 = number;
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default freetype2;
}
declare module 'gi://freetype2' {
import Freetype220 from 'gi://freetype2?version=2.0';
export default Freetype220;
}
// END

View File

@@ -0,0 +1,405 @@
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://GDesktopEnums?version=3.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
export namespace GDesktopEnums {
/**
* GDesktopEnums-3.0
*/
export namespace AccentColor {
export const $gtype: GObject.GType<AccentColor>;
}
enum AccentColor {
BLUE,
TEAL,
GREEN,
YELLOW,
ORANGE,
RED,
PINK,
PURPLE,
SLATE,
}
export namespace BackgroundShading {
export const $gtype: GObject.GType<BackgroundShading>;
}
enum BackgroundShading {
SOLID,
VERTICAL,
HORIZONTAL,
}
export namespace BackgroundStyle {
export const $gtype: GObject.GType<BackgroundStyle>;
}
enum BackgroundStyle {
NONE,
WALLPAPER,
CENTERED,
SCALED,
STRETCHED,
ZOOM,
SPANNED,
}
export namespace ClockFormat {
export const $gtype: GObject.GType<ClockFormat>;
}
enum ClockFormat {
'24H',
'12H',
}
export namespace ColorScheme {
export const $gtype: GObject.GType<ColorScheme>;
}
enum ColorScheme {
DEFAULT,
PREFER_DARK,
PREFER_LIGHT,
}
export namespace DeviceSendEvents {
export const $gtype: GObject.GType<DeviceSendEvents>;
}
enum DeviceSendEvents {
ENABLED,
DISABLED,
DISABLED_ON_EXTERNAL_MOUSE,
}
export namespace FocusMode {
export const $gtype: GObject.GType<FocusMode>;
}
enum FocusMode {
CLICK,
SLOPPY,
MOUSE,
}
export namespace FocusNewWindows {
export const $gtype: GObject.GType<FocusNewWindows>;
}
enum FocusNewWindows {
SMART,
STRICT,
}
export namespace FontAntialiasingMode {
export const $gtype: GObject.GType<FontAntialiasingMode>;
}
enum FontAntialiasingMode {
NONE,
GRAYSCALE,
RGBA,
}
export namespace FontHinting {
export const $gtype: GObject.GType<FontHinting>;
}
enum FontHinting {
NONE,
SLIGHT,
MEDIUM,
FULL,
}
export namespace FontRendering {
export const $gtype: GObject.GType<FontRendering>;
}
enum FontRendering {
AUTOMATIC,
MANUAL,
}
export namespace FontRgbaOrder {
export const $gtype: GObject.GType<FontRgbaOrder>;
}
enum FontRgbaOrder {
RGBA,
RGB,
BGR,
VRGB,
VBGR,
}
export namespace LocationAccuracyLevel {
export const $gtype: GObject.GType<LocationAccuracyLevel>;
}
enum LocationAccuracyLevel {
COUNTRY,
CITY,
NEIGHBORHOOD,
STREET,
EXACT,
}
export namespace MagnifierCaretTrackingMode {
export const $gtype: GObject.GType<MagnifierCaretTrackingMode>;
}
enum MagnifierCaretTrackingMode {
NONE,
CENTERED,
PROPORTIONAL,
PUSH,
}
export namespace MagnifierFocusTrackingMode {
export const $gtype: GObject.GType<MagnifierFocusTrackingMode>;
}
enum MagnifierFocusTrackingMode {
NONE,
CENTERED,
PROPORTIONAL,
PUSH,
}
export namespace MagnifierMouseTrackingMode {
export const $gtype: GObject.GType<MagnifierMouseTrackingMode>;
}
enum MagnifierMouseTrackingMode {
NONE,
CENTERED,
PROPORTIONAL,
PUSH,
}
export namespace MagnifierScreenPosition {
export const $gtype: GObject.GType<MagnifierScreenPosition>;
}
enum MagnifierScreenPosition {
NONE,
FULL_SCREEN,
TOP_HALF,
BOTTOM_HALF,
LEFT_HALF,
RIGHT_HALF,
}
export namespace MouseDwellDirection {
export const $gtype: GObject.GType<MouseDwellDirection>;
}
enum MouseDwellDirection {
LEFT,
RIGHT,
UP,
DOWN,
}
export namespace MouseDwellMode {
export const $gtype: GObject.GType<MouseDwellMode>;
}
enum MouseDwellMode {
WINDOW,
GESTURE,
}
export namespace PadButtonAction {
export const $gtype: GObject.GType<PadButtonAction>;
}
enum PadButtonAction {
NONE,
HELP,
SWITCH_MONITOR,
KEYBINDING,
}
export namespace PointerAccelProfile {
export const $gtype: GObject.GType<PointerAccelProfile>;
}
enum PointerAccelProfile {
DEFAULT,
FLAT,
ADAPTIVE,
}
export namespace PointingStickScrollMethod {
export const $gtype: GObject.GType<PointingStickScrollMethod>;
}
enum PointingStickScrollMethod {
DEFAULT,
NONE,
ON_BUTTON_DOWN,
}
export namespace ProxyMode {
export const $gtype: GObject.GType<ProxyMode>;
}
enum ProxyMode {
NONE,
MANUAL,
AUTO,
}
export namespace ScreensaverMode {
export const $gtype: GObject.GType<ScreensaverMode>;
}
enum ScreensaverMode {
BLANK_ONLY,
RANDOM,
SINGLE,
}
export namespace StylusButtonAction {
export const $gtype: GObject.GType<StylusButtonAction>;
}
enum StylusButtonAction {
DEFAULT,
MIDDLE,
RIGHT,
BACK,
FORWARD,
SWITCH_MONITOR,
KEYBINDING,
}
export namespace TabletMapping {
export const $gtype: GObject.GType<TabletMapping>;
}
enum TabletMapping {
ABSOLUTE,
RELATIVE,
}
export namespace TitlebarAction {
export const $gtype: GObject.GType<TitlebarAction>;
}
enum TitlebarAction {
TOGGLE_SHADE,
TOGGLE_MAXIMIZE,
TOGGLE_MAXIMIZE_HORIZONTALLY,
TOGGLE_MAXIMIZE_VERTICALLY,
MINIMIZE,
NONE,
LOWER,
MENU,
}
export namespace ToolbarIconSize {
export const $gtype: GObject.GType<ToolbarIconSize>;
}
enum ToolbarIconSize {
SMALL,
LARGE,
}
export namespace ToolbarStyle {
export const $gtype: GObject.GType<ToolbarStyle>;
}
enum ToolbarStyle {
BOTH,
BOTH_HORIZ,
ICONS,
TEXT,
}
export namespace TouchpadClickMethod {
export const $gtype: GObject.GType<TouchpadClickMethod>;
}
enum TouchpadClickMethod {
DEFAULT,
NONE,
AREAS,
FINGERS,
}
export namespace TouchpadHandedness {
export const $gtype: GObject.GType<TouchpadHandedness>;
}
enum TouchpadHandedness {
RIGHT,
LEFT,
MOUSE,
}
export namespace TouchpadTapButtonMap {
export const $gtype: GObject.GType<TouchpadTapButtonMap>;
}
enum TouchpadTapButtonMap {
DEFAULT,
LRM,
LMR,
}
export namespace UsbProtection {
export const $gtype: GObject.GType<UsbProtection>;
}
enum UsbProtection {
LOCKSCREEN,
ALWAYS,
}
export namespace VisualBellType {
export const $gtype: GObject.GType<VisualBellType>;
}
enum VisualBellType {
FULLSCREEN_FLASH,
FRAME_FLASH,
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default GDesktopEnums;
}
declare module 'gi://GDesktopEnums' {
import GDesktopEnums30 from 'gi://GDesktopEnums?version=3.0';
export default GDesktopEnums30;
}
// END

13337
home/ags-config/@girs/gdk-3.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

18390
home/ags-config/@girs/gdk-4.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

2988
home/ags-config/@girs/gdkpixbuf-2.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,264 @@
/// <reference path="./gdkpixbuf-2.0.d.ts" />
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://GdkPixdata?version=2.0' {
// Module dependencies
import type GdkPixbuf from 'gi://GdkPixbuf?version=2.0';
import type Gio from 'gi://Gio?version=2.0';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
export namespace GdkPixdata {
/**
* GdkPixdata-2.0
*/
/**
* Magic number for #GdkPixdata structures.
*/
const PIXBUF_MAGIC_NUMBER: number;
/**
* The length of a #GdkPixdata structure without the `pixel_data` pointer.
*/
const PIXDATA_HEADER_LENGTH: number;
/**
* Converts a `GdkPixdata` to a `GdkPixbuf`.
*
* If `copy_pixels` is `TRUE` or if the pixel data is run-length-encoded,
* the pixel data is copied into newly-allocated memory; otherwise it is
* reused.
* @param pixdata a #GdkPixdata to convert into a `GdkPixbuf`.
* @param copy_pixels whether to copy raw pixel data; run-length encoded pixel data is always copied.
* @returns a new pixbuf
*/
function pixbuf_from_pixdata(pixdata: Pixdata, copy_pixels: boolean): GdkPixbuf.Pixbuf;
/**
* An enumeration which is used by gdk_pixdata_to_csource() to
* determine the form of C source to be generated. The three values
* `GDK_PIXDATA_DUMP_PIXDATA_STREAM,` `GDK_PIXDATA_DUMP_PIXDATA_STRUCT`
* and `GDK_PIXDATA_DUMP_MACROS` are mutually exclusive, as are
* `GDK_PIXBUF_DUMP_GTYPES` and `GDK_PIXBUF_DUMP_CTYPES`. The remaining
* elements are optional flags that can be freely added.
*/
/**
* An enumeration which is used by gdk_pixdata_to_csource() to
* determine the form of C source to be generated. The three values
* `GDK_PIXDATA_DUMP_PIXDATA_STREAM,` `GDK_PIXDATA_DUMP_PIXDATA_STRUCT`
* and `GDK_PIXDATA_DUMP_MACROS` are mutually exclusive, as are
* `GDK_PIXBUF_DUMP_GTYPES` and `GDK_PIXBUF_DUMP_CTYPES`. The remaining
* elements are optional flags that can be freely added.
*/
export namespace PixdataDumpType {
export const $gtype: GObject.GType<PixdataDumpType>;
}
enum PixdataDumpType {
/**
* Generate pixbuf data stream (a single
* string containing a serialized #GdkPixdata structure in network byte
* order).
*/
PIXDATA_STREAM,
/**
* Generate #GdkPixdata structure (needs
* the #GdkPixdata structure definition from gdk-pixdata.h).
*/
PIXDATA_STRUCT,
/**
* Generate <function>*_ROWSTRIDE</function>,
* <function>*_WIDTH</function>, <function>*_HEIGHT</function>,
* <function>*_BYTES_PER_PIXEL</function> and
* <function>*_RLE_PIXEL_DATA</function> or <function>*_PIXEL_DATA</function>
* macro definitions for the image.
*/
MACROS,
/**
* Generate GLib data types instead of
* standard C data types.
*/
GTYPES,
/**
* Generate standard C data types instead of
* GLib data types.
*/
CTYPES,
/**
* Generate static symbols.
*/
STATIC,
/**
* Generate const symbols.
*/
CONST,
/**
* Provide a <function>*_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp)</function>
* macro definition to decode run-length encoded image data.
*/
RLE_DECODER,
}
/**
* An enumeration containing three sets of flags for a #GdkPixdata struct:
* one for the used colorspace, one for the width of the samples and one
* for the encoding of the pixel data.
*/
/**
* An enumeration containing three sets of flags for a #GdkPixdata struct:
* one for the used colorspace, one for the width of the samples and one
* for the encoding of the pixel data.
*/
export namespace PixdataType {
export const $gtype: GObject.GType<PixdataType>;
}
enum PixdataType {
/**
* each pixel has red, green and blue samples.
*/
COLOR_TYPE_RGB,
/**
* each pixel has red, green and blue samples
* and an alpha value.
*/
COLOR_TYPE_RGBA,
/**
* mask for the colortype flags of the enum.
*/
COLOR_TYPE_MASK,
/**
* each sample has 8 bits.
*/
SAMPLE_WIDTH_8,
/**
* mask for the sample width flags of the enum.
*/
SAMPLE_WIDTH_MASK,
/**
* the pixel data is in raw form.
*/
ENCODING_RAW,
/**
* the pixel data is run-length encoded. Runs may
* be up to 127 bytes long; their length is stored in a single byte
* preceding the pixel data for the run. If a run is constant, its length
* byte has the high bit set and the pixel data consists of a single pixel
* which must be repeated.
*/
ENCODING_RLE,
/**
* mask for the encoding flags of the enum.
*/
ENCODING_MASK,
}
/**
* A pixel buffer suitable for serialization and streaming.
*
* Using `GdkPixdata`, images can be compiled into an application,
* making it unnecessary to refer to external image files at runtime.
*
* `GdkPixbuf` includes a utility named `gdk-pixbuf-csource`, which
* can be used to convert image files into `GdkPixdata` structures suitable
* for inclusion in C sources. To convert the `GdkPixdata` structures back
* into a `GdkPixbuf`, use `gdk_pixbuf_from_pixdata()`.
*/
class Pixdata {
static $gtype: GObject.GType<Pixdata>;
// Fields
magic: number;
length: number;
pixdata_type: number;
rowstride: number;
width: number;
height: number;
pixel_data: Uint8Array;
// Constructors
constructor(
properties?: Partial<{
magic: number;
length: number;
pixdata_type: number;
rowstride: number;
width: number;
height: number;
pixel_data: Uint8Array;
}>,
);
_init(...args: any[]): void;
// Methods
/**
* Deserializes (reconstruct) a #GdkPixdata structure from a byte stream.
*
* The byte stream consists of a straightforward writeout of the
* `GdkPixdata` fields in network byte order, plus the `pixel_data`
* bytes the structure points to.
*
* The `pixdata` contents are reconstructed byte by byte and are checked
* for validity.
*
* This function may fail with `GDK_PIXBUF_ERROR_CORRUPT_IMAGE`
* or `GDK_PIXBUF_ERROR_UNKNOWN_TYPE`.
* @param stream stream of bytes containing a serialized #GdkPixdata structure.
* @returns Upon successful deserialization `TRUE` is returned, `FALSE` otherwise.
*/
deserialize(stream: Uint8Array | string): boolean;
/**
* Serializes a #GdkPixdata structure into a byte stream.
* The byte stream consists of a straightforward writeout of the
* #GdkPixdata fields in network byte order, plus the `pixel_data`
* bytes the structure points to.
* @returns A newly-allocated string containing the serialized #GdkPixdata structure.
*/
serialize(): Uint8Array;
/**
* Generates C source code suitable for compiling images directly
* into programs.
*
* GdkPixbuf ships with a program called `gdk-pixbuf-csource`, which offers
* a command line interface to this function.
* @param name used for naming generated data structures or macros
* @param dump_type the kind of C source to be generated
* @returns a newly-allocated string buffer containing the C source form of `pixdata`.
*/
to_csource(name: string, dump_type: PixdataDumpType | null): GLib.String;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default GdkPixdata;
}
declare module 'gi://GdkPixdata' {
import GdkPixdata20 from 'gi://GdkPixdata?version=2.0';
export default GdkPixdata20;
}
// END

1689
home/ags-config/@girs/gdkwayland-4.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

1403
home/ags-config/@girs/gdkx11-3.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

1063
home/ags-config/@girs/gdkx11-4.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

43
home/ags-config/@girs/gettext.d.ts vendored Normal file
View File

@@ -0,0 +1,43 @@
declare module 'gettext' {
export enum LocaleCategory {
ALL,
COLLATE,
CTYPE,
MESSAGES,
MONETARY,
NUMERIC,
TIME,
}
export function setlocale(category: number, locale: string | null): string;
export function textdomain(domainname: string | null): string;
export function bindtextdomain(domainname: string, dirname: string | null): string;
export function gettext(msgid: string): string;
export function dgettext(domainname: string | null, msgid: string): string;
export function dcgettext(domainname: string | null, msgid: string, category: number): string;
export function ngettext(msgid: string, msgid_plural: string, n: number): string;
export function dngettext(domainname: string, msgid: string, msgid_plural: string, n: number): string;
export function pgettext(context: string, msgid: string): string;
export function dpgettext(dom: string | null, context: string, msgid: string): string;
export function domain(domainName: string): {
gettext: (msgid: string) => string;
ngettext: (msgid: string, msgid_plural: string, n: number) => string;
pgettext: (context: string, msgid: string) => string;
};
const Gettext: {
LocaleCategory: typeof LocaleCategory;
setlocale: typeof setlocale;
textdomain: typeof textdomain;
bindtextdomain: typeof bindtextdomain;
gettext: typeof gettext;
dgettext: typeof dgettext;
dcgettext: typeof dcgettext;
ngettext: typeof ngettext;
dngettext: typeof dngettext;
pgettext: typeof pgettext;
dpgettext: typeof dpgettext;
domain: typeof domain;
};
export default Gettext;
}

60
home/ags-config/@girs/gi.d.ts vendored Normal file
View File

@@ -0,0 +1,60 @@
/**
* This file exports all GIR module type definitions.
*/
import './glib-2.0.d.ts';
import './gio-2.0.d.ts';
import './gobject-2.0.d.ts';
import './cairo-1.0.d.ts';
import './xrandr-1.3.d.ts';
import './xlib-2.0.d.ts';
import './xft-2.0.d.ts';
import './xfixes-4.0.d.ts';
import './win32-1.0.d.ts';
import './libxml2-2.0.d.ts';
import './freetype2-2.0.d.ts';
import './fontconfig-2.0.d.ts';
import './webkit2webextension-4.0.d.ts';
import './webkit2-4.0.d.ts';
import './vulkan-1.0.d.ts';
import './soupgnome-2.4.d.ts';
import './soup-3.0.d.ts';
import './soup-2.4.d.ts';
import './pangoxft-1.0.d.ts';
import './pangoot-1.0.d.ts';
import './pangofc-1.0.d.ts';
import './pangoft2-1.0.d.ts';
import './pangocairo-1.0.d.ts';
import './pango-1.0.d.ts';
import './javascriptcore-4.0.d.ts';
import './harfbuzz-0.0.d.ts';
import './gtksource-3.0.d.ts';
import './gtklayershell-0.1.d.ts';
import './gtk4sessionlock-1.0.d.ts';
import './gtk4layershell-1.0.d.ts';
import './gtk-4.0.d.ts';
import './gtk-3.0.d.ts';
import './gsk-4.0.d.ts';
import './graphene-1.0.d.ts';
import './giounix-2.0.d.ts';
import './gdkx11-4.0.d.ts';
import './gdkx11-3.0.d.ts';
import './gdkwayland-4.0.d.ts';
import './gdkpixdata-2.0.d.ts';
import './gdkpixbuf-2.0.d.ts';
import './gdk-4.0.d.ts';
import './gdk-3.0.d.ts';
import './gmodule-2.0.d.ts';
import './glibunix-2.0.d.ts';
import './gl-1.0.d.ts';
import './girepository-3.0.d.ts';
import './girepository-2.0.d.ts';
import './gdesktopenums-3.0.d.ts';
import './dbusglib-1.0.d.ts';
import './dbus-1.0.d.ts';
import './atspi-2.0.d.ts';
import './atk-1.0.d.ts';
import './astalio-0.1.d.ts';
import './astal-4.0.d.ts';
import './astal-3.0.d.ts';
import './accountsservice-1.0.d.ts';

87964
home/ags-config/@girs/gio-2.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

5698
home/ags-config/@girs/giounix-2.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

738
home/ags-config/@girs/gjs.d.ts vendored Normal file
View File

@@ -0,0 +1,738 @@
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./gettext.d.ts" />
/// <reference path="./system.d.ts" />
/// <reference path="./cairo.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in ts-for-gir itself or create a bug report on https://github.com/gjsify/ts-for-gir
*/
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import gettext from 'gettext';
import system from 'system';
import cairo from 'cairo';
// https://gitlab.gnome.org/GNOME/gjs/-/blob/1.72.0/modules/script/package.js
declare namespace package {
/**
* Although there are references in the documentation of more properties that
* this object should accepts, only the following are actually used in the init code,
* and all the other have their values derived from them.
*/
interface PackageInitParams {
/** The base name of the entry point (eg. org.foo.Bar.App) */
name: string;
/** The version of the package */
version: string;
/** The prefix of the package */
prefix: string;
/**
* The final datadir and libdir when installed;
* usually, these would be prefix + '/share' and
* and prefix + '/lib' (or '/lib64')
*/
libdir: string;
/**
* The final datadir and libdir when installed;
* usually, these would be prefix + '/share' and
* and prefix + '/lib' (or '/lib64')
*/
datadir?: string;
}
/**
* The base name of the entry point (eg. org.foo.Bar.App)
*
* Note: Run `pkg.init()` before accessing this property.
*/
export const name: string;
/**
* The version of the package
*
* Note: Run `pkg.init()` before accessing this property.
*/
export const version: string;
/**
* The prefix of the package
*
* Note: Run `pkg.init()` before accessing this property.
*/
export const prefix: string;
/**
* The final datadir when installed; usually, these would be prefix + '/share'
*
* Note: Run `pkg.init()` before accessing this property.
*/
export const datadir: string;
/**
* The final libdir when installed; usually, these would be prefix + '/lib' (or '/lib64')
*
* Note: Run `pkg.init()` before accessing this property.
*/
export const libdir: string;
/**
* The final pkglibdir when installed; usually, this would be prefix + '/lib' (or '/lib64')
*
* Note: Run `pkg.init()` before accessing this property.
*/
export const pkglibdir: string;
/**
* The final moduledir when installed; usually, this would be prefix + '/lib' (or '/lib64')
*
* Note: Run `pkg.init()` before accessing this property.
*/
export const moduledir: string;
/**
* The directory containing gettext translation files; this will be datadir + '/locale' when installed and './po' in the source tree
*
* Note: Run `pkg.init()` before accessing this property.
*/
export const localedir: string;
/**
* Initialize directories and global variables. Must be called
* before any of other API in Package is used.
* `params` must be an object with at least the following keys:
* - name: the package name ($(PACKAGE_NAME) in autotools,
* eg. org.foo.Bar)
* - version: the package version
* - prefix: the installation prefix
*
* init() will take care to check if the program is running from
* the source directory or not, by looking for a 'src' directory.
*
* At the end, the global variable 'pkg' will contain the
* Package module (imports.package). Additionally, the following
* module variables will be available:
* - name: the base name of the entry point (eg. org.foo.Bar.App)
* - version: same as in @params
* - prefix: the installation prefix (as passed in @params)
* - datadir, libdir: the final datadir and libdir when installed;
* usually, these would be prefix + '/share' and
* and prefix + '/lib' (or '/lib64')
* - pkgdatadir: the directory to look for private data files, such as
* images, stylesheets and UI definitions;
* this will be datadir + name when installed and
* './data' when running from the source tree
* - pkglibdir: the directory to look for private typelibs and C
* libraries;
* this will be libdir + name when installed and
* './lib' when running from the source tree
* - moduledir: the directory to look for JS modules;
* this will be pkglibdir when installed and
* './src' when running from the source tree
* - localedir: the directory containing gettext translation files;
* this will be datadir + '/locale' when installed
* and './po' in the source tree
*
* All paths are absolute and will not end with '/'.
*
* As a side effect, init() calls GLib.set_prgname().
*
* @param {object} params package parameters
*/
export function init(params: PackageInitParams): void;
/**
* This is the function to use if you want to have multiple
* entry points in one package.
* You must define a main(ARGV) function inside the passed
* in module, and then the launcher would be
*
* imports.package.init(...);
* imports.package.run(imports.entrypoint);
*
* @param module the module to run
* @returns the exit code of the module's main() function
*/
export function run(module: { main: (argv: string[]) => void }): number | undefined;
/**
* This is a convenience function if your package has a
* single entry point.
* You must define a main(ARGV) function inside a main.js
* module in moduledir.
*
* @param params see init()
*/
export function start(params: PackageInitParams): void;
/**
* Mark a dependency on a specific version of one or more
* external GI typelibs.
* `libs` must be an object whose keys are a typelib name,
* and values are the respective version. The empty string
* indicates any version.
* @param deps The external dependencies to import
*/
export function require(deps: Record<string, string>): void;
/**
* As checkSymbol(), but exit with an error if the
* dependency cannot be satisfied.
*
* @param lib an external dependency to import
* @param ver version of the dependency
* @param symbol symbol to check for
*/
export function requireSymbol(lib: string, ver?: string, symbol?: string): void;
/**
* Check whether an external GI typelib can be imported
* and provides @symbol.
*
* Symbols may refer to
* - global functions ('main_quit')
* - classes ('Window')
* - class / instance methods ('IconTheme.get_default' / 'IconTheme.has_icon')
* - GObject properties ('Window.default_height')
*
* @param lib an external dependency to import
* @param ver version of the dependency
* @param symbol symbol to check for
* @returns true if `lib` can be imported and provides `symbol`, false
* otherwise
*/
export function checkSymbol(lib: string, ver: string, symbol: string): boolean;
/**
* Initialize `gettext`.
* After calling this method `globalThis._`, `globalThis.C_` and `globalThis.N_` will be available.
*/
export function initGettext(): void;
/**
* Initializes string formatting capabilities by adding a format() method to String.prototype.
*
* After calling this method, you can use a printf-style string formatting by calling
* the format() method on any string:
*
* @example
* ```ts
* pkg.initFormat();
*
* // Now you can use format() on any string
* const name = "User";
* const count = 5;
* const formatted = "Hello %s, you have %d items".format(name, count);
* // formatted = "Hello User, you have 5 items"
*
* // Format numbers with precision
* const price = 10.5;
* const priceStr = "Price: $%.2f".format(price);
* // priceStr = "Price: $10.50"
*
* // Pad with zeros
* const id = 42;
* const idStr = "ID: %05d".format(id);
* // idStr = "ID: 00042"
* ```
*/
export function initFormat(): void;
/**
* As checkSymbol(), but exit with an error if the
* dependency cannot be satisfied.
*
* @param lib an external dependency to import
* @param ver version of the dependency
* @param symbol symbol to check for
*/
export function initSubmodule(lib: string, ver?: string, symbol?: string): void;
/**
* Load and register a GResource named @name. @name is optional and defaults to ${package-name}
* @param name The name of the GResource to load
*/
export function loadResource(name?: string): void;
}
declare namespace byteArray {
export class ByteArray {
static get(target: any, property: string, receiver: any): any;
static set(target: any, property: string, value: any, receiver: any): boolean;
length: number;
protected _array: Uint8Array;
constructor(x: Uint8Array | number);
toString(encoding?: TextDecoderEncoding): string;
fromString(input: string, encoding?: TextDecoderEncoding): ByteArray;
toGBytes(): GLib.Bytes;
}
/** @deprecated Use {@link TextEncoder.encode} instead */
export function fromString(input: string, encoding?: TextDecoderEncoding): Uint8Array;
/** @deprecated Use {@link GLib.Bytes.toArray} instead */
export function fromGBytes(input: GLib.Bytes): Uint8Array;
/** @deprecated Use {@link TextDecoder.decode} instead */
export function toString(x: Uint8Array, encoding?: TextDecoderEncoding): string;
/** @deprecated Use {@link GLib.Bytes new GLib.Bytes() } instead */
export function toGBytes(x: Uint8Array): GLib.Bytes;
/** @deprecated Use {@link ByteArray new ByteArray()} instead */
export function fromArray(array: Iterable<number>): ByteArray;
}
declare namespace lang {
// TODO: There is a lot more in Lang
export function Class(props: any): void;
}
declare namespace format {
/**
* Formats a string using printf-style format specifiers.
*
* @param str The format string
* @param args The arguments to be formatted
* @returns The formatted string
*/
export function vprintf(str: string, args: (string | number | boolean | null | undefined)[]): string;
/**
* Prints a formatted string to the console.
* Similar to C's printf function.
*
* @param fmt The format string
* @param args The arguments to be formatted
*/
export function printf(fmt: string, ...args: (string | number | boolean | null | undefined)[]): void;
/**
* Formats a string with the given arguments.
* This is the implementation that backs String.prototype.format
* when pkg.initFormat() is called.
*
* Supported format specifiers:
* - %s: Formats as a string
* - %d: Formats as an integer
* - %x: Formats as a hexadecimal number
* - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
*
* All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
* If the width is prefixed with '0', it will pad with zeroes instead of spaces.
*
* @example
* ```ts
* format.format("Hello %s, you have %d items", "User", 5);
* // Returns: "Hello User, you have 5 items"
* ```
*
* @param fmt The format string
* @param args The arguments to format the string with
* @returns The formatted string
*/
export function format(fmt: string, ...args: (string | number | boolean | null | undefined)[]): string;
}
declare namespace mainloop {
export function quit(name: string): void;
export function idle_source(handler: any, priority?: number): any;
export function idle_add(handler: any, priority?: number): any;
export function timeout_source(timeout: any, handler: any, priority?: number): any;
export function timeout_seconds_source(timeout: any, handler: any, priority?: number): any;
export function timeout_add(timeout: any, handler: any, priority?: number): any;
export function timeout_add_seconds(timeout: any, handler: any, priority?: number): any;
export function source_remove(id: any): any;
export function run(name: string): void;
}
/**
* You can use the `Signals.addSignalMethods` method to apply the `Signals` convenience methods to an `Object`.
* Generally, this is called on an object prototype, but may also be called on an object instance.
* You can use this Interface for this object or prototype to make the methods in typescript known
* @example
* ```ts
* const Signals = imports.signals;
*
* // Define an interface with the same name of your class to make the methods known
* interface Events extends Signals.Methods {}
*
* class Events {}
* Signals.addSignalMethods(Events.prototype);
*
* const events = new Events();
*
* // Typescript will not complain here
* events.emit("test-signal", "test argument");
* ```
*/
export interface SignalMethods {
/**
* Connects a callback to a signal for an object. Pass the returned ID to
* `disconnect()` to remove the handler.
*
* If `callback` returns `true`, emission will stop and no other handlers will be
* invoked.
*
* > Warning: Unlike GObject signals, `this` within a signal callback will always
* > refer to the global object (ie. `globalThis`).
*
* @param sigName A signal name
* @param callback A callback function
* @returns A handler ID
*/
connect(sigName: string, callback: (self: any, ...args: any[]) => void): number;
/**
* Emits a signal for an object. Emission stops if a signal handler returns `true`.
*
* Unlike GObject signals, it is not necessary to declare signals or define their
* signature. Simply call `emit()` with whatever signal name you wish, with
* whatever arguments you wish.
* @param sigName A signal name
* @param args Any number of arguments, of any type
*/
emit(sigName: string, ...args: any[]): void;
/**
* Disconnects a handler for a signal.
* @param id The ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Disconnects all signal handlers for an object.
*/
disconnectAll(): void;
/**
* Checks if a handler ID is connected.
* @param id The ID of the handler to be disconnected
* @returns `true` if connected, or `false` if not
*/
signalHandlerIsConnected(id: number): boolean;
}
declare namespace signals {
export function addSignalMethods<T = any>(proto: T): proto is T & SignalMethods;
}
declare global {
// https://gitlab.gnome.org/GNOME/gjs/-/blob/1.73.2/modules/esm/_encoding/encodingMap.js#L7-232
type TextDecoderEncoding =
| 'unicode-1-1-utf-8'
| 'unicode11utf8'
| 'unicode20utf8'
| 'utf-8'
| 'utf8'
| 'x-unicode20utf8'
| '866'
| 'cp866'
| 'csibm866'
| 'ibm866'
| 'csisolatin2'
| 'iso-8859-2'
| 'iso-ir-101'
| 'iso8859-2'
| 'iso88592'
| 'iso_8859-2'
| 'iso_8859-2:1987'
| 'l2'
| 'latin2'
| 'csisolatin3'
| 'iso-8859-3'
| 'iso-ir-109'
| 'iso8859-3'
| 'iso88593'
| 'iso_8859-3'
| 'iso_8859-3:1988'
| 'l3'
| 'latin3'
| 'csisolatin4'
| 'iso-8859-4'
| 'iso-ir-110'
| 'iso8859-4'
| 'iso88594'
| 'iso_8859-4'
| 'iso_8859-4:1988'
| 'l4'
| 'latin4'
| 'csisolatincyrillic'
| 'cyrillic'
| 'iso-8859-5'
| 'iso-ir-144'
| 'iso8859-5'
| 'iso88595'
| 'iso_8859-5'
| 'iso_8859-5:1988'
| 'arabic'
| 'asmo-708'
| 'csiso88596e'
| 'csiso88596i'
| 'csisolatinarabic'
| 'ecma-114'
| 'iso-8859-6'
| 'iso-8859-6-e'
| 'iso-8859-6-i'
| 'iso-ir-127'
| 'iso8859-6'
| 'iso88596'
| 'iso_8859-6'
| 'iso_8859-6:1987'
| 'csisolatingreek'
| 'ecma-118'
| 'elot_928'
| 'greek'
| 'greek8'
| 'iso-8859-7'
| 'iso-ir-126'
| 'iso8859-7'
| 'iso88597'
| 'iso_8859-7'
| 'iso_8859-7:1987'
| 'sun_eu_greek'
| 'csiso88598e'
| 'csisolatinhebrew'
| 'hebrew'
| 'iso-8859-8'
| 'iso-8859-8-e'
| 'iso-ir-138'
| 'iso8859-8'
| 'iso88598'
| 'iso_8859-8'
| 'iso_8859-8:1988'
| 'visual'
| 'csiso88598i'
| 'iso-8859-8-i'
| 'logical'
| 'csisolatin6'
| 'iso-8859-10'
| 'iso-ir-157'
| 'iso8859-10'
| 'iso885910'
| 'l6'
| 'latin6'
| 'iso-8859-13'
| 'iso8859-13'
| 'iso885913'
| 'iso-8859-14'
| 'iso8859-14'
| 'iso885914'
| 'csisolatin9'
| 'iso-8859-15'
| 'iso8859-15'
| 'iso885915'
| 'iso_8859-15'
| 'l9'
| 'iso-8859-16'
| 'cskoi8r'
| 'koi'
| 'koi8'
| 'koi8-r'
| 'koi8_r'
| 'koi8-ru'
| 'koi8-u'
| 'csmacintosh'
| 'mac'
| 'macintosh'
| 'x-mac-roman'
| 'dos-874'
| 'iso-8859-11'
| 'iso8859-11'
| 'iso885911'
| 'tis-620'
| 'windows-874'
| 'cp1250'
| 'windows-1250'
| 'x-cp1250'
| 'cp1251'
| 'windows-1251'
| 'x-cp1251'
| 'ansi_x3.4-1968'
| 'ascii'
| 'cp1252'
| 'cp819'
| 'csisolatin1'
| 'ibm819'
| 'iso-8859-1'
| 'iso-ir-100'
| 'iso8859-1'
| 'iso88591'
| 'iso_8859-1'
| 'iso_8859-1:1987'
| 'l1'
| 'latin1'
| 'us-ascii'
| 'windows-1252'
| 'x-cp1252'
| 'cp1253'
| 'windows-1253'
| 'x-cp1253'
| 'cp1254'
| 'csisolatin5'
| 'iso-8859-9'
| 'iso-ir-148'
| 'iso8859-9'
| 'iso88599'
| 'iso_8859-9'
| 'iso_8859-9:1989'
| 'l5'
| 'latin5'
| 'windows-1254'
| 'x-cp1254'
| 'cp1255'
| 'windows-1255'
| 'x-cp1255'
| 'cp1256'
| 'windows-1256'
| 'x-cp1256'
| 'cp1257'
| 'windows-1257'
| 'x-cp1257'
| 'cp1258'
| 'windows-1258'
| 'x-cp1258'
| 'x-mac-cyrillic'
| 'x-mac-ukrainian'
| 'chinese'
| 'csgb2312'
| 'csiso58gb231280'
| 'gb2312'
| 'gb_2312'
| 'gb_2312-80'
| 'gbk'
| 'iso-ir-58'
| 'x-gbk'
| 'gb18030'
| 'big5'
| 'cn-big5'
| 'csbig5'
| 'x-x-big5'
| 'cseucpkdfmtjapanese'
| 'euc-jp'
| 'x-euc-jp'
| 'csiso2022jp'
| 'iso-2022-jp'
| 'csshiftjis'
| 'ms932'
| 'ms_kanji'
| 'shift-jis'
| 'shift_jis'
| 'sjis'
| 'windows-31j'
| 'x-sjis'
| 'cseuckr'
| 'csksc56011987'
| 'euc-kr'
| 'iso-ir-149'
| 'korean'
| 'ks_c_5601-1987'
| 'ks_c_5601-1989'
| 'ksc5601'
| 'ksc_5601'
| 'windows-949'
| 'unicodefffe'
| 'utf-16be'
| 'csunicode'
| 'iso-10646-ucs-2'
| 'ucs-2'
| 'unicode'
| 'unicodefeff'
| 'utf-16'
| 'utf-16le';
interface GjsGiImports {
// Will be extended by the import of more gir types
versions: {
[namespace: string]: string;
};
}
interface GjsImports {
gi: GjsGiImports;
lang: typeof lang;
system: typeof system;
signals: typeof signals;
package: typeof package;
mainloop: typeof mainloop;
searchPath: string[];
gettext: typeof gettext;
byteArray: typeof byteArray;
format: typeof format;
cairo: typeof cairo;
}
// Overwrites, see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/script/package.js
/**
* Run `pkg.initGettext()` before using this.
* See {@link gettext.gettext}
*/
const _: typeof gettext.gettext;
/**
* Run `pkg.initGettext()` before using this.
* See {@link gettext.pgettext}
*/
const C_: typeof gettext.pgettext;
/**
* Run `pkg.initGettext()` before using this.
* Currently not implemented.
*/
const N_: (x: string) => string;
function print(...args: any[]): void;
function printerr(...args: any[]): void;
function log(obj: object, others?: object[]): void;
function log(msg: string, substitutions?: any[]): void;
function logError(exception: object, message?: any): void;
function logError(message?: any): void;
const pkg: typeof package;
interface BooleanConstructor {
$gtype: GObject.GType<boolean>;
}
interface NumberConstructor {
$gtype: GObject.GType<number>;
}
interface StringConstructor {
$gtype: GObject.GType<string>;
}
interface StringConstructor {
$gtype: GObject.GType<string>;
}
interface ObjectConstructor {
$gtype: GObject.GType<Object>;
}
const imports: GjsImports;
const ARGV: string[];
interface String {
/**
* Formats a string with the given arguments.
* This method is made available by calling `pkg.initFormat()`.
*
* Supported format specifiers:
* - %s: Formats as a string
* - %d: Formats as an integer
* - %x: Formats as a hexadecimal number
* - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
*
* All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
* If the width is prefixed with '0', it will pad with zeroes instead of spaces.
*
* @example
* ```ts
* // After calling pkg.initFormat()
* "Hello %s, you have %d items".format("User", 5);
* // Returns: "Hello User, you have 5 items"
*
* "Price: $%.2f".format(10.5);
* // Returns: "Price: $10.50"
*
* "ID: %05d".format(42);
* // Returns: "ID: 00042"
* ```
*
* @param args The arguments to format the string with
* @returns The formatted string
*/
format(...args: (string | number | boolean | null | undefined)[]): string;
}
}
declare const _imports: GjsImports;
export default _imports;
export { _imports as imports };

145
home/ags-config/@girs/gl-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,145 @@
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://GL?version=1.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
export namespace GL {
/**
* GL-1.0
*/
function InitNames(): void;
class bitfield {
static $gtype: GObject.GType<bitfield>;
// Constructors
_init(...args: any[]): void;
}
class charARB {
static $gtype: GObject.GType<charARB>;
// Constructors
_init(...args: any[]): void;
}
class clampf {
static $gtype: GObject.GType<clampf>;
// Constructors
_init(...args: any[]): void;
}
class __boolean {
static $gtype: GObject.GType<__boolean>;
// Constructors
_init(...args: any[]): void;
}
class __enum {
static $gtype: GObject.GType<__enum>;
// Constructors
_init(...args: any[]): void;
}
class float {
static $gtype: GObject.GType<float>;
// Constructors
_init(...args: any[]): void;
}
class handleARB {
static $gtype: GObject.GType<handleARB>;
// Constructors
_init(...args: any[]): void;
}
class int {
static $gtype: GObject.GType<int>;
// Constructors
_init(...args: any[]): void;
}
class intptr {
static $gtype: GObject.GType<intptr>;
// Constructors
_init(...args: any[]): void;
}
class sizei {
static $gtype: GObject.GType<sizei>;
// Constructors
_init(...args: any[]): void;
}
class sizeiptr {
static $gtype: GObject.GType<sizeiptr>;
// Constructors
_init(...args: any[]): void;
}
class uint {
static $gtype: GObject.GType<uint>;
// Constructors
_init(...args: any[]): void;
}
class __void {
static $gtype: GObject.GType<__void>;
// Constructors
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default GL;
}
declare module 'gi://GL' {
import GL10 from 'gi://GL?version=1.0';
export default GL10;
}
// END

26903
home/ags-config/@girs/glib-2.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

103
home/ags-config/@girs/glibunix-2.0.d.ts vendored Normal file
View File

@@ -0,0 +1,103 @@
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://GLibUnix?version=2.0' {
// Module dependencies
import type GLib from 'gi://GLib?version=2.0';
import type GObject from 'gi://GObject?version=2.0';
export namespace GLibUnix {
/**
* GLibUnix-2.0
*/
/**
* Mnemonic constants for the ends of a Unix pipe.
*/
/**
* Mnemonic constants for the ends of a Unix pipe.
*/
export namespace PipeEnd {
export const $gtype: GObject.GType<PipeEnd>;
}
enum PipeEnd {
/**
* The readable file descriptor 0
*/
READ,
/**
* The writable file descriptor 1
*/
WRITE,
}
function closefrom(lowfd: number): number;
function error_quark(): GLib.Quark;
function fd_add_full(
priority: number,
fd: number,
condition: GLib.IOCondition | null,
_function: GLib.UnixFDSourceFunc,
): number;
function fd_source_new(fd: number, condition: GLib.IOCondition | null): GLib.Source;
function fdwalk_set_cloexec(lowfd: number): number;
function get_passwd_entry(user_name: string): any | null;
function open_pipe(fds: number, flags: number): boolean;
function set_fd_nonblocking(fd: number, nonblock: boolean): boolean;
function signal_add_full(priority: number, signum: number, handler: GLib.SourceFunc): number;
function signal_source_new(signum: number): GLib.Source;
interface FDSourceFunc {
(fd: number, condition: GLib.IOCondition): boolean;
}
/**
* A Unix pipe. The advantage of this type over `int[2]` is that it can
* be closed automatically when it goes out of scope, using `g_auto(GUnixPipe)`,
* on compilers that support that feature.
*/
class Pipe {
static $gtype: GObject.GType<Pipe>;
// Fields
fds: number[];
// Constructors
constructor(
properties?: Partial<{
fds: number[];
}>,
);
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default GLibUnix;
}
declare module 'gi://GLibUnix' {
import GLibUnix20 from 'gi://GLibUnix?version=2.0';
export default GLibUnix20;
}
// END

207
home/ags-config/@girs/gmodule-2.0.d.ts vendored Normal file
View File

@@ -0,0 +1,207 @@
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://GModule?version=2.0' {
// Module dependencies
import type GLib from 'gi://GLib?version=2.0';
import type GObject from 'gi://GObject?version=2.0';
export namespace GModule {
/**
* GModule-2.0
*/
/**
* Errors returned by g_module_open_full().
*/
class ModuleError extends GLib.Error {
static $gtype: GObject.GType<ModuleError>;
// Static fields
/**
* there was an error loading or opening a module file
*/
static FAILED: number;
/**
* a module returned an error from its `g_module_check_init()` function
*/
static CHECK_FAILED: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
}
const MODULE_IMPL_AR: number;
const MODULE_IMPL_DL: number;
const MODULE_IMPL_NONE: number;
const MODULE_IMPL_WIN32: number;
/**
* A portable way to build the filename of a module. The platform-specific
* prefix and suffix are added to the filename, if needed, and the result
* is added to the directory, using the correct separator character.
*
* The directory should specify the directory where the module can be found.
* It can be %NULL or an empty string to indicate that the module is in a
* standard platform-specific directory, though this is not recommended
* since the wrong module may be found.
*
* For example, calling g_module_build_path() on a Linux system with a
* `directory` of `/lib` and a `module_name` of "mylibrary" will return
* `/lib/libmylibrary.so`. On a Windows system, using `\Windows` as the
* directory it will return `\Windows\mylibrary.dll`.
* @param directory the directory where the module is. This can be %NULL or the empty string to indicate that the standard platform-specific directories will be used, though that is not recommended
* @param module_name the name of the module
* @returns the complete path of the module, including the standard library prefix and suffix. This should be freed when no longer needed
*/
function module_build_path(directory: string | null, module_name: string): string;
/**
* Gets a string describing the last module error.
* @returns a string describing the last module error
*/
function module_error(): string;
function module_error_quark(): GLib.Quark;
/**
* Checks if modules are supported on the current platform.
* @returns %TRUE if modules are supported
*/
function module_supported(): boolean;
interface ModuleCheckInit {
(module: Module): string;
}
interface ModuleUnload {
(module: Module): void;
}
/**
* Flags passed to g_module_open().
* Note that these flags are not supported on all platforms.
*/
/**
* Flags passed to g_module_open().
* Note that these flags are not supported on all platforms.
*/
export namespace ModuleFlags {
export const $gtype: GObject.GType<ModuleFlags>;
}
enum ModuleFlags {
/**
* specifies that symbols are only resolved when
* needed. The default action is to bind all symbols when the module
* is loaded.
*/
LAZY,
/**
* specifies that symbols in the module should
* not be added to the global name space. The default action on most
* platforms is to place symbols in the module in the global name space,
* which may cause conflicts with existing symbols.
*/
LOCAL,
/**
* mask for all flags.
*/
MASK,
}
/**
* The #GModule struct is an opaque data structure to represent a
* [dynamically-loaded module](modules.html#dynamic-loading-of-modules).
* It should only be accessed via the following functions.
*/
abstract class Module {
static $gtype: GObject.GType<Module>;
// Constructors
_init(...args: any[]): void;
// Static methods
/**
* A portable way to build the filename of a module. The platform-specific
* prefix and suffix are added to the filename, if needed, and the result
* is added to the directory, using the correct separator character.
*
* The directory should specify the directory where the module can be found.
* It can be %NULL or an empty string to indicate that the module is in a
* standard platform-specific directory, though this is not recommended
* since the wrong module may be found.
*
* For example, calling g_module_build_path() on a Linux system with a
* `directory` of `/lib` and a `module_name` of "mylibrary" will return
* `/lib/libmylibrary.so`. On a Windows system, using `\Windows` as the
* directory it will return `\Windows\mylibrary.dll`.
* @param directory the directory where the module is. This can be %NULL or the empty string to indicate that the standard platform-specific directories will be used, though that is not recommended
* @param module_name the name of the module
*/
static build_path(directory: string | null, module_name: string): string;
/**
* Gets a string describing the last module error.
*/
static error(): string;
static error_quark(): GLib.Quark;
/**
* Checks if modules are supported on the current platform.
*/
static supported(): boolean;
// Methods
/**
* Closes a module.
* @returns %TRUE on success
*/
close(): boolean;
/**
* Ensures that a module will never be unloaded.
* Any future g_module_close() calls on the module will be ignored.
*/
make_resident(): void;
/**
* Returns the filename that the module was opened with.
*
* If `module` refers to the application itself, "main" is returned.
* @returns the filename of the module
*/
name(): string;
/**
* Gets a symbol pointer from a module, such as one exported
* by %G_MODULE_EXPORT. Note that a valid symbol can be %NULL.
* @param symbol_name the name of the symbol to find
* @returns %TRUE on success
*/
symbol(symbol_name: string): [boolean, any];
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default GModule;
}
declare module 'gi://GModule' {
import GModule20 from 'gi://GModule?version=2.0';
export default GModule20;
}
// END

7259
home/ags-config/@girs/gobject-2.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

3382
home/ags-config/@girs/graphene-1.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

5072
home/ags-config/@girs/gsk-4.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

353446
home/ags-config/@girs/gtk-3.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

273917
home/ags-config/@girs/gtk-4.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,272 @@
/// <reference path="./gtk-4.0.d.ts" />
/// <reference path="./gsk-4.0.d.ts" />
/// <reference path="./graphene-1.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./gdk-4.0.d.ts" />
/// <reference path="./cairo-1.0.d.ts" />
/// <reference path="./cairo.d.ts" />
/// <reference path="./pangocairo-1.0.d.ts" />
/// <reference path="./pango-1.0.d.ts" />
/// <reference path="./harfbuzz-0.0.d.ts" />
/// <reference path="./freetype2-2.0.d.ts" />
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/// <reference path="./gdkpixbuf-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://Gtk4LayerShell?version=1.0' {
// Module dependencies
import type Gtk from 'gi://Gtk?version=4.0';
import type Gsk from 'gi://Gsk?version=4.0';
import type Graphene from 'gi://Graphene?version=1.0';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type Gdk from 'gi://Gdk?version=4.0';
import type cairo from 'cairo';
import type PangoCairo from 'gi://PangoCairo?version=1.0';
import type Pango from 'gi://Pango?version=1.0';
import type HarfBuzz from 'gi://HarfBuzz?version=0.0';
import type freetype2 from 'gi://freetype2?version=2.0';
import type Gio from 'gi://Gio?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
import type GdkPixbuf from 'gi://GdkPixbuf?version=2.0';
export namespace Gtk4LayerShell {
/**
* Gtk4LayerShell-1.0
*/
export namespace Edge {
export const $gtype: GObject.GType<Edge>;
}
enum Edge {
/**
* The left edge of the screen.
*/
LEFT,
/**
* The right edge of the screen.
*/
RIGHT,
/**
* The top edge of the screen.
*/
TOP,
/**
* The bottom edge of the screen.
*/
BOTTOM,
/**
* Should not be used except to get the number of entries. (NOTE: may change in
* future releases as more entries are added)
*/
ENTRY_NUMBER,
}
export namespace KeyboardMode {
export const $gtype: GObject.GType<KeyboardMode>;
}
enum KeyboardMode {
/**
* This window should not receive keyboard events.
*/
NONE,
/**
* This window should have exclusive focus if it is on the top or overlay layer.
*/
EXCLUSIVE,
/**
* The user should be able to focus and unfocues this window in an implementation
* defined way. Not supported for protocol version < 4.
*/
ON_DEMAND,
/**
* Should not be used except to get the number of entries. (NOTE: may change in
* future releases as more entries are added)
*/
ENTRY_NUMBER,
}
export namespace Layer {
export const $gtype: GObject.GType<Layer>;
}
enum Layer {
/**
* The background layer.
*/
BACKGROUND,
/**
* The bottom layer.
*/
BOTTOM,
/**
* The top layer.
*/
TOP,
/**
* The overlay layer.
*/
OVERLAY,
/**
* Should not be used except to get the number of entries. (NOTE: may change in
* future releases as more entries are added)
*/
ENTRY_NUMBER,
}
/**
* When auto exclusive zone is enabled, exclusive zone is automatically set to the
* size of the `window` + relevant margin. To disable auto exclusive zone, just set the
* exclusive zone to 0 or any other fixed value.
*
* NOTE: you can control the auto exclusive zone by changing the margin on the non-anchored
* edge. This behavior is specific to gtk4-layer-shell and not part of the underlying protocol
* @param window A layer surface.
*/
function auto_exclusive_zone_enable(window: Gtk.Window): void;
function auto_exclusive_zone_is_enabled(window: Gtk.Window): boolean;
function get_anchor(window: Gtk.Window, edge: Edge | null): boolean;
function get_exclusive_zone(window: Gtk.Window): number;
function get_keyboard_mode(window: Gtk.Window): KeyboardMode;
function get_layer(window: Gtk.Window): Layer;
function get_major_version(): number;
function get_margin(window: Gtk.Window, edge: Edge | null): number;
function get_micro_version(): number;
function get_minor_version(): number;
/**
* NOTE: To get which monitor the surface is actually on, use
* gdk_display_get_monitor_at_surface().
* @param window A layer surface.
* @returns the monitor this surface will/has requested to be on.
*/
function get_monitor(window: Gtk.Window): Gdk.Monitor | null;
/**
* NOTE: this function does not return ownership of the string. Do not free the returned string.
* Future calls into the library may invalidate the returned string.
* @param window A layer surface.
* @returns a reference to the namespace property. If namespace is unset, returns the default namespace("gtk4-layer-shell"). Never returns %NULL.
*/
function get_namespace(window: Gtk.Window): string;
/**
* May block for a Wayland roundtrip the first time it's called.
* @returns version of the zwlr_layer_shell_v1 protocol supported by the compositor or 0 if the protocol is not supported.
*/
function get_protocol_version(): number;
function get_zwlr_layer_surface_v1(window: Gtk.Window): any | null;
/**
* Set the `window` up to be a layer surface once it is mapped. this must be called before
* the `window` is realized.
* @param window A #GtkWindow to be turned into a layer surface.
*/
function init_for_window(window: Gtk.Window): void;
function is_layer_window(window: Gtk.Window): boolean;
/**
* May block for a Wayland roundtrip the first time it's called.
* @returns %TRUE if the platform is Wayland and Wayland compositor supports the zwlr_layer_shell_v1 protocol.
*/
function is_supported(): boolean;
/**
* Set whether `window` should be anchored to `edge`.
* - If two perpendicular edges are anchored, the surface with be anchored to that corner
* - If two opposite edges are anchored, the window will be stretched across the screen in that direction
*
* Default is %FALSE for each #GtkLayerShellEdge
* @param window A layer surface.
* @param edge A #GtkLayerShellEdge this layer surface may be anchored to.
* @param anchor_to_edge Whether or not to anchor this layer surface to @edge.
*/
function set_anchor(window: Gtk.Window, edge: Edge | null, anchor_to_edge: boolean): void;
/**
* Has no effect unless the surface is anchored to an edge. Requests that the compositor
* does not place other surfaces within the given exclusive zone of the anchored edge.
* For example, a panel can request to not be covered by maximized windows. See
* wlr-layer-shell-unstable-v1.xml for details.
*
* Default is 0
* @param window A layer surface.
* @param exclusive_zone The size of the exclusive zone.
*/
function set_exclusive_zone(window: Gtk.Window, exclusive_zone: number): void;
/**
* Sets if/when `window` should receive keyboard events from the compositor, see
* GtkLayerShellKeyboardMode for details. To control mouse/touch interactivity use input regions,
* see [#61](https://github.com/wmww/gtk4-layer-shell/issues/61) for details.
*
* Default is %GTK_LAYER_SHELL_KEYBOARD_MODE_NONE
* @param window A layer surface.
* @param mode The type of keyboard interactivity requested.
*/
function set_keyboard_mode(window: Gtk.Window, mode: KeyboardMode | null): void;
/**
* Set the "layer" on which the surface appears(controls if it is over top of or below other surfaces). The layer may
* be changed on-the-fly in the current version of the layer shell protocol, but on compositors that only support an
* older version the `window` is remapped so the change can take effect.
*
* Default is %GTK_LAYER_SHELL_LAYER_TOP
* @param window A layer surface.
* @param layer The layer on which this surface appears.
*/
function set_layer(window: Gtk.Window, layer: Layer | null): void;
/**
* Set the margin for a specific `edge` of a `window`. Effects both surface's distance from
* the edge and its exclusive zone size(if auto exclusive zone enabled).
*
* Default is 0 for each #GtkLayerShellEdge
* @param window A layer surface.
* @param edge The #GtkLayerShellEdge for which to set the margin.
* @param margin_size The margin for @edge to be set.
*/
function set_margin(window: Gtk.Window, edge: Edge | null, margin_size: number): void;
/**
* Set the output for the window to be placed on, or %NULL to let the compositor choose.
* If the window is currently mapped, it will get remapped so the change can take effect.
*
* Default is %NULL
* @param window A layer surface.
* @param monitor The output this layer surface will be placed on (%NULL to let the compositor decide).
*/
function set_monitor(window: Gtk.Window, monitor?: Gdk.Monitor | null): void;
/**
* Set the "namespace" of the surface.
*
* No one is quite sure what this is for, but it probably should be something generic
* ("panel", "osk", etc). The `name_space` string is copied, and caller maintains
* ownership of original. If the window is currently mapped, it will get remapped so
* the change can take effect.
*
* Default is "gtk4-layer-shell" (which will be used if set to %NULL)
* @param window A layer surface.
* @param name_space The namespace of this layer surface.
*/
function set_namespace(window: Gtk.Window, name_space?: string | null): void;
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default Gtk4LayerShell;
}
declare module 'gi://Gtk4LayerShell' {
import Gtk4LayerShell10 from 'gi://Gtk4LayerShell?version=1.0';
export default Gtk4LayerShell10;
}
// END

View File

@@ -0,0 +1,158 @@
/// <reference path="./gtk-4.0.d.ts" />
/// <reference path="./gsk-4.0.d.ts" />
/// <reference path="./graphene-1.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./gdk-4.0.d.ts" />
/// <reference path="./cairo-1.0.d.ts" />
/// <reference path="./cairo.d.ts" />
/// <reference path="./pangocairo-1.0.d.ts" />
/// <reference path="./pango-1.0.d.ts" />
/// <reference path="./harfbuzz-0.0.d.ts" />
/// <reference path="./freetype2-2.0.d.ts" />
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/// <reference path="./gdkpixbuf-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://Gtk4SessionLock?version=1.0' {
// Module dependencies
import type Gtk from 'gi://Gtk?version=4.0';
import type Gsk from 'gi://Gsk?version=4.0';
import type Graphene from 'gi://Graphene?version=1.0';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type Gdk from 'gi://Gdk?version=4.0';
import type cairo from 'cairo';
import type PangoCairo from 'gi://PangoCairo?version=1.0';
import type Pango from 'gi://Pango?version=1.0';
import type HarfBuzz from 'gi://HarfBuzz?version=0.0';
import type freetype2 from 'gi://freetype2?version=2.0';
import type Gio from 'gi://Gio?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
import type GdkPixbuf from 'gi://GdkPixbuf?version=2.0';
export namespace Gtk4SessionLock {
/**
* Gtk4SessionLock-1.0
*/
/**
* May block for a Wayland roundtrip the first time it's called.
* @returns %TRUE if the platform is Wayland and Wayland compositor supports the Session Lock protocol.
*/
function is_supported(): boolean;
namespace Instance {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
failed: () => void;
locked: () => void;
monitor: (arg0: Gdk.Monitor) => void;
unlocked: () => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {}
}
/**
* An instance of the object used to control locking the screen.
* Multiple instances can exist at once, but only one can be locked at a time.
*/
class Instance extends GObject.Object {
static $gtype: GObject.GType<Instance>;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Instance.SignalSignatures;
// Constructors
constructor(properties?: Partial<Instance.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Instance;
// Signals
connect<K extends keyof Instance.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Instance.SignalSignatures[K]>,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after<K extends keyof Instance.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Instance.SignalSignatures[K]>,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit<K extends keyof Instance.SignalSignatures>(
signal: K,
...args: GObject.GjsParameters<Instance.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* This must be called with a different unrealized window once for each monitor immediately after calling
* gtk_session_lock_lock(). Hiding a window that is active on a monitor or not letting a window be resized by the
* library is not allowed (may result in a Wayland protocol error). The window will be unmapped and gtk_window_destroy()
* called on it when the current lock ends.
* @param window The GTK Window to use as a lock surface
* @param monitor The monitor to show it on
*/
assign_window_to_monitor(window: Gtk.Window, monitor: Gdk.Monitor): void;
/**
* Returns if this instance currently holds a lock.
*/
is_locked(): boolean;
/**
* Lock the screen. This should be called before assigning any windows to monitors. If this function fails the ::failed
* signal is emitted, if it succeeds the ::locked signal is emitted. The ::failed signal may be emitted before the
* function returns (for example, if another #GtkSessionLockInstance holds a lock) or later (if another process holds a
* lock). The only case where neither signal is triggered is if the instance is already locked.
* @returns false on immediate fail, true if lock acquisition was successfully started
*/
lock(): boolean;
/**
* If the screen is locked by this instance unlocks it and fires ::unlocked. Otherwise has no effect
*/
unlock(): void;
}
type InstanceClass = typeof Instance;
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default Gtk4SessionLock;
}
declare module 'gi://Gtk4SessionLock' {
import Gtk4SessionLock10 from 'gi://Gtk4SessionLock?version=1.0';
export default Gtk4SessionLock10;
}
// END

View File

@@ -0,0 +1,286 @@
/// <reference path="./gtk-3.0.d.ts" />
/// <reference path="./xlib-2.0.d.ts" />
/// <reference path="./gdk-3.0.d.ts" />
/// <reference path="./cairo-1.0.d.ts" />
/// <reference path="./cairo.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./pango-1.0.d.ts" />
/// <reference path="./harfbuzz-0.0.d.ts" />
/// <reference path="./freetype2-2.0.d.ts" />
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/// <reference path="./gdkpixbuf-2.0.d.ts" />
/// <reference path="./atk-1.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://GtkLayerShell?version=0.1' {
// Module dependencies
import type Gtk from 'gi://Gtk?version=3.0';
import type xlib from 'gi://xlib?version=2.0';
import type Gdk from 'gi://Gdk?version=3.0';
import type cairo from 'cairo';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type Pango from 'gi://Pango?version=1.0';
import type HarfBuzz from 'gi://HarfBuzz?version=0.0';
import type freetype2 from 'gi://freetype2?version=2.0';
import type Gio from 'gi://Gio?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
import type GdkPixbuf from 'gi://GdkPixbuf?version=2.0';
import type Atk from 'gi://Atk?version=1.0';
export namespace GtkLayerShell {
/**
* GtkLayerShell-0.1
*/
export namespace Edge {
export const $gtype: GObject.GType<Edge>;
}
enum Edge {
/**
* The left edge of the screen.
*/
LEFT,
/**
* The right edge of the screen.
*/
RIGHT,
/**
* The top edge of the screen.
*/
TOP,
/**
* The bottom edge of the screen.
*/
BOTTOM,
/**
* Should not be used except to get the number of entries. (NOTE: may change in
* future releases as more entries are added)
*/
ENTRY_NUMBER,
}
export namespace KeyboardMode {
export const $gtype: GObject.GType<KeyboardMode>;
}
enum KeyboardMode {
/**
* This window should not receive keyboard events.
*/
NONE,
/**
* This window should have exclusive focus if it is on the top or overlay layer.
*/
EXCLUSIVE,
/**
* The user should be able to focus and unfocues this window in an implementation
* defined way. Not supported for protocol version < 4.
*/
ON_DEMAND,
/**
* Should not be used except to get the number of entries. (NOTE: may change in
* future releases as more entries are added)
*/
ENTRY_NUMBER,
}
export namespace Layer {
export const $gtype: GObject.GType<Layer>;
}
enum Layer {
/**
* The background layer.
*/
BACKGROUND,
/**
* The bottom layer.
*/
BOTTOM,
/**
* The top layer.
*/
TOP,
/**
* The overlay layer.
*/
OVERLAY,
/**
* Should not be used except to get the number of entries. (NOTE: may change in
* future releases as more entries are added)
*/
ENTRY_NUMBER,
}
/**
* When auto exclusive zone is enabled, exclusive zone is automatically set to the
* size of the `window` + relevant margin. To disable auto exclusive zone, just set the
* exclusive zone to 0 or any other fixed value.
*
* NOTE: you can control the auto exclusive zone by changing the margin on the non-anchored
* edge. This behavior is specific to gtk-layer-shell and not part of the underlying protocol
* @param window A layer surface.
*/
function auto_exclusive_zone_enable(window: Gtk.Window): void;
function auto_exclusive_zone_is_enabled(window: Gtk.Window): boolean;
function get_anchor(window: Gtk.Window, edge: Edge | null): boolean;
function get_exclusive_zone(window: Gtk.Window): number;
function get_keyboard_interactivity(window: Gtk.Window): boolean;
function get_keyboard_mode(window: Gtk.Window): KeyboardMode;
function get_layer(window: Gtk.Window): Layer;
function get_major_version(): number;
function get_margin(window: Gtk.Window, edge: Edge | null): number;
function get_micro_version(): number;
function get_minor_version(): number;
/**
* NOTE: To get which monitor the surface is actually on, use
* gdk_display_get_monitor_at_window().
* @param window A layer surface.
* @returns the monitor this surface will/has requested to be on, can be %NULL.
*/
function get_monitor(window: Gtk.Window): Gdk.Monitor;
/**
* NOTE: this function does not return ownership of the string. Do not free the returned string.
* Future calls into the library may invalidate the returned string.
* @param window A layer surface.
* @returns a reference to the namespace property. If namespace is unset, returns the default namespace ("gtk-layer-shell"). Never returns %NULL.
*/
function get_namespace(window: Gtk.Window): string;
/**
* May block for a Wayland roundtrip the first time it's called.
* @returns version of the zwlr_layer_shell_v1 protocol supported by the compositor or 0 if the protocol is not supported.
*/
function get_protocol_version(): number;
function get_zwlr_layer_surface_v1(window: Gtk.Window): any | null;
/**
* Set the `window` up to be a layer surface once it is mapped. this must be called before
* the `window` is realized.
* @param window A #GtkWindow to be turned into a layer surface.
*/
function init_for_window(window: Gtk.Window): void;
function is_layer_window(window: Gtk.Window): boolean;
/**
* May block for a Wayland roundtrip the first time it's called.
* @returns %TRUE if the platform is Wayland and Wayland compositor supports the zwlr_layer_shell_v1 protocol.
*/
function is_supported(): boolean;
/**
* Set whether `window` should be anchored to `edge`.
* - If two perpendicular edges are anchored, the surface with be anchored to that corner
* - If two opposite edges are anchored, the window will be stretched across the screen in that direction
*
* Default is %FALSE for each #GtkLayerShellEdge
* @param window A layer surface.
* @param edge A #GtkLayerShellEdge this layer surface may be anchored to.
* @param anchor_to_edge Whether or not to anchor this layer surface to @edge.
*/
function set_anchor(window: Gtk.Window, edge: Edge | null, anchor_to_edge: boolean): void;
/**
* Has no effect unless the surface is anchored to an edge. Requests that the compositor
* does not place other surfaces within the given exclusive zone of the anchored edge.
* For example, a panel can request to not be covered by maximized windows. See
* wlr-layer-shell-unstable-v1.xml for details.
*
* Default is 0
* @param window A layer surface.
* @param exclusive_zone The size of the exclusive zone.
*/
function set_exclusive_zone(window: Gtk.Window, exclusive_zone: number): void;
/**
* Whether the `window` should receive keyboard events from the compositor.
*
* Default is %FALSE
* @param window A layer surface.
* @param interactivity Whether the layer surface should receive keyboard events.
*/
function set_keyboard_interactivity(window: Gtk.Window, interactivity: boolean): void;
/**
* Sets if/when `window` should receive keyboard events from the compositor, see
* GtkLayerShellKeyboardMode for details.
*
* Default is %GTK_LAYER_SHELL_KEYBOARD_MODE_NONE
* @param window A layer surface.
* @param mode The type of keyboard interactivity requested.
*/
function set_keyboard_mode(window: Gtk.Window, mode: KeyboardMode | null): void;
/**
* Set the "layer" on which the surface appears (controls if it is over top of or below other surfaces). The layer may
* be changed on-the-fly in the current version of the layer shell protocol, but on compositors that only support an
* older version the `window` is remapped so the change can take effect.
*
* Default is %GTK_LAYER_SHELL_LAYER_TOP
* @param window A layer surface.
* @param layer The layer on which this surface appears.
*/
function set_layer(window: Gtk.Window, layer: Layer | null): void;
/**
* Set the margin for a specific `edge` of a `window`. Effects both surface's distance from
* the edge and its exclusive zone size (if auto exclusive zone enabled).
*
* Default is 0 for each #GtkLayerShellEdge
* @param window A layer surface.
* @param edge The #GtkLayerShellEdge for which to set the margin.
* @param margin_size The margin for @edge to be set.
*/
function set_margin(window: Gtk.Window, edge: Edge | null, margin_size: number): void;
/**
* Set the output for the window to be placed on, or %NULL to let the compositor choose.
* If the window is currently mapped, it will get remapped so the change can take effect.
*
* Default is %NULL
* @param window A layer surface.
* @param monitor The output this layer surface will be placed on (%NULL to let the compositor decide).
*/
function set_monitor(window: Gtk.Window, monitor: Gdk.Monitor): void;
/**
* Set the "namespace" of the surface.
*
* No one is quite sure what this is for, but it probably should be something generic
* ("panel", "osk", etc). The `name_space` string is copied, and caller maintains
* ownership of original. If the window is currently mapped, it will get remapped so
* the change can take effect.
*
* Default is "gtk-layer-shell" (which will be used if set to %NULL)
* @param window A layer surface.
* @param name_space The namespace of this layer surface.
*/
function set_namespace(window: Gtk.Window, name_space: string): void;
/**
* Commits a surface state if there's no pending commit scheduled by the GTK.
* You almost never need to call this; the only known case is when the surface is in a state
* where it does not receive frame callbacks and the regular deferred commit mechanism
* is unavailable.
* @param window A layer surface.
*/
function try_force_commit(window: Gtk.Window): void;
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default GtkLayerShell;
}
declare module 'gi://GtkLayerShell' {
import GtkLayerShell01 from 'gi://GtkLayerShell?version=0.1';
export default GtkLayerShell01;
}
// END

16107
home/ags-config/@girs/gtksource-3.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

9626
home/ags-config/@girs/harfbuzz-0.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

8
home/ags-config/@girs/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* This file exports all type definitions.
*/
import './gjs.d.ts';
import './dom.d.ts';
import './gi.d.ts';
import './console.d.ts';

File diff suppressed because it is too large Load Diff

105
home/ags-config/@girs/libxml2-2.0.d.ts vendored Normal file
View File

@@ -0,0 +1,105 @@
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://libxml2?version=2.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
export namespace libxml2 {
/**
* libxml2-2.0
*/
function dummy(): void;
class Node {
static $gtype: GObject.GType<Node>;
// Constructors
_init(...args: any[]): void;
}
class NodePtr {
static $gtype: GObject.GType<NodePtr>;
// Constructors
_init(...args: any[]): void;
}
class Doc {
static $gtype: GObject.GType<Doc>;
// Constructors
_init(...args: any[]): void;
}
class DocPtr {
static $gtype: GObject.GType<DocPtr>;
// Constructors
_init(...args: any[]): void;
}
class NsPtr {
static $gtype: GObject.GType<NsPtr>;
// Constructors
_init(...args: any[]): void;
}
class Char {
static $gtype: GObject.GType<Char>;
// Constructors
_init(...args: any[]): void;
}
class TextWriter {
static $gtype: GObject.GType<TextWriter>;
// Constructors
_init(...args: any[]): void;
}
class TextReader {
static $gtype: GObject.GType<TextReader>;
// Constructors
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default libxml2;
}
declare module 'gi://libxml2' {
import Libxml220 from 'gi://libxml2?version=2.0';
export default Libxml220;
}
// END

9500
home/ags-config/@girs/pango-1.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,450 @@
/// <reference path="./cairo-1.0.d.ts" />
/// <reference path="./cairo.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./pango-1.0.d.ts" />
/// <reference path="./harfbuzz-0.0.d.ts" />
/// <reference path="./freetype2-2.0.d.ts" />
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://PangoCairo?version=1.0' {
// Module dependencies
import type cairo from 'cairo';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type Pango from 'gi://Pango?version=1.0';
import type HarfBuzz from 'gi://HarfBuzz?version=0.0';
import type freetype2 from 'gi://freetype2?version=2.0';
import type Gio from 'gi://Gio?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
export namespace PangoCairo {
/**
* PangoCairo-1.0
*/
/**
* Retrieves any font rendering options previously set with
* [func`PangoCairo`.context_set_font_options].
*
* This function does not report options that are derived from
* the target surface by [func`update_context]`.
* @param context a `PangoContext`, from a pangocairo font map
* @returns the font options previously set on the context, or %NULL if no options have been set. This value is owned by the context and must not be modified or freed.
*/
function context_get_font_options(context: Pango.Context): cairo.FontOptions | null;
/**
* Gets the resolution for the context.
*
* See [func`PangoCairo`.context_set_resolution]
* @param context a `PangoContext`, from a pangocairo font map
* @returns the resolution in "dots per inch". A negative value will be returned if no resolution has previously been set.
*/
function context_get_resolution(context: Pango.Context): number;
/**
* Sets the font options used when rendering text with this context.
*
* These options override any options that [func`update_context]`
* derives from the target surface.
* @param context a `PangoContext`, from a pangocairo font map
* @param options a `cairo_font_options_t`, or %NULL to unset any previously set options. A copy is made.
*/
function context_set_font_options(context: Pango.Context, options?: cairo.FontOptions | null): void;
/**
* Sets the resolution for the context.
*
* This is a scale factor between points specified in a `PangoFontDescription`
* and Cairo units. The default value is 96, meaning that a 10 point font will
* be 13 units high. (10 * 96. / 72. = 13.3).
* @param context a `PangoContext`, from a pangocairo font map
* @param dpi the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.) A 0 or negative value means to use the resolution from the font map.
*/
function context_set_resolution(context: Pango.Context, dpi: number): void;
/**
* Sets callback function for context to use for rendering attributes
* of type %PANGO_ATTR_SHAPE.
*
* See `PangoCairoShapeRendererFunc` for details.
* @param context a `PangoContext`, from a pangocairo font map
* @param func Callback function for rendering attributes of type %PANGO_ATTR_SHAPE, or %NULL to disable shape rendering.
* @param dnotify Callback that will be called when the context is freed to release @data
*/
function context_set_shape_renderer(
context: Pango.Context,
func?: ShapeRendererFunc | null,
dnotify?: GLib.DestroyNotify | null,
): void;
/**
* Creates a context object set up to match the current transformation
* and target surface of the Cairo context.
*
* This context can then be
* used to create a layout using [ctor`Pango`.Layout.new].
*
* This function is a convenience function that creates a context using
* the default font map, then updates it to `cr`. If you just need to
* create a layout for use with `cr` and do not need to access `PangoContext`
* directly, you can use [func`create_layout]` instead.
* @param cr a Cairo context
* @returns the newly created `PangoContext`
*/
function create_context(cr: cairo.Context): Pango.Context;
/**
* Creates a layout object set up to match the current transformation
* and target surface of the Cairo context.
*
* This layout can then be used for text measurement with functions
* like [method`Pango`.Layout.get_size] or drawing with functions like
* [func`show_layout]`. If you change the transformation or target
* surface for `cr,` you need to call [func`update_layout]`.
*
* This function is the most convenient way to use Cairo with Pango,
* however it is slightly inefficient since it creates a separate
* `PangoContext` object for each layout. This might matter in an
* application that was laying out large amounts of text.
* @param cr a Cairo context
* @returns the newly created `PangoLayout`
*/
function create_layout(cr: cairo.Context): Pango.Layout;
/**
* Add a squiggly line to the current path in the specified cairo context that
* approximately covers the given rectangle in the style of an underline used
* to indicate a spelling error.
*
* The width of the underline is rounded to an integer number of up/down
* segments and the resulting rectangle is centered in the original rectangle.
* @param cr a Cairo context
* @param x The X coordinate of one corner of the rectangle
* @param y The Y coordinate of one corner of the rectangle
* @param width Non-negative width of the rectangle
* @param height Non-negative height of the rectangle
*/
function error_underline_path(cr: cairo.Context, x: number, y: number, width: number, height: number): void;
/**
* Gets a default `PangoCairoFontMap` to use with Cairo.
*
* Note that the type of the returned object will depend on the
* particular font backend Cairo was compiled to use; you generally
* should only use the `PangoFontMap` and `PangoCairoFontMap`
* interfaces on the returned object.
*
* The default Cairo fontmap can be changed by using
* [method`PangoCairo`.FontMap.set_default]. This can be used to
* change the Cairo font backend that the default fontmap uses
* for example.
*
* Note that since Pango 1.32.6, the default fontmap is per-thread.
* Each thread gets its own default fontmap. In this way, PangoCairo
* can be used safely from multiple threads.
* @returns the default PangoCairo fontmap for the current thread. This object is owned by Pango and must not be freed.
*/
function font_map_get_default(): Pango.FontMap;
/**
* Creates a new `PangoCairoFontMap` object.
*
* A fontmap is used to cache information about available fonts,
* and holds certain global parameters such as the resolution.
* In most cases, you can use `func`PangoCairo`.font_map_get_default]
* instead.
*
* Note that the type of the returned object will depend
* on the particular font backend Cairo was compiled to use;
* You generally should only use the `PangoFontMap` and
* `PangoCairoFontMap` interfaces on the returned object.
*
* You can override the type of backend returned by using an
* environment variable %PANGOCAIRO_BACKEND. Supported types,
* based on your build, are fc (fontconfig), win32, and coretext.
* If requested type is not available, NULL is returned. Ie.
* this is only useful for testing, when at least two backends
* are compiled in.
* @returns the newly allocated `PangoFontMap`, which should be freed with g_object_unref().
*/
function font_map_new(): Pango.FontMap;
/**
* Creates a new `PangoCairoFontMap` object of the type suitable
* to be used with cairo font backend of type `fonttype`.
*
* In most cases one should simply use [func`PangoCairo`.FontMap.new], or
* in fact in most of those cases, just use [func`PangoCairo`.FontMap.get_default].
* @param fonttype desired #cairo_font_type_t
* @returns the newly allocated `PangoFontMap` of suitable type which should be freed with g_object_unref(), or %NULL if the requested cairo font backend is not supported / compiled in.
*/
function font_map_new_for_font_type(fonttype: cairo.FontType | null): Pango.FontMap | null;
/**
* Adds the glyphs in `glyphs` to the current path in the specified
* cairo context.
*
* The origin of the glyphs (the left edge of the baseline)
* will be at the current point of the cairo context.
* @param cr a Cairo context
* @param font a `PangoFont` from a `PangoCairoFontMap`
* @param glyphs a `PangoGlyphString`
*/
function glyph_string_path(cr: cairo.Context, font: Pango.Font, glyphs: Pango.GlyphString): void;
/**
* Adds the text in `PangoLayoutLine` to the current path in the
* specified cairo context.
*
* The origin of the glyphs (the left edge of the line) will be
* at the current point of the cairo context.
* @param cr a Cairo context
* @param line a `PangoLayoutLine`
*/
function layout_line_path(cr: cairo.Context, line: Pango.LayoutLine): void;
/**
* Adds the text in a `PangoLayout` to the current path in the
* specified cairo context.
*
* The top-left corner of the `PangoLayout` will be at the
* current point of the cairo context.
* @param cr a Cairo context
* @param layout a Pango layout
*/
function layout_path(cr: cairo.Context, layout: Pango.Layout): void;
/**
* Draw a squiggly line in the specified cairo context that approximately
* covers the given rectangle in the style of an underline used to indicate a
* spelling error.
*
* The width of the underline is rounded to an integer
* number of up/down segments and the resulting rectangle is centered in the
* original rectangle.
* @param cr a Cairo context
* @param x The X coordinate of one corner of the rectangle
* @param y The Y coordinate of one corner of the rectangle
* @param width Non-negative width of the rectangle
* @param height Non-negative height of the rectangle
*/
function show_error_underline(cr: cairo.Context, x: number, y: number, width: number, height: number): void;
/**
* Draws the glyphs in `glyph_item` in the specified cairo context,
*
* embedding the text associated with the glyphs in the output if the
* output format supports it (PDF for example), otherwise it acts
* similar to [func`show_glyph_string]`.
*
* The origin of the glyphs (the left edge of the baseline) will
* be drawn at the current point of the cairo context.
*
* Note that `text` is the start of the text for layout, which is then
* indexed by `glyph_item->item->offset`.
* @param cr a Cairo context
* @param text the UTF-8 text that @glyph_item refers to
* @param glyph_item a `PangoGlyphItem`
*/
function show_glyph_item(cr: cairo.Context, text: string, glyph_item: Pango.GlyphItem): void;
/**
* Draws the glyphs in `glyphs` in the specified cairo context.
*
* The origin of the glyphs (the left edge of the baseline) will
* be drawn at the current point of the cairo context.
* @param cr a Cairo context
* @param font a `PangoFont` from a `PangoCairoFontMap`
* @param glyphs a `PangoGlyphString`
*/
function show_glyph_string(cr: cairo.Context, font: Pango.Font, glyphs: Pango.GlyphString): void;
/**
* Draws a `PangoLayout` in the specified cairo context.
*
* The top-left corner of the `PangoLayout` will be drawn
* at the current point of the cairo context.
* @param cr a Cairo context
* @param layout a Pango layout
*/
function show_layout(cr: cairo.Context, layout: Pango.Layout): void;
/**
* Draws a `PangoLayoutLine` in the specified cairo context.
*
* The origin of the glyphs (the left edge of the line) will
* be drawn at the current point of the cairo context.
* @param cr a Cairo context
* @param line a `PangoLayoutLine`
*/
function show_layout_line(cr: cairo.Context, line: Pango.LayoutLine): void;
/**
* Updates a `PangoContext` previously created for use with Cairo to
* match the current transformation and target surface of a Cairo
* context.
*
* If any layouts have been created for the context, it's necessary
* to call [method`Pango`.Layout.context_changed] on those layouts.
* @param cr a Cairo context
* @param context a `PangoContext`, from a pangocairo font map
*/
function update_context(cr: cairo.Context, context: Pango.Context): void;
/**
* Updates the private `PangoContext` of a `PangoLayout` created with
* [func`create_layout]` to match the current transformation and target
* surface of a Cairo context.
* @param cr a Cairo context
* @param layout a `PangoLayout`, from [func@create_layout]
*/
function update_layout(cr: cairo.Context, layout: Pango.Layout): void;
interface ShapeRendererFunc {
(cr: cairo.Context, attr: Pango.AttrShape, do_path: boolean): void;
}
namespace Font {
// Constructor properties interface
interface ConstructorProps extends Pango.Font.ConstructorProps {}
}
export interface FontNamespace {
$gtype: GObject.GType<Font>;
prototype: Font;
}
interface Font extends Pango.Font {
// Methods
/**
* Gets the `cairo_scaled_font_t` used by `font`.
* The scaled font can be referenced and kept using
* cairo_scaled_font_reference().
* @returns the `cairo_scaled_font_t` used by @font
*/
get_scaled_font(): cairo.ScaledFont | null;
}
export const Font: FontNamespace & {
new (): Font; // This allows `obj instanceof Font`
};
namespace FontMap {
// Constructor properties interface
interface ConstructorProps extends Pango.FontMap.ConstructorProps {}
}
export interface FontMapNamespace {
$gtype: GObject.GType<FontMap>;
prototype: FontMap;
/**
* Gets a default `PangoCairoFontMap` to use with Cairo.
*
* Note that the type of the returned object will depend on the
* particular font backend Cairo was compiled to use; you generally
* should only use the `PangoFontMap` and `PangoCairoFontMap`
* interfaces on the returned object.
*
* The default Cairo fontmap can be changed by using
* [method`PangoCairo`.FontMap.set_default]. This can be used to
* change the Cairo font backend that the default fontmap uses
* for example.
*
* Note that since Pango 1.32.6, the default fontmap is per-thread.
* Each thread gets its own default fontmap. In this way, PangoCairo
* can be used safely from multiple threads.
*/
get_default(): Pango.FontMap;
/**
* Creates a new `PangoCairoFontMap` object.
*
* A fontmap is used to cache information about available fonts,
* and holds certain global parameters such as the resolution.
* In most cases, you can use `func`PangoCairo`.font_map_get_default]
* instead.
*
* Note that the type of the returned object will depend
* on the particular font backend Cairo was compiled to use;
* You generally should only use the `PangoFontMap` and
* `PangoCairoFontMap` interfaces on the returned object.
*
* You can override the type of backend returned by using an
* environment variable %PANGOCAIRO_BACKEND. Supported types,
* based on your build, are fc (fontconfig), win32, and coretext.
* If requested type is not available, NULL is returned. Ie.
* this is only useful for testing, when at least two backends
* are compiled in.
*/
['new'](): Pango.FontMap;
/**
* Creates a new `PangoCairoFontMap` object of the type suitable
* to be used with cairo font backend of type `fonttype`.
*
* In most cases one should simply use [func`PangoCairo`.FontMap.new], or
* in fact in most of those cases, just use [func`PangoCairo`.FontMap.get_default].
* @param fonttype desired #cairo_font_type_t
*/
new_for_font_type(fonttype: cairo.FontType): Pango.FontMap | null;
}
interface FontMap extends Pango.FontMap {
// Methods
/**
* Gets the type of Cairo font backend that `fontmap` uses.
* @returns the `cairo_font_type_t` cairo font backend type
*/
get_font_type(): cairo.FontType;
/**
* Gets the resolution for the fontmap.
*
* See [method`PangoCairo`.FontMap.set_resolution].
* @returns the resolution in "dots per inch"
*/
get_resolution(): number;
/**
* Sets a default `PangoCairoFontMap` to use with Cairo.
*
* This can be used to change the Cairo font backend that the
* default fontmap uses for example. The old default font map
* is unreffed and the new font map referenced.
*
* Note that since Pango 1.32.6, the default fontmap is per-thread.
* This function only changes the default fontmap for
* the current thread. Default fontmaps of existing threads
* are not changed. Default fontmaps of any new threads will
* still be created using [func`PangoCairo`.FontMap.new].
*
* A value of %NULL for `fontmap` will cause the current default
* font map to be released and a new default font map to be created
* on demand, using [func`PangoCairo`.FontMap.new].
*/
set_default(): void;
/**
* Sets the resolution for the fontmap.
*
* This is a scale factor between
* points specified in a `PangoFontDescription` and Cairo units. The
* default value is 96, meaning that a 10 point font will be 13
* units high. (10 * 96. / 72. = 13.3).
* @param dpi the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.)
*/
set_resolution(dpi: number): void;
}
export const FontMap: FontMapNamespace & {
new (): FontMap; // This allows `obj instanceof FontMap`
};
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default PangoCairo;
}
declare module 'gi://PangoCairo' {
import PangoCairo10 from 'gi://PangoCairo?version=1.0';
export default PangoCairo10;
}
// END

1058
home/ags-config/@girs/pangofc-1.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

810
home/ags-config/@girs/pangoft2-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,810 @@
/// <reference path="./freetype2-2.0.d.ts" />
/// <reference path="./pangofc-1.0.d.ts" />
/// <reference path="./fontconfig-2.0.d.ts" />
/// <reference path="./pango-1.0.d.ts" />
/// <reference path="./cairo-1.0.d.ts" />
/// <reference path="./cairo.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./harfbuzz-0.0.d.ts" />
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://PangoFT2?version=1.0' {
// Module dependencies
import type freetype2 from 'gi://freetype2?version=2.0';
import type PangoFc from 'gi://PangoFc?version=1.0';
import type fontconfig from 'gi://fontconfig?version=2.0';
import type Pango from 'gi://Pango?version=1.0';
import type cairo from 'cairo';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type HarfBuzz from 'gi://HarfBuzz?version=0.0';
import type Gio from 'gi://Gio?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
export namespace PangoFT2 {
/**
* PangoFT2-1.0
*/
/**
* Gets the `PangoCoverage` for a `PangoFT2Font`.
*
* Use [method`Pango`.Font.get_coverage] instead.
* @param font a Pango FT2 font
* @param language a language tag.
* @returns a `PangoCoverage`
*/
function font_get_coverage(font: Pango.Font, language: Pango.Language): Pango.Coverage;
/**
* Retrieves kerning information for a combination of two glyphs.
*
* Use pango_fc_font_kern_glyphs() instead.
* @param font a `PangoFont`
* @param left the left `PangoGlyph`
* @param right the right `PangoGlyph`
* @returns The amount of kerning (in Pango units) to apply for the given combination of glyphs.
*/
function font_get_kerning(font: Pango.Font, left: Pango.Glyph, right: Pango.Glyph): number;
/**
* Return the index of a glyph suitable for drawing unknown
* characters with `font,` or %PANGO_GLYPH_EMPTY if no suitable
* glyph found.
*
* If you want to draw an unknown-box for a character that
* is not covered by the font, use PANGO_GET_UNKNOWN_GLYPH()
* instead.
* @param font a `PangoFont`
* @returns a glyph index into @font, or %PANGO_GLYPH_EMPTY
*/
function get_unknown_glyph(font: Pango.Font): Pango.Glyph;
/**
* Renders a `PangoGlyphString` onto a FreeType2 bitmap.
* @param bitmap the FreeType2 bitmap onto which to draw the string
* @param font the font in which to draw the string
* @param glyphs the glyph string to draw
* @param x the x position of the start of the string (in pixels)
* @param y the y position of the baseline (in pixels)
*/
function render(
bitmap: freetype2.Bitmap,
font: Pango.Font,
glyphs: Pango.GlyphString,
x: number,
y: number,
): void;
/**
* Render a `PangoLayout` onto a FreeType2 bitmap
* @param bitmap a FT_Bitmap to render the layout onto
* @param layout a `PangoLayout`
* @param x the X position of the left of the layout (in pixels)
* @param y the Y position of the top of the layout (in pixels)
*/
function render_layout(bitmap: freetype2.Bitmap, layout: Pango.Layout, x: number, y: number): void;
/**
* Render a `PangoLayoutLine` onto a FreeType2 bitmap
* @param bitmap a FT_Bitmap to render the line onto
* @param line a `PangoLayoutLine`
* @param x the x position of start of string (in pixels)
* @param y the y position of baseline (in pixels)
*/
function render_layout_line(bitmap: freetype2.Bitmap, line: Pango.LayoutLine, x: number, y: number): void;
/**
* Render a `PangoLayoutLine` onto a FreeType2 bitmap, with he
* location specified in fixed-point Pango units rather than
* pixels.
*
* (Using this will avoid extra inaccuracies from rounding
* to integer pixels multiple times, even if the final glyph
* positions are integers.)
* @param bitmap a FT_Bitmap to render the line onto
* @param line a `PangoLayoutLine`
* @param x the x position of start of string (in Pango units)
* @param y the y position of baseline (in Pango units)
*/
function render_layout_line_subpixel(
bitmap: freetype2.Bitmap,
line: Pango.LayoutLine,
x: number,
y: number,
): void;
/**
* Render a `PangoLayout` onto a FreeType2 bitmap, with he
* location specified in fixed-point Pango units rather than
* pixels.
*
* (Using this will avoid extra inaccuracies from rounding
* to integer pixels multiple times, even if the final glyph
* positions are integers.)
* @param bitmap a FT_Bitmap to render the layout onto
* @param layout a `PangoLayout`
* @param x the X position of the left of the layout (in Pango units)
* @param y the Y position of the top of the layout (in Pango units)
*/
function render_layout_subpixel(bitmap: freetype2.Bitmap, layout: Pango.Layout, x: number, y: number): void;
/**
* Renders a `PangoGlyphString` onto a FreeType2 bitmap, possibly
* transforming the layed-out coordinates through a transformation
* matrix.
*
* Note that the transformation matrix for `font` is not
* changed, so to produce correct rendering results, the `font`
* must have been loaded using a `PangoContext` with an identical
* transformation matrix to that passed in to this function.
* @param bitmap the FreeType2 bitmap onto which to draw the string
* @param matrix a `PangoMatrix`
* @param font the font in which to draw the string
* @param glyphs the glyph string to draw
* @param x the x position of the start of the string (in Pango units in user space coordinates)
* @param y the y position of the baseline (in Pango units in user space coordinates)
*/
function render_transformed(
bitmap: freetype2.Bitmap,
matrix: Pango.Matrix | null,
font: Pango.Font,
glyphs: Pango.GlyphString,
x: number,
y: number,
): void;
/**
* Free the global fontmap. (See pango_ft2_font_map_for_display())
* Use of the global PangoFT2 fontmap is deprecated.
*/
function shutdown_display(): void;
interface SubstituteFunc {
(pattern: fontconfig.Pattern, data?: any | null): void;
}
namespace FontMap {
// Signal signatures
interface SignalSignatures extends PangoFc.FontMap.SignalSignatures {
'notify::item-type': (pspec: GObject.ParamSpec) => void;
'notify::n-items': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps<A extends GObject.Object = GObject.Object>
extends PangoFc.FontMap.ConstructorProps<A>,
Gio.ListModel.ConstructorProps {}
}
/**
* The `PangoFT2FontMap` is the `PangoFontMap` implementation for FreeType fonts.
*/
class FontMap<A extends GObject.Object = GObject.Object>
extends PangoFc.FontMap<A>
implements Gio.ListModel<A>
{
static $gtype: GObject.GType<FontMap>;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: FontMap.SignalSignatures;
// Constructors
constructor(properties?: Partial<FontMap.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): FontMap;
// Signals
connect<K extends keyof FontMap.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, FontMap.SignalSignatures[K]>,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after<K extends keyof FontMap.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, FontMap.SignalSignatures[K]>,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit<K extends keyof FontMap.SignalSignatures>(
signal: K,
...args: GObject.GjsParameters<FontMap.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* Sets a function that will be called to do final configuration
* substitution on a `FcPattern` before it is used to load
* the font.
*
* This function can be used to do things like set
* hinting and antialiasing options.
* @param func function to call to to do final config tweaking on #FcPattern objects.
*/
set_default_substitute(func: SubstituteFunc): void;
// Conflicted with PangoFc.FontMap.set_default_substitute
set_default_substitute(...args: never[]): any;
/**
* Sets the horizontal and vertical resolutions for the fontmap.
* @param dpi_x dots per inch in the X direction
* @param dpi_y dots per inch in the Y direction
*/
set_resolution(dpi_x: number, dpi_y: number): void;
/**
* Call this function any time the results of the
* default substitution function set with
* pango_ft2_font_map_set_default_substitute() change.
*
* That is, if your substitution function will return different
* results for the same input pattern, you must call this function.
*/
substitute_changed(): void;
// Inherited methods
/**
* Gets the type of the items in `list`.
*
* All items returned from g_list_model_get_item() are of the type
* returned by this function, or a subtype, or if the type is an
* interface, they are an implementation of that interface.
*
* The item type of a #GListModel can not change during the life of the
* model.
* @returns the #GType of the items contained in @list.
*/
get_item_type(): GObject.GType;
/**
* Gets the number of items in `list`.
*
* Depending on the model implementation, calling this function may be
* less efficient than iterating the list with increasing values for
* `position` until g_list_model_get_item() returns %NULL.
* @returns the number of items in @list.
*/
get_n_items(): number;
/**
* Get the item at `position`.
*
* If `position` is greater than the number of items in `list,` %NULL is
* returned.
*
* %NULL is never returned for an index that is smaller than the length
* of the list.
*
* This function is meant to be used by language bindings in place
* of g_list_model_get_item().
*
* See also: g_list_model_get_n_items()
* @param position the position of the item to fetch
* @returns the object at @position.
*/
get_item(position: number): A | null;
/**
* Emits the #GListModel::items-changed signal on `list`.
*
* This function should only be called by classes implementing
* #GListModel. It has to be called after the internal representation
* of `list` has been updated, because handlers connected to this signal
* might query the new state of the list.
*
* Implementations must only make changes to the model (as visible to
* its consumer) in places that will not cause problems for that
* consumer. For models that are driven directly by a write API (such
* as #GListStore), changes can be reported in response to uses of that
* API. For models that represent remote data, changes should only be
* made from a fresh mainloop dispatch. It is particularly not
* permitted to make changes in response to a call to the #GListModel
* consumer API.
*
* Stated another way: in general, it is assumed that code making a
* series of accesses to the model via the API, without returning to the
* mainloop, and without calling other code, will continue to view the
* same contents of the model.
* @param position the position at which @list changed
* @param removed the number of items removed
* @param added the number of items added
*/
items_changed(position: number, removed: number, added: number): void;
/**
* Get the item at `position`. If `position` is greater than the number of
* items in `list,` %NULL is returned.
*
* %NULL is never returned for an index that is smaller than the length
* of the list. See g_list_model_get_n_items().
*
* The same #GObject instance may not appear more than once in a #GListModel.
* @param position the position of the item to fetch
*/
vfunc_get_item(position: number): A | null;
/**
* Gets the type of the items in `list`.
*
* All items returned from g_list_model_get_item() are of the type
* returned by this function, or a subtype, or if the type is an
* interface, they are an implementation of that interface.
*
* The item type of a #GListModel can not change during the life of the
* model.
*/
vfunc_get_item_type(): GObject.GType;
/**
* Gets the number of items in `list`.
*
* Depending on the model implementation, calling this function may be
* less efficient than iterating the list with increasing values for
* `position` until g_list_model_get_item() returns %NULL.
*/
vfunc_get_n_items(): number;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default PangoFT2;
}
declare module 'gi://PangoFT2' {
import PangoFT210 from 'gi://PangoFT2?version=1.0';
export default PangoFT210;
}
// END

620
home/ags-config/@girs/pangoot-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,620 @@
/// <reference path="./freetype2-2.0.d.ts" />
/// <reference path="./pangofc-1.0.d.ts" />
/// <reference path="./fontconfig-2.0.d.ts" />
/// <reference path="./pango-1.0.d.ts" />
/// <reference path="./cairo-1.0.d.ts" />
/// <reference path="./cairo.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./harfbuzz-0.0.d.ts" />
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://PangoOT?version=1.0' {
// Module dependencies
import type freetype2 from 'gi://freetype2?version=2.0';
import type PangoFc from 'gi://PangoFc?version=1.0';
import type fontconfig from 'gi://fontconfig?version=2.0';
import type Pango from 'gi://Pango?version=1.0';
import type cairo from 'cairo';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type HarfBuzz from 'gi://HarfBuzz?version=0.0';
import type Gio from 'gi://Gio?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
export namespace PangoOT {
/**
* PangoOT-1.0
*/
/**
* The PangoOTTableType enumeration values are used to
* identify the various OpenType tables in the
* pango_ot_info_… functions.
*/
/**
* The PangoOTTableType enumeration values are used to
* identify the various OpenType tables in the
* pango_ot_info_… functions.
*/
export namespace TableType {
export const $gtype: GObject.GType<TableType>;
}
enum TableType {
/**
* The GSUB table.
*/
GSUB,
/**
* The GPOS table.
*/
GPOS,
}
/**
* This is used as the property bit in pango_ot_ruleset_add_feature() when a
* feature should be applied to all glyphs.
*/
const ALL_GLYPHS: number;
/**
* This is used as the language index in pango_ot_info_find_feature() when
* the default language system of the script is desired.
*
* It is also returned by pango_ot_info_find_language() if the requested language
* is not found, or the requested language tag was PANGO_OT_TAG_DEFAULT_LANGUAGE.
* The end result is that one can always call pango_ot_tag_from_language()
* followed by pango_ot_info_find_language() and pass the result to
* pango_ot_info_find_feature() without having to worry about falling back to
* default language system explicitly.
*/
const DEFAULT_LANGUAGE: number;
/**
* This is used as a feature index that represent no feature, that is, should be
* skipped. It may be returned as feature index by pango_ot_info_find_feature()
* if the feature is not found, and pango_ot_ruleset_add_feature() function
* automatically skips this value, so no special handling is required by the user.
*/
const NO_FEATURE: number;
/**
* This is used as a script index that represent no script, that is, when the
* requested script was not found, and a default ('DFLT') script was not found
* either. It may be returned as script index by pango_ot_info_find_script()
* if the script or a default script are not found, all other functions
* taking a script index essentially return if the input script index is
* this value, so no special handling is required by the user.
*/
const NO_SCRIPT: number;
/**
* Finds the OpenType language-system tag best describing `language`.
* @param language A `PangoLanguage`
* @returns `PangoOTTag` best matching @language or %PANGO_OT_TAG_DEFAULT_LANGUAGE if none found or if @language is %NULL.
*/
function tag_from_language(language?: Pango.Language | null): Tag;
/**
* Finds the OpenType script tag corresponding to `script`.
*
* The %PANGO_SCRIPT_COMMON, %PANGO_SCRIPT_INHERITED, and
* %PANGO_SCRIPT_UNKNOWN scripts are mapped to the OpenType
* 'DFLT' script tag that is also defined as
* %PANGO_OT_TAG_DEFAULT_SCRIPT.
*
* Note that multiple `PangoScript` values may map to the same
* OpenType script tag. In particular, %PANGO_SCRIPT_HIRAGANA
* and %PANGO_SCRIPT_KATAKANA both map to the OT tag 'kana'.
* @param script A `PangoScript`
* @returns `PangoOTTag` corresponding to @script or %PANGO_OT_TAG_DEFAULT_SCRIPT if none found.
*/
function tag_from_script(script: Pango.Script | null): Tag;
/**
* Finds a `PangoLanguage` corresponding to `language_tag`.
* @param language_tag A `PangoOTTag` OpenType language-system tag
* @returns `PangoLanguage` best matching @language_tag or `PangoLanguage` corresponding to the string "xx" if none found.
*/
function tag_to_language(language_tag: Tag): Pango.Language;
/**
* Finds the `PangoScript` corresponding to `script_tag`.
*
* The 'DFLT' script tag is mapped to %PANGO_SCRIPT_COMMON.
*
* Note that an OpenType script tag may correspond to multiple
* `PangoScript` values. In such cases, the `PangoScript` value
* with the smallest value is returned.
* In particular, %PANGO_SCRIPT_HIRAGANA
* and %PANGO_SCRIPT_KATAKANA both map to the OT tag 'kana'.
* This function will return %PANGO_SCRIPT_HIRAGANA for
* 'kana'.
* @param script_tag A `PangoOTTag` OpenType script tag
* @returns `PangoScript` corresponding to @script_tag or %PANGO_SCRIPT_UNKNOWN if none found.
*/
function tag_to_script(script_tag: Tag): Pango.Script;
namespace Info {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {}
}
class Info extends GObject.Object {
static $gtype: GObject.GType<Info>;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Info.SignalSignatures;
// Constructors
constructor(properties?: Partial<Info.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect<K extends keyof Info.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Info.SignalSignatures[K]>,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after<K extends keyof Info.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Info.SignalSignatures[K]>,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit<K extends keyof Info.SignalSignatures>(
signal: K,
...args: GObject.GjsParameters<Info.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Static methods
/**
* Returns the `PangoOTInfo` structure for the given FreeType font face.
* @param face a `FT_Face`
*/
static get(face: freetype2.Face): Info;
// Methods
/**
* Finds the index of a feature.
*
* If the feature is not found, sets `feature_index` to PANGO_OT_NO_FEATURE,
* which is safe to pass to [method`PangoOT`.Ruleset.add_feature] and similar
* functions.
*
* In the future, this may set `feature_index` to an special value that if
* used in [method`PangoOT`.Ruleset.add_feature] will ask Pango to synthesize
* the requested feature based on Unicode properties and data. However, this
* function will still return %FALSE in those cases. So, users may want to
* ignore the return value of this function in certain cases.
* @param table_type the table type to obtain information about
* @param feature_tag the tag of the feature to find
* @param script_index the index of the script
* @param language_index the index of the language whose features are searched, or %PANGO_OT_DEFAULT_LANGUAGE to use the default language of the script
* @returns %TRUE if the feature was found
*/
find_feature(
table_type: TableType | null,
feature_tag: Tag,
script_index: number,
language_index: number,
): [boolean, number];
/**
* Finds the index of a language and its required feature index.
*
* If the language is not found, sets `language_index` to %PANGO_OT_DEFAULT_LANGUAGE
* and the required feature of the default language system is returned in
* required_feature_index. For best compatibility with some fonts, also
* searches the language system tag 'dflt' before falling back to the default
* language system, but that is transparent to the user. The user can simply
* ignore the return value of this function to automatically fall back to the
* default language system.
* @param table_type the table type to obtain information about
* @param script_index the index of the script whose languages are searched
* @param language_tag the tag of the language to find
* @returns %TRUE if the language was found
*/
find_language(
table_type: TableType | null,
script_index: number,
language_tag: Tag,
): [boolean, number, number];
/**
* Finds the index of a script.
*
* If not found, tries to find the 'DFLT' and then 'dflt' scripts and
* return the index of that in `script_index`. If none of those is found
* either, %PANGO_OT_NO_SCRIPT is placed in `script_index`.
*
* All other functions taking an input script_index parameter know
* how to handle %PANGO_OT_NO_SCRIPT, so one can ignore the return
* value of this function completely and proceed, to enjoy the automatic
* fallback to the 'DFLT'/'dflt' script.
* @param table_type the table type to obtain information about
* @param script_tag the tag of the script to find
* @returns %TRUE if the script was found
*/
find_script(table_type: TableType | null, script_tag: Tag): [boolean, number];
/**
* Obtains the list of features for the given language of the given script.
* @param table_type the table type to obtain information about
* @param tag unused parameter
* @param script_index the index of the script to obtain information about
* @param language_index the index of the language to list features for, or %PANGO_OT_DEFAULT_LANGUAGE, to list features for the default language of the script
* @returns a newly-allocated zero-terminated array containing the tags of the available features
*/
list_features(table_type: TableType | null, tag: Tag, script_index: number, language_index: number): Tag;
/**
* Obtains the list of available languages for a given script.
* @param table_type the table type to obtain information about
* @param script_index the index of the script to list languages for
* @param language_tag unused parameter
* @returns a newly-allocated zero-terminated array containing the tags of the available languages
*/
list_languages(table_type: TableType | null, script_index: number, language_tag: Tag): Tag;
/**
* Obtains the list of available scripts.
* @param table_type the table type to obtain information about
* @returns a newly-allocated zero-terminated array containing the tags of the available scripts
*/
list_scripts(table_type: TableType | null): Tag;
}
namespace Ruleset {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {}
}
/**
* The `PangoOTRuleset` structure holds a set of features selected
* from the tables in an OpenType font.
*
* A feature is an operation such as adjusting glyph positioning
* that should be applied to a text feature such as a certain
* type of accent.
*
* A `PangoOTRuleset` is created with [ctor`PangoOT`.Ruleset.new],
* features are added to it with [method`PangoOT`.Ruleset.add_feature],
* then it is applied to a `PangoGlyphString` with
* [method`PangoOT`.Ruleset.position].
*/
class Ruleset extends GObject.Object {
static $gtype: GObject.GType<Ruleset>;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Ruleset.SignalSignatures;
// Constructors
constructor(properties?: Partial<Ruleset.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](info: Info): Ruleset;
static new_for(info: Info, script: Pango.Script, language: Pango.Language): Ruleset;
static new_from_description(info: Info, desc: RulesetDescription): Ruleset;
// Signals
connect<K extends keyof Ruleset.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Ruleset.SignalSignatures[K]>,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after<K extends keyof Ruleset.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Ruleset.SignalSignatures[K]>,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit<K extends keyof Ruleset.SignalSignatures>(
signal: K,
...args: GObject.GjsParameters<Ruleset.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Static methods
/**
* Returns a ruleset for the given OpenType info and ruleset
* description.
*
* Rulesets are created on demand using
* [ctor`PangoOT`.Ruleset.new_from_description].
* The returned ruleset should not be modified or destroyed.
*
* The static feature map members of `desc` should be alive as
* long as `info` is.
* @param info a `PangoOTInfo`
* @param desc a `PangoOTRulesetDescription`
*/
static get_for_description(info: Info, desc: RulesetDescription): Ruleset;
// Methods
/**
* Adds a feature to the ruleset.
* @param table_type the table type to add a feature to
* @param feature_index the index of the feature to add
* @param property_bit the property bit to use for this feature. Used to identify the glyphs that this feature should be applied to, or %PANGO_OT_ALL_GLYPHS if it should be applied to all glyphs.
*/
add_feature(table_type: TableType | null, feature_index: number, property_bit: number): void;
/**
* Gets the number of GSUB and GPOS features in the ruleset.
* @returns Total number of features in the @ruleset
*/
get_feature_count(): [number, number, number];
/**
* This is a convenience function that first tries to find the feature
* using [method`PangoOT`.Info.find_feature] and the ruleset script and
* language passed to [ctor`PangoOT`.Ruleset.new_for] and if the feature
* is found, adds it to the ruleset.
*
* If `ruleset` was not created using [ctor`PangoOT`.Ruleset.new_for],
* this function does nothing.
* @param table_type the table type to add a feature to
* @param feature_tag the tag of the feature to add
* @param property_bit the property bit to use for this feature. Used to identify the glyphs that this feature should be applied to, or %PANGO_OT_ALL_GLYPHS if it should be applied to all glyphs.
* @returns %TRUE if the feature was found and added to ruleset, %FALSE otherwise
*/
maybe_add_feature(table_type: TableType | null, feature_tag: Tag, property_bit: number): boolean;
/**
* This is a convenience function that for each feature in the feature map
* array `features` converts the feature name to a `PangoOTTag` feature tag
* using PANGO_OT_TAG_MAKE() and calls [method`PangoOT`.Ruleset.maybe_add_feature]
* on it.
* @param table_type the table type to add features to
* @param features array of feature name and property bits to add
* @param n_features number of feature records in @features array
* @returns The number of features in @features that were found and added to @ruleset
*/
maybe_add_features(table_type: TableType | null, features: FeatureMap, n_features: number): number;
/**
* Performs the OpenType GPOS positioning on `buffer` using
* the features in `ruleset`.
* @param buffer a `PangoOTBuffer`
*/
position(buffer: Buffer): void;
/**
* Performs the OpenType GSUB substitution on `buffer` using
* the features in `ruleset`.
* @param buffer a `PangoOTBuffer`
*/
substitute(buffer: Buffer): void;
}
class Buffer {
static $gtype: GObject.GType<Buffer>;
// Constructors
constructor(font: PangoFc.Font);
_init(...args: any[]): void;
static ['new'](font: PangoFc.Font): Buffer;
// Methods
/**
* Appends a glyph to a `PangoOTBuffer`, with `properties` identifying which
* features should be applied on this glyph.
*
* See [method`PangoOT`.Ruleset.add_feature].
* @param glyph the glyph index to add, like a `PangoGlyph`
* @param properties the glyph properties
* @param cluster the cluster that this glyph belongs to
*/
add_glyph(glyph: number, properties: number, cluster: number): void;
/**
* Empties a `PangoOTBuffer`, make it ready to add glyphs to.
*/
clear(): void;
/**
* Destroys a `PangoOTBuffer` and free all associated memory.
*/
destroy(): void;
/**
* Gets the glyph array contained in a `PangoOTBuffer`.
*
* The glyphs are owned by the buffer and should not be freed,
* and are only valid as long as buffer is not modified.
*/
get_glyphs(): Glyph[] | null;
/**
* Exports the glyphs in a `PangoOTBuffer` into a `PangoGlyphString`.
*
* This is typically used after the OpenType layout processing
* is over, to convert the resulting glyphs into a generic Pango
* glyph string.
* @param glyphs a `PangoGlyphString`
*/
output(glyphs: Pango.GlyphString): void;
/**
* Sets whether glyphs will be rendered right-to-left.
*
* This setting is needed for proper horizontal positioning
* of right-to-left scripts.
* @param rtl %TRUE for right-to-left text
*/
set_rtl(rtl: boolean): void;
/**
* Sets whether characters with a mark class should be forced to zero width.
*
* This setting is needed for proper positioning of Arabic accents,
* but will produce incorrect results with standard OpenType Indic
* fonts.
* @param zero_width_marks %TRUE if characters with a mark class should be forced to zero width
*/
set_zero_width_marks(zero_width_marks: boolean): void;
}
/**
* The `PangoOTFeatureMap` typedef is used to represent an OpenType
* feature with the property bit associated with it. The feature tag is
* represented as a char array instead of a `PangoOTTag` for convenience.
*/
class FeatureMap {
static $gtype: GObject.GType<FeatureMap>;
// Fields
feature_name: number[];
property_bit: number;
// Constructors
constructor(
properties?: Partial<{
feature_name: number[];
property_bit: number;
}>,
);
_init(...args: any[]): void;
}
/**
* The `PangoOTGlyph` structure represents a single glyph together with
* information used for OpenType layout processing of the glyph.
* It contains the following fields.
*/
class Glyph {
static $gtype: GObject.GType<Glyph>;
// Fields
glyph: number;
properties: number;
cluster: number;
component: number;
ligID: number;
internal: number;
// Constructors
constructor(
properties?: Partial<{
glyph: number;
properties: number;
cluster: number;
component: number;
ligID: number;
internal: number;
}>,
);
_init(...args: any[]): void;
}
/**
* The `PangoOTRuleset` structure holds all the information needed
* to build a complete `PangoOTRuleset` from an OpenType font.
* The main use of this struct is to act as the key for a per-font
* hash of rulesets. The user populates a ruleset description and
* gets the ruleset using pango_ot_ruleset_get_for_description()
* or create a new one using pango_ot_ruleset_new_from_description().
*/
class RulesetDescription {
static $gtype: GObject.GType<RulesetDescription>;
// Fields
script: Pango.Script;
static_gsub_features: FeatureMap;
n_static_gsub_features: number;
static_gpos_features: FeatureMap;
n_static_gpos_features: number;
other_features: FeatureMap;
n_other_features: number;
// Constructors
_init(...args: any[]): void;
// Methods
/**
* Creates a copy of `desc,` which should be freed with
* [method`PangoOT`.RulesetDescription.free].
*
* Primarily used internally by [func`PangoOT`.Ruleset.get_for_description]
* to cache rulesets for ruleset descriptions.
* @returns the newly allocated `PangoOTRulesetDescription`
*/
copy(): RulesetDescription;
/**
* Compares two ruleset descriptions for equality.
*
* Two ruleset descriptions are considered equal if the rulesets
* they describe are provably identical. This means that their
* script, language, and all feature sets should be equal.
*
* For static feature sets, the array addresses are compared directly,
* while for other features, the list of features is compared one by
* one.(Two ruleset descriptions may result in identical rulesets
* being created, but still compare %FALSE.)
* @param desc2 a ruleset description
* @returns %TRUE if two ruleset descriptions are identical, %FALSE otherwise
*/
equal(desc2: RulesetDescription): boolean;
/**
* Frees a ruleset description allocated by
* pango_ot_ruleset_description_copy().
*/
free(): void;
/**
* Computes a hash of a `PangoOTRulesetDescription` structure suitable
* to be used, for example, as an argument to g_hash_table_new().
* @returns the hash value
*/
hash(): number;
}
type Tag = number;
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default PangoOT;
}
declare module 'gi://PangoOT' {
import PangoOT10 from 'gi://PangoOT?version=1.0';
export default PangoOT10;
}
// END

978
home/ags-config/@girs/pangoxft-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,978 @@
/// <reference path="./xlib-2.0.d.ts" />
/// <reference path="./xft-2.0.d.ts" />
/// <reference path="./pangoot-1.0.d.ts" />
/// <reference path="./freetype2-2.0.d.ts" />
/// <reference path="./pangofc-1.0.d.ts" />
/// <reference path="./fontconfig-2.0.d.ts" />
/// <reference path="./pango-1.0.d.ts" />
/// <reference path="./cairo-1.0.d.ts" />
/// <reference path="./cairo.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./harfbuzz-0.0.d.ts" />
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/// <reference path="./pangoft2-1.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://PangoXft?version=1.0' {
// Module dependencies
import type xlib from 'gi://xlib?version=2.0';
import type xft from 'gi://xft?version=2.0';
import type PangoOT from 'gi://PangoOT?version=1.0';
import type freetype2 from 'gi://freetype2?version=2.0';
import type PangoFc from 'gi://PangoFc?version=1.0';
import type fontconfig from 'gi://fontconfig?version=2.0';
import type Pango from 'gi://Pango?version=1.0';
import type cairo from 'cairo';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type HarfBuzz from 'gi://HarfBuzz?version=0.0';
import type Gio from 'gi://Gio?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
import type PangoFT2 from 'gi://PangoFT2?version=1.0';
export namespace PangoXft {
/**
* PangoXft-1.0
*/
/**
* Returns the `PangoXftFontMap` for the given display and screen.
* The fontmap is owned by Pango and will be valid until
* the display is closed.
* @param display an X display
* @param screen the screen number of a screen within @display
* @returns a `PangoFontMap` object, owned by Pango.
*/
function get_font_map(display: xlib.Display, screen: number): Pango.FontMap;
/**
* Renders a `PangoGlyphString` onto an Xrender Picture object.
* @param display an X display
* @param src_picture the source picture to draw the string with
* @param dest_picture the destination picture to draw the string onto
* @param font the font in which to draw the string
* @param glyphs the glyph string to draw
* @param x the x position of start of string (in pixels)
* @param y the y position of baseline (in pixels)
*/
function picture_render(
display: xlib.Display,
src_picture: xlib.Picture,
dest_picture: xlib.Picture,
font: Pango.Font,
glyphs: Pango.GlyphString,
x: number,
y: number,
): void;
/**
* Renders a `PangoGlyphString` onto an XftDraw object wrapping an X drawable.
* @param draw the XftDraw object.
* @param color the color in which to draw the string
* @param font the font in which to draw the string
* @param glyphs the glyph string to draw
* @param x the x position of start of string (in pixels)
* @param y the y position of baseline (in pixels)
*/
function render(
draw: xft.Draw,
color: xft.Color,
font: Pango.Font,
glyphs: Pango.GlyphString,
x: number,
y: number,
): void;
/**
* Render a `PangoLayout` onto a XftDraw
* @param draw an XftDraw
* @param color the foreground color in which to draw the layout (may be overridden by color attributes)
* @param layout a `PangoLayout`
* @param x the X position of the left of the layout (in Pango units)
* @param y the Y position of the top of the layout (in Pango units)
*/
function render_layout(draw: xft.Draw, color: xft.Color, layout: Pango.Layout, x: number, y: number): void;
/**
* Render a `PangoLayoutLine` onto a XftDraw
* @param draw an XftDraw
* @param color the foreground color in which to draw the layout line (may be overridden by color attributes)
* @param line a `PangoLayoutLine`
* @param x the x position of start of string (in Pango units)
* @param y the y position of baseline (in Pango units)
*/
function render_layout_line(
draw: xft.Draw,
color: xft.Color,
line: Pango.LayoutLine,
x: number,
y: number,
): void;
/**
* Renders a `PangoGlyphString` onto a XftDraw, possibly
* transforming the layed-out coordinates through a transformation
* matrix.
*
* Note that the transformation matrix for `font` is not
* changed, so to produce correct rendering results, the `font`
* must have been loaded using a `PangoContext` with an identical
* transformation matrix to that passed in to this function.
* @param draw an XftDraw
* @param color the color in which to draw the glyphs
* @param matrix a `PangoMatrix`
* @param font the font in which to draw the string
* @param glyphs the glyph string to draw
* @param x the x position of the start of the string (in Pango units in user space coordinates)
* @param y the y position of the baseline (in Pango units in user space coordinates)
*/
function render_transformed(
draw: xft.Draw,
color: xft.Color,
matrix: Pango.Matrix | null,
font: Pango.Font,
glyphs: Pango.GlyphString,
x: number,
y: number,
): void;
/**
* Sets a function that will be called to do final configuration
* substitution on a #FcPattern before it is used to load
* the font. This function can be used to do things like set
* hinting and antialiasing options.
* @param display an X Display
* @param screen the screen number of a screen within @display
* @param func function to call to to do final config tweaking on #FcPattern objects.
*/
function set_default_substitute(display: xlib.Display, screen: number, func: SubstituteFunc): void;
/**
* Release any resources that have been cached for the
* combination of `display` and `screen`. Note that when the
* X display is closed, resources are released automatically,
* without needing to call this function.
* @param display an X display
* @param screen the screen number of a screen within @display
*/
function shutdown_display(display: xlib.Display, screen: number): void;
/**
* Call this function any time the results of the
* default substitution function set with
* pango_xft_set_default_substitute() change.
* That is, if your substitution function will return different
* results for the same input pattern, you must call this function.
* @param display an X Display
* @param screen the screen number of a screen within @display
*/
function substitute_changed(display: xlib.Display, screen: number): void;
interface SubstituteFunc {
(pattern: fontconfig.Pattern, data?: any | null): void;
}
namespace Font {
// Signal signatures
interface SignalSignatures extends PangoFc.Font.SignalSignatures {
'notify::fontmap': (pspec: GObject.ParamSpec) => void;
'notify::pattern': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends PangoFc.Font.ConstructorProps {}
}
/**
* `PangoXftFont` is an implementation of `PangoFcFont` using the Xft
* library for rendering. It is used in conjunction with `PangoXftFontMap`.
*/
class Font extends PangoFc.Font {
static $gtype: GObject.GType<Font>;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Font.SignalSignatures;
// Constructors
constructor(properties?: Partial<Font.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect<K extends keyof Font.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Font.SignalSignatures[K]>,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after<K extends keyof Font.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Font.SignalSignatures[K]>,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit<K extends keyof Font.SignalSignatures>(
signal: K,
...args: GObject.GjsParameters<Font.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* Gets the glyph index for a given Unicode character
* for `font`.
*
* If you only want to determine whether the font has
* the glyph, use pango_xft_font_has_char().
*
* Use pango_fc_font_get_glyph() instead.
* @param wc Unicode codepoint to look up
* @returns the glyph index, or 0, if the Unicode character does not exist in the font.
*/
get_glyph(wc: string): number;
/**
* Returns the index of a glyph suitable for drawing `wc` as an
* unknown character.
*
* Use PANGO_GET_UNKNOWN_GLYPH() instead.
* @param wc the Unicode character for which a glyph is needed.
* @returns a glyph index into @font.
*/
get_unknown_glyph(wc: string): Pango.Glyph;
/**
* Determines whether `font` has a glyph for the codepoint `wc`.
*
* Use pango_fc_font_has_char() instead.
* @param wc Unicode codepoint to look up
* @returns %TRUE if @font has the requested codepoint.
*/
has_char(wc: string): boolean;
}
namespace FontMap {
// Signal signatures
interface SignalSignatures extends PangoFc.FontMap.SignalSignatures {
'notify::item-type': (pspec: GObject.ParamSpec) => void;
'notify::n-items': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps<A extends GObject.Object = GObject.Object>
extends PangoFc.FontMap.ConstructorProps,
Gio.ListModel.ConstructorProps {}
}
/**
* `PangoXftFontMap` is an implementation of `PangoFcFontMap` suitable for
* the Xft library as the renderer. It is used in to create fonts of
* type `PangoXftFont`.
*/
class FontMap<A extends GObject.Object = GObject.Object> extends PangoFc.FontMap implements Gio.ListModel<A> {
static $gtype: GObject.GType<FontMap>;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: FontMap.SignalSignatures;
// Constructors
constructor(properties?: Partial<FontMap.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect<K extends keyof FontMap.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, FontMap.SignalSignatures[K]>,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after<K extends keyof FontMap.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, FontMap.SignalSignatures[K]>,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit<K extends keyof FontMap.SignalSignatures>(
signal: K,
...args: GObject.GjsParameters<FontMap.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Inherited methods
/**
* Gets the type of the items in `list`.
*
* All items returned from g_list_model_get_item() are of the type
* returned by this function, or a subtype, or if the type is an
* interface, they are an implementation of that interface.
*
* The item type of a #GListModel can not change during the life of the
* model.
* @returns the #GType of the items contained in @list.
*/
get_item_type(): GObject.GType;
/**
* Gets the number of items in `list`.
*
* Depending on the model implementation, calling this function may be
* less efficient than iterating the list with increasing values for
* `position` until g_list_model_get_item() returns %NULL.
* @returns the number of items in @list.
*/
get_n_items(): number;
/**
* Get the item at `position`.
*
* If `position` is greater than the number of items in `list,` %NULL is
* returned.
*
* %NULL is never returned for an index that is smaller than the length
* of the list.
*
* This function is meant to be used by language bindings in place
* of g_list_model_get_item().
*
* See also: g_list_model_get_n_items()
* @param position the position of the item to fetch
* @returns the object at @position.
*/
get_item(position: number): A | null;
/**
* Emits the #GListModel::items-changed signal on `list`.
*
* This function should only be called by classes implementing
* #GListModel. It has to be called after the internal representation
* of `list` has been updated, because handlers connected to this signal
* might query the new state of the list.
*
* Implementations must only make changes to the model (as visible to
* its consumer) in places that will not cause problems for that
* consumer. For models that are driven directly by a write API (such
* as #GListStore), changes can be reported in response to uses of that
* API. For models that represent remote data, changes should only be
* made from a fresh mainloop dispatch. It is particularly not
* permitted to make changes in response to a call to the #GListModel
* consumer API.
*
* Stated another way: in general, it is assumed that code making a
* series of accesses to the model via the API, without returning to the
* mainloop, and without calling other code, will continue to view the
* same contents of the model.
* @param position the position at which @list changed
* @param removed the number of items removed
* @param added the number of items added
*/
items_changed(position: number, removed: number, added: number): void;
/**
* Get the item at `position`. If `position` is greater than the number of
* items in `list,` %NULL is returned.
*
* %NULL is never returned for an index that is smaller than the length
* of the list. See g_list_model_get_n_items().
*
* The same #GObject instance may not appear more than once in a #GListModel.
* @param position the position of the item to fetch
*/
vfunc_get_item(position: number): A | null;
/**
* Gets the type of the items in `list`.
*
* All items returned from g_list_model_get_item() are of the type
* returned by this function, or a subtype, or if the type is an
* interface, they are an implementation of that interface.
*
* The item type of a #GListModel can not change during the life of the
* model.
*/
vfunc_get_item_type(): GObject.GType;
/**
* Gets the number of items in `list`.
*
* Depending on the model implementation, calling this function may be
* less efficient than iterating the list with increasing values for
* `position` until g_list_model_get_item() returns %NULL.
*/
vfunc_get_n_items(): number;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace Renderer {
// Signal signatures
interface SignalSignatures extends Pango.Renderer.SignalSignatures {
'notify::display': (pspec: GObject.ParamSpec) => void;
'notify::screen': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends Pango.Renderer.ConstructorProps {
display: any;
screen: number;
}
}
/**
* `PangoXftRenderer` is a subclass of `PangoRenderer` used for rendering
* with Pango's Xft backend. It can be used directly, or it can be
* further subclassed to modify exactly how drawing of individual
* elements occurs.
*/
class Renderer extends Pango.Renderer {
static $gtype: GObject.GType<Renderer>;
// Properties
set display(val: any);
set screen(val: number);
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Renderer.SignalSignatures;
// Constructors
constructor(properties?: Partial<Renderer.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](display: xlib.Display, screen: number): Renderer;
// Signals
connect<K extends keyof Renderer.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Renderer.SignalSignatures[K]>,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after<K extends keyof Renderer.SignalSignatures>(
signal: K,
callback: GObject.SignalCallback<this, Renderer.SignalSignatures[K]>,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit<K extends keyof Renderer.SignalSignatures>(
signal: K,
...args: GObject.GjsParameters<Renderer.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Virtual methods
/**
* draw the specified glyphs using
* the current foreground color and other foreground
* attributes
* @param xft_font
* @param glyphs
* @param n_glyphs
*/
vfunc_composite_glyphs(xft_font: xft.Font, glyphs: xft.GlyphSpec, n_glyphs: number): void;
/**
* draw the specified trapezoids using
* the current color and other attributes for `part`
* @param part
* @param trapezoids
* @param n_trapezoids
*/
vfunc_composite_trapezoids(part: Pango.RenderPart, trapezoids: xlib.XTrapezoid, n_trapezoids: number): void;
// Methods
/**
* Sets the default foreground color for a XftRenderer.
* @param default_color the default foreground color
*/
set_default_color(default_color: Pango.Color): void;
/**
* Sets the XftDraw object that the renderer is drawing to.
* The renderer must not be currently active.
* @param draw a XftDraw
*/
set_draw(draw: xft.Draw): void;
}
type RendererClass = typeof Renderer;
abstract class RendererPrivate {
static $gtype: GObject.GType<RendererPrivate>;
// Constructors
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default PangoXft;
}
declare module 'gi://PangoXft' {
import PangoXft10 from 'gi://PangoXft?version=1.0';
export default PangoXft10;
}
// END

21719
home/ags-config/@girs/soup-2.4.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

14156
home/ags-config/@girs/soup-3.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

1730
home/ags-config/@girs/soupgnome-2.4.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

178
home/ags-config/@girs/system.d.ts vendored Normal file
View File

@@ -0,0 +1,178 @@
/// <reference path="./gobject-2.0.d.ts" />
declare module 'system' {
import type GObject from 'gi://GObject?version=2.0';
/**
* This property contains the name of the script as it was invoked from the command
* line. In C and other languages, this information is contained in the first element of
* the platform's equivalent of argv, but GJS's ARGV only contains the
* subsequent command-line arguments. In other words, `ARGV[0]` in GJS is the same as `argv[1]` in C.
* @version Gjs 1.68
*/
export const programInvocationName: string;
/**
* This property contains version information about GJS.
*/
export const version: number;
/**
* The full path of the executed program.
* @version Gjs 1.68
*/
export const programPath: string | null;
/**
* A list of arguments passed to the current process.
* This is effectively an alias for the global `ARGV`, which is misleading in that
* it is not equivalent to the platform'`s` argv.
* @version Gjs 1.68
*/
export const programArgs: string[];
/**
* Return the memory address of any object as a string.
* This is the address of memory being managed by the JavaScript engine, which may
* represent a wrapper around memory elsewhere.
* **Caution**, don't use this as a unique identifier!
* JavaScript's garbage collector can move objects around in memory, or
* deduplicate identical objects, so this value may change during the execution
* of a program.
* @param o Any Object
* @returns A hexadecimal string (e.g. `0xb4f170f0`)
*/
export function addressOf(o: object): string;
/**
* Return the memory address of any GObject as a string.
* See also {@link addressOf}
* @param o Any {@link GObject.Object}-derived instance
* @returns A hexadecimal string (e.g. `0xb4f170f0`)
* @version Gjs 1.58
*/
export function addressOfGObject(o: GObject.Object): string;
/**
* Inserts a breakpoint instruction into the code.
* **Warning**: Using this function in code run outside of GDB will abort the process.
* With `System.breakpoint()` calls in your code, a GJS program can be debugged by
* running it in GDB:
* ```bash
* gdb --args gjs script.js
* ```
* Once GDB has started, you can start the program with run. When the debugger
* hits a breakpoint it will pause execution of the process and return to the
* prompt. You can then use the standard `backtrace` command to print a C++ stack
* trace, or use `call gjs_dumpstack()` to print a JavaScript stack trace:
* ```bash
* (gdb) run
* tarting program: /usr/bin/gjs -m script.js
* ...
* Thread 1 "gjs" received signal SIGTRAP, Trace/breakpoint trap.
* (gdb) call gjs_dumpstack()
* == Stack trace for context 0x5555555b7180 ==
* #0 555555640548 i file:///path/to/script.js:4 (394b8c3cc060 @ 12)
* #1 5555556404c8 i file:///path/to/script.js:7 (394b8c3cc0b0 @ 6)
* #2 7fffffffd3a0 b self-hosted:2408 (394b8c3a9650 @ 753)
* #3 5555556403e8 i self-hosted:2355 (394b8c3a9600 @ 375)
* (gdb)
* ```
* To continue executing the program, you can use the `continue` (or `cont`) to
* resume the process and debug further.
* Remember that if you run the program outside of GDB, it will abort at the
* breakpoint, so make sure to remove any calls to `System.breakpoint()` when
* you're done debugging.
*/
export function breakpoint(): void;
/**
* Clears the timezone cache.
* This is a workaround for SpiderMonkey Bug [#1004706](https://bugzilla.mozilla.org/show_bug.cgi?id=1004706).
*/
export function clearDateCaches(): void;
/** Runs the garbage collector */
export function gc(): void;
/**
* Return the reference count of any GObject-derived type. When an object's
* reference count is zero, it is cleaned up and erased from memory.
* @param o A {@link GObject.Object}
*/
export function refcount(o: GObject.Object): number;
/**
* See also: The [heapgraph](https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/tools/heapgraph.md) utility in the GJS repository.
* Dump a representation of internal heap memory. If `path` is not given, GJS will
* write the contents to `stdout`.
* @param path Optional file path
*/
export function dumpHeap(path?: string): void;
/**
* Dump internal garbage collector statistics. If `path` is not given, GJS will
* write the contents to `stdout`.
* @param path Optional file path
* @version Gjs 1.70
* @example Output:
* ```json
* {
* "gcBytes": 794624,
* "gcMaxBytes": 4294967295,
* "mallocBytes": 224459,
* "gcIsHighFrequencyMode": true,
* "gcNumber": 1,
* "majorGCCount": 1,
* "minorGCCount": 1,
* "sliceCount": 1,
* "zone": {
* "gcBytes": 323584,
* "gcTriggerBytes": 42467328,
* "gcAllocTrigger": 36097228.8,
* "mallocBytes": 120432,
* "mallocTriggerBytes": 59768832,
* "gcNumber": 1
* }
* }
* ```
*
*/
export function dumpMemoryInfo(path?: string): void;
/**
* This works the same as C's exit() function; exits the program, passing a
* certain error code to the shell. The shell expects the error code to be zero if
* there was no error, or non-zero (any value you please) to indicate an error.
*
* This value is used by other tools such as `make`; if `make` calls a program that
* returns a non-zero error code, then `make` aborts the build.
* @param code An exit code
*/
export function exit(code: number): never;
/**
* The System module provides common low-level facilities such as access to
* process arguments and exit(), as well as a number of useful functions and
* properties for debugging.
*
* Note that the majority of the functions and properties in this module should not
* be used in normal operation of a GJS application.
*/
const System: {
programInvocationName: typeof programInvocationName;
version: typeof version;
programPath: typeof programPath;
programArgs: typeof programArgs;
addressOf: typeof addressOf;
addressOfGObject: typeof addressOfGObject;
breakpoint: typeof breakpoint;
clearDateCaches: typeof clearDateCaches;
gc: typeof gc;
refcount: typeof refcount;
dumpHeap: typeof dumpHeap;
dumpMemoryInfo: typeof dumpMemoryInfo;
exit: typeof exit;
};
export default System;
}

13648
home/ags-config/@girs/vulkan-1.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

20781
home/ags-config/@girs/webkit2-4.0.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

52
home/ags-config/@girs/win32-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,52 @@
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://win32?version=1.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
export namespace win32 {
/**
* win32-1.0
*/
class MSG {
static $gtype: GObject.GType<MSG>;
// Constructors
_init(...args: any[]): void;
}
type HWND = number;
type HICON = number;
type HCURSOR = number;
type HGDIOBJ = number;
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default win32;
}
declare module 'gi://win32' {
import Win3210 from 'gi://win32?version=1.0';
export default Win3210;
}
// END

48
home/ags-config/@girs/xfixes-4.0.d.ts vendored Normal file
View File

@@ -0,0 +1,48 @@
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://xfixes?version=4.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
export namespace xfixes {
/**
* xfixes-4.0
*/
class XserverRegion {
static $gtype: GObject.GType<XserverRegion>;
// Constructors
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default xfixes;
}
declare module 'gi://xfixes' {
import Xfixes40 from 'gi://xfixes?version=4.0';
export default Xfixes40;
}
// END

75
home/ags-config/@girs/xft-2.0.d.ts vendored Normal file
View File

@@ -0,0 +1,75 @@
/// <reference path="./xlib-2.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://xft?version=2.0' {
// Module dependencies
import type xlib from 'gi://xlib?version=2.0';
import type GObject from 'gi://GObject?version=2.0';
export namespace xft {
/**
* xft-2.0
*/
function init(): void;
class Color {
static $gtype: GObject.GType<Color>;
// Constructors
_init(...args: any[]): void;
}
class Draw {
static $gtype: GObject.GType<Draw>;
// Constructors
_init(...args: any[]): void;
}
class Font {
static $gtype: GObject.GType<Font>;
// Constructors
_init(...args: any[]): void;
}
class GlyphSpec {
static $gtype: GObject.GType<GlyphSpec>;
// Constructors
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default xft;
}
declare module 'gi://xft' {
import Xft20 from 'gi://xft?version=2.0';
export default Xft20;
}
// END

134
home/ags-config/@girs/xlib-2.0.d.ts vendored Normal file
View File

@@ -0,0 +1,134 @@
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://xlib?version=2.0' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
export namespace xlib {
/**
* xlib-2.0
*/
function open_display(): void;
class Display {
static $gtype: GObject.GType<Display>;
// Constructors
_init(...args: any[]): void;
}
class Screen {
static $gtype: GObject.GType<Screen>;
// Constructors
_init(...args: any[]): void;
}
class Visual {
static $gtype: GObject.GType<Visual>;
// Constructors
_init(...args: any[]): void;
}
class XConfigureEvent {
static $gtype: GObject.GType<XConfigureEvent>;
// Constructors
_init(...args: any[]): void;
}
class XImage {
static $gtype: GObject.GType<XImage>;
// Constructors
_init(...args: any[]): void;
}
class XFontStruct {
static $gtype: GObject.GType<XFontStruct>;
// Constructors
_init(...args: any[]): void;
}
class XTrapezoid {
static $gtype: GObject.GType<XTrapezoid>;
// Constructors
_init(...args: any[]): void;
}
class XVisualInfo {
static $gtype: GObject.GType<XVisualInfo>;
// Constructors
_init(...args: any[]): void;
}
class XWindowAttributes {
static $gtype: GObject.GType<XWindowAttributes>;
// Constructors
_init(...args: any[]): void;
}
class XEvent {
static $gtype: GObject.GType<XEvent>;
// Constructors
_init(...args: any[]): void;
}
type Atom = number;
type Colormap = number;
type Cursor = number;
type Drawable = number;
type GC = any;
type KeyCode = number;
type KeySym = number;
type Picture = number;
type Time = number;
type VisualID = number;
type Window = number;
type XID = number;
type Pixmap = number;
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default xlib;
}
declare module 'gi://xlib' {
import Xlib20 from 'gi://xlib?version=2.0';
export default Xlib20;
}
// END

96
home/ags-config/@girs/xrandr-1.3.d.ts vendored Normal file
View File

@@ -0,0 +1,96 @@
/// <reference path="./gobject-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://xrandr?version=1.3' {
// Module dependencies
import type GObject from 'gi://GObject?version=2.0';
export namespace xrandr {
/**
* xrandr-1.3
*/
class ScreenSize {
static $gtype: GObject.GType<ScreenSize>;
// Constructors
_init(...args: any[]): void;
}
class ScreenChangeNotifyEvent {
static $gtype: GObject.GType<ScreenChangeNotifyEvent>;
// Constructors
_init(...args: any[]): void;
}
class NotifyEvent {
static $gtype: GObject.GType<NotifyEvent>;
// Constructors
_init(...args: any[]): void;
}
class ScreenResources {
static $gtype: GObject.GType<ScreenResources>;
// Constructors
_init(...args: any[]): void;
}
class OutputChangeNotifyEvent {
static $gtype: GObject.GType<OutputChangeNotifyEvent>;
// Constructors
_init(...args: any[]): void;
}
class CrtcChangeNotifyEvent {
static $gtype: GObject.GType<CrtcChangeNotifyEvent>;
// Constructors
_init(...args: any[]): void;
}
class OutputPropertyNotifyEvent {
static $gtype: GObject.GType<OutputPropertyNotifyEvent>;
// Constructors
_init(...args: any[]): void;
}
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default xrandr;
}
declare module 'gi://xrandr' {
import Xrandr13 from 'gi://xrandr?version=1.3';
export default Xrandr13;
}
// END

344
home/ags-config/app.ts Normal file
View File

@@ -0,0 +1,344 @@
// thanks Aylur!!
// import "/usr/share/ags/js/lib/overrides"; // Not needed in AGS v3 with NixOS
// Define build-time constants (normally set by colorshell's build script)
globalThis.DEVEL = false;
globalThis.SRC = "$HOME/.config/ags";
globalThis.GRESOURCES_FILE = "$HOME/.config/ags/resources.gresource";
globalThis.COLORSHELL_VERSION = "2.0.3-nixos";
import "./config";
// Runner disabled - using Vicinae instead
// import {
// PluginApps,
// PluginClipboard,
// PluginMedia,
// PluginShell,
// PluginWallpapers,
// PluginWebSearch,
// PluginKill
// } from "./runner/plugins";
import { handleArguments } from "./modules/arg-handler";
// import { Runner } from "./runner/Runner";
import { Windows } from "./windows";
import { Notifications } from "./modules/notifications";
import { Wallpaper } from "./modules/wallpaper";
import { Stylesheet } from "./modules/stylesheet";
import { Clipboard } from "./modules/clipboard";
import { Gdk, Gtk } from "ags/gtk4";
import { createBinding, createComputed, createRoot, getScope, Scope } from "ags";
import { OSDModes, triggerOSD } from "./window/osd";
import { programArgs, programInvocationName } from "system";
import { setConsoleLogDomain } from "console";
import { createScopedConnection, createSubscription, encoder, secureBaseBinding } from "./modules/utils";
import { exec } from "ags/process";
import { NightLight } from "./modules/nightlight";
import { Backlights } from "./modules/backlight";
import GObject, { register } from "ags/gobject";
import Media from "./modules/media";
import GLib from "gi://GLib?version=2.0";
import Gio from "gi://Gio?version=2.0";
import Adw from "gi://Adw?version=1";
import AstalWp from "gi://AstalWp";
// const runnerPlugins: Array<Runner.Plugin> = [
// PluginApps,
// PluginShell,
// PluginWebSearch,
// PluginKill,
// PluginMedia,
// PluginWallpapers,
// PluginClipboard
// ];
const defaultWindows: Array<string> = [ "bar" ];
GLib.unsetenv("LD_PRELOAD");
@register({ GTypeName: "Shell" })
export class Shell extends Adw.Application {
private static instance: Shell;
#scope!: Scope;
#connections = new Map<GObject.Object, Array<number> | number>();
#providers: Array<Gtk.CssProvider> = [];
#gresource: Gio.Resource|null = null;
#socketService!: Gio.SocketService;
#socketFile!: Gio.File;
get scope() { return this.#scope; }
constructor() {
super({
applicationId: "io.github.retrozinndev.colorshell",
flags: Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
version: COLORSHELL_VERSION ?? "0.0.0-unknown",
});
setConsoleLogDomain("Colorshell");
GLib.set_application_name("colorshell");
}
public static getDefault(): Shell {
if(!this.instance)
this.instance = new Shell();
return this.instance;
}
public resetStyle(): void {
this.#providers.forEach(provider =>
Gtk.StyleContext.remove_provider_for_display(
Gdk.Display.get_default()!,
provider
)
);
}
public removeProvider(provider: Gtk.CssProvider): void {
if(!this.#providers.includes(provider)) {
console.warn("Colorshell: Couldn't find the provided GtkCssProvider to remove. Was it added before?");
return;
}
for(let i = 0; i < this.#providers.length; i++) {
const prov = this.#providers[i];
if(prov === provider) {
this.#providers.splice(i, 1);
Gtk.StyleContext.remove_provider_for_display(
Gdk.Display.get_default()!,
provider
);
break;
}
}
}
public applyStyle(stylesheet: string): void {
try {
const provider = Gtk.CssProvider.new();
provider.load_from_string(stylesheet)
this.#providers.push(provider);
Gtk.StyleContext.add_provider_for_display(
Gdk.Display.get_default()!,
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
} catch(e) {
console.error(`Colorshell: Couldn't apply style. Stderr: ${e}`);
return;
}
}
vfunc_command_line(cmd: Gio.ApplicationCommandLine): number {
const args = cmd.get_arguments().toSpliced(0, 1); // remove executable
if(cmd.isRemote) {
try {
// warn user that this method is pretty slow
cmd.print_literal("\nColorshell: !! Using a remote instance to communicate is pretty slow, \
you should use the socket in the XDG_RUNTIME_DIR/colorshell.sock for a faster response.\n\n");
const res = handleArguments(cmd, args);
cmd.done();
cmd.set_exit_status(res);
return res;
} catch(_e) {
const e = _e as Error;
cmd.printerr_literal(`Error: something went wrong! Stderr: ${e.message}\n${e.stack}`);
cmd.done();
return 1;
}
} else {
if(args.length > 0) {
cmd.printerr_literal("Error: colorshell not running. Try to clean-run before using arguments");
cmd.done();
return 1;
}
this.activate();
}
return 0;
}
vfunc_activate(): void {
super.vfunc_activate();
this.hold();
this.main();
}
private init(): void {
// load gresource from build-defined path
try {
this.#gresource = Gio.Resource.load(GRESOURCES_FILE.split('/').filter(s =>
s !== ""
).map(path => {
// support environment variables at runtime
if(/^\$/.test(path)) {
const env = GLib.getenv(path.replace(/^\$/, ""));
if(env === null)
throw new Error(`Couldn't get environment variable: ${path}`);
return env;
}
return path;
}).join('/'));
Gio.resources_register(this.#gresource);
// add icons
Gtk.IconTheme.get_for_display(Gdk.Display.get_default()!)
.add_resource_path("/io/github/retrozinndev/colorshell/icons")
} catch(_e) {
const e = _e as Error;
console.error(`Error: couldn't load gresource! Stderr: ${e.message}\n${e.stack}`);
}
this.#socketFile = Gio.File.new_for_path(`${GLib.get_user_runtime_dir() ??
`/run/user/${exec("id -u").trim()}`}/colorshell.sock`);
if(this.#socketFile.query_exists(null)) {
console.log(`Colorshell: Deleting previous instance's socket`);
this.#socketFile.delete(null);
}
this.#socketService = Gio.SocketService.new();
this.#socketService.add_address(
Gio.UnixSocketAddress.new(this.#socketFile.get_path()!),
Gio.SocketType.STREAM,
Gio.SocketProtocol.DEFAULT,
null
);
// handle communication via socket
createScopedConnection(this.#socketService, "incoming", (conn) => {
const inputStream = Gio.DataInputStream.new(conn.inputStream);
inputStream.read_upto_async('\x00', -1, GLib.PRIORITY_DEFAULT, null, (_, res) => {
const [args, len] = inputStream.read_upto_finish(res);
inputStream.close(null);
conn.inputStream.close(null);
if(len < 1) {
console.error(`Colorshell: No args provided via socket call`);
return;
}
try {
const [success, parsedArgs] = GLib.shell_parse_argv(`colorshell ${args}`);
parsedArgs?.splice(0, 1); // remove the unnecessary `colorshell` part
if(success) {
handleArguments({
print_literal: (msg) => conn.outputStream.write_bytes(
encoder.encode(`${msg}\n`),
null
),
// TODO: support writing to stderr(i don't know how to do that :sob:)
printerr_literal: (msg) => conn.outputStream.write_bytes(
encoder.encode(`${msg}\n`),
null
)
}, parsedArgs!);
conn.outputStream.flush(null);
conn.close(null);
return;
}
conn.outputStream.write_bytes(
encoder.encode("Error: Unexpected error occurred on argument parsing!"),
null
);
conn.outputStream.flush(null);
conn.close(null);
} catch(_e) {
const e = _e as Error;
console.error(`Colorshell: An error occurred while writing to socket output. Stderr:\n${
e.message}\n${e.stack}`);
}
});
return false;
});
}
private main(): void {
Gtk.init();
Adw.init();
createRoot((dispose) => {
console.log(`Colorshell: Initializing things`);
this.#connections.set(this, this.connect("shutdown", () => dispose()));
this.init();
this.#scope = getScope();
// NightLight.getDefault(); // Disabled - requires gamma control tools
Media.getDefault();
Clipboard.getDefault();
console.log("Colorshell: Initializing Wallpaper and Stylesheet modules");
Wallpaper.getDefault();
Stylesheet.getDefault();
// Runner disabled - using Vicinae instead
// console.log("Adding runner plugins");
// runnerPlugins.forEach(plugin => Runner.addPlugin(plugin));
createSubscription(
createComputed([
secureBaseBinding<AstalWp.Endpoint>(createBinding(
AstalWp.get_default(), "defaultSpeaker"
), "volume", null),
secureBaseBinding<AstalWp.Endpoint>(createBinding(
AstalWp.get_default(), "defaultSpeaker"
), "mute", null)
]),
() => !Windows.getDefault().isOpen("control-center") &&
triggerOSD(OSDModes.sink)
);
createSubscription(
secureBaseBinding<Backlights.Backlight>(
createBinding(Backlights.getDefault(), "default"),
"brightness",
100
),
() => !Windows.getDefault().isOpen("control-center") &&
triggerOSD(OSDModes.brightness)
);
this.#connections.set(Notifications.getDefault(), [
Notifications.getDefault().connect("notification-added", () => {
Windows.getDefault().open("floating-notifications");
}),
Notifications.getDefault().connect("notification-removed", (self) => {
self.notifications.length === 0 && Windows.getDefault().close("floating-notifications");
})
]);
defaultWindows.forEach(w => Windows.getDefault().open(w));
});
this.#scope.onCleanup(() => {
console.log("Colorshell: disposing connections and quitting because of ::shutdown");
this.#connections.forEach((ids, obj) => Array.isArray(ids) ?
ids.forEach(id => obj.disconnect(id))
: obj.disconnect(ids));
});
}
quit(): void {
this.release();
}
}
Shell.getDefault().runAsync([ programInvocationName, ...programArgs ]);

View File

@@ -0,0 +1,335 @@
// thanks Aylur!!
import "/usr/share/ags/js/lib/overrides";
import "./config";
import {
PluginApps,
PluginClipboard,
PluginMedia,
PluginShell,
PluginWallpapers,
PluginWebSearch,
PluginKill
} from "./runner/plugins";
import { handleArguments } from "./modules/arg-handler";
import { Runner } from "./runner/Runner";
import { Windows } from "./windows";
import { Notifications } from "./modules/notifications";
import { Wallpaper } from "./modules/wallpaper";
import { Stylesheet } from "./modules/stylesheet";
import { Clipboard } from "./modules/clipboard";
import { Gdk, Gtk } from "ags/gtk4";
import { createBinding, createComputed, createRoot, getScope, Scope } from "ags";
import { OSDModes, triggerOSD } from "./window/osd";
import { programArgs, programInvocationName } from "system";
import { setConsoleLogDomain } from "console";
import { createScopedConnection, createSubscription, encoder, secureBaseBinding } from "./modules/utils";
import { exec } from "ags/process";
import { NightLight } from "./modules/nightlight";
import { Backlights } from "./modules/backlight";
import GObject, { register } from "ags/gobject";
import Media from "./modules/media";
import GLib from "gi://GLib?version=2.0";
import Gio from "gi://Gio?version=2.0";
import Adw from "gi://Adw?version=1";
import AstalWp from "gi://AstalWp";
const runnerPlugins: Array<Runner.Plugin> = [
PluginApps,
PluginShell,
PluginWebSearch,
PluginKill,
PluginMedia,
PluginWallpapers,
PluginClipboard
];
const defaultWindows: Array<string> = [ "bar" ];
GLib.unsetenv("LD_PRELOAD");
@register({ GTypeName: "Shell" })
export class Shell extends Adw.Application {
private static instance: Shell;
#scope!: Scope;
#connections = new Map<GObject.Object, Array<number> | number>();
#providers: Array<Gtk.CssProvider> = [];
#gresource: Gio.Resource|null = null;
#socketService!: Gio.SocketService;
#socketFile!: Gio.File;
get scope() { return this.#scope; }
constructor() {
super({
applicationId: "io.github.retrozinndev.colorshell",
flags: Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
version: COLORSHELL_VERSION ?? "0.0.0-unknown",
});
setConsoleLogDomain("Colorshell");
GLib.set_application_name("colorshell");
}
public static getDefault(): Shell {
if(!this.instance)
this.instance = new Shell();
return this.instance;
}
public resetStyle(): void {
this.#providers.forEach(provider =>
Gtk.StyleContext.remove_provider_for_display(
Gdk.Display.get_default()!,
provider
)
);
}
public removeProvider(provider: Gtk.CssProvider): void {
if(!this.#providers.includes(provider)) {
console.warn("Colorshell: Couldn't find the provided GtkCssProvider to remove. Was it added before?");
return;
}
for(let i = 0; i < this.#providers.length; i++) {
const prov = this.#providers[i];
if(prov === provider) {
this.#providers.splice(i, 1);
Gtk.StyleContext.remove_provider_for_display(
Gdk.Display.get_default()!,
provider
);
break;
}
}
}
public applyStyle(stylesheet: string): void {
try {
const provider = Gtk.CssProvider.new();
provider.load_from_string(stylesheet)
this.#providers.push(provider);
Gtk.StyleContext.add_provider_for_display(
Gdk.Display.get_default()!,
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
} catch(e) {
console.error(`Colorshell: Couldn't apply style. Stderr: ${e}`);
return;
}
}
vfunc_command_line(cmd: Gio.ApplicationCommandLine): number {
const args = cmd.get_arguments().toSpliced(0, 1); // remove executable
if(cmd.isRemote) {
try {
// warn user that this method is pretty slow
cmd.print_literal("\nColorshell: !! Using a remote instance to communicate is pretty slow, \
you should use the socket in the XDG_RUNTIME_DIR/colorshell.sock for a faster response.\n\n");
const res = handleArguments(cmd, args);
cmd.done();
cmd.set_exit_status(res);
return res;
} catch(_e) {
const e = _e as Error;
cmd.printerr_literal(`Error: something went wrong! Stderr: ${e.message}\n${e.stack}`);
cmd.done();
return 1;
}
} else {
if(args.length > 0) {
cmd.printerr_literal("Error: colorshell not running. Try to clean-run before using arguments");
cmd.done();
return 1;
}
this.activate();
}
return 0;
}
vfunc_activate(): void {
super.vfunc_activate();
this.hold();
this.main();
}
private init(): void {
// load gresource from build-defined path
try {
this.#gresource = Gio.Resource.load(GRESOURCES_FILE.split('/').filter(s =>
s !== ""
).map(path => {
// support environment variables at runtime
if(/^\$/.test(path)) {
const env = GLib.getenv(path.replace(/^\$/, ""));
if(env === null)
throw new Error(`Couldn't get environment variable: ${path}`);
return env;
}
return path;
}).join('/'));
Gio.resources_register(this.#gresource);
// add icons
Gtk.IconTheme.get_for_display(Gdk.Display.get_default()!)
.add_resource_path("/io/github/retrozinndev/colorshell/icons")
} catch(_e) {
const e = _e as Error;
console.error(`Error: couldn't load gresource! Stderr: ${e.message}\n${e.stack}`);
}
this.#socketFile = Gio.File.new_for_path(`${GLib.get_user_runtime_dir() ??
`/run/user/${exec("id -u").trim()}`}/colorshell.sock`);
if(this.#socketFile.query_exists(null)) {
console.log(`Colorshell: Deleting previous instance's socket`);
this.#socketFile.delete(null);
}
this.#socketService = Gio.SocketService.new();
this.#socketService.add_address(
Gio.UnixSocketAddress.new(this.#socketFile.get_path()!),
Gio.SocketType.STREAM,
Gio.SocketProtocol.DEFAULT,
null
);
// handle communication via socket
createScopedConnection(this.#socketService, "incoming", (conn) => {
const inputStream = Gio.DataInputStream.new(conn.inputStream);
inputStream.read_upto_async('\x00', -1, GLib.PRIORITY_DEFAULT, null, (_, res) => {
const [args, len] = inputStream.read_upto_finish(res);
inputStream.close(null);
conn.inputStream.close(null);
if(len < 1) {
console.error(`Colorshell: No args provided via socket call`);
return;
}
try {
const [success, parsedArgs] = GLib.shell_parse_argv(`colorshell ${args}`);
parsedArgs?.splice(0, 1); // remove the unnecessary `colorshell` part
if(success) {
handleArguments({
print_literal: (msg) => conn.outputStream.write_bytes(
encoder.encode(`${msg}\n`),
null
),
// TODO: support writing to stderr(i don't know how to do that :sob:)
printerr_literal: (msg) => conn.outputStream.write_bytes(
encoder.encode(`${msg}\n`),
null
)
}, parsedArgs!);
conn.outputStream.flush(null);
conn.close(null);
return;
}
conn.outputStream.write_bytes(
encoder.encode("Error: Unexpected error occurred on argument parsing!"),
null
);
conn.outputStream.flush(null);
conn.close(null);
} catch(_e) {
const e = _e as Error;
console.error(`Colorshell: An error occurred while writing to socket output. Stderr:\n${
e.message}\n${e.stack}`);
}
});
return false;
});
}
private main(): void {
Gtk.init();
Adw.init();
createRoot((dispose) => {
console.log(`Colorshell: Initializing things`);
this.#connections.set(this, this.connect("shutdown", () => dispose()));
this.init();
this.#scope = getScope();
NightLight.getDefault();
Media.getDefault();
Clipboard.getDefault();
console.log("Colorshell: Initializing Wallpaper and Stylesheet modules");
Wallpaper.getDefault();
Stylesheet.getDefault();
console.log("Adding runner plugins");
runnerPlugins.forEach(plugin => Runner.addPlugin(plugin));
createSubscription(
createComputed([
secureBaseBinding<AstalWp.Endpoint>(createBinding(
AstalWp.get_default(), "defaultSpeaker"
), "volume", null),
secureBaseBinding<AstalWp.Endpoint>(createBinding(
AstalWp.get_default(), "defaultSpeaker"
), "mute", null)
]),
() => !Windows.getDefault().isOpen("control-center") &&
triggerOSD(OSDModes.sink)
);
createSubscription(
secureBaseBinding<Backlights.Backlight>(
createBinding(Backlights.getDefault(), "default"),
"brightness",
100
),
() => !Windows.getDefault().isOpen("control-center") &&
triggerOSD(OSDModes.brightness)
);
this.#connections.set(Notifications.getDefault(), [
Notifications.getDefault().connect("notification-added", () => {
Windows.getDefault().open("floating-notifications");
}),
Notifications.getDefault().connect("notification-removed", (self) => {
self.notifications.length === 0 && Windows.getDefault().close("floating-notifications");
})
]);
defaultWindows.forEach(w => Windows.getDefault().open(w));
});
this.#scope.onCleanup(() => {
console.log("Colorshell: disposing connections and quitting because of ::shutdown");
this.#connections.forEach((ids, obj) => Array.isArray(ids) ?
ids.forEach(id => obj.disconnect(id))
: obj.disconnect(ids));
});
}
quit(): void {
this.release();
}
}
Shell.getDefault().runAsync([ programInvocationName, ...programArgs ]);

View File

@@ -0,0 +1,264 @@
import { Scope } from "ags";
import { createScopedConnection, decoder, encoder } from "../modules/utils";
import { showWorkspaceNumber } from "../window/bar/widgets/Workspaces";
import windows from "./modules/windows";
import volume from "./modules/volume";
import devel from "./modules/devel";
import media from "./modules/media";
import Gio from "gi://Gio?version=2.0";
import GLib from "gi://GLib?version=2.0";
/** cli implementation for colorshell */
export namespace Cli {
let rootScope: Scope;
let initialized: boolean = false;
const modules: Array<Module> = [
// main module, no need for prefix
{
help: "manage colorshell windows and do more cool stuff.",
commands: [
...windows,
// others
{
name: "runner",
onCalled: (_, data) => {
return {
content: `Opening runner${data ? ` with "${data}"` : ""}...`,
type: "out"
};
}
},
{
name: "peek-workspace-num",
help: "peek the workspace numbers in the workspace indicator. (optional: time in millis)",
onCalled: () => {
showWorkspaceNumber(true);
return "Peeking workspace IDs...";
}
}
],
arguments: [
{
name: "version",
alias: "v",
help: "print the current colorshell version",
onCalled: () => `colorshell by retrozinndev, version ${COLORSHELL_VERSION
}${DEVEL ? "(devel)" : ""}`
}
]
},
volume,
media
];
export type Output = {
type: "err"|"out";
content: string|Uint8Array;
} | string;
/** argument passed to the command / module.
* output of onCalled is passed to */
export type Argument = {
/** kebab-cased name for the argument(without the `--` prefix)
* @example help (turns into `--help` internally)*/
name: string;
/** alias for the name (without the `-` prefix).
* @example help -> h */
alias?: string;
/** whether the argument needs a value attribute.
* @example --file ~/a_nice_home_file.txt */
hasValue?: boolean;
/** runtime-set value for the argument(if enabled) */
value?: string;
/** help message for the argument */
help?: string;
onCalled?: (value?: string) => void;
};
export type ArgumentData = {
argument: Argument;
data?: string;
};
export type Command = {
/** the command name to be called.
* @example `colorshell ${prefix?} ${command.name}`*/
name: string;
help?: string;
/** data passed to the command. (only works when arguments are disabled) */
data?: string;
arguments?: Array<Argument>;
onCalled: (args: Array<ArgumentData>, data?: string) => Output;
};
export type Module = {
/** command to come after the cli call.
* @example `colorshell ${prefix?} ${command}`*/
prefix?: string;
commands?: Array<Command>;
arguments?: Array<Argument>;
help?: string;
/** called everytime the prefix is used, even when using module commands */
onPrefixCalled?: () => void;
};
/** initialize the cli */
export function init(scope: Scope, communicationMethod: Gio.SocketService|Gio.ApplicationCommandLine, app?: Gio.Application): void {
if(initialized) return;
initialized = true;
rootScope = scope;
DEVEL && modules.push(devel);
scope.run(() => {
if(communicationMethod instanceof Gio.SocketService) {
createScopedConnection(
communicationMethod, "incoming", (conn) => {
try {
return handleIncoming(conn);
} catch(_) {}
return false;
}
);
return;
}
if(!app)
throw new Error("GApplication not specified for GApplicationCommandLine communication method")
if(app.flags !& Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
throw new Error("GApplication does not have the HANDLES_COMMAND_LINE flag or doesn't implement it")
createScopedConnection(
app,
"command-line",
(cmd) => {
let hasError: boolean = false;
try {
handleArgs(
cmd.get_arguments().toSpliced(0, 1),
(str, type) => {
if(type === "err") {
cmd.printerr_literal(str);
hasError = true;
return;
}
cmd.print_literal(str);
}
);
} catch(_) {
// TODO better error message
hasError = true;
}
return hasError ? 1 : 0;
}
);
});
}
/** handle incoming socket calls */
function handleIncoming(conn: Gio.SocketConnection): void {
const inputStream = Gio.DataInputStream.new(conn.inputStream);
inputStream.read_upto_async('\x00', -1, GLib.PRIORITY_DEFAULT, null, (_, res) => {
const [args, len] = inputStream.read_upto_finish(res);
inputStream.close(null);
conn.inputStream.close(null);
if(len < 1) {
console.error(`Colorshell: No args provided via socket call`);
return;
}
try {
const [success, parsedArgs] = GLib.shell_parse_argv(`colorshell ${args}`);
parsedArgs?.splice(0, 1); // remove the unnecessary `colorshell` part
if(success) {
handleArgs(parsedArgs!, conn.outputStream);
conn.outputStream.flush(null);
conn.close(null);
return;
}
conn.outputStream.write_bytes(
encoder.encode("Error: Unexpected syntax error occurred"),
null
);
conn.outputStream.flush(null);
conn.close(null);
} catch(_e) {
const e = _e as Error;
console.error(`Colorshell: An error occurred while writing to socket output. Stderr:\n${
e.message}\n${e.stack}`);
}
});
}
/** translate app arguments to modules/commands
* order: module ?arg -> command ?arg */
function handleArgs(args: Array<string>, writeTo: Gio.OutputStream|((str: string, type: "out"|"err") => void)): void {
let mod: Module;
let command: Command|undefined;
const modArgs: Array<Argument> = [];
const cmdArgs: Array<Argument> = [];
function print(out: Output): void {
const content = `${outputToString(out)}\n`;
const type: "out"|"err" = typeof out === "object" ?
out.type
: "out";
typeof writeTo === "function" ?
writeTo(content, type)
: writeTo.write_bytes(
encoder.encode(`${outputToString(out)}\n`),
null
);
}
function handleCommandArguments(cmd: Module|Command, args: Array<string>, index: number, printFun: (out: Output) => void): void {
const argNameRegEx = /^--/, argAliasRegEx = /^-/;
let argName: string;
if(args[index].startsWith("--")) {
}
}
const firstFoundMod = modules.filter(mod => mod.prefix === args[0])[0];
mod = firstFoundMod ?? modules[0];
if(!mod) {
print({
content: `No command module found with the name ${args[0]}!`,
type: "err"
});
return;
}
for(let i = 1; i < args.length; i++) {
const arg = args[i];
if(/^-/.test(arg)) {
handleCommandArguments(command ?? mod, args, i, print);
continue;
}
}
function outputToString(out: Output): string {
if(typeof out === "object")
return out.content instanceof Uint8Array ?
decoder.decode(out.content)
: out.content;
return out;
}
}

View File

@@ -0,0 +1,16 @@
import { Gtk } from "ags/gtk4";
import { Cli } from "..";
export default {
prefix: "dev",
help: "development tools to help debugging colorshell",
commands: [{
name: "inspector",
help: "open the gtk's visual inspector",
onCalled: () => {
Gtk.Window.set_interactive_debugging(true);
return "Opening GTK Inspector..."
}
}]
} satisfies Cli.Module;

View File

@@ -0,0 +1,46 @@
import { Cli } from "..";
export default {
prefix: "media",
help: "manage colorshell's active player",
commands: [
{
name: "play",
help: "resume/start active player's media",
onCalled: () => "TODO"
}, {
name: "pause",
help: "pause the active player",
onCalled: () => "TODO"
}, {
name: "play-pause",
help: "toggle pause/resume the active player",
onCalled: () => "TODO"
}, {
name: "stop",
help: "stop the active player (if compatible)",
onCalled: () => "TODO"
}, {
name: "previous",
help: "go back to previous media in the active player",
onCalled: () => "TODO"
}, {
name: "next",
help: "jump to the next media in active player",
onCalled: () => "TODO"
}, {
name: "bus-name",
help: "retrieve the active player's mpris bus name",
onCalled: () => "TODO"
}, {
name: "list",
help: "list available players implementing mpris",
onCalled: () => "TODO"
}, {
name: "select",
help: "resume/start active player's media",
onCalled: (_, busName) => "TODO"
}
]
} satisfies Cli.Module;

View File

@@ -0,0 +1,27 @@
import { Cli } from "..";
export default {
prefix: "volume",
help: "manage audio device volume/sensitivity. available devices are sink(speaker) and source(microphone).\
example usage: `colorshell volume increase sink 5%`",
commands: [
{
name: "increase",
help: "increase volume/sensitivity of a sink/source",
onCalled: () => "TODO"
}, {
name: "decrease",
help: "decrease volume/sensitivity of a sink/source",
onCalled: () => "TODO"
}, {
name: "set",
help: "set the volume/sensitivity of a sink/source",
onCalled: () => "TODO"
}, {
name: "mute",
help: "toggle-mute a sink/source's audio",
onCalled: () => "TODO"
}
]
} satisfies Cli.Module;

View File

@@ -0,0 +1,46 @@
import { Cli } from "..";
export default [
{
name: "open",
onCalled: (_, data) => {
return {
type: "out",
content: "TODO"
}
}
}, {
name: "toggle",
onCalled: (_, data) => {
return {
type: "out",
content: "TODO"
}
}
}, {
name: "close",
onCalled: (_, data) => {
return {
type: "out",
content: "TODO"
}
}
}, {
name: "windows",
onCalled: () => {
return {
type: "out",
content: "TODO"
}
}
}, {
name: "reopen",
onCalled: () => {
return {
type: "out",
content: "TODO"
}
}
}
] satisfies Array<Cli.Command>;

80
home/ags-config/config.ts Normal file
View File

@@ -0,0 +1,80 @@
import { Config } from "./modules/config";
import GLib from "gi://GLib?version=2.0";
const generalConfigDefaults = {
notifications: {
timeout_low: 4000,
timeout_normal: 6000,
timeout_critical: 0,
/** notification popup horizontal position. can be "left" or "right"
* @default "right" */
position_h: "right",
/** vertical notification popup position. can be "top" or "bottom"
* @default "top" */
position_v: "top"
},
night_light: {
/** whether to save night light values to disk */
save_on_shutdown: true
},
workspaces: {
/** breaks `enable_helper`, makes all workspaces show their respective ID
* by default */
always_show_id: false,
/** this is the function that shows the Workspace's IDs
* around the current workspace if one breaks the crescent order.
* It basically helps keyboard navigation between workspaces.
* ---
* Example: 1(empty, current, shows ID), 2(empty, does not appear(makes
* the previous not to be in a crescent order)), 3(not empty, shows ID) */
enable_helper: true,
/** hide workspace indicator if there's only one active workspace */
hide_if_single: false
},
clock: {
/** use the same format as gnu's `date` command */
date_format: "%A %d, %H:%M"
},
misc: {
play_bell_on_volume_change: true
}
};
const userDataDefaults = {
/** last default adapter */
bluetooth_default_adapter: undefined as unknown as string,
control_center: {
/** last default backlight */
default_backlight: undefined as unknown as string
},
night_light: {
/** last blue light filter temperature */
temperature: 6000,
/** last gamma filter value */
gamma: 100,
/** wheter to enable identity filters("disables" the filters) */
identity: true
}
};
export const userData = new Config<
keyof typeof userDataDefaults,
(typeof userDataDefaults)[keyof typeof userDataDefaults]
>(
`${GLib.get_user_data_dir()}/colorshell/data.json`,
userDataDefaults
);
export const generalConfig = new Config<keyof typeof generalConfigDefaults,
typeof generalConfigDefaults[keyof typeof generalConfigDefaults]>(
`${GLib.get_user_config_dir()}/colorshell/config.json`,
generalConfigDefaults
);

24
home/ags-config/env.d.ts vendored Normal file
View File

@@ -0,0 +1,24 @@
declare const SRC: string
declare const DEVEL: boolean;
declare const GRESOURCES_FILE: string;
declare const COLORSHELL_VERSION: string;
declare module "inline:*" {
const content: string
export default content
}
declare module "*.scss" {
const content: string
export default content
}
declare module "*.blp" {
const content: string
export default content
}
declare module "*.css" {
const content: string
export default content
}

View File

@@ -0,0 +1,58 @@
import GLib from "gi://GLib?version=2.0";
const i18nKeys = {
en_US: (await import("./lang/en_US")).default,
fr_FR: (await import("./lang/fr_FR")).default,
fr_BE: (await import("./lang/fr_FR")).default,
pt_BR: (await import("./lang/pt_BR")).default,
ru_RU: (await import("./lang/ru_RU")).default,
};
const languages: Array<string> = Object.keys(i18nKeys);
let language: string = getSystemLanguage();
export function getSystemLanguage(): string {
const sysLanguage: string | null | undefined =
GLib.getenv("LANG") ?? GLib.getenv("LANGUAGE"),
splitted: Array<string> | undefined = sysLanguage?.split(".");
if (!splitted || !languages.includes(splitted![0])) {
console.warn(`Intl: Falling back to default \`${languages[0]}\``);
return languages[0];
}
return splitted![0];
}
export function setLanguage(lang: string): string {
languages.map((cur: string) => {
if (cur === lang) {
language = lang;
return lang;
}
});
throw new Error(`Intl: couldn't set language: ${lang}`, {
cause: `language ${lang} not found in languages of type ${typeof languages}`,
});
}
export function tr(key: string): string {
let result = i18nKeys[language as keyof typeof i18nKeys],
defResult = i18nKeys[languages[0] as keyof typeof i18nKeys];
for (const keyString of key.split(".")) {
result = result[keyString as keyof typeof result] as never;
defResult = defResult[keyString as keyof typeof defResult] as never;
}
return typeof result == "string"
? result
: typeof defResult == "string"
? defResult
: 'not found / is not of type "string"';
}
export function trGet() {
return i18nKeys[getSystemLanguage() as keyof typeof i18nKeys];
}

View File

@@ -0,0 +1,105 @@
import { i18nStruct } from "../struct";
export default {
language: "English (United States)",
cancel: "Cancel",
accept: "Ok",
devices: "Devices",
others: "Others",
connected: "Connected",
disconnected: "Disconnected",
unknown: "Unknown",
connecting: "Connecting",
none: "None",
limited: "Limited",
apps: "Applications",
clear: "Clear",
connect: "Connect",
disconnect: "Disconnect",
copy_to_clipboard: "Copy to clipboard",
media: {
play: "Play",
pause: "Pause",
next: "Next",
previous: "Previous",
loop: "Loop",
no_loop: "No loop",
song_loop: "Loop song",
shuffle_order: "Shuffle",
follow_order: "Follow order",
no_artist: "No artist",
no_title: "No title"
},
control_center: {
tiles: {
enabled: "Enabled",
disabled: "Disabled",
more: "More",
network: {
network: "Network",
wireless: "Wireless",
wired: "Wired"
},
recording: {
title: "Screen Recording",
disabled_desc: "Start recording",
enabled_desc: "Stop recording",
},
dnd: {
title: "Do Not Disturb"
},
night_light: {
title: "Night Light",
default_desc: "Fidelity"
}
},
pages: {
more_settings: "More settings",
sound: {
title: "Sound",
description: "Configure the audio output"
},
microphone: {
title: "Microphone",
description: "Configure the audio input"
},
night_light: {
title: "Night Light",
description: "Control Night Light and Gamma filters",
gamma: "Gamma",
temperature: "Temperature"
},
backlight: {
title: "Backlight",
description: "Control the brightness of your screens",
refresh: "Refresh backlights"
},
bluetooth: {
title: "Bluetooth",
description: "Manage Bluetooth devices",
new_devices: "New devices",
adapters: "Adapters",
paired_devices: "Paired Devices",
start_discovering: "Start discovering",
stop_discovering: "Stop discovering",
untrust_device: "Untrust device",
unpair_device: "Unpair device",
trust_device: "Trust device",
pair_device: "Pair device"
},
network: {
title: "Network",
interface: "Interface"
}
}
},
ask_popup: {
title: "Question"
}
} satisfies i18nStruct;

View File

@@ -0,0 +1,105 @@
import { i18nStruct } from "../struct";
export default {
language: "Français (France)",
cancel: "Annuler",
accept: "Ok",
devices: "Appareils",
others: "Autres",
connected: "Connecté",
disconnected: "Déconnecté",
unknown: "Inconnu",
connecting: "Connexion en cours",
none: "Aucun",
limited: "Limité",
apps: "Applications",
clear: "Effacer",
connect: "Se connecter",
disconnect: "Se déconnecter",
copy_to_clipboard: "Copier dans le presse-papiers",
media: {
play: "Lecture",
pause: "Pause",
next: "Suivant",
previous: "Précédent",
loop: "Boucle",
no_loop: "Pas de boucle",
song_loop: "Répéter le morceau",
shuffle_order: "Lecture aléatoire",
follow_order: "Lecture dans l'ordre",
no_artist: "Aucun artiste",
no_title: "Aucun titre",
},
control_center: {
tiles: {
enabled: "Activé",
disabled: "Désactivé",
more: "Plus",
network: {
network: "Réseau",
wireless: "Sans fil",
wired: "Filaire",
},
recording: {
title: "Enregistrement de l'écran",
disabled_desc: "Démarrer l'enregistrement",
enabled_desc: "Arrêter l'enregistrement",
},
dnd: {
title: "Ne pas déranger",
},
night_light: {
title: "Éclairage nocturne",
default_desc: "Fidélité",
},
},
pages: {
more_settings: "Plus de paramètres",
sound: {
title: "Son",
description: "Configurer la sortie audio",
},
microphone: {
title: "Microphone",
description: "Configurer l'entrée audio",
},
night_light: {
title: "Éclairage nocturne",
description: "Contrôler l'éclairage nocturne et les filtres Gamma",
gamma: "Gamma",
temperature: "Température",
},
backlight: {
title: "Rétroéclairage",
description: "Contrôler la luminosité de vos écrans",
refresh: "Actualiser les rétroéclairages",
},
bluetooth: {
title: "Bluetooth",
description: "Gérer les appareils Bluetooth",
new_devices: "Nouveaux appareils",
adapters: "Adaptateurs",
paired_devices: "Appareils appairés",
start_discovering: "Démarrer la recherche",
stop_discovering: "Arrêter la recherche",
untrust_device: "Retirer la confiance",
unpair_device: "Désappairer",
trust_device: "Faire confiance",
pair_device: "Appairer",
},
network: {
title: "Réseau",
interface: "Interface",
},
},
},
ask_popup: {
title: "Question",
},
} satisfies i18nStruct;

View File

@@ -0,0 +1,105 @@
import { i18nStruct } from "../struct";
export default {
language: "Português (Brasil)",
cancel: "Cancelar",
accept: "Ok",
devices: "Dispositivos",
others: "Outros",
connected: "Conectado",
disconnected: "Desconectado",
unknown: "Desconhecido",
connecting: "Conectando",
limited: "Limitado",
none: "Nenhum",
disconnect: "Desconectar",
connect: "Conectar",
apps: "Aplicativos",
clear: "Limpar",
copy_to_clipboard: "Copiar para a Área de Transferência",
media: {
next: "Próxima faixa",
pause: "Pausar",
play: "Tocar",
previous: "Faixa anterior",
loop: "Repetir",
no_loop: "Não repetir",
song_loop: "Repetir faixa",
follow_order: "Seguir ordem",
shuffle_order: "Ordem aleatória",
no_title: "Sem título",
no_artist: "Sem artista"
},
control_center: {
tiles: {
enabled: "Ligado",
disabled: "Desligado",
more: "Mais",
network: {
network: "Rede",
wireless: "Wi-Fi",
wired: "Cabeada"
},
recording: {
title: "Gravação de Tela",
disabled_desc: "Iniciar gravação",
enabled_desc: "Parar gravação",
},
dnd: {
title: "Não Perturbe"
},
night_light: {
title: "Luz Noturna",
default_desc: "Fidelidade"
}
},
pages: {
more_settings: "Mais configurações",
sound: {
title: "Som",
description: "Controle a saída de áudio"
},
microphone: {
title: "Microfone",
description: "Configure a entrada de áudio"
},
night_light: {
title: "Luz Noturna",
description: "Controle os filtros de Luz Noturna e Gama",
temperature: "Temperatura",
gamma: "Gama"
},
backlight: {
title: "Brilho",
description: "Controle o nível de brilho das suas telas",
refresh: "Recarregar"
},
bluetooth: {
title: "Bluetooth",
description: "Gerencie dispositivos Bluetooth",
new_devices: "Novos Dispositivos",
adapters: "Adaptadores",
paired_devices: "Dispositivos Pareados",
start_discovering: "Começar a procurar dispositivos",
stop_discovering: "Parar de procurar dispositivos",
pair_device: "Parear dispositivo",
trust_device: "Confiar no dispositivo",
unpair_device: "Desparear dispositivo",
untrust_device: "Deixar de confiar no dispositivo"
},
network: {
title: "Rede",
interface: "Interface"
}
}
},
ask_popup: {
title: "Pergunta"
}
} satisfies i18nStruct;

View File

@@ -0,0 +1,86 @@
import { i18nStruct } from "../struct";
export default {
language: "Русский (Российская Федерация)",
cancel: "Отменить",
accept: "Ок",
devices: "Устройства",
others: "Другие",
connected: "Подключён",
disconnected: "Отключён",
unknown: "Неизвестный",
connecting: "Подключение",
none: "Ничего",
limited: "Ограничен",
apps: "Приложения",
clear: "Очистить",
connect: "Подключиться",
disconnect: "Отключиться",
control_center: {
tiles: {
enabled: "Включить",
disabled: "Отключить",
more: "Больше",
network: {
network: "Инетрнет",
wireless: "Беспроводное",
wired: "Проводное"
},
recording: {
title: "Запись экрана",
disabled_desc: "Начать запись",
enabled_desc: "Остановить запись",
},
dnd: {
title: "Не беспокоить"
},
night_light: {
title: "Ночной свет",
default_desc: "Тонн"
}
},
pages: {
more_settings: "Больше настроек",
sound: {
title: "Звук",
description: "Настройка вывода звука"
},
microphone: {
title: "Микрофон",
description: "Настройка ввода звука"
},
night_light: {
title: "Ночной свет",
description: "Контроль интенсивности фильтрации синего света",
gamma: "Гамма",
temperature: "Температура"
},
bluetooth: {
title: "Bluetooth",
description: "Управление Bluetooth устройствами",
new_devices: "Новые устройства",
adapters: "Адапреты",
paired_devices: "Привязанные устройства",
start_discovering: "Начать поиск",
stop_discovering: "Остановить поиск",
untrust_device: "Недоверенное устройство",
unpair_device: "Отвязанное устройство",
trust_device: "Доверенное устройство",
pair_device: "Привязанное устройство"
},
network: {
title: "Интернет",
interface: "Интерфейсы"
}
}
},
ask_popup: {
title: "Вопрос"
}
} as i18nStruct;

View File

@@ -0,0 +1,105 @@
export type i18nStruct = {
language: string,
cancel: string,
accept: string,
connected: string,
disconnected: string,
connecting: string,
unknown: string,
none: string,
limited: string,
devices: string,
others: string,
disconnect: string,
connect: string,
apps: string,
clear: string,
copy_to_clipboard: string,
media: {
loop: string,
song_loop: string,
no_loop: string,
shuffle_order: string,
follow_order: string,
pause: string,
play: string,
next: string,
previous: string,
no_artist: string,
no_title: string
},
control_center: {
tiles: {
enabled: string,
disabled: string,
more: string,
network: {
network: string,
wireless: string,
wired: string
},
recording: {
title: string,
disabled_desc: string,
enabled_desc: string
},
dnd: {
title: string
},
night_light: {
title: string,
default_desc: string
}
},
pages: {
more_settings: string,
sound: {
title: string,
description: string
},
microphone: {
title: string,
description: string
},
network: {
title: string,
interface: string
},
backlight: {
title: string,
description: string,
refresh: string
},
bluetooth: {
title: string,
description: string,
adapters: string,
new_devices: string,
paired_devices: string,
start_discovering: string,
stop_discovering: string,
trust_device: string,
untrust_device: string,
pair_device: string,
unpair_device: string
},
night_light: {
title: string,
description: string,
temperature: string,
gamma: string
}
}
},
ask_popup: {
title: string
}
};

View File

@@ -0,0 +1,105 @@
import { Gdk, Gtk } from "ags/gtk4";
import { execAsync } from "ags/process";
import AstalApps from "gi://AstalApps";
import AstalHyprland from "gi://AstalHyprland";
// Disabled uwsm - not installed in NixOS
export const uwsmIsActive: boolean = false;
const astalApps: AstalApps.Apps = new AstalApps.Apps();
let appsList: Array<AstalApps.Application> = astalApps.get_list();
export function getApps(): Array<AstalApps.Application> {
return appsList;
}
export function updateApps(): void {
astalApps.reload();
appsList = astalApps.get_list();
}
export function getAstalApps(): AstalApps.Apps {
return astalApps;
}
/** handles running with uwsm if it's installed */
export function execApp(app: AstalApps.Application|string, dispatchExecArgs?: string) {
const executable = (typeof app === "string") ? app
: app.executable.replace(/%[fFcuUik]/g, "");
AstalHyprland.get_default().dispatch("exec",
`${dispatchExecArgs ? `${dispatchExecArgs} ` : ""}${uwsmIsActive ? "uwsm-app -- " : ""}${executable}`
);
}
export function lookupIcon(name: string): boolean {
return Gtk.IconTheme.get_for_display(Gdk.Display.get_default()!)?.has_icon(name);
}
export function getAppsByName(appName: string): (Array<AstalApps.Application>|undefined) {
let found: Array<AstalApps.Application> = [];
getApps().map((app: AstalApps.Application) => {
if(app.get_name().trim().toLowerCase() === appName.trim().toLowerCase()
|| (app?.wmClass && app.wmClass.trim().toLowerCase() === appName.trim().toLowerCase()))
found.push(app);
});
return (found.length > 0 ? found : undefined);
}
export function getIconByAppName(appName: string): (string|undefined) {
if(!appName) return undefined;
if(lookupIcon(appName))
return appName;
if(lookupIcon(appName.toLowerCase()))
return appName.toLowerCase();
const nameReverseDNS = appName.split('.');
const lastItem = nameReverseDNS[nameReverseDNS.length - 1];
const lastPretty = `${lastItem.charAt(0).toUpperCase()}${lastItem.substring(1, lastItem.length)}`;
const uppercaseRDNS = nameReverseDNS.slice(0, nameReverseDNS.length - 1)
.concat(lastPretty).join('.');
if(lookupIcon(uppercaseRDNS))
return uppercaseRDNS;
if(lookupIcon(nameReverseDNS[nameReverseDNS.length - 1]))
return nameReverseDNS[nameReverseDNS.length - 1];
const found: (AstalApps.Application|undefined) = getAppsByName(appName)?.[0];
if(Boolean(found))
return found?.iconName;
return undefined;
}
export function getAppIcon(app: (string|AstalApps.Application)): (string|undefined) {
if(!app) return undefined;
if(typeof app === "string")
return getIconByAppName(app);
if(app.iconName && lookupIcon(app.iconName))
return app.iconName;
if(app.wmClass)
return getIconByAppName(app.wmClass);
return getIconByAppName(app.name);
}
export function getSymbolicIcon(app: (string|AstalApps.Application)): (string|undefined) {
const icon = getAppIcon(app);
return (icon && lookupIcon(`${icon}-symbolic`)) ?
`${icon}-symbolic`
: undefined;
}

View File

@@ -0,0 +1,104 @@
import { Gdk, Gtk } from "ags/gtk4";
import { execAsync } from "ags/process";
import AstalApps from "gi://AstalApps";
import AstalHyprland from "gi://AstalHyprland";
export const uwsmIsActive: boolean = false; // Disabled - uwsm not installed
"uwsm check is-active"
).then(() => true).catch(() => false);
const astalApps: AstalApps.Apps = new AstalApps.Apps();
let appsList: Array<AstalApps.Application> = astalApps.get_list();
export function getApps(): Array<AstalApps.Application> {
return appsList;
}
export function updateApps(): void {
astalApps.reload();
appsList = astalApps.get_list();
}
export function getAstalApps(): AstalApps.Apps {
return astalApps;
}
/** handles running with uwsm if it's installed */
export function execApp(app: AstalApps.Application|string, dispatchExecArgs?: string) {
const executable = (typeof app === "string") ? app
: app.executable.replace(/%[fFcuUik]/g, "");
AstalHyprland.get_default().dispatch("exec",
`${dispatchExecArgs ? `${dispatchExecArgs} ` : ""}${uwsmIsActive ? "uwsm-app -- " : ""}${executable}`
);
}
export function lookupIcon(name: string): boolean {
return Gtk.IconTheme.get_for_display(Gdk.Display.get_default()!)?.has_icon(name);
}
export function getAppsByName(appName: string): (Array<AstalApps.Application>|undefined) {
let found: Array<AstalApps.Application> = [];
getApps().map((app: AstalApps.Application) => {
if(app.get_name().trim().toLowerCase() === appName.trim().toLowerCase()
|| (app?.wmClass && app.wmClass.trim().toLowerCase() === appName.trim().toLowerCase()))
found.push(app);
});
return (found.length > 0 ? found : undefined);
}
export function getIconByAppName(appName: string): (string|undefined) {
if(!appName) return undefined;
if(lookupIcon(appName))
return appName;
if(lookupIcon(appName.toLowerCase()))
return appName.toLowerCase();
const nameReverseDNS = appName.split('.');
const lastItem = nameReverseDNS[nameReverseDNS.length - 1];
const lastPretty = `${lastItem.charAt(0).toUpperCase()}${lastItem.substring(1, lastItem.length)}`;
const uppercaseRDNS = nameReverseDNS.slice(0, nameReverseDNS.length - 1)
.concat(lastPretty).join('.');
if(lookupIcon(uppercaseRDNS))
return uppercaseRDNS;
if(lookupIcon(nameReverseDNS[nameReverseDNS.length - 1]))
return nameReverseDNS[nameReverseDNS.length - 1];
const found: (AstalApps.Application|undefined) = getAppsByName(appName)?.[0];
if(Boolean(found))
return found?.iconName;
return undefined;
}
export function getAppIcon(app: (string|AstalApps.Application)): (string|undefined) {
if(!app) return undefined;
if(typeof app === "string")
return getIconByAppName(app);
if(app.iconName && lookupIcon(app.iconName))
return app.iconName;
if(app.wmClass)
return getIconByAppName(app.wmClass);
return getIconByAppName(app.name);
}
export function getSymbolicIcon(app: (string|AstalApps.Application)): (string|undefined) {
const icon = getAppIcon(app);
return (icon && lookupIcon(`${icon}-symbolic`)) ?
`${icon}-symbolic`
: undefined;
}

View File

@@ -0,0 +1,406 @@
import { Gtk } from "ags/gtk4";
import { Wireplumber } from "./volume";
import { Windows } from "../windows";
import { restartInstance } from "./reload-handler";
import { timeout } from "ags/time";
import { Runner } from "../runner/Runner";
import { showWorkspaceNumber } from "../window/bar/widgets/Workspaces";
import { playSystemBell } from "./utils";
import { Shell } from "../app";
import { generalConfig } from "../config";
import Media from "./media";
import AstalIO from "gi://AstalIO";
import AstalMpris from "gi://AstalMpris";
export type RemoteCaller = {
printerr_literal: (message: string) => void,
print_literal: (message: string) => void
};
let wsTimeout: AstalIO.Time|undefined;
const help = `Manage Astal Windows and do more stuff. From retrozinndev's colorshell, \
made using GTK4, AGS, Gnim and Astal libraries by Aylur.
Window Management:
open [window]: opens the specified window.
close [window]: closes all instances of specified window.
toggle [window]: toggle-open/close the specified window.
windows: list shell windows and their respective status.
reload: quit this instance and start a new one.
reopen: restart all open-windows.
quit: exit the main instance of the shell.
Audio Controls:
volume: speaker and microphone volume controller, see "volume help".
Media Controls:
media: manage colorshell's active player, see "media help".
${false ? `
Development Tools:
dev: tools to help debugging colorshell
` : ""}
Other options:
runner [initial_text]: open the application runner, optionally add an initial search.
peek-workspace-num [millis]: peek the workspace numbers on bar window.
v, version: display current colorshell version.
h, help: shows this help message.
2025 (c) retrozinndev's colorshell, licensed under the BSD 3-Clause License.
https://github.com/retrozinndev/colorshell
`.trim();
export function handleArguments(cmd: RemoteCaller, args: Array<string>): number {
switch(args[0]) {
case "help":
case "h":
cmd.print_literal(help);
return 0;
case "version":
case "v":
cmd.print_literal(`colorshell by retrozinndev, version ${COLORSHELL_VERSION
}${false ? " (devel)" : ""}\nhttps://github.com/retrozinndev/colorshell`);
return 0;
case "dev":
return handleDevArgs(cmd, args);
case "open":
case "close":
case "toggle":
case "windows":
case "reopen":
return handleWindowArgs(cmd, args);
case "volume":
return handleVolumeArgs(cmd, args);
case "media":
return handleMediaArgs(cmd, args);
case "reload":
restartInstance();
cmd.print_literal("Restarting instance...");
return 0;
case "quit":
try {
Shell.getDefault().quit();
cmd.print_literal("Quitting main instance...");
} catch(_e) {
const e = _e as Error;
cmd.printerr_literal(`Error: couldn't quit instance. Stderr: ${e.message}\n${e.stack}`);
return 1;
}
return 0;
case "runner":
!Runner.instance ?
Runner.openDefault(args[1] || undefined)
: Runner.close();
cmd.print_literal(`Opening runner${args[1] ? ` with predefined text: "${args[1]}"` : ""}`);
return 0;
case "peek-workspace-num":
if(wsTimeout) {
cmd.print_literal("Workspace numbers are already showing");
return 0;
}
showWorkspaceNumber(true);
wsTimeout = timeout(Number.parseInt(args[1]) || 2200, () => {
showWorkspaceNumber(false);
wsTimeout = undefined;
});
cmd.print_literal("Toggled workspace numbers");
return 0;
}
cmd.printerr_literal("Error: command not found! try checking help");
return 1;
}
function handleDevArgs(cmd: RemoteCaller, args: Array<string>): number {
if(/h|help/.test(args[1])) {
cmd.print_literal(`
Debugging tools for colorshell.
Options:
inspector: open GTK's visual debugger
`.trim());
return 0;
}
switch(args[1]) {
case "inspector":
cmd.print_literal("Opening inspector...");
Gtk.Window.set_interactive_debugging(true);
return 0;
}
cmd.printerr_literal("Error: command not found! try checking `dev help`");
return 1;
}
function handleMediaArgs(cmd: RemoteCaller, args: Array<string>): number {
if(/h|help/.test(args[1])) {
const mediaHelp = `
Manage colorshell's active player
Options:
play: resume/start active player's media.
pause: pause the active player.
play-pause: toggle play/pause on active player.
stop: stop the active player's media.
previous: go back to previous media if player supports it.
next: jump to next media if player supports it.
bus-name: get active player's mpris bus name.
list: show available players with their bus name.
select bus_name: change the active player, where bus_name is
the desired player's mpris bus name(with the mediaplayer2 prefix).
`.trim();
cmd.print_literal(mediaHelp);
return 0;
}
const activePlayer: AstalMpris.Player|undefined = Media.getDefault().player.available ?
Media.getDefault().player
: undefined;
const players = AstalMpris.get_default().players.filter(pl => pl.available);
if(!activePlayer) {
cmd.printerr_literal(`Error: no active player found! try playing some media first`);
return 1;
}
switch(args[1]) {
case "play":
activePlayer.play();
cmd.print_literal("Playing");
return 0;
case "list":
cmd.print_literal(`Available players:\n${players.map(pl => {
let playbackStatusStr: string;
switch(pl.playbackStatus) {
case AstalMpris.PlaybackStatus.PAUSED:
playbackStatusStr = "paused";
break;
case AstalMpris.PlaybackStatus.PLAYING:
playbackStatusStr = "playing";
break;
default:
playbackStatusStr = "stopped";
break;
}
return ` ${pl.busName}: ${playbackStatusStr}`;
}).join('\n')}`);
return 0;
case "pause":
activePlayer.pause();
cmd.print_literal("Paused");
return 0;
case "play-pause":
activePlayer.play_pause();
cmd.print_literal(
activePlayer?.playbackStatus === AstalMpris.PlaybackStatus.PAUSED ?
"Toggled play"
: "Toggled pause"
);
return 0;
case "stop":
activePlayer.stop();
cmd.print_literal("Stopped!");
return 0;
case "previous":
activePlayer.canGoPrevious && activePlayer.previous();
cmd.print_literal(
activePlayer.canGoPrevious ?
"Back to previous"
: "Player does not support this command"
);
return 0;
case "next":
activePlayer.canGoNext && activePlayer.next();
cmd.print_literal(
activePlayer.canGoNext ?
"Jump to next"
: "Player does not support this command"
);
return 0;
case "bus-name":
cmd.print_literal(activePlayer.busName);
return 0;
case "select":
if(!args[2] || !players.filter(pl => pl.busName == args[2])?.[0]) {
cmd.printerr_literal(`Error: either no player was specified or the player with \
specified bus name does not exist/is not available!`);
return 1;
}
Media.getDefault().player = players.filter(pl => pl.busName === args[2])[0];
cmd.print_literal(`Done setting player to \`${args[2]}\`!`);
return 0;
}
cmd.printerr_literal("Error: couldn't handle media arguments, try checking `media help`");
return 1;
}
function handleWindowArgs(cmd: RemoteCaller, args: Array<string>): number {
switch(args[0]) {
case "reopen":
Windows.getDefault().reopen();
cmd.print_literal("Reopening all open windows");
return 0;
case "windows":
cmd.print_literal(
Object.keys(Windows.getDefault().windows).map(name =>
`${name}: ${Windows.getDefault().isOpen(name) ?
"open"
: "closed"}`
).join('\n')
);
return 0;
}
const specifiedWindow: string = args[1];
if(!specifiedWindow) {
cmd.printerr_literal("Error: window argument not specified!");
return 1;
}
if(!Windows.getDefault().hasWindow(specifiedWindow)) {
cmd.printerr_literal(
`Error: "${specifiedWindow}" not found on window list! Make sure to add new windows to the system before using them`
);
return 1;
}
switch(args[0]) {
case "open":
if(!Windows.getDefault().isOpen(specifiedWindow)) {
Windows.getDefault().open(specifiedWindow);
cmd.print_literal(`Opening window with name "${args[1]}"`);
return 0;
}
cmd.print_literal(`Window is already open, ignored`);
return 0;
case "close":
if(Windows.getDefault().isOpen(specifiedWindow)) {
Windows.getDefault().close(specifiedWindow);
cmd.print_literal(`Closing window with name "${args[1]}"`);
return 0;
}
cmd.print_literal(`Window is already closed, ignored`);
return 0;
case "toggle":
if(!Windows.getDefault().isOpen(specifiedWindow)) {
Windows.getDefault().open(specifiedWindow);
cmd.print_literal(`Toggle opening window "${args[1]}"`);
return 0;
}
Windows.getDefault().close(specifiedWindow);
cmd.print_literal(`Toggle closing window "${args[1]}"`);
return 0;
}
cmd.printerr_literal("Couldn't handle window management arguments");
return 1;
}
function handleVolumeArgs(cmd: RemoteCaller, args: Array<string>): number {
if(!args[1]) {
cmd.printerr_literal(`Error: please specify what to do! see \`volume help\``);
return 1;
}
if(/^(sink|source)[-](increase|decrease|set)$/.test(args[1]) && !args[2]) {
cmd.printerr_literal(`Error: you forgot to set a value`);
return 1;
}
const command: Array<string> = args[1].split('-');
if(/h|help/.test(args[1])) {
cmd.print_literal(`
Control speaker and microphone volumes
Options:
(sink|source)-set [number]: set speaker/microphone volume.
(sink|source)-mute: toggle mute for the speaker/microphone device.
(sink|source)-increase [number]: increases speaker/microphone volume.
(sink|source)-decrease [number]: decreases speaker/microphone volume.
`.trim());
return 0;
}
if(command[1] === "mute") {
command[0] === "sink" ?
Wireplumber.getDefault().toggleMuteSink()
: Wireplumber.getDefault().toggleMuteSource()
cmd.print_literal(`Done toggling mute!`);
return 0;
}
if(Number.isNaN(Number.parseFloat(args[2]))) {
cmd.printerr_literal(`Error: argument "${args[2]} is not a valid number! Please use integers"`);
return 1;
}
switch(command[1]) {
case "set":
command[0] === "sink" ?
Wireplumber.getDefault().setSinkVolume(Number.parseInt(args[2]))
: Wireplumber.getDefault().setSourceVolume(Number.parseInt(args[2]))
cmd.print_literal(`Done! Set ${command[0]} volume to ${args[2]}`);
return 0;
case "increase":
command[0] === "sink" ?
Wireplumber.getDefault().increaseSinkVolume(Number.parseInt(args[2]))
: Wireplumber.getDefault().increaseSourceVolume(Number.parseInt(args[2]))
generalConfig.getProperty("misc.play_bell_on_volume_change", "boolean") === true &&
playSystemBell();
cmd.print_literal(`Done increasing volume by ${args[2]}`);
return 0;
case "decrease":
command[0] === "sink" ?
Wireplumber.getDefault().decreaseSinkVolume(Number.parseInt(args[2]))
: Wireplumber.getDefault().decreaseSourceVolume(Number.parseInt(args[2]))
generalConfig.getProperty("misc.play_bell_on_volume_change", "boolean") === true &&
playSystemBell();
cmd.print_literal(`Done decreasing volume to ${args[2]}`);
return 0;
}
cmd.printerr_literal(`Error: couldn't resolve arguments! "${args.join(' ')
.replace(new RegExp(`^${args[0]}`), "")}"`);
return 1;
}

View File

@@ -0,0 +1,111 @@
import { exec, execAsync } from "ags/process";
import { register } from "ags/gobject";
import { AuthPopup } from "../widget/AuthPopup";
import Polkit from "gi://Polkit?version=1.0";
import PolkitAgent from "gi://PolkitAgent?version=1.0";
import Gio from "gi://Gio?version=2.0";
import GLib from "gi://GLib?version=2.0";
import AstalAuth from "gi://AstalAuth?version=0.1";
@register({ GTypeName: "AuthAgent" })
export class Auth extends PolkitAgent.Listener {
private static instance: Auth;
#handle: any;
#user: Polkit.UnixUser;
#pam: AstalAuth.Pam;
constructor() {
super();
this.#user = Polkit.UnixUser.new(Number.parseInt(exec("id -u"))) as Polkit.UnixUser;
this.#pam = new AstalAuth.Pam;
this.register(
PolkitAgent.RegisterFlags.RUN_IN_THREAD,
Polkit.UnixSession.new(this.#user.get_uid().toString()),
"/io/github/retrozinndev/colorshell/AuthAgent",
null
);
}
vfunc_dispose() {
PolkitAgent.Listener.unregister(this.#handle);
}
public static initiate_authentication(action_id: string, message: string, icon_name: string, details: Polkit.Details, cookie: string, identities: Array<Polkit.Identity>, cancellable: Gio.Cancellable|null, callback: Gio.AsyncReadyCallback<Auth>|null): void {
const task = Gio.Task.new(
this.getDefault(),
cancellable,
callback as Gio.AsyncReadyCallback|null
);
AuthPopup({
text: message,
iconName: icon_name,
onContinue: (data, reject, approve) => {
this.getDefault().validateAuth(data.passwd, data.user).then((success) => {
approve();
task.return_boolean(success);
}).catch((error: GLib.Error) => {
// TODO implement a number of tries (usually it's 3)
reject(`Authentication failed: ${error.message}`);
task.return_error(error);
});
}
});
}
initiate_authentication_finish(res: Gio.AsyncResult): boolean {
}
// TODO: support fingerprint/facial auth
/** @returns true if data are correct, rejects promise otherwise */
public validateAuth(passwd: string, user?: string): Promise<boolean> {
if(user !== undefined)
this.#pam.username = user;
return new Promise<boolean>((resolve, reject) => {
const connections: Array<number> = [];
connections.push(
this.#pam.connect("fail", () => {
reject(
`Auth: Authentication has failed for user ${this.#pam.username}`
);
connections.forEach(id => this.#pam.disconnect(id));
}),
this.#pam.connect("success", () => {
resolve(true);
connections.forEach(id => this.#pam.disconnect(id));
})
);
this.#pam.start_authenticate();
this.#pam.supply_secret(passwd);
});
}
/** @returns true if successful */
public async polkitExecute(cmd: string | Array<string>): Promise<boolean> {
let success: boolean = true;
await execAsync([
"pkexec",
"--",
...(Array.isArray(cmd) ? cmd : [ cmd ]) ]
).catch((r) => {
success = false;
console.error(`Polkit: Couldn't authenticate. Stderr: ${r}`);
});
return success;
}
public static getDefault(): Auth {
if(!this.instance)
this.instance = new Auth();
return this.instance;
}
}

View File

@@ -0,0 +1,209 @@
import { monitorFile, readFile } from "ags/file";
import { exec } from "ags/process";
import GObject, { getter, ParamSpec, register, setter, signal } from "ags/gobject";
import Gio from "gi://Gio?version=2.0";
export namespace Backlights {
const BacklightParamSpec = (name: string, flags: GObject.ParamFlags) =>
GObject.ParamSpec.jsobject(name, null, null, flags) as ParamSpec<Backlight>;
let instance: Backlights;
export function getDefault(): Backlights {
if(!instance)
instance = new Backlights();
return instance;
}
@register({ GTypeName: "Backlights" })
class _Backlights extends GObject.Object {
#backlights: Array<Backlight> = [];
#default: Backlight|null = null;
#available: boolean = false;
@getter(Array as unknown as ParamSpec<Array<Backlight>>)
get backlights() { return this.#backlights; }
@getter(BacklightParamSpec)
get default() { return this.#default!; }
/** true if there are any backlights available */
@getter(Boolean)
get available() { return this.#available; }
public scan(): Array<Backlight> {
const dir = Gio.File.new_for_path(`/sys/class/backlight`),
backlights: Array<Backlight> = [];
let fileEnum: Gio.FileEnumerator;
try {
fileEnum = dir.enumerate_children("standard::*", Gio.FileQueryInfoFlags.NONE, null);
for(const backlight of fileEnum) {
try {
backlights.push(new Backlight(backlight.get_name()));
} catch(_) {}
}
} catch(_) {
return [];
}
if(backlights.length < 1) {
if(this.#available) {
this.#available = false;
this.notify("available");
}
this.#default = null;
this.notify("default");
}
if(backlights.length > 0) {
if(this.#backlights.length < 1) {
this.#available = true;
this.notify("available");
}
if(!this.#default || !backlights.filter(bk => bk.path === this.#default?.path)[0]) {
this.#default = backlights[0];
this.notify("default");
}
}
this.#backlights = backlights;
this.notify("backlights");
return backlights;
}
public setDefault(bk: Backlight): void {
this.#default = bk;
this.notify("default");
}
constructor(scan: boolean = true) {
super();
scan && this.scan();
}
}
@register({ GTypeName: "Backlight" })
class _Backlight extends GObject.Object {
declare $signals: GObject.Object.SignalSignatures & {
"brightness-changed": (value: number) => void
};
readonly #name: string;
#path: string;
#maxBrightness: number;
#brightness: number;
#monitor: Gio.FileMonitor;
#conn: number;
@signal(Number) brightnessChanged(_: number): void {};
@getter(String)
get name() { return this.#name; }
@getter(String)
get path() { return this.#path; }
@getter(Boolean)
get isDefault() { return this.path === getDefault().default?.path; }
@getter(Number)
get brightness() { return this.#brightness; };
@setter(Number)
set brightness(level: number) {
if(!this.writeBrightness(level)) return;
this.#brightness = level;
this.notify("brightness");
this.emit("brightness-changed", level);
}
@getter(Number)
get maxBrightness() { return this.#maxBrightness;};
// intel_backlight is mostly the default on laptops
constructor(name: string = "intel_backlight") {
super();
// check if backlight exists
if(!Gio.File.new_for_path(`/sys/class/backlight/${name}/brightness`).query_exists(null))
throw new Error(`Brightness: Couldn't find brightness for "${name}"`);
// notify :is-default on default backlight change
this.#conn = getDefault().connect("notify::default", () =>
this.notify("is-default"));
this.#name = name;
this.#path = `/sys/class/backlight/${name}`;
this.notify("path");
this.#maxBrightness = Number.parseInt(readFile(`${this.#path}/max_brightness`));
this.notify("max-brightness");
this.#brightness = Number.parseInt(readFile(`${this.#path}/brightness`))
this.#monitor = monitorFile(`/sys/class/backlight/${name}/brightness`, () => {
this.#brightness = this.readBrightness();
this.notify("brightness");
this.emit("brightness-changed", this.brightness);
});
}
private readBrightness(): number {
try {
const brightness = Number.parseInt(readFile(`${this.#path}/brightness`));
return brightness;
} catch(e) {
console.error(`Backlight: An error occurred while reading brightness from "${this.#name}"`);
}
return this.#brightness ?? this.#maxBrightness ?? 0;
}
private writeBrightness(level: number): boolean {
try {
exec(`brightnessctl -d ${this.#name} s ${level}`);
return true;
} catch(e) {
console.error(`Backlight: Couldn't set brightness for "${this.#name}". Stderr: ${e}`);
}
return false;
}
vfunc_dispose(): void {
this.#monitor.cancel();
getDefault().disconnect(this.#conn);
}
public emit<Signal extends keyof typeof this.$signals>(
signal: Signal,
...args: Parameters<(typeof this.$signals)[Signal]>
): void {
super.emit(signal, ...args);
}
public connect<Signal extends keyof typeof this.$signals>(
signal: Signal,
callback: (self: typeof this, ...args: Parameters<(typeof this.$signals)[Signal]>) => ReturnType<(typeof this.$signals)[Signal]>
): number {
return super.connect(signal, callback);
}
}
export const Backlights = _Backlights;
export const Backlight = _Backlight;
export type Backlight = InstanceType<typeof Backlight>;
export type Backlights = InstanceType<typeof Backlights>;
}

View File

@@ -0,0 +1,38 @@
import { Accessor, createBinding } from "ags";
import AstalBattery from "gi://AstalBattery?version=0.1";
export class Battery {
private static astalBattery: AstalBattery.Device = AstalBattery.get_default();
private static batteryInst: Battery;
constructor() {
AstalBattery.get_default();
}
public static getDefault(): Battery {
if (!this.batteryInst) {
this.batteryInst = new Battery();
}
return this.batteryInst;
}
public static getBattery(): AstalBattery.Device {
return this.astalBattery;
}
public bindHasBattery(): Accessor<boolean> {
return createBinding(Battery.getBattery(), "isBattery");
}
public bindPercentage(): Accessor<string> {
return createBinding(Battery.getBattery(), "percentage").as(
(v) => Math.round(v * 100) + "%"
);
}
public bindIcon(): Accessor<string> {
return createBinding(Battery.getBattery(), "battery_icon_name");
}
}

View File

@@ -0,0 +1,159 @@
import { createRoot, getScope, Scope } from "ags";
import { execAsync } from "ags/process";
import { userData } from "../config";
import { createScopedConnection } from "gnim-utils";
import GObject, { getter, gtype, property, register, setter } from "ags/gobject";
import AstalBluetooth from "gi://AstalBluetooth";
/** AstalBluetooth helper (implements the default adapter feature) */
@register({ GTypeName: "Bluetooth" })
export class Bluetooth extends GObject.Object {
declare $signals: {
"notify": () => void;
"notify::adapter": (adapter: AstalBluetooth.Adapter|null) => void;
"notify::is-available": (available: boolean) => void;
"notify::save-default-adapter": (save: boolean) => void;
"notify::last-device": (device: AstalBluetooth.Device|null) => void;
};
private static instance: Bluetooth;
private astalBl: AstalBluetooth.Bluetooth;
#connections: Map<GObject.Object, Array<number>|number> = new Map();
#adapter: AstalBluetooth.Adapter|null = null;
#scope!: Scope;
#isAvailable: boolean = false;
#lastDevice: AstalBluetooth.Device|null = null;
@property(Boolean)
saveDefaultAdapter: boolean = true;
@getter(Boolean)
get isAvailable() { return this.#isAvailable; }
/** last connected device, can be null */
@getter(AstalBluetooth.Device)
get lastDevice() { return this.#lastDevice!; }
@getter(gtype<AstalBluetooth.Adapter|null>(AstalBluetooth.Adapter))
get adapter() { return this.#adapter; }
@setter(gtype<AstalBluetooth.Adapter|null>(AstalBluetooth.Adapter))
set adapter(newAdapter: AstalBluetooth.Adapter|null) {
this.#adapter = newAdapter;
this.notify("adapter");
if(!newAdapter) return;
AstalBluetooth.get_default().adapters.filter(ad => {
if(ad.address !== newAdapter.address)
return true;
ad.set_powered(true);
return false;
}).forEach(ad => ad.set_powered(false));
execAsync(`bluetoothctl select ${newAdapter.address}`).then(() => {
userData.setProperty("bluetooth_default_adapter", newAdapter.address, true);
}).catch(e => console.error(`Bluetooth: Couldn't select adapter. Stderr: ${e}`));
}
constructor() {
super();
this.astalBl = AstalBluetooth.get_default();
this.#adapter = this.astalBl.adapter ?? null;
if(this.astalBl.adapters.length > 0) {
this.#isAvailable = true;
this.notify("is-available");
}
createRoot(() => {
this.#scope = getScope();
// load previous default adapter
const dataDefaultAdapter = userData.getProperty("bluetooth_default_adapter", "string");
const foundAdapter = this.astalBl.adapters.filter(a => a.address === dataDefaultAdapter)[0];
if(dataDefaultAdapter !== undefined && foundAdapter !== undefined)
this.adapter = foundAdapter;
createScopedConnection(AstalBluetooth.get_default(), "adapter-added", (adapter) => {
if(this.astalBl.adapters.length === 1) // adapter was just added
this.adapter = adapter;
});
createScopedConnection(AstalBluetooth.get_default(), "adapter-removed", (adapter) => {
if(this.astalBl.adapters.length < 1) {
this.adapter = null;
this.#isAvailable = false;
this.notify("is-available");
}
if(this.#adapter?.address !== adapter.address)
return;
// the removed adapter was the default
if(this.astalBl.adapters.length < 1) {
this.adapter = null;
this.#isAvailable = false;
this.notify("is-available");
return;
}
this.#adapter = this.astalBl.adapters[0];
});
this.#lastDevice = this.getLastConnectedDevice();
this.notify("last-device");
this.#connections.set(AstalBluetooth.get_default(), [
AstalBluetooth.get_default().connect("device-added", (_) => {
this.#lastDevice = this.getLastConnectedDevice();
this.notify("last-device");
}),
AstalBluetooth.get_default().connect("device-removed", (_) => {
this.#lastDevice = this.getLastConnectedDevice();
this.notify("last-device");
})
]);
this.#scope.onCleanup(() => this.#connections.forEach((ids, gobj) =>
Array.isArray(ids) ?
ids.forEach(id => gobj.disconnect(id))
: gobj.disconnect(ids)
));
});
}
public static getDefault(): Bluetooth {
if(!this.instance)
this.instance = new Bluetooth();
return this.instance;
}
vfunc_dispose(): void {
this.#scope.dispose();
}
private getLastConnectedDevice(): AstalBluetooth.Device|null {
const connectedDevices = AstalBluetooth.get_default().devices
.filter(d => d.connected);
const lastDevice = connectedDevices[connectedDevices.length - 1];
return lastDevice ?? null;
}
connect<Signal extends keyof (typeof this)["$signals"]>(
signal: Signal, callback: (typeof this["$signals"])[Signal]
): number {
return super.connect(signal as string, callback as () => void);
}
}

View File

@@ -0,0 +1,260 @@
import { timeout } from "ags/time";
import { monitorFile, readFile } from "ags/file";
import { execAsync } from "ags/process";
import GObject, { getter, register, signal } from "ags/gobject";
import AstalIO from "gi://AstalIO";
import GLib from "gi://GLib?version=2.0";
import Gio from "gi://Gio?version=2.0";
export enum ClipboardItemType {
TEXT = 0,
IMAGE = 1
}
export class ClipboardItem {
id: number;
type: ClipboardItemType;
preview: string;
constructor(id: number, type: ClipboardItemType, preview: string) {
this.id = id;
this.type = type;
this.preview = preview;
}
}
export { Clipboard };
/** Cliphist Manager and event listener
* This only supports wipe and store events from cliphist */
@register({ GTypeName: "Clipboard" })
class Clipboard extends GObject.Object {
private static instance: Clipboard;
declare $signals: GObject.Object.SignalSignatures & {
"copied": Clipboard["copied"];
"wiped": Clipboard["wiped"];
};
#dbFile: Gio.File;
#dbMonitor: Gio.FileMonitor;
#updateDone: boolean = false;
#history = new Array<ClipboardItem>;
#changesTimeout: (AstalIO.Time|undefined);
#ignoreChanges: boolean = false;
@signal(GObject.TYPE_JSOBJECT) copied(_item: object) {}
@signal() wiped() {};
@getter(Array)
public get history() { return this.#history; }
constructor() {
super();
this.#dbFile = this.getCliphistDatabase();
this.#dbMonitor = monitorFile(this.#dbFile.get_path()!, () => {
if(this.#ignoreChanges || this.#changesTimeout)
return;
this.#changesTimeout = timeout(300, () => this.#changesTimeout = undefined);
if(this.#updateDone) {
this.updateDatabase();
return;
}
this.init();
});
if(this.#dbFile.query_exists(null)) {
this.init();
return;
}
console.log("Clipboard: cliphist database not found. Try copying something first!");
}
vfunc_dispose(): void {
this.#dbMonitor.cancel();
this.#dbMonitor.unref();
}
private init() {
console.log("Clipboard: Starting to read cliphist history...");
this.updateDatabase().then(() => {
console.log("Clipboard: Done reading cliphist history!");
}).catch((err) =>
console.error(`Clipboard: An error occurred while reading cliphist history. Stderr: ${err}`)
);
}
public async copyAsync(content: string): Promise<boolean> {
const proc = Gio.Subprocess.new(
["wl-copy", content],
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE
);
const stderr = Gio.DataInputStream.new(proc.get_stderr_pipe()!);
if(!proc.wait_check(null)) {
try {
const [err, ] = stderr.read_upto('\x00', -1);
console.error(`Clipboard: An error occurred while copying text. Stderr: ${err}`);
} catch(_) {
console.error(`Clipboard: An error occurred while copying text and shell couldn't read \
stderr for more info.`);
}
}
return proc.get_exit_status() === 0;
}
public async selectItem(itemToSelect: number|ClipboardItem): Promise<boolean> {
const item = await this.getItemContent(itemToSelect);
let res: boolean = true;
if(item)
await this.copyAsync(item).catch(() => res = false);
return res;
}
/** Gets history item's content by its ID.
* @returns the clipboard item's content */
public async getItemContent(item: number|ClipboardItem): Promise<string|undefined> {
const id = (typeof item === "number") ?
item : item.id;
const cmd = Gio.Subprocess.new([ "cliphist", "decode", id.toString() ],
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE);
const [ , stdout, stderr ] = cmd.communicate_utf8(null, null);
if(stderr) {
console.error(`Clipboard: An error occurred while getting item content. Stderr:\n${stderr}`);
return;
}
return stdout;
}
/** Searches for the cliphist database file
* Will not work if cliphist config file is not on default path */
private getCliphistDatabase(): Gio.File {
// Check if env variable is set
const path = GLib.getenv("CLIPHIST_DB_PATH");
if(path != null)
return Gio.File.new_for_path(path);
// Check config file
const confFile = Gio.File.new_for_path(`${GLib.get_user_config_dir()}/cliphist/config`);
if(confFile.query_exists(null)) {
const cliphistConf = readFile(confFile.get_path()!);
for(const line of cliphistConf.split('\n').map(l => l.trim())) {
if(line.startsWith('#'))
continue;
const [ key, value ] = line.split('\s', 1);
if(key === "db-path") {
return Gio.File.new_for_path(value.trimStart());
}
}
}
// return default path if none of the above matches
return Gio.File.new_for_path(`${GLib.get_user_cache_dir()}/cliphist/db`);
}
private getContentType(preview: string): ClipboardItemType {
return /^\[\[.*binary data.*x.*\]\]$/u.test(preview) ?
ClipboardItemType.IMAGE
: ClipboardItemType.TEXT;
}
public async wipeHistory(noExec?: boolean): Promise<void> {
if(noExec) {
this.#history = [];
this.emit("wiped");
return;
}
this.#ignoreChanges = true;
await execAsync("cliphist wipe").then(() => {
this.#history = [];
this.emit("wiped");
}).catch((err: Gio.IOErrorEnum) =>
console.error(`Clipboard: An error occurred on cliphist database wipe. Stderr: ${
err.message ? `${err.message}\n` : ""}${err.stack}`)
).finally(() => this.#ignoreChanges = false);
}
public async updateDatabase(): Promise<void> {
const proc = Gio.Subprocess.new([ "cliphist", "list" ],
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE);
proc.communicate_utf8_async(null, null, (_, asyncRes) => {
const [ success, stdout, stderr ] = proc.communicate_utf8_finish(asyncRes);
if(!success || stderr) {
console.error("Clipboard: Couldn't communicate with cliphist! Is it installed?");
return;
}
if(!stdout.trim()) {
this.wipeHistory(true);
this.notify("history");
return;
}
const items = stdout.split('\n');
if(this.#updateDone) {
const [ id, preview ] = items[0].split('\t');
const clipItem = {
id: Number.parseInt(id),
preview,
type: this.getContentType(preview)
} as ClipboardItem;
this.#history.unshift(clipItem);
this.emit("copied", clipItem);
this.notify("history");
return;
}
for(const item of items) {
if(!item) continue;
const [ id, preview ] = item.split('\t');
const clipItem = {
id: Number.parseInt(id),
preview,
type: this.getContentType(preview)
} as ClipboardItem;
this.#history.push(clipItem);
this.emit("copied", clipItem);
this.notify("history");
}
this.#updateDone = true;
});
}
public static getDefault(): Clipboard {
if(!this.instance)
this.instance = new Clipboard();
return this.instance;
}
}

View File

@@ -0,0 +1,69 @@
import { Compositors } from ".";
import { register } from "ags/gobject";
import { createRoot, getScope, Scope } from "ags";
import { createScopedConnection } from "../utils";
import AstalHyprland from "gi://AstalHyprland";
type Event = "activewindow" | "activewindowv2"
| "workspace" | "workspacev2"
| "focusedmon" | "focusedmonv2";
@register({ GTypeName: "CompositorHyprland" })
export class CompositorHyprland extends Compositors.Compositor {
#scope: Scope;
hyprland: AstalHyprland.Hyprland;
protected _focusedClient: Compositors.Client | null = null;
constructor() {
super();
try {
this.hyprland = AstalHyprland.get_default();
} catch(e) {
throw new Error(`Couldn't initialize CompositorHyprland: ${e}`);
}
this.#scope = createRoot(() => {
createScopedConnection(
this.hyprland, "event", (e, args) => {
switch(e as Event) {
case "activewindowv2":
const address = args;
const clients = AstalHyprland.get_default().clients;
const focusedClient = clients.filter(c =>
c.address === address
)[0];
if(focusedClient) {
this._focusedClient = new Compositors.Client({
address: address,
class: focusedClient.class ?? "",
initialClass: focusedClient.initialClass ?? "",
mapped: focusedClient.mapped,
position: [focusedClient.x, focusedClient.y],
title: focusedClient.title ?? ""
});
this.notify("focused-client");
return;
}
this._focusedClient = null;
this.notify("focused-client");
break;
}
}
);
return getScope();
});
}
vfunc_dispose(): void {
this.#scope.dispose();
}
}

View File

@@ -0,0 +1,162 @@
import { CompositorHyprland } from "./hyprland";
import GObject, { getter, gtype, property, register } from "ags/gobject";
import GLib from "gi://GLib?version=2.0";
/** WIP modular implementation of a system that supports implementing
* a variety of Wayland Compositors
* @todo implement more general compositor info + a lot of stuff
* */
export namespace Compositors {
let compositor: Compositor|null = null;
@register({ GTypeName: "CompositorMonitor" })
export class Monitor extends GObject.Object {
#width: number;
#height: number;
@getter(Number)
get width() { return this.#width; }
@getter(Number)
get height() { return this.#height; }
@property(Number)
scaling: number;
constructor(width: number, height: number, scaling: number = 1) {
super();
this.#width = width;
this.#height = height;
this.scaling = scaling;
}
}
@register({ GTypeName: "CompositorWorkspace" })
export class Workspace extends GObject.Object {
#id: number;
#monitor: Monitor;
@getter(Number)
get id() { return this.#id; }
@getter(Monitor)
get monitor() { return this.#monitor; }
constructor(monitor: Monitor, id: number = 0) {
super();
this.#monitor = monitor;
this.#id = id;
}
}
@register({ GTypeName: "CompositorClient" })
export class Client extends GObject.Object {
readonly #address: string|null = null;
#initialClass: string;
#class: string;
#title: string = "";
#mapped: boolean = true;
#position: [number, number] = [0, 0];
#xwayland: boolean = false;
@getter(gtype<string|null>(String))
get address() { return this.#address; }
@getter(String)
get title() { return this.#title; }
@getter(String)
get class() { return this.#class; }
@getter(String)
get initialClass() { return this.#initialClass; }
@getter(gtype<[number, number]>(Array))
get position() { return this.#position; }
@getter(Boolean)
get xwayland() { return this.#xwayland; }
@getter(Boolean)
get mapped() { return this.#mapped; }
constructor(props: {
address?: string;
title?: string;
mapped?: boolean;
class: string;
initialClass?: string;
/** [x, y] */
position?: [number, number];
}) {
super();
this.#class = props.class;
if(props.title !== undefined)
this.#title = props.title;
if(props.mapped !== undefined)
this.#mapped = props.mapped;
if(props.address !== undefined)
this.#address = props.address;
if(props.position !== undefined)
this.#position = props.position;
this.#initialClass = props.initialClass !== undefined ?
props.initialClass
: props.class;
}
}
@register({ GTypeName: "Compositor" })
export class Compositor extends GObject.Object {
protected _workspaces: Array<Workspace> = [];
protected _focusedClient: Client|null = null;
@getter(Array<Workspace>)
get workspaces() { return this._workspaces; }
@getter(gtype<Client|null>(Client))
get focusedClient() { return this._focusedClient; }
constructor() {
super();
}
};
export function getDefault(): Compositor {
if(!compositor)
throw new Error("Compositors haven't been initialized correctly, please call `Compositors.init()` before calling any method in `Compositors`");
return compositor;
}
/** Uses the XDG_CURRENT_DESKTOP variable to detect running compositor's name.
* ---
* @returns running wayland compositor's name (lowercase) or `undefined` if variable's not set */
export function getName(): string|undefined {
return GLib.getenv("XDG_CURRENT_DESKTOP")?.toLowerCase() ?? undefined;
}
/** initialize colorshell's wayland compositor implementation abstraction.
* when called, and if it's implemented, sets the default compositor to an equivalent implementation for the current desktop(checks from XDG_CURRENT_DESKTOP) */
export function init(): void {
switch(Compositors.getName()) {
case "hyprland":
compositor = new CompositorHyprland();
break;
default:
console.error(`This compositor(${Compositors.getName()}) is not yet implemented to colorshell. Please contribute by implementing it if you can! :)`);
}
}
}

View File

@@ -0,0 +1,219 @@
import { timeout } from "ags/time";
import { monitorFile, readFileAsync, writeFileAsync } from "ags/file";
import { Notifications } from "./notifications";
import { Accessor } from "ags";
import GObject, { getter, gtype, register } from "ags/gobject";
import Gio from "gi://Gio?version=2.0";
import AstalIO from "gi://AstalIO";
import AstalNotifd from "gi://AstalNotifd";
export { Config };
type ValueTypes = "string" | "boolean" | "object" | "number" | "any";
@register({ GTypeName: "Config" })
class Config<K extends string, V = any> extends GObject.Object {
declare $signals: GObject.Object.SignalSignatures & {
"notify::entries": (entries: Record<K, V>) => void;
};
/** unmodified object with default entries. User-values are stored
* in the `entries` field */
public readonly defaults: Record<K, V>;
@getter(gtype<Record<K, V>>(Object))
public get entries() { return this.#entries; }
#file: Gio.File;
#entries: Record<K, V>;
private timeout: (AstalIO.Time|boolean|undefined);
public get file() { return this.#file; };
constructor(filePath: Gio.File|string, defaults?: Record<K, V>) {
super();
this.defaults = (defaults ?? {}) as Record<K, V>;
this.#entries = { ...defaults } as Record<K, V>;
this.#file = (typeof filePath === "string") ?
Gio.File.new_for_path(filePath)
: filePath;
if(!this.#file.query_exists(null)) {
this.#file.make_directory_with_parents(null);
this.#file.delete(null);
this.writeFile().catch(e => Notifications.getDefault().sendNotification({
appName: "colorshell",
summary: "Write error",
body: `Couldn't write default configuration file to "${this.#file.get_path()!
}".\nStderr: ${e}`
}));
}
monitorFile(this.#file.get_path()!,
() => {
if(this.timeout) return;
this.timeout = timeout(500, () => this.timeout = undefined);
if(this.#file.query_exists(null)) {
this.timeout?.cancel();
this.timeout = true;
this.readFile().finally(() =>
this.timeout = undefined);
return;
}
Notifications.getDefault().sendNotification({
appName: "colorshell",
summary: "Config error",
body: `Could not hot-reload configuration: config file not found in \`${this.#file.get_path()!}\`, last valid configuration is being used. Maybe it got deleted?`
});
}
);
this.readFile().catch(e => console.error(
`Config: An error occurred while read the configuration file. Stderr: ${e}`
));
}
private async writeFile(): Promise<void> {
this.timeout = true;
await writeFileAsync(
this.#file.get_path()!, JSON.stringify(this.entries, undefined, 4)
).finally(() => this.timeout = false);
}
private async readFile(): Promise<void> {
await readFileAsync(this.#file.get_path()!).then((content) => {
let config: (Record<K, V>|undefined);
try {
config = JSON.parse(content) as Record<K, V>;
} catch(e) {
Notifications.getDefault().sendNotification({
urgency: AstalNotifd.Urgency.NORMAL,
appName: "colorshell",
summary: "Config parsing error",
body: `An error occurred while parsing colorshell's config file: \nFile: ${
this.#file.get_path()!}\n${
(e as SyntaxError).message}`
});
}
if(!config) return;
// only change valid entries that are available in the defaults (with 1 of depth)
for(const k of Object.keys(this.entries)) {
if(config[k as keyof typeof config] === undefined)
return;
// TODO needs more work, like object-recursive(infinite depth) entry attributions
this.#entries[k as keyof Record<K, V>] = config[k as keyof typeof config];
}
this.notify("entries");
}).catch((e: Gio.IOErrorEnum) => {
Notifications.getDefault().sendNotification({
urgency: AstalNotifd.Urgency.NORMAL,
appName: "colorshell",
summary: "Config read error",
body: `An error occurred while reading colorshell's config file: ${this.#file.get_path()!
}\n${e.message}`.replace(/[<>]/g, "\\&")
});
});
}
public bindProperty(path: string, expectType: "boolean"): Accessor<boolean>;
public bindProperty(path: string, expectType: "number"): Accessor<number>;
public bindProperty(path: string, expectType: "string"): Accessor<string>;
public bindProperty(path: string, expectType: "object"): Accessor<object>;
public bindProperty(path: string, expectType: "any"): Accessor<any>;
public bindProperty(path: string, expectType: undefined): Accessor<any>;
public bindProperty(propertyPath: string, expectType?: ValueTypes): Accessor<boolean|number|string|object|any> {
return new Accessor(() => this.getProperty(propertyPath, expectType as never), (callback: () => void) => {
const id = this.connect("notify::entries", () => callback());
return () => this.disconnect(id);
});
}
public getProperty(path: string, expectType: "boolean"): boolean;
public getProperty(path: string, expectType: "number"): number;
public getProperty(path: string, expectType: "string"): string;
public getProperty(path: string, expectType: "object"): object;
public getProperty(path: string, expectType: "any"): any;
public getProperty(path: string, expectType: undefined): any;
public getProperty(path: string, expectType?: ValueTypes): boolean|number|string|object|any {
return this._getProperty(path, this.#entries, expectType);
}
public getPropertyDefault(path: string, expectType: "boolean"): boolean;
public getPropertyDefault(path: string, expectType: "number"): number;
public getPropertyDefault(path: string, expectType: "string"): string;
public getPropertyDefault(path: string, expectType: "object"): object;
public getPropertyDefault(path: string, expectType: "any"): any;
public getPropertyDefault(path: string, expectType: undefined): any;
public getPropertyDefault(path: string, expectType?: ValueTypes): boolean|number|string|object|any {
return this._getProperty(path, this.defaults, expectType);
}
public setProperty(path: string, value: any, write?: boolean): void {
let property: any = this.#entries,
obj: typeof this.entries = property;
const pathArray = path.split('.').filter(str => str);
for(let i = 0; i < pathArray.length; i++) {
const currentPath = pathArray[i];
property = property[currentPath as keyof typeof property];
if(typeof property === "object") {
obj = property;
} else {
obj[pathArray[pathArray.length - 1] as keyof typeof obj] = value;
break;
}
}
this.notify("entries");
write && this.writeFile().catch(e => console.error(
`Config: Couldn't save file. Stderr: ${e}`
));
}
private _getProperty(path: string, entries: Record<K, V>, expectType?: ValueTypes): (any|undefined) {
let property: any = entries;
const pathArray = path.split('.').filter(str => str);
for(let i = 0; i < pathArray.length; i++) {
const currentPath = pathArray[i];
property = property[currentPath as keyof typeof property];
}
if(expectType !== "any" && typeof property !== expectType) {
// return default value if not defined by user
property = this.defaults;
for(let i = 0; i < pathArray.length; i++) {
const currentPath = pathArray[i];
property = property[currentPath as keyof typeof property];
}
}
if(expectType !== "any" && typeof property !== expectType) {
console.error(`Config: property with path \`${path}\` not found in defaults/user-entries, returning \`undefined\``);
property = undefined;
}
return property;
}
}

View File

@@ -0,0 +1,86 @@
import { Accessor, createConnection, getScope, Scope } from "ags";
import { createScopedConnection, decoder } from "./utils";
import AstalMpris from "gi://AstalMpris";
import GObject from "gi://GObject?version=2.0";
import { property, register } from "ags/gobject";
@register({ GTypeName: "Media" })
export default class Media extends GObject.Object {
private static instance: Media;
public static readonly dummyPlayer = {
available: false,
busName: "dummy_player",
bus_name: "dummy_player"
} as AstalMpris.Player;
@property(AstalMpris.Player)
player: AstalMpris.Player = Media.dummyPlayer;
constructor(scope: Scope) {
super();
scope.run(() => {
const firstPlayer = AstalMpris.get_default().players[0];
if(firstPlayer)
this.player = firstPlayer;
createScopedConnection(
AstalMpris.get_default(),
"player-added",
(player) => {
if(player.available)
this.player = player;
}
);
createScopedConnection(
AstalMpris.get_default(),
"player-closed", (closedPlayer) => {
const players = AstalMpris.get_default().players.filter(pl => pl?.available &&
pl.busName !== closedPlayer.busName);
// go back to first player(if available) when the active player is closed
if(players.length > 0 && players[0]) {
this.player = players[0];
return;
}
this.player = Media.dummyPlayer;
}
);
});
}
public static getDefault(): Media {
if(!this.instance)
this.instance = new Media(getScope());
return this.instance;
}
public static accessMediaUrl(player: AstalMpris.Player): Accessor<string|undefined> {
return createConnection(player.get_meta("xesam:url"),
[player, "notify::metadata", () => player.get_meta("xesam:url")]
).as(url => {
const byteString = url?.get_data_as_bytes();
return byteString ?
decoder.decode(byteString.toArray())
: undefined;
})
}
public static getMediaUrl(player: AstalMpris.Player): string|undefined {
if(!player.available) return;
const meta = player.get_meta("xesam:url");
const byteString = meta?.get_data_as_bytes();
return byteString ?
decoder.decode(byteString.toArray())
: undefined;
}
}

View File

@@ -0,0 +1,181 @@
import { execAsync, exec } from "ags/process";
import { userData } from "../config";
import GObject, { getter, register, setter } from "ags/gobject";
import GLib from "gi://GLib?version=2.0";
@register({ GTypeName: "NightLight" })
export class NightLight extends GObject.Object {
private static instance: NightLight;
public readonly maxTemperature = 20000;
public readonly minTemperature = 1000;
public readonly identityTemperature = 6000;
public readonly maxGamma = 100;
#watchInterval: GLib.Source;
#temperature: number = this.identityTemperature;
#gamma: number = this.maxGamma;
#identity: boolean = false;
@getter(Number)
public get temperature() { return this.#temperature; }
public set temperature(newValue: number) { this.setTemperature(newValue); }
@getter(Number)
public get gamma() { return this.#gamma; }
public set gamma(newValue: number) { this.setGamma(newValue); }
@getter(Boolean)
public get identity() { return this.#identity; }
@setter(Boolean)
public set identity(val: boolean) {
val ? this.applyIdentity() : this.filter();
this.#identity = val;
this.notify("identity");
}
constructor() {
super();
this.loadData();
this.#watchInterval = setInterval(() => {
execAsync("hyprctl hyprsunset temperature").then(t => {
if(t.trim() !== "" && t.trim().length <= 5) {
const val = Number.parseInt(t.trim());
if(this.#temperature !== val) {
this.identity = this.#temperature === this.identityTemperature;
this.#temperature = val;
this.notify("temperature");
}
}
}).catch((r: Error) => console.error(`Night Light: Couldn't sync temperature. Stderr: ${
r.message}\n${r.stack}`));
execAsync("hyprctl hyprsunset gamma").then(g => {
if(g.trim() !== "" && g.trim().length <= 5) {
const val = Number.parseInt(g.trim());
if(this.#gamma !== val) {
this.identity = this.#gamma === this.maxGamma;
this.#gamma = val;
this.notify("gamma");
}
}
}).catch((r: Error) => console.error(`Night Light: Couldn't sync. Stderr: ${
r.message}\n${r.stack}`));
}, 10000);
}
vfunc_dispose(): void {
this.#watchInterval?.destroy();
}
public static getDefault(): NightLight {
if(!this.instance)
this.instance = new NightLight();
return this.instance;
}
private setTemperature(value: number): void {
if(value === this.temperature && !this.identity) return;
if(value > this.maxTemperature || value < 1000) {
console.error(`Night Light: provided temperatue ${value
} is out of bounds (min: 1000; max: ${this.maxTemperature})`);
return;
}
this.dispatchAsync("temperature", value).then(() => {
this.#temperature = value;
this.notify("temperature");
this.identity = false;
}).catch((r: Error) => console.error(
`Night Light: Couldn't set temperature. Stderr: ${r.message}\n${r.stack}`
));
}
private setGamma(value: number): void {
if(value === this.gamma && !this.identity) return;
if(value > this.maxGamma || value < 0) {
console.error(`Night Light: provided gamma ${value
} is out of bounds (min: 0; max: ${this.maxTemperature})`);
return;
}
this.dispatchAsync("gamma", value).then(() => {
this.#gamma = value;
this.notify("gamma");
this.identity = false;
}).catch((r: Error) => console.error(
`Night Light: Couldn't set gamma. Stderr: ${r.message}\n${r.stack}`
));
}
public applyIdentity(): void {
this.dispatch("identity");
if(!this.#identity) {
this.#identity = true;
this.notify("identity");
}
}
private dispatch(call: "temperature", val: number): string;
private dispatch(call: "gamma", val: number): string;
private dispatch(call: "identity"): string;
private dispatch(call: "temperature"|"gamma"|"identity", val?: number): string {
return exec(`hyprctl hyprsunset ${call}${val != null ? ` ${val}` : ""}`);
}
private async dispatchAsync(call: "temperature", val: number): Promise<string>;
private async dispatchAsync(call: "gamma", val: number): Promise<string>;
private async dispatchAsync(call: "identity"): Promise<string>;
private async dispatchAsync(call: "temperature"|"gamma"|"identity", val?: number): Promise<string> {
return await execAsync(`hyprctl hyprsunset ${call}${val != null ? ` ${val}` : ""}`);
}
public filter(): void {
this.setTemperature(this.temperature);
this.setGamma(this.gamma);
if(this.#identity) {
this.#identity = false;
this.notify("identity");
}
}
public saveData(): void {
userData.setProperty("night_light.temperature", this.#temperature);
userData.setProperty("night_light.gamma", this.#gamma);
userData.setProperty("night_light.identity", this.#identity, true);
}
/** load temperature, gamma and identity(off/on) properties from the user configuration */
public loadData(): void {
const identity = userData.getProperty("night_light.identity", "boolean");
const temperature = userData.getProperty("night_light.temperature", "number");
const gamma = userData.getProperty("night_light.gamma", "number");
if(identity) {
this.#temperature = temperature;
this.notify("temperature");
this.#gamma = gamma;
this.notify("gamma");
} else {
this.temperature = temperature;
this.gamma = gamma;
}
this.identity = identity;
}
}

View File

@@ -0,0 +1,361 @@
import { execAsync } from "ags/process";
import { generalConfig } from "../config";
import { onCleanup } from "ags";
import GObject, { getter, ParamSpec, property, register, signal } from "ags/gobject";
import AstalNotifd from "gi://AstalNotifd";
import GLib from "gi://GLib?version=2.0";
export type HistoryNotification = {
id: number;
appName: string;
body: string;
summary: string;
urgency: AstalNotifd.Urgency;
appIcon?: string;
time: number;
image?: string;
}
export class NotificationTimeout {
#source?: GLib.Source;
#args?: Array<any>;
#millis: number;
#lastRemained!: number;
readonly callback: () => void;
get millis(): number { return this.#millis; }
get remaining(): number { return this.source!.get_time() }
get lastRemained(): number { return this.#lastRemained; }
get running(): boolean { return Boolean(this.source?.is_destroyed()); }
get source(): GLib.Source|undefined { return this.#source; }
constructor(millis: number, callback: () => void, start: boolean = true, ...args: Array<any>) {
this.#millis = millis;
this.callback = callback;
this.#args = args;
if(!start) return;
this.start();
}
cancel(): void {
// use lastRemained to calculate on what time the user hold the notification, so it
// can be released by the remaining time (works like a timeout "pause")
this.#lastRemained = Math.floor(Math.max(this.#source!.get_ready_time() - GLib.get_monotonic_time()) / 1000);
this.#source?.destroy();
this.#source?.unref();
this.#source = undefined;
}
start(newMillis?: number): GLib.Source {
if(this.running)
throw new Error("Notifications: Can't start a new counter if it's already running!");
if(newMillis !== undefined)
this.#millis = newMillis;
this.#source = setTimeout(
this.callback,
this.#millis,
this.#args
);
this.#lastRemained = Math.floor(Math.max(this.#source!.get_ready_time() - GLib.get_monotonic_time()) / 1000);
return this.#source;
}
};
@register({ GTypeName: "Notifications" })
export class Notifications extends GObject.Object {
private static instance: (Notifications|null) = null;
declare $signals: GObject.Object.SignalSignatures & {
"history-added": (notification: HistoryNotification) => void;
"history-removed": (notificationId: number) => void;
"history-cleared": () => void;
"notification-added": (notification: AstalNotifd.Notification) => void;
"notification-removed": (notificationId: number) => void;
"notification-replaced": (notificationId: number) => void;
};
#notifications = new Map<number, [AstalNotifd.Notification, NotificationTimeout]>();
#history: Array<HistoryNotification> = [];
#connections: Array<number> = [];
@getter(Array<AstalNotifd.Notification>)
public get notifications() {
return [...this.#notifications.values()].map(([n]) => n);
};
@getter(Array<HistoryNotification>)
public get history() { return this.#history };
@getter(Array<AstalNotifd.Notification>)
public get notificationsOnHold() {
return [...this.#notifications.values()].filter(([_, s]) =>
typeof s === "undefined"
).map(([n]) => n);
}
@property(Number)
public historyLimit: number = 10;
/** skip notifications directly to notification history */
@property(Boolean)
public ignoreNotifications: boolean = false;
@signal(AstalNotifd.Notification) notificationAdded(_notification: AstalNotifd.Notification) {};
@signal(Number) notificationRemoved(_id: number) {};
@signal(Object as unknown as ParamSpec<HistoryNotification>) historyAdded(_notification: Object) {};
@signal() historyCleared() {};
@signal(Number) historyRemoved(_id: number) {};
@signal(Number) notificationReplaced(_id: number) {};
constructor() {
super();
this.#connections.push(
AstalNotifd.get_default().connect("notified", (notifd, id) => {
const notification = notifd.get_notification(id);
if(this.getNotifd().dontDisturb || this.ignoreNotifications) {
this.addHistory(notification, () => notification.dismiss());
return;
}
this.addNotification(notification, this.getNotificationTimeout(notification) > 0);
}),
AstalNotifd.get_default().connect("resolved", (notifd, id, _reason) => {
this.removeNotification(id);
this.addHistory(notifd.get_notification(id));
})
);
onCleanup(() => {
this.#connections.map(id =>
AstalNotifd.get_default().disconnect(id));
});
}
public static getDefault(): Notifications {
if(!this.instance)
this.instance = new Notifications();
return this.instance;
}
public async sendNotification(props: {
urgency?: AstalNotifd.Urgency;
appName?: string;
image?: string;
summary: string;
body?: string;
replaceId?: number;
actions?: Array<{
id?: (string|number);
text: string;
onAction?: () => void
}>
}): Promise<{
id?: (string|number);
text: string;
onAction?: () => void
}|null|void> {
return await execAsync([
"notify-send",
...(props.urgency ? [
"-u", this.getUrgencyString(props.urgency)
] : []), ...(props.appName ? [
"-a", props.appName
] : []), ...(props.image ? [
"-i", props.image
] : []), ...(props.actions ? props.actions.map((action) =>
[ "-A", action.text ]
).flat(2) : []), ...(props.replaceId ? [
"-r", props.replaceId.toString()
] : []), props.summary, props.body ? props.body : ""
]).then((stdout) => {
stdout = stdout.trim();
if(!stdout) {
if(props.actions && props.actions.length > 0)
return null;
return;
}
if(props.actions && props.actions.length > 0) {
const action = props.actions[Number.parseInt(stdout)];
action?.onAction?.();
return action ?? undefined;
}
}).catch((err: Error) => {
console.error(`Notifications: Couldn't send notification! Is the daemon running? Stderr:\n${
err.message ? `${err.message}\n` : ""}Stack: ${err.stack}`);
});
}
public getUrgencyString(urgency: AstalNotifd.Notification|AstalNotifd.Urgency) {
switch((urgency instanceof AstalNotifd.Notification) ?
urgency.urgency : urgency) {
case AstalNotifd.Urgency.LOW:
return "low";
case AstalNotifd.Urgency.CRITICAL:
return "critical";
}
return "normal";
}
private addHistory(notif: AstalNotifd.Notification, onAdded?: (notif: AstalNotifd.Notification) => void): void {
if(!notif) return;
this.#history.length === this.historyLimit &&
this.removeHistory(this.#history[this.#history.length - 1]);
this.#history.map((notifb, i) =>
notifb.id === notif.id && this.#history.splice(i, 1));
this.#history.unshift({
id: notif.id,
appName: notif.app_name,
body: notif.body,
summary: notif.summary,
urgency: notif.urgency,
appIcon: notif.app_icon,
time: notif.time,
image: notif.image ? notif.image : undefined
} as HistoryNotification);
this.notify("history");
this.emit("history-added", this.#history[0]);
onAdded?.(notif);
}
public async clearHistory(): Promise<void> {
this.#history.reverse().map((notif) => {
this.#history = this.history.filter((n) => n.id !== notif.id);
this.emit("history-removed", notif.id);
});
this.emit("history-cleared");
this.notify("history");
}
public removeHistory(notif: (HistoryNotification|number)): void {
const notifId = (typeof notif === "number") ? notif : notif.id;
this.#history = this.#history.filter((item: HistoryNotification) =>
item.id !== notifId);
this.notify("history");
this.emit("history-removed", notifId);
}
private addNotification(
notif: AstalNotifd.Notification,
removeOnTimeout: boolean = true,
onTimeoutEnd?: () => void
): void {
const replaced = this.#notifications.has(notif.id);
const notifTimeout = this.getNotificationTimeout(notif);
const onEnd = () => {
removeOnTimeout && this.removeNotification(notif);
onTimeoutEnd?.();
}
// destroy timer of replaced notification(if there's any)
if(replaced) {
const data = this.#notifications.get(notif.id)!;
(data?.[1] instanceof NotificationTimeout) &&
data[1].cancel();
}
this.#notifications.set(notif.id, [
notif,
new NotificationTimeout(notifTimeout, onEnd, notifTimeout > 0)
]);
replaced && this.emit("notification-replaced", notif.id);
this.notify("notifications");
this.emit("notification-added", notif);
if(notifTimeout <= 0) onEnd?.();
}
public getNotificationTimeout(notif: AstalNotifd.Notification): number {
return generalConfig.getProperty(
`notifications.timeout_${this.getUrgencyString(notif.urgency)}`,
"number"
);
}
public removeNotification(notif: (AstalNotifd.Notification|number), addToHistory: boolean = true): void {
notif = typeof notif === "number" ?
this.#notifications.get(notif)?.[0]!
: notif;
if(!notif) return;
const timeout = this.#notifications.get(notif.id)![1];
timeout.running && timeout.cancel();
this.#notifications.delete(notif.id);
addToHistory && this.addHistory(notif);
notif.dismiss();
this.notify("notifications");
this.emit("notification-removed", notif.id);
}
public holdNotification(notif: AstalNotifd.Notification|number): void {
const id = typeof notif === "number" ? notif : notif.id;
const data = this.#notifications.get(id);
if(!data) return;
data[1].cancel();
this.notify("notifications-on-hold");
}
public releaseNotification(notif: AstalNotifd.Notification|number): void {
const id = typeof notif === "number" ? notif : notif.id;
const data = this.#notifications.get(id);
if(!data) return;
data[1].start(data[1].lastRemained);
this.notify("notifications-on-hold");
}
public toggleDoNotDisturb(value?: boolean): boolean {
value = value ?? !AstalNotifd.get_default().dontDisturb;
AstalNotifd.get_default().dontDisturb = value;
return value;
}
public getNotifd(): AstalNotifd.Notifd { return AstalNotifd.get_default(); }
public emit<Signal extends keyof typeof this.$signals>(
signal: Signal, ...args: Parameters<(typeof this.$signals)[Signal]>
): void {
super.emit(signal, ...args);
}
public connect<Signal extends keyof typeof this.$signals>(
signal: Signal,
callback: (self: typeof this, ...params: Parameters<(typeof this.$signals)[Signal]>) =>
ReturnType<(typeof this.$signals)[Signal]>
): number {
return super.connect(signal, callback);
}
}

View File

@@ -0,0 +1,178 @@
import { execAsync } from "ags/process";
import { getter, register, signal } from "ags/gobject";
import { Gdk } from "ags/gtk4";
import { createRoot, getScope, Scope } from "ags";
import { makeDirectory } from "./utils";
import { Notifications } from "./notifications";
import { time } from "./utils";
import GObject from "ags/gobject";
import GLib from "gi://GLib?version=2.0";
import Gio from "gi://Gio?version=2.0";
@register({ GTypeName: "Recording" })
export class Recording extends GObject.Object {
private static instance: Recording;
@signal() started() {};
@signal() stopped() {};
#recording: boolean = false;
#path: string = "~/Recordings";
#recordingScope?: Scope;
/** Default extension: mp4(h264) */
#extension: string = "mp4";
#recordAudio: boolean = false;
#area: (Gdk.Rectangle|null) = null;
#startedAt: number = -1;
#process: (Gio.Subprocess|null) = null;
#output: (string|null) = null;
/** GLib.DateTime of when recording started
* its value can be `-1` if undefined(no recording is happening) */
@getter(Number)
public get startedAt() { return this.#startedAt; }
@getter(Boolean)
public get recording() { return this.#recording; }
private set recording(newValue: boolean) {
(!newValue && this.#recording) ?
this.stopRecording()
: this.startRecording(this.#area || undefined);
this.#recording = newValue;
this.notify("recording");
}
@getter(String)
public get path() { return this.#path; }
public set path(newPath: string) {
if(this.recording) return;
this.#path = newPath;
this.notify("path");
}
@getter(String)
public get extension() { return this.#extension; }
public set extension(newExt: string) {
if(this.recording) return;
this.#extension = newExt;
this.notify("extension");
}
@getter(String)
public get recordingTime() {
if(!this.#recording || !this.#startedAt)
return "not recording";
const startedAtSeconds = time.get().to_unix() - Recording.getDefault().startedAt!;
if(startedAtSeconds <= 0) return "00:00";
const seconds = Math.floor(startedAtSeconds % 60);
const minutes = Math.floor(startedAtSeconds / 60);
const hours = Math.floor(minutes / 60);
return `${hours > 0 ? `${hours < 10 ? '0' : ""}${hours}` : ""}${ minutes < 10 ? `0${minutes}` : minutes }:${ seconds < 10 ? `0${seconds}` : seconds }`;
}
/** Recording output file name. null if screen is not being recorded */
public get output() { return this.#output; }
/** Currently unsupported property */
public get recordAudio() { return this.#recordAudio; }
public set recordAudio(newValue: boolean) {
if(this.recording) return;
this.#recordAudio = newValue;
this.notify("record-audio");
}
constructor() {
super();
const videosDir = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_VIDEOS);
if(videosDir) this.#path = `${videosDir}/Recordings`;
}
public static getDefault() {
if(!this.instance)
this.instance = new Recording();
return this.instance;
}
public startRecording(area?: Gdk.Rectangle) {
if(this.#recording)
throw new Error("Screen Recording is already running!");
createRoot(() => {
this.#recordingScope = getScope();
this.#output = `${time.get().format("%Y-%m-%d-%H%M%S")}_rec.${this.extension || "mp4"}`;
this.#recording = true;
this.notify("recording");
this.emit("started");
makeDirectory(this.path);
const areaString = `${area?.x ?? 0},${area?.y ?? 0} ${area?.width ?? 1}x${area?.height ?? 1}`;
this.#process = Gio.Subprocess.new([
"wf-recorder",
...(area ? [ `-g`, areaString ] : []),
"-f",
`${this.path}/${this.output!}`
], Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE);
this.#process.wait_async(null, () => {
this.stopRecording();
});
this.#startedAt = time.get().to_unix();
this.notify("started-at");
const timeSub = time.subscribe(() => {
this.notify("recording-time");
});
this.#recordingScope.onCleanup(timeSub);
});
}
public stopRecording() {
if(!this.#process || !this.#recording) return;
!this.#process.get_if_exited() && execAsync([
"kill", "-s", "SIGTERM", this.#process.get_identifier()!
]);
this.#recordingScope?.dispose();
const path = this.#path;
const output = this.#output;
this.#process = null;
this.#recording = false;
this.#startedAt = -1;
this.#output = null;
this.notify("recording");
this.emit("stopped");
Notifications.getDefault().sendNotification({
actions: [
{
text: "View", // will be hidden(can be triggered by clicking in the notification)
id: "view",
onAction: () => {
execAsync(["xdg-open", `${path}/${output}`]);
}
}
],
appName: "Screen Recording",
summary: "Screen Recording saved",
body: `Saved as ${path}/${output}`
});
}
};

View File

@@ -0,0 +1,15 @@
import { uwsmIsActive } from "./apps";
import Gio from "gi://Gio?version=2.0";
import { Shell } from "../app";
export function restartInstance(): void {
Gio.Subprocess.new(
( uwsmIsActive ?
[ "uwsm", "app", "--", "colorshell" ]
: [ "colorshell" ]),
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE
);
Shell.getDefault().quit();
}

View File

@@ -0,0 +1,147 @@
import { monitorFile, readFile, writeFileAsync } from "ags/file";
import { decoder } from "./utils";
import { execAsync } from "ags/process";
import { Wallpaper } from "./wallpaper";
import { Shell } from "../app";
import Gio from "gi://Gio?version=2.0";
import GLib from "gi://GLib?version=2.0";
/** handles stylesheet compiling and reloading */
export class Stylesheet {
private static instance: Stylesheet;
#outputPath = Gio.File.new_for_path(`${GLib.get_user_cache_dir()}/colorshell/style`);
#stylesPaths: Array<string>;
readonly #sassStyles = {
modules: ["sass:color"].map(mod => `@use "${mod}";`).join('\n'),
colors: "",
mixins: "",
rules: ""
};
public get stylePath() { return this.#outputPath.get_path()!; }
public static getDefault(): Stylesheet {
if(!this.instance)
this.instance = new Stylesheet();
return this.instance;
}
private bundle(): string {
return `${this.#sassStyles.modules}\n\n${this.#sassStyles.colors
}\n${this.#sassStyles.mixins}\n${this.#sassStyles.rules}`.trim();
}
private async compile(): Promise<void> {
const sass = this.bundle();
await writeFileAsync(`${this.stylePath}/sass.scss`, sass).catch(_e => {
const e = _e as Error;
console.error(`Stylesheet: Couldn't write Sass to cache. Stderr: ${
e.message}\n${e.stack}`);
});
await execAsync(
`bash -c "sass ${this.stylePath}/sass.scss ${this.stylePath}/style.css"`
).catch(_e => {
const e = _e as Error;
console.error(`Stylesheet: An error occurred on compile-time! Stderr: ${
e.message}\n${e.stack}`);
});
}
public getStyleSheet(): string {
return readFile(`${this.stylePath}/style.css`);
}
public getColorDefinitions(): string {
const data = Wallpaper.getDefault().getData();
const colors = {
...data.special,
...data.colors
};
return Object.keys(colors).map(name =>
`$${name}: ${colors[name as keyof typeof colors]};`
).join('\n');
}
private organizeModuleImports(sass: string) {
return sass.replaceAll(
/[@](use|forward|import) ["'](.*)["']?[;]?\n/gi,
(_, impType, imp) => {
imp = (imp as string).replace(/["';]/g, "");
// add sass modules on top
if(!this.#sassStyles.modules.includes(imp) && /^(sass|.*http|.*https)/.test(imp))
this.#sassStyles.modules = this.#sassStyles.modules.concat(`\n@${impType} "${imp}";`);
return "";
}
).replace(/(colors|mixins|wal)\./g, "");
}
public compileApply(): void {
this.compile().then(() => {
Shell.getDefault().resetStyle();
Shell.getDefault().applyStyle(this.getStyleSheet());
}).catch(_e => {
const e = _e as Error;
console.error(`Stylesheet: An error occurred at compile-time. Stderr: ${
e.message}\n${e.stack}`);
});
}
private getStyleData(path: string): string {
return decoder.decode(Gio.resources_lookup_data(path, null).get_data()!);
}
constructor() {
if(!this.#outputPath.query_exists(null))
this.#outputPath.make_directory_with_parents(null);
this.#stylesPaths = Gio.resources_enumerate_children(
"/io/github/retrozinndev/colorshell/styles", null
).map(name =>
`/io/github/retrozinndev/colorshell/styles/${name}`
);
// Rules won't change at runtime in a common build,
// so no need to worry about this.
// But in a development build, there should be support
// hot-reloading the gresource, this is a TODO
this.#stylesPaths.forEach(path => {
const name = path.split('/')[path.split('/').length - 1];
switch(name) {
case "colors":
this.#sassStyles.colors = `${this.getColorDefinitions()}\n${
this.organizeModuleImports(this.getStyleData(path))
}`;
break;
case "mixins":
this.#sassStyles.mixins = `${this.organizeModuleImports(
this.getStyleData(path)
)}`;
break;
default:
this.#sassStyles.rules = `${this.#sassStyles.rules}\n${
this.organizeModuleImports(this.getStyleData(path))
}`;
break;
}
});
this.compileApply();
monitorFile(`${GLib.get_user_cache_dir()}/wal/colors`, () => {
this.#sassStyles.colors = `${this.getColorDefinitions()}\n${
this.organizeModuleImports(this.getStyleData(
"/io/github/retrozinndev/colorshell/styles/colors"
))
}`;
this.compileApply();
});
}
}

View File

@@ -0,0 +1,184 @@
import { createPoll } from "ags/time";
import { exec, execAsync } from "ags/process";
import { Astal, Gtk } from "ags/gtk4";
import { getSymbolicIcon } from "./apps";
export {
toBoolean as variableToBoolean,
construct,
transform,
transformWidget,
createSubscription,
createAccessorBinding as baseBinding,
createScopedConnection,
createSecureBinding as secureBinding,
createSecureAccessorBinding as secureBaseBinding,
} from "gnim-utils";
import GLib from "gi://GLib?version=2.0";
import Gio from "gi://Gio?version=2.0";
export const decoder = new TextDecoder("utf-8"),
encoder = new TextEncoder();
export const time = createPoll(GLib.DateTime.new_now_local(), 500, () =>
GLib.DateTime.new_now_local());
export function getHyprlandInstanceSig(): (string|null) {
return GLib.getenv("HYPRLAND_INSTANCE_SIGNATURE");
}
export function getHyprlandVersion(): string {
return exec(`${GLib.getenv("HYPRLAND_CMD") ?? "Hyprland"} --version | head -n1`).split(" ")[1];
}
export function getPlayerIconFromBusName(busName: string): string {
const splitName = busName.split('.').filter(str => str !== "" &&
!str.toLowerCase().includes('instance'));
return getSymbolicIcon(splitName[splitName.length - 1]) ?
getSymbolicIcon(splitName[splitName.length - 1])!
: "folder-music-symbolic";
}
export function escapeUnintendedMarkup(input: string): string {
return input.replace(/<[^>]*>|[<>&"]/g, (s) => {
if(s.startsWith('<') && s.endsWith('>'))
return s;
switch(s) {
case "<": return "&lt;";
case ">": return "&gt;";
case "&": return "&amp;";
case "\"": return "&quot;";
}
return s;
});
}
export function escapeSpecialCharacters(str: string): string {
return str.replace(/[\\^$.*?()[\]{}|]/g, "\\$&");
}
/** translate paths with environment variables in it to absolute paths */
export function translateDirWithEnvironment(path: string): string {
path = path.replace(/^[~]/, GLib.get_home_dir());
return path.split('/').map(part => /^\$/.test(part) ?
GLib.getenv(part.replace(/^\$/, "")) ?? part
: part).join('/');
}
export function getChildren(widget: Gtk.Widget): Array<Gtk.Widget> {
const firstChild = widget.get_first_child(),
children: Array<Gtk.Widget> = [];
if(!firstChild) return [];
let currentChild = firstChild.get_next_sibling();
while(currentChild != null) {
children.push(currentChild);
currentChild = currentChild.get_next_sibling();
}
return children;
}
export function omitObjectKeys<ObjT = object>(obj: ObjT, keys: keyof ObjT|Array<keyof ObjT>): object {
const finalObject = { ...obj };
for(const objKey of Object.keys(finalObject as object)) {
if(!Array.isArray(keys)) {
if(objKey === keys) {
delete finalObject[keys as keyof typeof finalObject];
break;
}
continue;
}
for(const omitKey of keys) {
if(objKey === omitKey) {
delete finalObject[objKey as keyof typeof finalObject];
break;
}
}
}
return finalObject as object;
}
export function pickObjectKeys<ObjT = object>(obj: ObjT, keys: Array<keyof ObjT>): object {
const finalObject = {} as Record<keyof ObjT, any>;
for(const key of keys) {
for(const objKey of Object.keys(obj as object)) {
if(key === objKey) {
finalObject[key as keyof ObjT] = obj[objKey as keyof ObjT];
break;
}
}
}
return finalObject;
}
export function pathToURI(path: string): string {
switch(true) {
case (/^[/]/).test(path):
return `file://${path}`;
case (/^[~]/).test(path):
case (/^file:\/\/[~]/i).test(path):
return `file://${GLib.get_home_dir()}/${path.replace(/^(file\:\/\/|[~]|file\:\/\[~])/i, "")}`;
}
return path;
}
export function makeDirectory(dir: string): void {
execAsync([ "mkdir", "-p", dir ]);
}
export function deleteFile(path: string): void {
execAsync([ "rm", "-r", path ]);
}
export function playSystemBell(): void {
execAsync("canberra-gtk-play -i bell").catch((e: Error) => {
console.error(`Couldn't play system bell. Stderr: ${e.message}\n${e.stack}`);
});
}
export function isInstalled(commandName: string): boolean {
const proc = Gio.Subprocess.new(["bash", "-c", `command -v ${commandName}`],
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE);
const [ , stdout, stderr ] = proc.communicate_utf8(null, null);
if(stdout && !stderr)
return true;
return false;
}
export function addSliderMarksFromMinMax(slider: Astal.Slider, amountOfMarks: number = 2, markup?: (string | null)) {
if(markup && !markup.includes("{}"))
markup = `${markup}{}`
slider.add_mark(slider.min, Gtk.PositionType.BOTTOM, markup ?
markup.replaceAll("{}", `${slider.min}`) : null);
const num = (amountOfMarks - 1);
for(let i = 1; i <= num; i++) {
const part = (slider.max / num) | 0;
if(i > num) {
slider.add_mark(slider.max, Gtk.PositionType.BOTTOM, `${slider.max}K`);
break;
}
slider.add_mark(part*i, Gtk.PositionType.BOTTOM, markup ?
markup.replaceAll("{}", `${part*i}`) : null);
}
return slider;
}

View File

@@ -0,0 +1,143 @@
import AstalWp from "gi://AstalWp";
export class Wireplumber {
private static astalWireplumber: AstalWp.Wp|null = AstalWp.get_default();
private static inst: Wireplumber;
private defaultSink: AstalWp.Endpoint = Wireplumber.astalWireplumber!.get_default_speaker()!;
private defaultSource: AstalWp.Endpoint = Wireplumber.astalWireplumber!.get_default_microphone()!;
private maxSinkVolume: number = 100;
private maxSourceVolume: number = 100;
constructor() {
if(!Wireplumber.astalWireplumber)
throw new Error("Audio features will not work correctly! Please install wireplumber first", {
cause: "Wireplumber library not found"
});
}
public static getDefault(): Wireplumber {
if(!Wireplumber.inst)
Wireplumber.inst = new Wireplumber();
return Wireplumber.inst;
}
public static getWireplumber(): AstalWp.Wp {
return Wireplumber.astalWireplumber!;
}
public getMaxSinkVolume(): number {
return this.maxSinkVolume;
}
public getMaxSourceVolume(): number {
return this.maxSourceVolume;
}
public getDefaultSink(): AstalWp.Endpoint {
return this.defaultSink;
}
public getDefaultSource(): AstalWp.Endpoint {
return this.defaultSource;
}
public getSinkVolume(): number {
return Math.floor(this.getDefaultSink().get_volume() * 100);
}
public getSourceVolume(): number {
return Math.floor(this.getDefaultSource().get_volume() * 100);
}
public setSinkVolume(newSinkVolume: number): void {
this.defaultSink.set_volume(
(newSinkVolume > this.maxSinkVolume ? this.maxSinkVolume : newSinkVolume) / 100
);
}
public setSourceVolume(newSourceVolume: number): void {
this.defaultSource.set_volume(
newSourceVolume > this.maxSourceVolume ? this.maxSourceVolume : newSourceVolume / 100
);
}
public increaseEndpointVolume(endpoint: AstalWp.Endpoint, volumeIncrease: number): void {
volumeIncrease = Math.abs(volumeIncrease) / 100;
if((endpoint.get_volume() + volumeIncrease) > (this.maxSinkVolume / 100)) {
endpoint.set_volume(1.0);
return;
}
endpoint.set_volume(endpoint.get_volume() + volumeIncrease);
}
public increaseSinkVolume(volumeIncrease: number): void {
this.increaseEndpointVolume(this.getDefaultSink(), volumeIncrease);
}
public increaseSourceVolume(volumeIncrease: number): void {
this.increaseEndpointVolume(this.getDefaultSource(), volumeIncrease);
}
public decreaseEndpointVolume(endpoint: AstalWp.Endpoint, volumeDecrease: number): void {
volumeDecrease = Math.abs(volumeDecrease) / 100;
if((endpoint.get_volume() - volumeDecrease) < 0) {
endpoint.set_volume(0);
return;
}
endpoint.set_volume(endpoint.get_volume() - volumeDecrease);
}
public decreaseSinkVolume(volumeDecrease: number): void {
this.decreaseEndpointVolume(this.getDefaultSink(), volumeDecrease);
}
public decreaseSourceVolume(volumeDecrease: number): void {
this.decreaseEndpointVolume(this.getDefaultSource(), volumeDecrease);
}
public muteSink(): void {
this.getDefaultSink().set_mute(true);
}
public muteSource(): void {
this.getDefaultSource().set_mute(true);
}
public unmuteSink(): void {
this.getDefaultSink().set_mute(false);
}
public unmuteSource(): void {
this.getDefaultSource().set_mute(false);
}
public isMutedSink(): boolean {
return this.getDefaultSink().get_mute();
}
public isMutedSource(): boolean {
return this.getDefaultSource().get_mute();
}
public toggleMuteSink(): void {
if(this.isMutedSink())
return this.unmuteSink();
return this.muteSink();
}
public toggleMuteSource(): void {
if(this.isMutedSource())
return this.unmuteSource();
return this.muteSource();
}
}

View File

@@ -0,0 +1,226 @@
import { execAsync } from "ags/process";
import { timeout } from "ags/time";
import { monitorFile, readFile } from "ags/file";
import GObject, { register, getter } from "ags/gobject";
import AstalIO from "gi://AstalIO";
import Gio from "gi://Gio?version=2.0";
import GLib from "gi://GLib?version=2.0";
import { decoder, encoder } from "./utils";
export { Wallpaper };
type WalData = {
checksum: string;
wallpaper: string;
alpha: number;
special: {
background: string;
foreground: string;
cursor: string;
};
colors: {
color0: string;
color1: string;
color2: string;
color3: string;
color4: string;
color5: string;
color6: string;
color7: string;
color8: string;
color9: string;
color10: string;
color11: string;
color12: string;
color13: string;
color14: string;
color15: string;
};
};
@register({ GTypeName: "Wallpaper" })
class Wallpaper extends GObject.Object {
private static instance: Wallpaper;
#wallpaper: (string|undefined);
#splash: boolean = true;
#monitor: Gio.FileMonitor;
#hyprpaperFile: Gio.File;
#wallpapersPath: string;
#ignoreWatch: boolean = false;
@getter(Boolean)
public get splash() { return this.#splash; }
public set splash(showSplash: boolean) {
this.#splash = showSplash;
this.notify("splash");
}
/** current wallpaper's complete path
* can be an empty string if undefined */
@getter(String)
public get wallpaper() { return this.#wallpaper ?? ""; }
public set wallpaper(newValue: string) { this.setWallpaper(newValue); }
public get wallpapersPath() { return this.#wallpapersPath; }
constructor() {
super();
this.#wallpapersPath = GLib.getenv("WALLPAPERS") ??
`${GLib.get_home_dir()}/wallpapers`;
this.#hyprpaperFile = Gio.File.new_for_path(`${
GLib.get_user_config_dir()}/hypr/hyprpaper.conf`);
this.getWallpaper().then((wall) => {
if(wall?.trim()) this.#wallpaper = wall.trim();
});
let tmeout: (AstalIO.Time|undefined) = undefined;
this.#monitor = monitorFile(this.#hyprpaperFile.get_path()!, (_, event) => {
if(event !== Gio.FileMonitorEvent.CHANGED && event !== Gio.FileMonitorEvent.CREATED &&
event !== Gio.FileMonitorEvent.MOVED_IN)
return;
if(tmeout) return;
else tmeout = timeout(1500, () => tmeout = undefined);
if(this.#ignoreWatch) {
this.#ignoreWatch = false;
return;
}
const [ loaded, text ] = this.#hyprpaperFile.load_contents(null);
if(!loaded)
console.error("Wallpaper: Couldn't read changes inside the hyprpaper file!");
const content = decoder.decode(text);
if(content) {
let setWall: boolean = true;
for(const line of content.split('\n')) {
if(line.trim().startsWith('#'))
continue;
const lineSplit = line.split('=');
const key = lineSplit[0].trim(),
value = lineSplit.filter((_, i) => i !== 0).join('=').trim();
switch(key) {
case "splash":
this.splash = (/(yes|true|on|enable|enabled|1).*/.test(value)) ? true : false;
break;
case "wallpaper":
if(this.#wallpaper !== value && setWall) {
this.setWallpaper(value, false);
setWall = false; // wallpaper already set
}
break;
}
}
}
});
}
vfunc_dispose(): void {
this.#monitor.cancel();
}
public static getDefault(): Wallpaper {
if(!this.instance)
this.instance = new Wallpaper();
return this.instance;
}
private writeChanges(): void {
this.#ignoreWatch = true; // tell monitor to ignore file replace
this.#hyprpaperFile.replace_async(null, false,
Gio.FileCreateFlags.REPLACE_DESTINATION,
GLib.PRIORITY_DEFAULT, null, (_, result) => {
const res = this.#hyprpaperFile.replace_finish(result);
if(res) {
// success
this.#ignoreWatch = true; // tell monitor to ignore this change
res.write_bytes_async(encoder.encode(`# This file was automatically generated by color-shell
preload = ${this.#wallpaper}
splash = ${this.#splash}
wallpaper = , ${this.#wallpaper}`.split('\n').map(str => str.trimStart()).join('\n')),
GLib.PRIORITY_DEFAULT, null, (_, asyncRes) => {
if(_!.write_finish(asyncRes)) res.flush(null);
res.close(null);
}
);
return;
}
console.error(`Wallpaper: an error occurred when trying to replace the hyprpaper file`);
}
);
}
public getData(): WalData {
const content = readFile(`${GLib.get_user_cache_dir()}/wal/colors.json`);
return JSON.parse(content) as WalData;
}
public async getWallpaper(): Promise<string|undefined> {
return await execAsync("sh -c \"hyprctl hyprpaper listactive | tail -n 1\"").then(stdout => {
const loaded: (string|undefined) = stdout.split('=')[1]?.trim();
if(!loaded)
console.warn(`Wallpaper: Couldn't get wallpaper. There is(are) no loaded wallpaper(s)`);
return loaded;
}).catch((err: Gio.IOErrorEnum) => {
console.error(`Wallpaper: Couldn't get wallpaper. Stderr: \n${err.message ? `${err.message} /` : ""} Stack: \n ${err.stack}`);
return undefined;
});
}
public reloadColors(): void {
execAsync(`wal -t --cols16 darken -i "${this.#wallpaper}"`).then(() => {
console.log("Wallpaper: reloaded shell colors");
}).catch(r => {
console.error(`Wallpaper: Couldn't update shell colors. Stderr: ${r}`);
});
}
public setWallpaper(path: string|Gio.File, write: boolean = true): void {
execAsync("hyprctl hyprpaper unload all").then(() =>
execAsync(`hyprctl hyprpaper preload ${path}`).then(() =>
execAsync(`hyprctl hyprpaper wallpaper ${path}`).then(() => {
this.#wallpaper = (typeof path === "string") ? path : path.get_path()!;
this.reloadColors();
write && this.writeChanges();
}).catch(r => {
console.error(`Wallpaper: Couldn't set wallpaper. Stderr: ${r}`);
})
).catch(r => {
console.error(`Wallpaper: Couldn't preload image. Stderr: ${r}`);
})
).catch(r => {
console.error(`Wallpaper: Couldn't unload images from memory. Stderr: ${r}`);
});
}
public async pickWallpaper(): Promise<string|undefined> {
return (await execAsync(`zenity --file-selection`).then(wall => {
if(!wall.trim()) return undefined;
this.setWallpaper(wall);
return wall;
}).catch(r => {
console.error(`Wallpaper: Couldn't pick wallpaper, is \`zenity\` installed? Stderr: ${r}`);
return undefined;
}));
}
}

23
home/ags-config/node_modules/.modules.yaml generated vendored Normal file
View File

@@ -0,0 +1,23 @@
hoistPattern:
- '*'
hoistedDependencies:
gnim@1.8.2:
gnim: private
included:
dependencies: true
devDependencies: true
optionalDependencies: true
injectedDeps: {}
layoutVersion: 5
nodeLinker: isolated
packageManager: pnpm@10.12.1
pendingBuilds: []
prunedAt: Tue, 04 Nov 2025 20:28:58 GMT
publicHoistPattern: []
registries:
'@jsr': https://npm.jsr.io/
default: https://registry.npmjs.org/
skipped: []
storeDir: /home/zeph/.local/share/pnpm/store/v10
virtualStoreDir: .pnpm
virtualStoreDirMaxLength: 120

Some files were not shown because too many files have changed in this diff Show More