Skip to content

Commit

Permalink
Fix awayOnSystemIdle behaviour when locking the screen: now it shows …
Browse files Browse the repository at this point in the history
…status as 'Available' when locking the screen with awayOnSystemIdle = false (#1335)

Co-authored-by: kindofblues <[email protected]>
  • Loading branch information
kindofblues and kindofblues committed Jul 12, 2024
1 parent 3e58b20 commit 9e2a4be
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
23 changes: 20 additions & 3 deletions app/browser/notifications/activityManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,32 @@ class ActivityManager {
watchSystemIdleState() {
const self = this;
self.ipcRenderer.invoke('get-system-idle-state').then((state) => {
activityHub.setMachineState(state.system === 'active' ? 1 : 2);
const timeOut = (state.system === 'active' ? self.config.appIdleTimeoutCheckInterval : self.config.appActiveCheckInterval) * 1000;

let timeOut;
if (this.config.awayOnSystemIdle) {
/*
Same logic as before:
awayOnSystemIdle = true, sets status "Away" when screen is locked.
*/
activityHub.setMachineState(state.system === 'active' ? 1 : 2);
timeOut = (state.system === 'active' ? self.config.appIdleTimeoutCheckInterval : self.config.appActiveCheckInterval) * 1000;

if (state.system === 'active' && state.userIdle === 1) {
activityHub.setUserStatus(1);
} else if (state.system !== 'active' && state.userCurrent === 1) {
activityHub.setUserStatus(3);
}
} else {
/*
Handle screen locked:
awayOnSystemIdle = false, keeps status "Available" when locking the screen.
*/
if ((state.system === 'active') || (state.system === 'locked')) {
activityHub.setMachineState(1);
timeOut = self.config.appIdleTimeoutCheckInterval * 1000;
} else {
activityHub.setMachineState(2);
timeOut = self.config.appActiveCheckInterval * 1000;
}
}

setTimeout(() => self.watchSystemIdleState(), timeOut);
Expand Down
7 changes: 7 additions & 0 deletions com.github.IsmaelMartinez.teams_for_linux.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
<url type="bugtracker">https://github.com/IsmaelMartinez/teams-for-linux/issues</url>
<launchable type="desktop-id">com.github.IsmaelMartinez.teams_for_linux.desktop</launchable>
<releases>
<release version="1.8.1" date="2024-07-10">
<description>
<ul>
<li>Fix awayOnSystemIdle behaviour when locking the screen: now it shows status as "Available" when locking the screen with awayOnSystemIdle = false</li>
</ul>
</description>
</release>
<release version="1.8.0" date="2024-07-08">
<description>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "teams-for-linux",
"version": "1.8.0",
"version": "1.8.1",
"main": "app/index.js",
"description": "Unofficial client for Microsoft Teams for Linux",
"homepage": "https://github.com/IsmaelMartinez/teams-for-linux",
Expand Down

0 comments on commit 9e2a4be

Please sign in to comment.