diff --git a/src-tauri/app-icon.png b/src-tauri/app-icon.png new file mode 100644 index 0000000..650df94 Binary files /dev/null and b/src-tauri/app-icon.png differ diff --git a/src-tauri/commands/browser/ahk/Run browser.ahk b/src-tauri/commands/browser/ahk/Run browser.ahk index 5f4d141..cf7d283 100644 --- a/src-tauri/commands/browser/ahk/Run browser.ahk +++ b/src-tauri/commands/browser/ahk/Run browser.ahk @@ -8,6 +8,4 @@ RegRead, BrowserFullCommand, HKEY_CLASSES_ROOT, %BrowserKeyName%\shell\open\comm StringGetPos, pos, BrowserFullCommand, ",,1 pos := --pos StringMid, BrowserPathandEXE, BrowserFullCommand, 2, %pos% -Run, % BrowserPathandEXE - - +Run, % BrowserPathandEXE \ No newline at end of file diff --git a/src-tauri/commands/browser/ahk/Run google.ahk b/src-tauri/commands/browser/ahk/Run website.ahk similarity index 79% rename from src-tauri/commands/browser/ahk/Run google.ahk rename to src-tauri/commands/browser/ahk/Run website.ahk index 77b1837..65d08a3 100644 --- a/src-tauri/commands/browser/ahk/Run google.ahk +++ b/src-tauri/commands/browser/ahk/Run website.ahk @@ -3,4 +3,9 @@ SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. -Run C:/Program Files (x86)/Google/Chrome/Application/chrome.exe "https://google.com" \ No newline at end of file +#Include _include.ahk + +args = %1% +path := DefaultBrowser() + +Run, %path% %args% \ No newline at end of file diff --git a/src-tauri/commands/browser/ahk/Run youtube.exe b/src-tauri/commands/browser/ahk/Run website.exe similarity index 99% rename from src-tauri/commands/browser/ahk/Run youtube.exe rename to src-tauri/commands/browser/ahk/Run website.exe index 0758a5e..a5a84ee 100644 Binary files a/src-tauri/commands/browser/ahk/Run youtube.exe and b/src-tauri/commands/browser/ahk/Run website.exe differ diff --git a/src-tauri/commands/browser/ahk/Run youtube.ahk b/src-tauri/commands/browser/ahk/Run youtube.ahk deleted file mode 100644 index 077677e..0000000 --- a/src-tauri/commands/browser/ahk/Run youtube.ahk +++ /dev/null @@ -1,6 +0,0 @@ -#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. -; #Warn ; Enable warnings to assist with detecting common errors. -SendMode Input ; Recommended for new scripts due to its superior speed and reliability. -SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. - -Run C:/Program Files (x86)/Google/Chrome/Application/chrome.exe "https://youtube.com" \ No newline at end of file diff --git a/src-tauri/commands/browser/ahk/_include.ahk b/src-tauri/commands/browser/ahk/_include.ahk new file mode 100644 index 0000000..5de1a4b --- /dev/null +++ b/src-tauri/commands/browser/ahk/_include.ahk @@ -0,0 +1,19 @@ +DefaultBrowser() { + ; Find the Registry key name for the default browser + RegRead, BrowserKeyName, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice, Progid + + ; Find the executable command associated with the above Registry key + RegRead, BrowserFullCommand, HKEY_CLASSES_ROOT, %BrowserKeyName%\shell\open\command + + ; The above RegRead will return the path and executable name of the brower contained within quotes and optional parameters + ; We only want the text contained inside the first set of quotes which is the path and executable + ; Find the ending quote position (we know the beginning quote is in position 0 so start searching at position 1) + StringGetPos, pos, BrowserFullCommand, ",,1 + + ; Decrement the found position by one to work correctly with the StringMid function + pos := --pos + + ; Extract and return the path and executable of the browser + StringMid, BrowserPathandEXE, BrowserFullCommand, 2, %pos% + Return BrowserPathandEXE +} \ No newline at end of file diff --git a/src-tauri/commands/browser/command.yaml b/src-tauri/commands/browser/command.yaml index a7a02a8..4272892 100644 --- a/src-tauri/commands/browser/command.yaml +++ b/src-tauri/commands/browser/command.yaml @@ -2,7 +2,6 @@ list: - command: action: ahk exe_path: ahk/Run browser.exe - exe_args: voice: sounds: - ok1 @@ -11,13 +10,14 @@ list: phrases: - открой браузер - запусти браузер - - открой гугл хром + - открой хром - гугл хром - command: action: ahk - exe_path: ahk/Run google.exe + exe_path: ahk/Run website.exe exe_args: + - http://google.com voice: sounds: - ok1 @@ -26,14 +26,14 @@ list: - ok4 phrases: - открой гугл - - гугл - запусти гугл - перейди в гугл - command: action: ahk - exe_path: ahk/Run youtube.exe + exe_path: ahk/Run website.exe exe_args: + - http://youtube.com voice: sounds: - ok1 @@ -43,4 +43,20 @@ list: phrases: - открой ютуб - ютуб - - запусти ютуб \ No newline at end of file + - запусти ютуб + +- command: + action: ahk + exe_path: ahk/Run website.exe + exe_args: + - https://translate.google.com + voice: + sounds: + - ok1 + - ok2 + - ok3 + - ok4 + phrases: + - открой переводчик + - переводчик + - запусти переводчик \ No newline at end of file diff --git a/src-tauri/commands/calculator/command.yaml b/src-tauri/commands/calculator/command.yaml new file mode 100644 index 0000000..06a346b --- /dev/null +++ b/src-tauri/commands/calculator/command.yaml @@ -0,0 +1,31 @@ +list: +- command: + action: cli + cli_cmd: calc + voice: + sounds: + - ok1 + - ok2 + - ok3 + phrases: + - открой калькулятор + - покажи калькулятор + - запусти калькулятор + - калькулятор + +- command: + action: cli + cli_cmd: taskkill + cli_args: + - /f + - /im + - CalculatorApp.exe + voice: + sounds: + - ok1 + - ok2 + - ok3 + phrases: + - закрой калькулятор + - отключи калькулятор + - выключи калькулятор \ No newline at end of file diff --git a/src-tauri/commands/jarvis/ahk/reboot.ahk b/src-tauri/commands/jarvis/ahk/reboot.ahk new file mode 100644 index 0000000..668b74f --- /dev/null +++ b/src-tauri/commands/jarvis/ahk/reboot.ahk @@ -0,0 +1,7 @@ +WinKill, AHK_exe jarvis-app.exe +Process, Close, jarvis-app.exe +sleep 3000 +Run shell:AppsFolder\com.priler.jarvis +sleep 2000 +WinMinimize jarvis-app +WinMinimize Jarvis Voice Assistant \ No newline at end of file diff --git a/src-tauri/commands/jarvis/ahk/reboot.exe b/src-tauri/commands/jarvis/ahk/reboot.exe new file mode 100644 index 0000000..446e8de Binary files /dev/null and b/src-tauri/commands/jarvis/ahk/reboot.exe differ diff --git a/src-tauri/commands/humor/command.yaml b/src-tauri/commands/jarvis/command.yaml similarity index 62% rename from src-tauri/commands/humor/command.yaml rename to src-tauri/commands/jarvis/command.yaml index dce8ed0..317a040 100644 --- a/src-tauri/commands/humor/command.yaml +++ b/src-tauri/commands/jarvis/command.yaml @@ -1,8 +1,46 @@ list: +- command: + action: ahk + exe_path: ahk/reboot.exe + voice: + sounds: + - ok1 + - ok2 + - ok3 + phrases: + - перезагрузись + - перезагрузи себя + - выполни перезагрузку + +- command: + action: voice + voice: + sounds: + - stupid + phrases: + - ты дурак + - ты дебил + - ты глупый + - ты тупой + +- command: + action: voice + voice: + sounds: + - thanks + phrases: + - спасибо + - молодец + - респект + - ты супер + - отличная работа + - ты крут + - ты большой молодец + - ты реально крут + - ты афигенный + - command: action: voice - exe_path: - exe_args: voice: sounds: - joke1 @@ -29,8 +67,6 @@ list: - command: action: voice - exe_path: - exe_args: voice: sounds: - thanks diff --git a/src-tauri/commands/steam/ahk/Close steam.ahk b/src-tauri/commands/steam/ahk/Close steam.ahk new file mode 100644 index 0000000..8a0e1c6 --- /dev/null +++ b/src-tauri/commands/steam/ahk/Close steam.ahk @@ -0,0 +1,2 @@ +WinKill, AHK_exe Steam.exe +Process, Close, Steam.exe \ No newline at end of file diff --git a/src-tauri/commands/steam/ahk/Close steam.exe b/src-tauri/commands/steam/ahk/Close steam.exe new file mode 100644 index 0000000..ddc1aa1 Binary files /dev/null and b/src-tauri/commands/steam/ahk/Close steam.exe differ diff --git a/src-tauri/commands/steam/ahk/Open steam.ahk b/src-tauri/commands/steam/ahk/Open steam.ahk new file mode 100644 index 0000000..dd3578d --- /dev/null +++ b/src-tauri/commands/steam/ahk/Open steam.ahk @@ -0,0 +1,4 @@ +WinKill, AHK_exe Steam.exe +Process, Close, Steam.exe + +Run, steam://open/bigpicture \ No newline at end of file diff --git a/src-tauri/commands/steam/ahk/Open steam.exe b/src-tauri/commands/steam/ahk/Open steam.exe new file mode 100644 index 0000000..7c05b68 Binary files /dev/null and b/src-tauri/commands/steam/ahk/Open steam.exe differ diff --git a/src-tauri/commands/steam/command.yaml b/src-tauri/commands/steam/command.yaml new file mode 100644 index 0000000..13c9d86 --- /dev/null +++ b/src-tauri/commands/steam/command.yaml @@ -0,0 +1,36 @@ +list: +- command: + action: ahk + exe_path: ahk/Open steam.exe + voice: + sounds: + - game_mode + phrases: + - включи игровой режим + - перейди в игровой режим + - я хочу поиграть + - включи стим + - запусти стим + - открой стим + +- command: + action: ahk + exe_path: ahk/Close steam.exe + voice: + sounds: + - ok1 + - ok2 + - ok3 + - ok4 + phrases: + - рабочий режим + - вернись в рабочий режим + - отключи игровой режим + - выйди из игрового режима + - выход с игрового режима + - рабочее пространство + - выключи игровой режим + - выключи стим + - отключи стим + - выйди из стима + - закрой стим \ No newline at end of file diff --git a/src-tauri/commands/stop/command.yaml b/src-tauri/commands/stop/command.yaml new file mode 100644 index 0000000..e52cf66 --- /dev/null +++ b/src-tauri/commands/stop/command.yaml @@ -0,0 +1,15 @@ +list: +- command: + action: stop_chaining + voice: + sounds: + - thanks + - ok1 + phrases: + - всё + - хватит + - отмена + - не слушай + - перестань слушать + - отдыхай + - на этом всё \ No newline at end of file diff --git a/src-tauri/commands/stupid/command.yaml b/src-tauri/commands/stupid/command.yaml deleted file mode 100644 index 09ba093..0000000 --- a/src-tauri/commands/stupid/command.yaml +++ /dev/null @@ -1,13 +0,0 @@ -list: -- command: - action: voice - exe_path: - exe_args: - voice: - sounds: - - stupid - phrases: - - ты дурак - - ты дебил - - ты глупый - - ты тупой \ No newline at end of file diff --git a/src-tauri/commands/terminate/command.yaml b/src-tauri/commands/terminate/command.yaml index 0afbdb5..b75ad5d 100644 --- a/src-tauri/commands/terminate/command.yaml +++ b/src-tauri/commands/terminate/command.yaml @@ -1,15 +1,12 @@ list: - command: action: terminate - exe_path: - exe_args: voice: sounds: - off phrases: - выключись - вырубись - - завершить работу - закройся - отключись - заверши свою работу diff --git a/src-tauri/commands/thanks/command.yaml b/src-tauri/commands/thanks/command.yaml deleted file mode 100644 index 1aee89b..0000000 --- a/src-tauri/commands/thanks/command.yaml +++ /dev/null @@ -1,20 +0,0 @@ -list: -- command: - action: voice - exe_path: - exe_args: - voice: - sounds: - - thanks - phrases: - - спасибо - - молодец - - респект - - ты супер - - отличная работа - - ты крут - - ты большой молодец - - ты реально крут - - ты афигенный - - ты отец - - вечно ты молодец \ No newline at end of file diff --git a/src-tauri/commands/volume/ahk/Set sound.ahk b/src-tauri/commands/volume/ahk/Set sound.ahk new file mode 100644 index 0000000..dd7cf24 --- /dev/null +++ b/src-tauri/commands/volume/ahk/Set sound.ahk @@ -0,0 +1 @@ +SoundSet, %1% \ No newline at end of file diff --git a/src-tauri/commands/browser/ahk/Run google.exe b/src-tauri/commands/volume/ahk/Set sound.exe similarity index 99% rename from src-tauri/commands/browser/ahk/Run google.exe rename to src-tauri/commands/volume/ahk/Set sound.exe index 163051b..23806a6 100644 Binary files a/src-tauri/commands/browser/ahk/Run google.exe and b/src-tauri/commands/volume/ahk/Set sound.exe differ diff --git a/src-tauri/commands/windows/ahk/Empty trash.ahk b/src-tauri/commands/windows/ahk/Empty trash.ahk new file mode 100644 index 0000000..ab9a4fa --- /dev/null +++ b/src-tauri/commands/windows/ahk/Empty trash.ahk @@ -0,0 +1 @@ +FileRecycleEmpty, \ No newline at end of file diff --git a/src-tauri/commands/windows/ahk/Empty trash.exe b/src-tauri/commands/windows/ahk/Empty trash.exe new file mode 100644 index 0000000..3343dd0 Binary files /dev/null and b/src-tauri/commands/windows/ahk/Empty trash.exe differ diff --git a/src-tauri/commands/windows/ahk/Roll up windows.ahk b/src-tauri/commands/windows/ahk/Roll up windows.ahk new file mode 100644 index 0000000..46adf19 --- /dev/null +++ b/src-tauri/commands/windows/ahk/Roll up windows.ahk @@ -0,0 +1 @@ +WinMinimizeAll \ No newline at end of file diff --git a/src-tauri/commands/windows/ahk/Roll up windows.exe b/src-tauri/commands/windows/ahk/Roll up windows.exe new file mode 100644 index 0000000..3a83bea Binary files /dev/null and b/src-tauri/commands/windows/ahk/Roll up windows.exe differ diff --git a/src-tauri/commands/windows/ahk/Set language.ahk b/src-tauri/commands/windows/ahk/Set language.ahk new file mode 100644 index 0000000..88a8141 --- /dev/null +++ b/src-tauri/commands/windows/ahk/Set language.ahk @@ -0,0 +1 @@ +Send, {Shift down}{Alt}{Shift up} \ No newline at end of file diff --git a/src-tauri/commands/windows/ahk/Set language.exe b/src-tauri/commands/windows/ahk/Set language.exe new file mode 100644 index 0000000..a40507a Binary files /dev/null and b/src-tauri/commands/windows/ahk/Set language.exe differ diff --git a/src-tauri/commands/windows/ahk/Task manager open.ahk b/src-tauri/commands/windows/ahk/Task manager open.ahk new file mode 100644 index 0000000..587535a --- /dev/null +++ b/src-tauri/commands/windows/ahk/Task manager open.ahk @@ -0,0 +1 @@ +Run taskmgr.exe \ No newline at end of file diff --git a/src-tauri/commands/windows/ahk/Task manager open.exe b/src-tauri/commands/windows/ahk/Task manager open.exe new file mode 100644 index 0000000..57be607 Binary files /dev/null and b/src-tauri/commands/windows/ahk/Task manager open.exe differ diff --git a/src-tauri/commands/windows/ahk/blocking.ahk b/src-tauri/commands/windows/ahk/blocking.ahk new file mode 100644 index 0000000..361a38b --- /dev/null +++ b/src-tauri/commands/windows/ahk/blocking.ahk @@ -0,0 +1 @@ +DllCall("LockWorkStation") \ No newline at end of file diff --git a/src-tauri/commands/windows/ahk/blocking.exe b/src-tauri/commands/windows/ahk/blocking.exe new file mode 100644 index 0000000..960dccf Binary files /dev/null and b/src-tauri/commands/windows/ahk/blocking.exe differ diff --git a/src-tauri/commands/windows/ahk/clipboard.ahk b/src-tauri/commands/windows/ahk/clipboard.ahk new file mode 100644 index 0000000..9c0e919 --- /dev/null +++ b/src-tauri/commands/windows/ahk/clipboard.ahk @@ -0,0 +1 @@ +Send #v \ No newline at end of file diff --git a/src-tauri/commands/windows/ahk/clipboard.exe b/src-tauri/commands/windows/ahk/clipboard.exe new file mode 100644 index 0000000..f4906a8 Binary files /dev/null and b/src-tauri/commands/windows/ahk/clipboard.exe differ diff --git a/src-tauri/commands/windows/ahk/screenshot.ahk b/src-tauri/commands/windows/ahk/screenshot.ahk new file mode 100644 index 0000000..87b5b9b --- /dev/null +++ b/src-tauri/commands/windows/ahk/screenshot.ahk @@ -0,0 +1 @@ +Send, #{PrintScreen} \ No newline at end of file diff --git a/src-tauri/commands/windows/ahk/screenshot.exe b/src-tauri/commands/windows/ahk/screenshot.exe new file mode 100644 index 0000000..046f4d4 Binary files /dev/null and b/src-tauri/commands/windows/ahk/screenshot.exe differ diff --git a/src-tauri/commands/windows/ahk/sleep.ahk b/src-tauri/commands/windows/ahk/sleep.ahk new file mode 100644 index 0000000..baff485 --- /dev/null +++ b/src-tauri/commands/windows/ahk/sleep.ahk @@ -0,0 +1 @@ +DllCall("PowrProf\SetSuspendState", "int", 1, "int", 1, "int", 1) \ No newline at end of file diff --git a/src-tauri/commands/windows/ahk/sleep.exe b/src-tauri/commands/windows/ahk/sleep.exe new file mode 100644 index 0000000..693a1a9 Binary files /dev/null and b/src-tauri/commands/windows/ahk/sleep.exe differ diff --git a/src-tauri/commands/windows/command.yaml b/src-tauri/commands/windows/command.yaml new file mode 100644 index 0000000..737ec97 --- /dev/null +++ b/src-tauri/commands/windows/command.yaml @@ -0,0 +1,124 @@ +list: +- command: + action: ahk + exe_path: ahk/Roll up windows.exe + exe_args: + voice: + sounds: + - ok1 + - ok2 + - ok3 + phrases: + - сверни все окна + - сверни окна + +- command: + action: ahk + exe_path: ahk/Empty trash.exe + exe_args: + voice: + sounds: + - ok1 + - ok2 + - ok3 + phrases: + - очисти корзину + - почисти корзину + - очистка корзины + +- command: + action: ahk + exe_path: ahk/Task manager open.exe + exe_args: + voice: + sounds: + - ok1 + - ok2 + - ok3 + phrases: + - запусти диспетчер задач + - открой диспетчер задач + - диспетчер задач + +- command: + action: ahk + exe_path: ahk/screenshot.exe + exe_args: + voice: + sounds: + - ok1 + - ok2 + - ok3 + phrases: + - сделай скриншот + - сделай снимок экрана + - сними экран + +- command: + action: ahk + exe_path: ahk/blocking.exe + exe_args: + voice: + sounds: + - ok1 + - ok2 + - ok3 + - ok4 + phrases: + - заблокируй компьютер + - заблокируй комп + +- command: + action: ahk + exe_path: ahk/sleep.exe + exe_args: + voice: + sounds: + - ok1 + - ok2 + - ok3 + - ok4 + phrases: + - спящий режим + - ждущий режим + - иди поспи + +- command: + action: ahk + exe_path: ahk/clipboard.exe + exe_args: + voice: + sounds: + - ok1 + - ok2 + - ok3 + phrases: + - открой буфер обмена + - покажи буфер обмена + - запусти буфер обмена + - буфер обмена + +- command: + action: ahk + exe_path: ahk/Set language.exe + exe_args: + voice: + sounds: + - ok1 + - ok2 + - ok3 + phrases: + - смени раскладку + - поменяй раскладку + - смени язык + - поменяй язык + - переключи на русский + - переключи на английский + - смени раскладку на русскую + - поменяй раскладку на русскую + - поменяй раскладку на английскую + - смени раскладку на английскую + - смени язык на русский + - поменяй язык на русский + - смени язык на английский + - поменяй язык на английский diff --git a/src-tauri/icons/128x128.png b/src-tauri/icons/128x128.png index e1454fc..6c36989 100644 Binary files a/src-tauri/icons/128x128.png and b/src-tauri/icons/128x128.png differ diff --git a/src-tauri/icons/128x128@2x.png b/src-tauri/icons/128x128@2x.png index 68626e0..5726cca 100644 Binary files a/src-tauri/icons/128x128@2x.png and b/src-tauri/icons/128x128@2x.png differ diff --git a/src-tauri/icons/32x32.png b/src-tauri/icons/32x32.png index cf48517..aaa2f2d 100644 Binary files a/src-tauri/icons/32x32.png and b/src-tauri/icons/32x32.png differ diff --git a/src-tauri/icons/Square107x107Logo.png b/src-tauri/icons/Square107x107Logo.png index 1b8d3ce..55e7dd8 100644 Binary files a/src-tauri/icons/Square107x107Logo.png and b/src-tauri/icons/Square107x107Logo.png differ diff --git a/src-tauri/icons/Square142x142Logo.png b/src-tauri/icons/Square142x142Logo.png index 4bce679..7a176aa 100644 Binary files a/src-tauri/icons/Square142x142Logo.png and b/src-tauri/icons/Square142x142Logo.png differ diff --git a/src-tauri/icons/Square150x150Logo.png b/src-tauri/icons/Square150x150Logo.png index 7da8d34..ec28d28 100644 Binary files a/src-tauri/icons/Square150x150Logo.png and b/src-tauri/icons/Square150x150Logo.png differ diff --git a/src-tauri/icons/Square284x284Logo.png b/src-tauri/icons/Square284x284Logo.png index 21d6359..59f92a2 100644 Binary files a/src-tauri/icons/Square284x284Logo.png and b/src-tauri/icons/Square284x284Logo.png differ diff --git a/src-tauri/icons/Square30x30Logo.png b/src-tauri/icons/Square30x30Logo.png index 11d6bce..418fb45 100644 Binary files a/src-tauri/icons/Square30x30Logo.png and b/src-tauri/icons/Square30x30Logo.png differ diff --git a/src-tauri/icons/Square310x310Logo.png b/src-tauri/icons/Square310x310Logo.png index af30f2a..0783492 100644 Binary files a/src-tauri/icons/Square310x310Logo.png and b/src-tauri/icons/Square310x310Logo.png differ diff --git a/src-tauri/icons/Square44x44Logo.png b/src-tauri/icons/Square44x44Logo.png index ac8e01e..66f3551 100644 Binary files a/src-tauri/icons/Square44x44Logo.png and b/src-tauri/icons/Square44x44Logo.png differ diff --git a/src-tauri/icons/Square71x71Logo.png b/src-tauri/icons/Square71x71Logo.png index cde0658..f1a5882 100644 Binary files a/src-tauri/icons/Square71x71Logo.png and b/src-tauri/icons/Square71x71Logo.png differ diff --git a/src-tauri/icons/Square89x89Logo.png b/src-tauri/icons/Square89x89Logo.png index cb241b8..b8baf6d 100644 Binary files a/src-tauri/icons/Square89x89Logo.png and b/src-tauri/icons/Square89x89Logo.png differ diff --git a/src-tauri/icons/StoreLogo.png b/src-tauri/icons/StoreLogo.png index e3fa9eb..8969e28 100644 Binary files a/src-tauri/icons/StoreLogo.png and b/src-tauri/icons/StoreLogo.png differ diff --git a/src-tauri/icons/icon.icns b/src-tauri/icons/icon.icns index 49e4def..f88c466 100644 Binary files a/src-tauri/icons/icon.icns and b/src-tauri/icons/icon.icns differ diff --git a/src-tauri/icons/icon.ico b/src-tauri/icons/icon.ico index 180e0d4..4e19503 100644 Binary files a/src-tauri/icons/icon.ico and b/src-tauri/icons/icon.ico differ diff --git a/src-tauri/icons/icon.png b/src-tauri/icons/icon.png index 79bc4e4..046b8dc 100644 Binary files a/src-tauri/icons/icon.png and b/src-tauri/icons/icon.png differ diff --git a/src-tauri/src/assistant_commands.rs b/src-tauri/src/assistant_commands.rs index e9550ce..0e689c9 100644 --- a/src-tauri/src/assistant_commands.rs +++ b/src-tauri/src/assistant_commands.rs @@ -7,8 +7,7 @@ use log::{info, warn, error}; use core::time::Duration; use std::path::PathBuf; -use std::process::Child; -use std::process::Command; +use std::process::{Command, Child}; // use tauri::Manager; mod structs; @@ -34,14 +33,16 @@ pub fn parse_commands() -> Result, String> { let cc_yaml: CommandsList; // try parse command.yaml - if let Ok(parse_result) = serde_yaml::from_reader::(cc_reader) { - cc_yaml = parse_result; - } else { - warn!("Can't parse {}, skipping ...", &cc_file.display()); - continue; - // return Err(format!("Can't parse {}", &cc_file.display())); + match serde_yaml::from_reader::(cc_reader) { + Ok(parse_result) => { + cc_yaml = parse_result; + }, + Err(msg) => { + warn!("Can't parse {}, skipping ...\nCommand parse error is: {:?}", &cc_file.display(), msg); + eprintln!("Can't parse {}, skipping ...\nCommand parse error is: {:?}", &cc_file.display(), msg); + continue; + } } - // everything seems to be Ok commands.push(AssistantCommand { path: _cpath, @@ -109,11 +110,30 @@ pub fn execute_exe(exe: &str, args: &Vec) -> std::io::Result { Command::new(exe).args(args).spawn() } +pub fn execute_cli(cmd: &str, args: &Vec) -> std::io::Result { + + println!("Spawning cmd as: cmd /C {} {:?}", cmd, args); + + if cfg!(target_os = "windows") { + Command::new("cmd") + .arg("/C") + .arg(cmd) + .args(args) + .spawn() + } else { + Command::new("sh") + .arg("-c") + .arg(cmd) + .args(args) + .spawn() + } +} + pub fn execute_command( cmd_path: &PathBuf, cmd_config: &Config, app_handle: &tauri::AppHandle, -) -> Result<(), String> { +) -> Result { match cmd_config.command.action.as_str() { "voice" => { // VOICE command type @@ -124,7 +144,7 @@ pub fn execute_command( .unwrap(); events::play(random_cmd_sound, app_handle); - Ok(()) + Ok(true) } "ahk" => { // AutoHotkey command type @@ -146,7 +166,7 @@ pub fn execute_command( .unwrap(); events::play(random_cmd_sound, app_handle); - Ok(()) + Ok(true) } else { error!("AHK process spawn error (does exe path is valid?)"); Err("AHK process spawn error (does exe path is valid?)".into()) @@ -154,28 +174,26 @@ pub fn execute_command( } "cli" => { // CLI command type - let exe_path_absolute = Path::new(&cmd_config.command.exe_path); - let exe_path_local = Path::new(&cmd_path).join(&cmd_config.command.exe_path); + let cli_cmd = &cmd_config.command.cli_cmd; - if let Ok(_) = execute_exe( - if exe_path_absolute.exists() { - exe_path_absolute.to_str().unwrap() - } else { - exe_path_local.to_str().unwrap() - }, - &cmd_config.command.exe_args, + match execute_cli( + cli_cmd, + &cmd_config.command.cli_args, ) { - let random_cmd_sound = cmd_config - .voice - .sounds - .choose(&mut rand::thread_rng()) - .unwrap(); - events::play(random_cmd_sound, app_handle); + Ok(_) => { + let random_cmd_sound = cmd_config + .voice + .sounds + .choose(&mut rand::thread_rng()) + .unwrap(); + events::play(random_cmd_sound, app_handle); - Ok(()) - } else { - error!("Shell process spawn error (does cli command is valid?)"); - Err("Shell process spawn error (does cli command is valid?)".into()) + Ok(true) + }, + Err(msg) => { + error!("CLI command error ({})", msg); + Err(format!("Shell command error ({})", msg).into()) + } } } "terminate" => { @@ -190,6 +208,17 @@ pub fn execute_command( std::thread::sleep(Duration::from_secs(2)); std::process::exit(0); } + "stop_chaining" => { + // STOP_CHAINING command type + let random_cmd_sound = cmd_config + .voice + .sounds + .choose(&mut rand::thread_rng()) + .unwrap(); + events::play(random_cmd_sound, app_handle); + + Ok(false) + } _ => { error!("Command type unknown"); Err("Command type unknown".into()) diff --git a/src-tauri/src/assistant_commands/structs.rs b/src-tauri/src/assistant_commands/structs.rs index 6a0005c..3c97f59 100644 --- a/src-tauri/src/assistant_commands/structs.rs +++ b/src-tauri/src/assistant_commands/structs.rs @@ -15,18 +15,32 @@ pub struct CommandsList { #[derive(Deserialize, Debug)] pub struct Config { pub command: ConfigCommandSection, + pub voice: ConfigVoiceSection, + pub phrases: Vec, } #[derive(Deserialize, Debug)] pub struct ConfigCommandSection { pub action: String, + + #[serde(default)] pub exe_path: String, + + #[serde(default)] pub exe_args: Vec, + + #[serde(default)] + pub cli_cmd: String, + + #[serde(default)] + pub cli_args: Vec } #[derive(Deserialize, Debug)] pub struct ConfigVoiceSection { + + #[serde(default)] pub sounds: Vec, } diff --git a/src-tauri/src/config.rs b/src-tauri/src/config.rs index f50bef8..d6a68cf 100644 --- a/src-tauri/src/config.rs +++ b/src-tauri/src/config.rs @@ -24,7 +24,7 @@ pub const AUTHOR_NAME: Option<&str> = option_env!("CARGO_PKG_AUTHORS"); pub const REPOSITORY_LINK: Option<&str> = option_env!("CARGO_PKG_REPOSITORY"); // RUSPOTTER -pub const RUSPOTTER_MIN_SCORE: f32 = 0.64; +pub const RUSPOTTER_MIN_SCORE: f32 = 0.62; // PICOVOICE pub const COMMANDS_PATH: &str = "commands/"; diff --git a/src-tauri/src/recorder.rs b/src-tauri/src/recorder.rs index 502bb87..c590ff5 100644 --- a/src-tauri/src/recorder.rs +++ b/src-tauri/src/recorder.rs @@ -111,17 +111,6 @@ pub fn stop_recording() { } } -// pub fn update_selected_microphone_index() -> i32 { -// let selected_microphone: i32 = get_selected_microphone_index(); - -// // store current microphone idx -// SELECTED_MICROPHONE_IDX.store(selected_microphone, Ordering::SeqCst); - -// // return microphone index -// info!("Selected microphone index = {selected_microphone}"); -// selected_microphone -// } - pub fn get_selected_microphone_index() -> i32 { let selected_microphone: i32; diff --git a/src-tauri/src/tauri_commands/listener.rs b/src-tauri/src/tauri_commands/listener.rs index 5367780..e95198c 100644 --- a/src-tauri/src/tauri_commands/listener.rs +++ b/src-tauri/src/tauri_commands/listener.rs @@ -1,4 +1,5 @@ use porcupine::{Porcupine, PorcupineBuilder}; +use std::ops::Sub; use std::sync::atomic::{AtomicBool, Ordering}; use std::path::Path; use log::{info, warn, error}; @@ -149,9 +150,17 @@ fn keyword_callback(_keyword_index: i32) { ); match cmd_result { - Ok(_) => { + Ok(chain) => { println!("Command executed successfully!"); - start = SystemTime::now(); // listen for more commands + + if chain { + // continue chaining commands + start = SystemTime::now(); // listen for more commands + } else { + // skip forward if chaining is not required + start = start.checked_sub(core::time::Duration::from_secs(1000)).unwrap(); + } + continue; } Err(error_message) => { @@ -317,7 +326,7 @@ fn rustpotter_init() -> Result { avg_threshold: 0., threshold: 0.5, min_scores: 15, - score_mode: ScoreMode::Max, + score_mode: ScoreMode::Average, comparator_band_size: 5, comparator_ref: 0.22 }, @@ -325,7 +334,7 @@ fn rustpotter_init() -> Result { gain_normalizer: GainNormalizationConfig { enabled: true, gain_ref: None, - min_gain: 0.5, + min_gain: 0.7, max_gain: 1.0, }, band_pass: BandPassConfig {