Skip to content

Commit 8f0fdfe

Browse files
authored
Merge pull request #97 from xconnio/update-titlebar
update titlebar of the browser to show current app
2 parents 1653187 + 5712d11 commit 8f0fdfe

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/App.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ watch(() => route.fullPath, () => {
7373
mobileOpen.value = false
7474
})
7575
76+
// Resets the tab title when leaving all desktop sessions (DesktopSessionHost sets it while active).
77+
watch(activeRealm, (realm) => {
78+
if (!realm) document.title = 'Deskconn'
79+
})
80+
7681
watch(
7782
() => authStore.session,
7883
(session) => {

src/components/DesktopSessionHost.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ const {
5050
syncMaximizedBounds,
5151
} = desktopSessionsStore.getOrCreate(props.realm)
5252
53+
const sessionTitle = computed(() => {
54+
const focused = windows.value.find((w) => w.id === focusedId.value)
55+
return focused
56+
? `${focused.title} · ${desktopName.value} - Deskconn`
57+
: `${desktopName.value} - Deskconn`
58+
})
59+
60+
// Only the active realm's instance may write document.title (others stay mounted via v-show).
61+
watch(
62+
[sessionTitle, () => props.active],
63+
([title, active]) => {
64+
if (active) document.title = title
65+
},
66+
{ immediate: true },
67+
)
68+
5369
const launcherBodyRef = ref<HTMLElement | null>(null)
5470
const wallpaperUrl = ref<string | null>(null)
5571
let activeWallpaperObjUrl: string | null = null

0 commit comments

Comments
 (0)