improvement: Add Show Keyguard option to the tray icon
This commit is contained in:
parent
8a520656cc
commit
10676243da
|
@ -2,8 +2,11 @@
|
|||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="ok">OK</string>
|
||||
<string name="close">Close</string>
|
||||
<string name="quit">Quit</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
<!-- On click brings Keyguard app to the front -->
|
||||
<string name="show_keyguard">Show Keyguard</string>
|
||||
<!-- A name of a thing, such as an account -->
|
||||
<string name="generic_name">Name</string>
|
||||
<string name="account_name">Account name</string>
|
||||
|
|
|
@ -204,6 +204,12 @@ fun main() {
|
|||
val isWindowOpenState = remember {
|
||||
mutableStateOf(true)
|
||||
}
|
||||
val onWindowOpen = remember(isWindowOpenState) {
|
||||
// lambda
|
||||
{
|
||||
isWindowOpenState.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// Show a tray icon and allow the app to be collapsed into
|
||||
// the tray on supported platforms.
|
||||
|
@ -222,12 +228,14 @@ fun main() {
|
|||
Tray(
|
||||
icon = painterResource(Res.images.ic_keyguard),
|
||||
state = trayState,
|
||||
onAction = {
|
||||
isWindowOpenState.value = true
|
||||
},
|
||||
onAction = onWindowOpen,
|
||||
menu = {
|
||||
Item(
|
||||
stringResource(Res.strings.close),
|
||||
stringResource(Res.strings.show_keyguard),
|
||||
onClick = onWindowOpen,
|
||||
)
|
||||
Item(
|
||||
stringResource(Res.strings.quit),
|
||||
onClick = ::exitApplication,
|
||||
)
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue