🐛 Compatible with the latest GPT
This commit is contained in:
@@ -5,7 +5,7 @@ use tauri::{App, Window, WindowBuilder, WindowUrl};
|
||||
#[cfg(target_os = "macos")]
|
||||
use tauri::TitleBarStyle;
|
||||
|
||||
pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Window {
|
||||
pub fn build_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Window {
|
||||
let window_config = config
|
||||
.windows
|
||||
.first()
|
||||
@@ -26,17 +26,16 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
|
||||
|
||||
let mut window_builder = WindowBuilder::new(app, "pake", url)
|
||||
.title("")
|
||||
.visible(false)
|
||||
.user_agent(user_agent)
|
||||
.resizable(window_config.resizable)
|
||||
.fullscreen(window_config.fullscreen)
|
||||
.inner_size(window_config.width, window_config.height)
|
||||
.disable_file_drop_handler()
|
||||
.always_on_top(window_config.always_on_top)
|
||||
.initialization_script(&config_script)
|
||||
.initialization_script(include_str!("../inject/component.js"))
|
||||
.initialization_script(include_str!("../inject/event.js"))
|
||||
.initialization_script(include_str!("../inject/style.js"))
|
||||
//This is necessary to allow for file injection by external developers for customization purposes.
|
||||
.initialization_script(include_str!("../inject/custom.js"));
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
|
||||
4
src-tauri/src/inject/style.js
vendored
4
src-tauri/src/inject/style.js
vendored
@@ -342,6 +342,10 @@ window.addEventListener('DOMContentLoaded', _event => {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
#__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.flex-shrink-0.overflow-x-hidden.bg-token-sidebar-surface-primary > div > div > div > div > nav, #__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main {
|
||||
padding-top: 6px;
|
||||
}
|
||||
|
||||
#__next > div.AnnouncementWrapper_container__Z51yh > div > aside.SidebarLayout_sidebar__SXeDJ.SidebarLayout_left__k163a > div > div > header{
|
||||
padding-left: 84px;
|
||||
padding-top: 10px;
|
||||
|
||||
@@ -10,9 +10,8 @@ use app::{invoke, menu, window};
|
||||
use invoke::{download_file, download_file_by_binary};
|
||||
use menu::{get_system_tray, system_tray_handle};
|
||||
use tauri::{GlobalShortcutManager, Manager};
|
||||
use tauri_plugin_window_state::Builder as windowStatePlugin;
|
||||
use util::{get_data_dir, get_pake_config};
|
||||
use window::get_window;
|
||||
use window::build_window;
|
||||
|
||||
pub fn run_app() {
|
||||
let (pake_config, tauri_config) = get_pake_config();
|
||||
@@ -33,26 +32,25 @@ pub fn run_app() {
|
||||
let activation_shortcut = pake_config.windows[0].activation_shortcut.clone();
|
||||
|
||||
tauri_app
|
||||
.plugin(windowStatePlugin::default().build())
|
||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
.plugin(tauri_plugin_oauth::init())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
download_file,
|
||||
download_file_by_binary
|
||||
])
|
||||
.setup(move |app| {
|
||||
let _window = get_window(app, pake_config, data_dir);
|
||||
|
||||
let _window = build_window(app, pake_config, data_dir);
|
||||
_window.show().unwrap();
|
||||
if !activation_shortcut.is_empty() {
|
||||
let app_handle = app.app_handle().clone();
|
||||
app_handle
|
||||
.global_shortcut_manager()
|
||||
.register(activation_shortcut.as_str(), move || {
|
||||
let window = app_handle.get_window("pake").unwrap();
|
||||
match window.is_visible().unwrap() {
|
||||
true => window.hide().unwrap(),
|
||||
match _window.is_visible().unwrap() {
|
||||
true => _window.hide().unwrap(),
|
||||
false => {
|
||||
window.show().unwrap();
|
||||
window.set_focus().unwrap();
|
||||
_window.show().unwrap();
|
||||
_window.set_focus().unwrap();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user