#tauri-plugin #tauri #tauri-app #detect-session-lock

tauri-plugin-screen-lock-status

This plugin helps track the lock status for the current session

1 unstable release

0.1.2 Mar 1, 2024
0.0.1 Feb 7, 2024

#27 in #tauri

Download history 9/week @ 2024-02-19 140/week @ 2024-02-26 18/week @ 2024-03-04 3/week @ 2024-03-11 19/week @ 2024-04-01 107/week @ 2024-04-08

126 downloads per month

Apache-2.0

16KB
210 lines

Плагин для отслеживания блокировки сессии |eng|

Данный плагин помогает отслеживать статус блокировки для текущей сессии. Текущая версия плагина подходит для Tauri 1.5.4.

Установка

  • [ 1 ] Для начала работы нужно подключить в проект плагин
  • [ 2 ] Для этого в src-tauri/Cargo.toml добавить:
[dependencies]
  tauri-plugin-screen-lock-status = { git = "https://github.com/ren40/tauri-plugin-screen-lock-status" }
  • [ 3 ] Далее в исполняемом файле src-tauri/src/main.rc подключаем:
//main.rc
fn main() {
  tauri::Builder::default()
  .plugin(tauri_plugin_screen_lock_status::init())
  .setup(|app| {
              let _ =
                  tauri_plugin_screen_lock_status::WINDOW_TAURI.set(app.get_window("main").unwrap());
              Ok(())
          })
}
  • [ 4 ] Для прослушивания надо подключить следующий код:
import { listen } from '@tauri-apps/api/event'

await listen("window_screen_lock_status://change_session_status", (result) => {
    console.log(`[${new Date().toLocaleString()} ${result.payload}]`)
  })
  • [ 4.1 ]Событие изменения статуса прослушиваются по каналу window_screen_lock_status://change_session_status.

ОС

Название ОС Статус
Windows
Linux
MacOS
Android
IOS

Цели

  • Реализовать и проверить для MacOS
  • Реализовать и проверить для Android
  • Реализовать и проверить для IOS
  • Проверить работоспособность для версии Tauri v2 и выше (При условии что он станет стабильным)

Сотрудничество

PR принимаются.


Plugin for tracking session blocking |rus|

This plugin helps you control the lock status for the current session. The current version of the plugin is suitable for Tauri 1.5.4.

Installation

  • [ 1 ] To get started, you need to connect a plugin to the project
  • [ 2 ] To do this, add to src-tauri/Cargo.toml:
[dependencies]
  tauri-plugin-screen-lock-status = { git = "https://github.com/ren40/tauri-plugin-screen-lock-status" }
  • [ 3 ] Next, in the executable file src-tauri/src/main.rc, we connect:
//main.rc
fn main() {
  tauri::Builder::default()
  .plugin(tauri_plugin_screen_lock_status::init())
  .setup(|app| {
              let _ =
                  tauri_plugin_screen_lock_status::WINDOW_TAURI.set(app.get_window("main").unwrap());
              Ok(())
          })
}
  • [ 4 ] To listen, you need to connect the following code:
import { listen } from '@tauri-apps/api/event'

await listen("window_screen_lock_status://change_session_status", (result) => {
    console.log(`[${new Date().toLocaleString()} ${result.payload}]`)
  })
  • [ 4.1 ]The status change event is listened to via the channel `window_screen_lock_status://change_session_status'.

OS

OS name Status
Windows
Linux
MacOS
Android
IOS

TODO

  • Implement and test for MacOS
  • Implement and test for Android
  • Implement and test for iOS
  • Check performance for version Tauri v2 and higher (Assuming it becomes stable)

Contributing

PRs accepted.

Dependencies

~21–80MB
~1.5M SLoC