Skip to content

Commit 82c5a5b

Browse files
committed
feat: add gkd shortcut
1 parent 2a0d0bd commit 82c5a5b

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/renderer/avd/components/AvdManager.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import fileSize from 'licia/fileSize'
1010
import { useWindowResize } from 'share/renderer/lib/hooks'
1111

1212
export default observer(function AvdManager() {
13-
const dataGridRef = useRef<DataGrid>()
13+
const dataGridRef = useRef<DataGrid>(null)
1414

1515
useWindowResize(() => dataGridRef.current?.fit())
1616

src/renderer/main/components/shell/Shell.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import filter from 'licia/filter'
1414
import LunaCommandPalette from 'luna-command-palette/react'
1515
import find from 'licia/find'
1616
import idxOf from 'licia/idxOf'
17+
import truncate from 'licia/truncate'
1718
import { Terminal } from '@xterm/xterm'
1819

1920
interface IShell {
@@ -90,7 +91,7 @@ export default observer(function Shell() {
9091

9192
const commands = map(getCommands(), ([title, command]) => {
9293
return {
93-
title: `${title} (${command})`,
94+
title: `${title} (${truncate(command, 95 - title.length)})`,
9495
handler: () => {
9596
main.writeShell(selectedShell.sessionId, command)
9697
setTimeout(() => {
@@ -148,15 +149,24 @@ export default observer(function Shell() {
148149
})
149150

150151
function getCommands() {
151-
return [
152+
const commands = [
152153
[t('reboot'), 'reboot\n'],
153154
[t('rebootRecovery'), 'reboot recovery\n'],
154155
[t('rebootBootloader'), 'reboot bootloader\n'],
156+
[t('memInfo'), 'dumpsys meminfo\n'],
157+
[t('batteryInfo'), 'dumpsys battery\n'],
155158
[
156159
`${t('start')} shizuku`,
157160
'sh /sdcard/Android/data/moe.shizuku.privileged.api/start.sh\n',
158161
],
159-
[t('memInfo'), 'dumpsys meminfo\n'],
160-
[t('batteryInfo'), 'dumpsys battery\n'],
161162
]
163+
164+
if (store.language === 'zh-CN') {
165+
commands.push([
166+
'授权 GKD',
167+
'pm grant li.songe.gkd android.permission.WRITE_SECURE_SETTINGS; appops set li.songe.gkd ACCESS_RESTRICTED_SETTINGS allow\n',
168+
])
169+
}
170+
171+
return commands
162172
}

0 commit comments

Comments
 (0)