diff options
| author | Priyansh <[email protected]> | 2021-04-27 20:42:13 +0530 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2021-04-27 20:42:13 +0530 |
| commit | a8edac4105f007003c3f244b482d03732ce74398 (patch) | |
| tree | 1440e377da6b4ba18ca3151066efbafeed7a9c06 /src/preferences.ts | |
| parent | b18cf71249b26d965215bcf06204daf6af5f55e7 (diff) | |
| download | styx-master.tar.xz styx-master.zip | |
Diffstat (limited to 'src/preferences.ts')
| -rw-r--r-- | src/preferences.ts | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/preferences.ts b/src/preferences.ts new file mode 100644 index 0000000..ea8ae64 --- /dev/null +++ b/src/preferences.ts @@ -0,0 +1,42 @@ +// import * as Store from 'electron-store'; +import systemLevelInformation from './systemLevelInformation'; + +class Preferences { + + + getFavourites(): { text: string, path: string, icon: string }[] { + if (localStorage.getItem('favourites')) { + return JSON.parse(localStorage.getItem('favourites')) as { text: string, path: string, icon: string }[]; + } else { + switch (systemLevelInformation.getUserInfo().platform) { + case 'darwin': + const userPath: string = `/Users/${systemLevelInformation.getUserInfo().username}`; + const favourites: { text: string, path: string, icon: string }[] = [ + { text: 'Applications', path: '/Applications', icon: 'icofont-brand-appstore' }, + { text: 'Desktop', path: `${userPath}/Desktop`, icon: 'icofont-computer' }, + { text: 'Documents', path: `${userPath}/Documents`, icon: 'icofont-file-document' }, + { text: 'Movies', path: `${userPath}/Movies`, icon: 'icofont-movie' }, + { text: 'Music', path: `${userPath}/Music`, icon: 'icofont-music-disk' }, + { text: 'Pictures', path: `${userPath}/Pictures`, icon: 'icofont-image' }, + { text: systemLevelInformation.getUserInfo().username, path: `${userPath}`, icon: 'icofont-home' }, + ]; + localStorage.setItem('favourites', JSON.stringify(favourites)); + return favourites; + default: + return []; + } + } + } + + getConfiguredPathToDisplayAfterAppInit(): string { + if (localStorage.getItem('appStartPath')) { + return localStorage.getItem('appStartPath'); + } else { + localStorage.setItem('appStartPath', `/Users/${systemLevelInformation.getUserInfo().username}`); + return localStorage.getItem('appStartPath'); + } + } + +} + +export default new Preferences; |
