Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: showing location name in the app title

Ilian Sapundshievc9053a76788e
diff --git a/src/main/main.ts b/src/main/main.ts
index a1d7ec257..7784c9716 100644
--- a/src/main/main.ts
+++ b/src/main/main.ts
@@ -111,7 +111,7 @@ const installExtensions = async () => {
.catch(console.log);
};
-function showTagSpaces() {
+function showApp() {
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
@@ -122,152 +122,148 @@ function showTagSpaces() {
function openLocationManagerPanel() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'open-location-manager-panel');
}
}
function openTagLibraryPanel() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'open-tag-library-panel');
}
}
function goBack() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'go-back');
}
}
function goForward() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'go-forward');
}
}
function setZoomResetApp() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'set-zoom-reset-app');
}
}
function setZoomInApp() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'set-zoom-in-app');
}
}
function setZoomOutApp() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'set-zoom-out-app');
}
}
function exitFullscreen() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'exit-fullscreen');
}
}
function toggleSettingsDialog() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'toggle-settings-dialog');
}
}
function openHelpFeedbackPanel() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'open-help-feedback-panel');
}
}
function toggleKeysDialog() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'toggle-keys-dialog');
}
}
function toggleOnboardingDialog() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'toggle-onboarding-dialog');
}
}
function openURLExternally(data) {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('open-url-externally', data);
}
}
function toggleLicenseDialog() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'toggle-license-dialog');
}
}
function toggleThirdPartyLibsDialog() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'toggle-third-party-libs-dialog');
}
}
function toggleAboutDialog() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'toggle-about-dialog');
}
}
function showSearch() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'open-search');
}
}
function newTextFile() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'new-text-file');
}
}
function getNextFile() {
if (mainWindow) {
- // showTagSpaces();
mainWindow.webContents.send('cmd', 'next-file');
}
}
function getPreviousFile() {
if (mainWindow) {
- // showTagSpaces();
mainWindow.webContents.send('cmd', 'previous-file');
}
}
function showCreateDirectoryDialog() {
if (mainWindow) {
- // showTagSpaces();
mainWindow.webContents.send('cmd', 'show-create-directory-dialog');
}
}
function toggleOpenLinkDialog() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.webContents.send('cmd', 'toggle-open-link-dialog');
}
}
function resumePlayback() {
if (mainWindow) {
- // showTagSpaces();
mainWindow.webContents.send('play-pause', true);
}
}
function reloadApp() {
if (mainWindow) {
- showTagSpaces();
+ showApp();
mainWindow.loadURL(resolveHtmlPath('index.html'));
}
}
@@ -305,7 +301,7 @@ function createNewWindowInstance(url?) {
function buildTrayMenu(i18n) {
buildTrayIconMenu(
{
- showTagSpaces,
+ showTagSpaces: showApp,
resumePlayback,
createNewWindowInstance,
openSearch: showSearch,
@@ -322,7 +318,7 @@ function buildTrayMenu(i18n) {
function buildAppMenu(i18n) {
buildDesktopMenu(
{
- showTagSpaces,
+ showTagSpaces: showApp,
openSearch: showSearch,
toggleNewFileDialog: newTextFile,
openNextFile: getNextFile,
@@ -692,7 +688,7 @@ app
globalShortcut.register('MediaNextTrack', getNextFile);
globalShortcut.register('CommandOrControl+Shift+A', getPreviousFile);
globalShortcut.register('MediaPreviousTrack', getPreviousFile);
- globalShortcut.register('CommandOrControl+Shift+W', showTagSpaces);
+ globalShortcut.register('CommandOrControl+Shift+W', showApp);
} else {
globalShortcut.unregisterAll();
}
diff --git a/src/renderer/components/dialogs/settings/SettingsKeyBindings.tsx b/src/renderer/components/dialogs/settings/SettingsKeyBindings.tsx
index 9bdc33cf9..261c66e98 100644
--- a/src/renderer/components/dialogs/settings/SettingsKeyBindings.tsx
+++ b/src/renderer/components/dialogs/settings/SettingsKeyBindings.tsx
@@ -68,7 +68,8 @@ function SettingsKeyBindings() {
<Typography variant="body2">
The following key names can be used for defining key bindings:{' '}
<Typography variant="overline">
- ctrl, command, alt, option, shift, space
+ ctrl, command, alt, option, shift, space, backspace, escape, enter,
+ up, down, left, right
</Typography>{' '}
plus letters and digits from your keyboard.
</Typography>
diff --git a/src/renderer/hooks/CurrentLocationContextProvider.tsx b/src/renderer/hooks/CurrentLocationContextProvider.tsx
index eaaec00a8..5fb472e68 100644
--- a/src/renderer/hooks/CurrentLocationContextProvider.tsx
+++ b/src/renderer/hooks/CurrentLocationContextProvider.tsx
@@ -40,6 +40,7 @@ import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import { useNotificationContext } from '-/hooks/useNotificationContext';
import { getPersistTagsInSidecarFile } from '-/reducers/settings';
import AppConfig from '../AppConfig';
+import versionMeta from '-/version.json';
type CurrentLocationContextData = {
currentLocation: TS.Location;
@@ -278,6 +279,9 @@ export const CurrentLocationContextProvider = ({
function changeLocation(location: TS.Location) {
if (!currentLocation || location.uuid !== currentLocation.uuid) {
+ if (location && location.name) {
+ document.title = location.name + ' | ' + versionMeta.name;
+ }
setCurrentLocation(location);
}
}
@@ -378,6 +382,7 @@ export const CurrentLocationContextProvider = ({
setCurrentLocation(undefined);
}
clearAllURLParams();
+ document.title = versionMeta.name;
return true;
});
}
@@ -387,6 +392,7 @@ export const CurrentLocationContextProvider = ({
// location needed evtl. to unwatch many loc. root folders if available
setCurrentLocation(undefined);
clearAllURLParams();
+ document.title = versionMeta.name;
return true;
}
diff --git a/src/renderer/hooks/OpenedEntryContextProvider.tsx b/src/renderer/hooks/OpenedEntryContextProvider.tsx
index 29f23e9b7..24159e9b4 100644
--- a/src/renderer/hooks/OpenedEntryContextProvider.tsx
+++ b/src/renderer/hooks/OpenedEntryContextProvider.tsx
@@ -437,7 +437,11 @@ export const OpenedEntryContextProvider = ({
}
function closeAllFiles() {
- document.title = 'TagSpaces'; // TODO move to AppConfig
+ const appName = versionMeta.name;
+ document.title = appName;
+ if (currentLocation) {
+ document.title = currentLocation.name + ' | ' + appName;
+ }
clearURLParam('tsepath');
closeOpenedEntries(); // [...openedEntries, fsEntry] // TODO uncomment for multiple file support
if (isEntryInFullWidth) {