mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-06 02:30:47 -08:00
Add option to hibernate unused workspaces at app launch (#97)
This commit is contained in:
parent
e175cb78d8
commit
91f8e9e96c
3 changed files with 26 additions and 1 deletions
|
|
@ -42,6 +42,8 @@ if (!gotTheLock) {
|
|||
loadListeners();
|
||||
|
||||
const commonInit = () => {
|
||||
const hibernateUnusedWorkspacesAtLaunch = getPreference('hibernateUnusedWorkspacesAtLaunch');
|
||||
|
||||
mainWindow.createAsync()
|
||||
.then(() => {
|
||||
createMenu();
|
||||
|
|
@ -50,7 +52,10 @@ if (!gotTheLock) {
|
|||
|
||||
Object.keys(workspaceObjects).forEach((id) => {
|
||||
const workspace = workspaceObjects[id];
|
||||
if (workspace.hibernateWhenUnused && !workspace.active) {
|
||||
if (
|
||||
(hibernateUnusedWorkspacesAtLaunch || workspace.hibernateWhenUnused)
|
||||
&& !workspace.active
|
||||
) {
|
||||
if (!workspace.hibernated) {
|
||||
setWorkspace(workspace.id, { hibernated: true });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ const defaultPreferences = {
|
|||
attachToMenubar: false,
|
||||
cssCodeInjection: null,
|
||||
downloadPath: getDefaultDownloadsPath(),
|
||||
hibernateUnusedWorkspacesAtLaunch: false,
|
||||
jsCodeInjection: null,
|
||||
navigationBar: false,
|
||||
pauseNotifications: null,
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ const Preferences = ({
|
|||
classes,
|
||||
cssCodeInjection,
|
||||
downloadPath,
|
||||
hibernateUnusedWorkspacesAtLaunch,
|
||||
isDefaultMailClient,
|
||||
isDefaultWebBrowser,
|
||||
jsCodeInjection,
|
||||
|
|
@ -514,6 +515,22 @@ const Preferences = ({
|
|||
</Typography>
|
||||
<Paper className={classes.paper}>
|
||||
<List dense>
|
||||
<ListItem>
|
||||
<ListItemText
|
||||
primary="Hibernate unused workspaces at app launch"
|
||||
secondary="Hibernate all workspaces at launch, except the last active workspace."
|
||||
/>
|
||||
<ListItemSecondaryAction>
|
||||
<Switch
|
||||
color="primary"
|
||||
checked={hibernateUnusedWorkspacesAtLaunch}
|
||||
onChange={(e) => {
|
||||
requestSetPreference('hibernateUnusedWorkspacesAtLaunch', e.target.checked);
|
||||
}}
|
||||
/>
|
||||
</ListItemSecondaryAction>
|
||||
</ListItem>
|
||||
<Divider />
|
||||
<ListItem button onClick={() => requestShowCodeInjectionWindow('js')}>
|
||||
<ListItemText primary="JS Code Injection" secondary={jsCodeInjection ? 'Set' : 'Not set'} />
|
||||
<ChevronRightIcon color="action" />
|
||||
|
|
@ -568,6 +585,7 @@ Preferences.propTypes = {
|
|||
classes: PropTypes.object.isRequired,
|
||||
cssCodeInjection: PropTypes.string,
|
||||
downloadPath: PropTypes.string.isRequired,
|
||||
hibernateUnusedWorkspacesAtLaunch: PropTypes.bool.isRequired,
|
||||
isDefaultMailClient: PropTypes.bool.isRequired,
|
||||
isDefaultWebBrowser: PropTypes.bool.isRequired,
|
||||
jsCodeInjection: PropTypes.string,
|
||||
|
|
@ -594,6 +612,7 @@ const mapStateToProps = (state) => ({
|
|||
attachToMenubar: state.preferences.attachToMenubar,
|
||||
cssCodeInjection: state.preferences.cssCodeInjection,
|
||||
downloadPath: state.preferences.downloadPath,
|
||||
hibernateUnusedWorkspacesAtLaunch: state.preferences.hibernateUnusedWorkspacesAtLaunch,
|
||||
isDefaultMailClient: state.general.isDefaultMailClient,
|
||||
isDefaultWebBrowser: state.general.isDefaultWebBrowser,
|
||||
jsCodeInjection: state.preferences.jsCodeInjection,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue