window_focus

Creator: coderz1093

Last updated:

0 purchases

window_focus Image
window_focus Images

Languages

Categories

Add to Cart

Description:

window focus

Window focus plugin #
Language Versions #

English
Русский


Window Focus is a convenient plugin for Flutter that allows you to track user inactivity and obtain information about the title of the active window on Mac OS and Windows.
Key Features: #
User Inactivity Tracking: #
The plugin enables you to detect periods of user inactivity within your Flutter application. You can customize the inactivity threshold and handle inactivity events according to your needs.
Active Window Title Retrieval: #
Provides the ability to retrieve the title of the active window of the operating system. For Mac OS, this is the application name, and for Windows, it's the window title.
Plugin Installation #
Windows #
No action required.
Mac OS #
You need to add the following code to the Info.plist file for MacOS:
<key>NSApplicationSupportsSecureRestorableState</key>
<true/>
copied to clipboard
Plugin Usage #
final _windowFocusPlugin = WindowFocus();

/// Listener for user's active window change events
_windowFocusPlugin.addFocusChangeListener((p0) {
setState(() {
activeWindowTitle='${p0.windowTitle}';
/// activeWindowTitle - contains 2 fields windowTitle = window title, appName = Application name.
/// On Mac OS, these names are the same. On Windows, appName is the name of the process in which the window is running.
});
});
/// Listener for user activity. Works with true if the user is active and false if the user is inactive.
_windowFocusPlugin.addUserActiveListener((p0) {
setState(() {
userIdle=p0;
});
});
/// Setting the user inactivity threshold. Default is 5 seconds.
_windowFocusPlugin.setIdleThreshold(duration: duration);

/// Returns the current inactivity threshold
Duration duration = await _windowFocusPlugin.idleThreshold;

copied to clipboard
About the author #
My telegram channel - @kotelnikoff_dev

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.