Skip to content

Commit

Permalink
initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
Om-Thorat committed Mar 31, 2023
1 parent 88fa2e0 commit 801de10
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
# Tauri + Svelte + Typescript
# Defer 🪄

This template should help get you started developing with Tauri, Svelte and TypeScript in Vite.
Too many windows on your desktop?

## Recommended IDE Setup
* Have a meeting?
* need a break?

[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).
but don't want to loose the windows? **DEFER THEM!**

Just one click and all your windows go poof 🪄 another click to restore them all back to the exact state they were in 👀.

If that sounds appealing download the installer from [here!]()
## Code 🧑🏽‍💻
The app is built with Rust for backend and Tauri with Svelte and TailwindCSS for frontend.

To edit the code just clone the repo and make sure to have Tauri installed 👀.

All PRs are welcome and appreciated 🚀.
Please also create and issue if you face one, Thanks!

Heavily inspired by [later](https://github.com/alyssaxuu/later).

<h3 align="center" > Made with 💖 by Om </h3>
12 changes: 6 additions & 6 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,19 @@ fn get_apps(handles: State<Handles>) -> (String, usize){
hwnd: HWND
}
let mut n_handles = handles.0.lock().unwrap();
println!("Dude are u here?");
let mut curr_apps:Vec<App> = Vec::new();
unsafe {
EnumWindows(Some(enum_window), LPARAM(&mut curr_apps as *mut Vec<App> as _)).ok().unwrap();
};
println!("==========================================");
let mut tot_apps = String::new();
let mut index = 0;
for i in &curr_apps{
if (i.title != "folder") && (i.title != "main.rs - folder - Visual Studio Code"){
if i.title != "Defer"{
n_handles.push(i.hwnd);
unsafe{
ShowWindow(i.hwnd, SW_HIDE);
}
if index < 3{
println!("{}============",i.title);
if !i.title.contains("—") {
tot_apps = tot_apps + "," + &i.title;
index += 1;
Expand All @@ -62,7 +59,7 @@ fn get_apps(handles: State<Handles>) -> (String, usize){
}
}
}
println!("{} | {} | {} | {}",i.active,i.title,i.dim.0,i.dim.1);
// println!("{} | {} | {} | {}",i.active,i.title,i.dim.0,i.dim.1);
}
tot_apps = tot_apps.chars().skip(1).collect();
let len = curr_apps.len() - 1;
Expand Down Expand Up @@ -126,7 +123,6 @@ fn main() {
Ok(())})
.on_window_event(|event| match event.event() {
tauri::WindowEvent::CloseRequested { api, .. } => {
println!("heyo?");
event.window().hide().unwrap();
api.prevent_close();
}
Expand All @@ -139,6 +135,10 @@ fn main() {
window.show().unwrap();
window.set_focus().unwrap();
}
SystemTrayEvent::RightClick { .. } =>{
let window = app.get_window("main").unwrap();
window.close().expect("won't close");
}
_ => {}
})
.manage(Handles(Default::default()))
Expand Down
6 changes: 3 additions & 3 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"withGlobalTauri": false
},
"package": {
"productName": "folder",
"productName": "Defer",
"version": "0.0.0"
},
"tauri": {
Expand Down Expand Up @@ -44,7 +44,7 @@
"icons/icon.icns",
"icons/icon.ico"
],
"identifier": "folder",
"identifier": "Defer",
"targets": "all"
},
"security": {
Expand All @@ -58,7 +58,7 @@
"decorations": false,
"fullscreen": false,
"resizable": true,
"title": "folder",
"title": "Defer",
"width": 315,
"height": 544
}
Expand Down

0 comments on commit 801de10

Please sign in to comment.