-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* style: add prettier style: add prettier ignore file style: apply formatting style: install and apply svelte prettier * Add prettier to recommended extensions * chore: add check and format scripts to package.json * chore: update prettier scripts to avoid conflict with svelte-check
- Loading branch information
1 parent
d0f00a5
commit e7ee512
Showing
27 changed files
with
591 additions
and
574 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
src-tauri | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"primary_bg_color": "rgba(20, 20, 80, 0.6)", | ||
"secondary_bg_color": "rgba(84, 101, 115, 0.6)", | ||
"primary_text_color": "#FFFFFF", | ||
"secondary_text_color": "#878787", | ||
"primary_accent_color": "#556CE5", | ||
"secondary_accent_color": "#48A5FF", | ||
"highlight_overlay": "rgba(255, 255, 255, 0.1)", | ||
"dark_overlay": "rgba(0, 0, 0, 0.1)" | ||
} | ||
"primary_bg_color": "rgba(20, 20, 80, 0.6)", | ||
"secondary_bg_color": "rgba(84, 101, 115, 0.6)", | ||
"primary_text_color": "#FFFFFF", | ||
"secondary_text_color": "#878787", | ||
"primary_accent_color": "#556CE5", | ||
"secondary_accent_color": "#48A5FF", | ||
"highlight_overlay": "rgba(255, 255, 255, 0.1)", | ||
"dark_overlay": "rgba(0, 0, 0, 0.1)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"primary_bg_color": "rgba(20, 20, 30, 0.6)", | ||
"secondary_bg_color": "rgba(84, 101, 115, 0.6)", | ||
"primary_text_color": "#FFFFFF", | ||
"secondary_text_color": "#878787", | ||
"primary_accent_color": "#556CE5", | ||
"secondary_accent_color": "#48A5FF", | ||
"highlight_overlay": "rgba(255, 255, 255, 0.1)", | ||
"dark_overlay": "rgba(0, 0, 0, 0.1)" | ||
} | ||
"primary_bg_color": "rgba(20, 20, 30, 0.6)", | ||
"secondary_bg_color": "rgba(84, 101, 115, 0.6)", | ||
"primary_text_color": "#FFFFFF", | ||
"secondary_text_color": "#878787", | ||
"primary_accent_color": "#556CE5", | ||
"secondary_accent_color": "#48A5FF", | ||
"highlight_overlay": "rgba(255, 255, 255, 0.1)", | ||
"dark_overlay": "rgba(0, 0, 0, 0.1)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"primary_bg_color": "rgba(20, 45, 30, 0.6)", | ||
"secondary_bg_color": "rgba(84, 101, 115, 0.6)", | ||
"primary_text_color": "#FFFFFF", | ||
"secondary_text_color": "#878787", | ||
"primary_accent_color": "#556CE5", | ||
"secondary_accent_color": "#48A5FF", | ||
"highlight_overlay": "rgba(255, 255, 255, 0.1)", | ||
"dark_overlay": "rgba(0, 0, 0, 0.1)" | ||
} | ||
"primary_bg_color": "rgba(20, 45, 30, 0.6)", | ||
"secondary_bg_color": "rgba(84, 101, 115, 0.6)", | ||
"primary_text_color": "#FFFFFF", | ||
"secondary_text_color": "#878787", | ||
"primary_accent_color": "#556CE5", | ||
"secondary_accent_color": "#48A5FF", | ||
"highlight_overlay": "rgba(255, 255, 255, 0.1)", | ||
"dark_overlay": "rgba(0, 0, 0, 0.1)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,82 @@ | ||
import "./style.css"; | ||
import './style.css'; | ||
// @ts-ignore | ||
import App from "./routes/App/App.svelte"; | ||
import { appWindow } from "@tauri-apps/api/window"; | ||
import { register } from '@tauri-apps/api/globalShortcut' | ||
import { appDataDir, join, resolveResource } from "@tauri-apps/api/path"; | ||
import { readTextFile } from "@tauri-apps/api/fs"; | ||
import { invoke } from "@tauri-apps/api/tauri"; | ||
import { preferences, paths } from "./cache"; | ||
import { listen } from '@tauri-apps/api/event' | ||
import App from './routes/App/App.svelte'; | ||
import { appWindow } from '@tauri-apps/api/window'; | ||
import { register } from '@tauri-apps/api/globalShortcut'; | ||
import { appDataDir, join, resolveResource } from '@tauri-apps/api/path'; | ||
import { readTextFile } from '@tauri-apps/api/fs'; | ||
import { invoke } from '@tauri-apps/api/tauri'; | ||
import { preferences, paths } from './cache'; | ||
import { listen } from '@tauri-apps/api/event'; | ||
|
||
// Create the app | ||
const app = new App({ | ||
target: document.getElementById("app"), | ||
target: document.getElementById('app'), | ||
}); | ||
|
||
const fetchPreferencesData = async () => { | ||
const preferencesData = await readTextFile(await join(paths.get("appDataDirPath"), `preferences.json`)).then((data) => JSON.parse(data)); | ||
Object.keys(preferencesData).forEach((key) => { | ||
const preferencesData = await readTextFile( | ||
await join(paths.get('appDataDirPath'), `preferences.json`) | ||
).then(data => JSON.parse(data)); | ||
Object.keys(preferencesData).forEach(key => { | ||
preferences.set(key, preferencesData[key]); | ||
}); | ||
} | ||
}; | ||
|
||
const reloadTheme = async () => { | ||
const theme = await readTextFile(await join(paths.get("appDataDirPath"), `theme.json`)).then((data) => JSON.parse(data)); | ||
const theme = await readTextFile( | ||
await join(paths.get('appDataDirPath'), `theme.json`) | ||
).then(data => JSON.parse(data)); | ||
// @ts-ignore | ||
const style = document.styleSheets[0].cssRules[0].style; | ||
style.setProperty("--primary-bg-color", theme.primary_bg_color); | ||
style.setProperty("--secondary-bg-color", theme.secondary_bg_color); | ||
style.setProperty("--primary-text-color", theme.primary_text_color); | ||
style.setProperty("--secondary-text-color", theme.secondary_text_color); | ||
style.setProperty("--primary-accent-color", theme.primary_accent_color); | ||
style.setProperty("--secondary-accent-color", theme.secondary_accent_color); | ||
} | ||
style.setProperty('--primary-bg-color', theme.primary_bg_color); | ||
style.setProperty('--secondary-bg-color', theme.secondary_bg_color); | ||
style.setProperty('--primary-text-color', theme.primary_text_color); | ||
style.setProperty('--secondary-text-color', theme.secondary_text_color); | ||
style.setProperty('--primary-accent-color', theme.primary_accent_color); | ||
style.setProperty('--secondary-accent-color', theme.secondary_accent_color); | ||
}; | ||
|
||
(async () => { | ||
// get and set values | ||
paths.set("appDataDirPath", await appDataDir()); | ||
paths.set('appDataDirPath', await appDataDir()); | ||
await fetchPreferencesData(); | ||
await reloadTheme(); | ||
|
||
document.addEventListener("keydown", (event) => { | ||
if (event.key === "Escape") { | ||
document.addEventListener('keydown', event => { | ||
if (event.key === 'Escape') { | ||
appWindow.hide(); | ||
} | ||
}); | ||
|
||
// Listen for Menu Bar event to open preferences emitted from main.rs | ||
await listen("PreferencesClicked", (data) => { | ||
await listen('PreferencesClicked', data => { | ||
app.$set({ | ||
appState: { | ||
app: false, | ||
settings: true | ||
} | ||
settings: true, | ||
}, | ||
}); | ||
}); | ||
|
||
|
||
await invoke("launch_on_login", { | ||
enable: preferences.get("launch_on_login"), | ||
await invoke('launch_on_login', { | ||
enable: preferences.get('launch_on_login'), | ||
}); | ||
|
||
await listenForHotkey(preferences.get("shortcut")); | ||
await listenForHotkey(preferences.get('shortcut')); | ||
})(); | ||
|
||
export async function listenForHotkey(shortcut: string) { | ||
await register(shortcut, async () => { | ||
if (document.hasFocus()) { | ||
await appWindow.hide() | ||
await appWindow.hide(); | ||
} else { | ||
await appWindow.show(); | ||
await appWindow.center(); | ||
await appWindow.setFocus(); | ||
document.getElementById('searchBarInput').focus(); | ||
} | ||
}) | ||
}); | ||
} | ||
|
||
export default app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.