Skip to content

Commit

Permalink
enh(code): add auto-generation for tauri commands
Browse files Browse the repository at this point in the history
  • Loading branch information
eythaann committed Dec 27, 2024
1 parent fa5a32d commit 35e147f
Showing 1 changed file with 19 additions and 96 deletions.
115 changes: 19 additions & 96 deletions src/background/exposed.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::HashMap;
use std::path::PathBuf;

use seelen_core::command_handler_list;
use tauri::{Builder, WebviewWindow, Wry};
use tauri_plugin_shell::ShellExt;

Expand All @@ -9,29 +10,18 @@ use crate::hook::HookManager;
use crate::modules::input::Keyboard;
use crate::modules::virtual_desk::get_vd_manager;
use crate::seelen::{get_app_handle, Seelen};
use crate::seelen_rofi::handler::*;
use crate::seelen_weg::handler::*;

use crate::seelen_weg::icon_extractor::{
extract_and_save_icon_from_file, extract_and_save_icon_umid,
};
use crate::seelen_wm_v2::handler::*;
use crate::state::infrastructure::*;
use crate::system::brightness::*;

use crate::utils::{
is_running_as_appx_package, is_virtual_desktop_supported as virtual_desktop_supported,
};
use crate::windows_api::WindowsApi;
use crate::winevent::{SyntheticFullscreenData, WinEvent};
use crate::{log_error, utils};

use crate::modules::media::infrastructure::*;
use crate::modules::monitors::infrastructure::*;
use crate::modules::network::infrastructure::*;
use crate::modules::notifications::infrastructure::*;
use crate::modules::power::infrastructure::*;
use crate::modules::system_settings::infrastructure::*;
use crate::modules::tray::infrastructure::*;

#[tauri::command(async)]
fn select_file_on_explorer(path: String) -> Result<()> {
get_app_handle()
Expand Down Expand Up @@ -181,87 +171,20 @@ async fn install_last_available_update() -> Result<()> {
}

pub fn register_invoke_handler(app_builder: Builder<Wry>) -> Builder<Wry> {
use crate::modules::language;

app_builder.invoke_handler(tauri::generate_handler![
// General
run,
is_dev_mode,
is_appx_package,
open_file,
run_as_admin,
select_file_on_explorer,
is_virtual_desktop_supported,
get_user_envs,
show_app_settings,
switch_workspace,
send_keys,
get_icon,
get_system_colors,
simulate_fullscreen,
check_for_updates,
install_last_available_update,
get_connected_monitors,
// Seelen Settings
set_auto_start,
get_auto_start_status,
state_get_icon_packs,
state_get_themes,
state_get_placeholders,
state_get_layouts,
state_get_weg_items,
state_get_settings,
state_get_default_settings,
state_get_default_monitor_settings,
state_write_settings,
state_write_weg_items,
state_get_specific_apps_configurations,
state_get_wallpaper,
state_set_wallpaper,
state_get_history,
state_get_plugins,
state_get_widgets,
state_get_profiles,
// Media
media_prev,
media_toggle_play_pause,
media_next,
set_volume_level,
media_toggle_mute,
media_set_default_device,
// Brightness
get_main_monitor_brightness,
set_main_monitor_brightness,
// Power
log_out,
suspend,
restart,
shutdown,
// SeelenWeg
weg_get_items_for_widget,
weg_close_app,
weg_kill_app,
weg_toggle_window_state,
weg_request_update_previews,
weg_pin_item,
// Windows Manager
set_window_position,
request_focus,
// App Launcher
launcher_get_apps,
// tray icons
temp_get_by_event_tray_info,
on_click_tray_icon,
on_context_menu_tray_icon,
// network
wlan_get_profiles,
wlan_start_scanning,
wlan_stop_scanning,
wlan_connect,
wlan_disconnect,
// notifications
notifications_close,
notifications_close_all,
language::get_system_languages,
])
use crate::seelen_rofi::handler::*;
use crate::seelen_weg::handler::*;
use crate::seelen_wm_v2::handler::*;
use crate::state::infrastructure::*;
use crate::system::brightness::*;

use crate::modules::language::*;
use crate::modules::media::infrastructure::*;
use crate::modules::monitors::infrastructure::*;
use crate::modules::network::infrastructure::*;
use crate::modules::notifications::infrastructure::*;
use crate::modules::power::infrastructure::*;
use crate::modules::system_settings::infrastructure::*;
use crate::modules::tray::infrastructure::*;

app_builder.invoke_handler(command_handler_list!())
}

0 comments on commit 35e147f

Please sign in to comment.