Skip to content

Commit 5d321b0

Browse files
committed
fix: idle state and shell icons
1 parent d595927 commit 5d321b0

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

src/main/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ app.on('will-finish-launching', () => {
7070
})
7171

7272
app.on('window-all-closed', () => {
73-
if (process.platform !== 'darwin') {
73+
if (process.platform !== 'darwin' || !app.isPackaged) {
7474
app.quit()
7575
}
7676
})

src/renderer/assets/icons.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,28 @@ export interface IconEntry {
55
}
66

77
export default [
8+
{
9+
name: 'simple-icons-gnubash',
10+
patterns: ['bash'],
11+
color: '#4eaa25',
12+
},
813
{
914
name: 'simple-icons-bun',
1015
patterns: ['bun', 'bunx'],
1116
},
17+
{
18+
name: 'simple-icons-dash',
19+
patterns: ['dash'],
20+
color: '#008de4',
21+
},
1222
{
1323
name: 'simple-icons-curl',
1424
patterns: ['curl'],
1525
},
1626
{
1727
name: 'simple-icons-deno',
1828
patterns: ['deno'],
29+
color: '#70ffaf',
1930
},
2031
{
2132
name: 'simple-icons-docker',
@@ -30,7 +41,7 @@ export default [
3041
{
3142
name: 'simple-icons-nodedotjs',
3243
patterns: ['node'],
33-
color: '#339933',
44+
color: '#5fa04e',
3445
},
3546
{
3647
name: 'simple-icons-rust',
@@ -56,4 +67,9 @@ export default [
5667
patterns: ['nvim'],
5768
color: '#57a143',
5869
},
70+
{
71+
name: 'simple-icons-zsh',
72+
patterns: ['zsh'],
73+
color: '#f15a24',
74+
},
5975
] as (IconEntry & { patterns: NonNullable<IconEntry['patterns']> })[]

src/renderer/components/TabItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { TerminalTab, TerminalTabCharacter } from '@commas/types/terminal'
44
import type { IconEntry } from '../assets/icons'
55
import { useSettings } from '../compositions/settings'
66
import { closeTerminalTab, getTerminalTabTitle, useCurrentTerminal } from '../compositions/terminal'
7-
import { getIconEntry } from '../utils/terminal'
7+
import { getIconEntry, isShellProcess } from '../utils/terminal'
88
import VisualIcon from './basic/VisualIcon.vue'
99
1010
const { tab, character, closable = false, customizable = false } = defineProps<{
@@ -112,7 +112,7 @@ const idleState = $computed(() => {
112112
if (typeof tab.idle === 'boolean') return tab.idle ? 'idle' : 'busy'
113113
if (tab.command === '') return 'idle'
114114
if (pane) return ''
115-
if (tab.process === tab.shell) return 'idle'
115+
if (isShellProcess(tab)) return 'idle'
116116
return 'busy'
117117
})
118118

src/renderer/utils/terminal.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ import icons from '../assets/icons'
99

1010
export const TERMINAL_DIRECTORY_SHELL = '/'
1111

12+
export function isShellProcess(tab: TerminalTab) {
13+
return tab.process === (
14+
path.isAbsolute(tab.process) ? tab.shell : path.basename(tab.shell)
15+
)
16+
}
17+
1218
export function getProcessName(tab: TerminalTab) {
13-
if (tab.process === tab.shell) {
19+
if (isShellProcess(tab)) {
1420
if (tab.command) {
1521
const entries = parse(tab.command)
1622
const command = entries.find((item): item is string => typeof item === 'string')
@@ -42,6 +48,7 @@ export function getPrompt(expr: string, tab: TerminalTab | null) {
4248
}
4349

4450
export function getIconEntry(tab: TerminalTab) {
51+
if (isShellProcess(tab)) return undefined
4552
let name = getProcessName(tab).toLowerCase()
4653
const ext = path.extname(name)
4754
// strip '.exe' extname in process name (Windows only)

0 commit comments

Comments
 (0)