Skip to content

Commit

Permalink
doc(*): Update documentations
Browse files Browse the repository at this point in the history
  • Loading branch information
miniben-90 committed Aug 7, 2024
1 parent df10f0f commit d6f4081
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 28 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# @miniben90/x-win

[![ci-rs](https://github.com/miniben-90/x-win/actions/workflows/ci-rs.yml/badge.svg)](https://github.com/miniben-90/x-win/actions/workflows/ci-rs.yml)
[![ci-napi](https://github.com/miniben-90/x-win/actions/workflows/ci-napi.yml/badge.svg)](https://github.com/miniben-90/x-win/actions/workflows/ci-napi.yml)
[![Node version](https://img.shields.io/node/v/@miniben90/x-win.svg)](https://www.npmjs.com/package/@miniben90/x-win)
![npm type definitions](https://img.shields.io/npm/types/@miniben90/x-win)
![NPM License](https://img.shields.io/npm/l/@miniben90/x-win)
![License](https://img.shields.io/npm/l/@miniben90/x-win)
![NPM Version](https://img.shields.io/npm/v/%40miniben90%2Fx-win)

This project uses Rust and napi-rs to make it easy to obtain the active window or an array of open windows. It works on Microsoft Windows (10, 11), [Linux (with X server)](#linux), [Linux (with Gnome =< 45)](#GNOME), and [macOS 10.6+](#darwin).
This project uses Rust and napi-rs to make it easy to obtain the active window or an array of open windows. It works on Microsoft Windows (10, 11), [Linux (with X server)](#linux), [Linux (with Gnome =< 45)](#wayland), and [macOS 10.6+](#darwin).

## How to install

Expand Down Expand Up @@ -188,7 +189,7 @@ sudo apt install libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0
> ⚠️**Warning**<br />
> Recovery url is not available on linux
### GNOME (Wayland)
### Wayland

In order to recover data, you'll need to install and activate an extension designed for systems running GNOME version 41 or newer (as evaluation is disabled from this version onward).

Expand All @@ -202,7 +203,9 @@ After executing this function, it's vital to **restart the user session** to loa
| Ubuntu 22.04.4 Desktop ||
| Debian 12 Desktop ||

### Darwin (version 10.6+)
## Darwin

> ⚠️**Warning**<br /> This project work only for macos version 10.6+
## Screen recording permission introduced in macOS 10.15 Catalina

Expand Down
12 changes: 6 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ export declare function unsubscribeActiveWindow(threadId: number): void
*/
export declare function unsubscribeAllActiveWindow(): void
/**
* Install Gnome extensions required for Linux using Gnome > 41.
* Install "@mininben90/x-win" Gnome extension required for Linux using Gnome > 41.
* This function will write extension files needed to correctly detect working windows with Wayland desktop environment.
* Restart session will be require to install the gnome extension.
* **Restart session will be require to install the gnome extension.**
*/
export declare function installExtension(): boolean
/**
* Install Gnome extensions required for Linux using Gnome > 41.
* This function will write extension files needed to correctly detect working windows with Wayland desktop environment.
* Restart session will be require to remove the gnome extension.
* Uninstall "@mininben90/x-win" Gnome extension.
* This function will disable and remove extension files.
* **Restart session will be require to remove the gnome extension.**
*/
export declare function uninstallExtension(): boolean
/**
Expand All @@ -322,7 +322,7 @@ export declare function disableExtension(): boolean
/**
* Struct to store all informations of the window
*/
export class WindowInfo {
export declare class WindowInfo {
id: number
os: string
title: string
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,19 +443,19 @@ pub fn unsubscribe_all_active_window() -> Result<()> {
}

/**
* Install Gnome extensions required for Linux using Gnome > 41.
* Install "@mininben90/x-win" Gnome extension required for Linux using Gnome > 41.
* This function will write extension files needed to correctly detect working windows with Wayland desktop environment.
* Restart session will be require to install the gnome extension.
* **Restart session will be require to install the gnome extension.**
*/
#[napi]
pub fn install_extension() -> Result<bool> {
Ok(x_win::install_extension().unwrap())
}

/**
* Install Gnome extensions required for Linux using Gnome > 41.
* This function will write extension files needed to correctly detect working windows with Wayland desktop environment.
* Restart session will be require to remove the gnome extension.
* Uninstall "@mininben90/x-win" Gnome extension.
* This function will disable and remove extension files.
* **Restart session will be require to remove the gnome extension.**
*/
#[napi]
pub fn uninstall_extension() -> Result<bool> {
Expand Down
7 changes: 4 additions & 3 deletions x-win-rs/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# x-win

[![CI](https://github.com/miniben-90/x-win/actions/workflows/ci-rs.yml/badge.svg)](https://github.com/miniben-90/x-win/actions/workflows/ci-rs.yml)
[![crates.io version](https://img.shields.io/crates/v/x-win.svg)](https://crates.io/crates/x-win)
[![docs](https://docs.rs/x-win/badge.svg)](https://docs.rs/x-win/)
![License](https://img.shields.io/crates/l/x-win)

This package make it easy to obtain the active window or an array of open windows. It works on Microsoft Windows (10, 11), [Linux (with X server)](#linux), [Linux (with Gnome =< 45)](#GNOME), and [macOS 10.6+](#darwin).

# How to use x-win
This package make it easy to obtain the active window or an array of open windows. It works on Microsoft Windows (10, 11), [Linux (with X server)](#linux), [Linux (with Gnome =< 45)](#gnome), and [macOS 10.6+](#darwin).

## Get information about the currently active window

Expand Down
20 changes: 10 additions & 10 deletions x-win-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ impl fmt::Display for XWinError {
impl std::error::Error for XWinError {}

/**
* Retrieve information the about currently active window.
* Returns an object of `WindowInfo`.
* Recover icon of window.
* Return `IconInfo`
*/
pub fn get_window_icon(window_info: &WindowInfo) -> Result<IconInfo, XWinError> {
let api = init_platform_api();
Expand All @@ -64,26 +64,26 @@ pub fn get_window_icon(window_info: &WindowInfo) -> Result<IconInfo, XWinError>

/**
* Retrieve information the about currently active window.
* Returns an object of `WindowInfo`.
* Return `WindowInfo` containing details about a specific active window.
*/
pub fn get_active_window() -> Result<WindowInfo, XWinError> {
let api = init_platform_api();
Ok(api.get_active_window())
}

/**
* Retrieve information the about currently active window.
* Returns an object of `WindowInfo`.
* Retrieve information about the currently open windows.
* Return `Vec<WindowInfo>` each containing details about a specific open window.
*/
pub fn get_open_windows() -> Result<Vec<WindowInfo>, XWinError> {
let api = init_platform_api();
Ok(api.get_open_windows())
}

/**
* Install Gnome extensions required for Linux using Gnome > 41.
* Install "@mininben90/x-win" Gnome extensions required for Linux using Gnome > 41.
* This function will write extension files needed to correctly detect working windows with Wayland desktop environment.
* Restart session will be require to install the gnome extension.
* **Restart session will be require to install the gnome extension.**
*/
pub fn install_extension() -> Result<bool, XWinError> {
#[cfg(not(target_os = "linux"))]
Expand All @@ -97,9 +97,9 @@ pub fn install_extension() -> Result<bool, XWinError> {
}

/**
* Install Gnome extensions required for Linux using Gnome > 41.
* This function will write extension files needed to correctly detect working windows with Wayland desktop environment.
* Restart session will be require to remove the gnome extension.
* Uninstall "@mininben90/x-win" Gnome extensions.
* This function will disable and remove extension files.
* **Restart session will be require to remove the gnome extension.**
*/
pub fn uninstall_extension() -> Result<bool, XWinError> {
#[cfg(not(target_os = "linux"))]
Expand Down

0 comments on commit d6f4081

Please sign in to comment.