File tree Expand file tree Collapse file tree 7 files changed +38
-0
lines changed
crates/gitbutler-tauri/capabilities Expand file tree Collapse file tree 7 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,8 @@ Cypress.on('window:before:load', (win) => {
162
162
return MOCK_USER ;
163
163
case 'plugin:window|theme' :
164
164
return 'light' ;
165
+ case 'plugin:window|set_title' :
166
+ return await Promise . resolve ( ) ;
165
167
case 'update_feature_flags' :
166
168
return await Promise . resolve ( ) ;
167
169
case 'get_app_settings' :
Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ export interface IBackend {
69
69
* Loads a disk store from a file.
70
70
*/
71
71
loadDiskStore : ( fileName : string ) => Promise < DiskStore > ;
72
+ /**
73
+ * Sets the window title.
74
+ */
75
+ setWindowTitle : ( title : string ) => void ;
72
76
}
73
77
74
78
export interface DiskStore {
Original file line number Diff line number Diff line change @@ -59,6 +59,12 @@ export default class Tauri implements IBackend {
59
59
const store = await Store . load ( fileName , { autoSave : true } ) ;
60
60
return new TauriDiskStore ( store ) ;
61
61
}
62
+ setWindowTitle ( title : string ) : void {
63
+ if ( ! this . appWindow ) {
64
+ this . appWindow = getCurrentWindow ( ) ;
65
+ }
66
+ this . appWindow . setTitle ( title ) ;
67
+ }
62
68
}
63
69
64
70
class TauriDiskStore implements DiskStore {
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ export default class Web implements IBackend {
32
32
// For the web version, we don't have a disk store, so we return a no-op implementation
33
33
return new WebDiskStore ( ) ;
34
34
}
35
+ setWindowTitle ( title : string ) : void {
36
+ document . title = title ;
37
+ }
35
38
}
36
39
37
40
class WebDiskStore implements DiskStore {
Original file line number Diff line number Diff line change 74
74
const shortcutService = inject (SHORTCUT_SERVICE );
75
75
$effect (() => shortcutService .listen ());
76
76
77
+ // Reset window title when not in a project
78
+ $effect (() => {
79
+ if (! projectId ) {
80
+ backend .setWindowTitle (' GitButler' );
81
+ }
82
+ });
83
+
77
84
// =============================================================================
78
85
// ANALYTICS & NAVIGATION
79
86
// =============================================================================
Original file line number Diff line number Diff line change 11
11
import ProjectSettingsMenuAction from ' $components/ProjectSettingsMenuAction.svelte' ;
12
12
import ReduxResult from ' $components/ReduxResult.svelte' ;
13
13
import { OnboardingEvent , POSTHOG_WRAPPER } from ' $lib/analytics/posthog' ;
14
+ import { BACKEND } from ' $lib/backend' ;
14
15
import { BASE_BRANCH_SERVICE } from ' $lib/baseBranch/baseBranchService.svelte' ;
15
16
import { BRANCH_SERVICE } from ' $lib/branches/branchService.svelte' ;
16
17
import { SETTINGS_SERVICE } from ' $lib/config/appSettingsV2' ;
59
60
// Project data
60
61
const projectsResult = $derived (projectsService .projects ());
61
62
const projects = $derived (projectsResult .current .data );
63
+ const currentProject = $derived (projects ?.find ((p ) => p .id === projectId ));
62
64
63
65
// =============================================================================
64
66
// REPOSITORY & BRANCH MANAGEMENT
172
174
};
173
175
});
174
176
177
+ // =============================================================================
178
+ // WINDOW TITLE
179
+ // =============================================================================
180
+
181
+ const backend = inject (BACKEND );
182
+ $effect (() => {
183
+ if (currentProject ?.title ) {
184
+ backend .setWindowTitle (` ${currentProject .title } — GitButler ` );
185
+ } else {
186
+ backend .setWindowTitle (' GitButler' );
187
+ }
188
+ });
189
+
175
190
// =============================================================================
176
191
// FEED & UPDATES MANAGEMENT
177
192
// =============================================================================
Original file line number Diff line number Diff line change 7
7
"permissions" : [
8
8
" core:default" ,
9
9
" core:window:allow-start-dragging" ,
10
+ " core:window:allow-set-title" ,
10
11
" core:window:default" ,
11
12
" dialog:allow-open" ,
12
13
" fs:allow-read-file" ,
You can’t perform that action at this time.
0 commit comments