Titlebar fixes

This commit is contained in:
Fedor Indutny 2022-07-05 09:44:53 -07:00 committed by GitHub
parent f273333046
commit f92be05b15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 225 additions and 154 deletions

View file

@ -0,0 +1,23 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { useEffect, useState } from 'react';
export function useIsWindowActive(): boolean {
const { activeWindowService } = window.SignalContext;
const [isActive, setIsActive] = useState(activeWindowService.isActive());
useEffect(() => {
const update = (newIsActive: boolean): void => {
setIsActive(newIsActive);
};
activeWindowService.registerForChange(update);
return () => {
activeWindowService.unregisterForChange(update);
};
}, [activeWindowService]);
return isActive;
}