mirror of
https://github.com/ByteAtATime/raycast-linux.git
synced 2025-09-09 15:40:37 +00:00
style(backend): formatting
This commit is contained in:
parent
56813684e1
commit
6365d18cdb
14 changed files with 36 additions and 35 deletions
|
@ -31,8 +31,8 @@ impl ExpansionEngine {
|
|||
pub fn start_listening(&self) -> anyhow::Result<()> {
|
||||
let engine = Arc::new(self.clone_for_thread());
|
||||
self.input_manager.start_listening(Box::new(move |event| {
|
||||
engine.handle_key_press(event);
|
||||
}))?;
|
||||
engine.handle_key_press(event);
|
||||
}))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -158,4 +158,4 @@ impl ExpansionEngine {
|
|||
let mut buffer = self.buffer.lock().unwrap();
|
||||
buffer.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,21 +48,21 @@ impl InputManager for RdevInputManager {
|
|||
|
||||
thread::spawn(move || {
|
||||
let cb = move |event: rdev::Event| match event.event_type {
|
||||
rdev::EventType::KeyPress(key) => {
|
||||
if key == Key::ShiftLeft || key == Key::ShiftRight {
|
||||
*shift_clone_press.lock().unwrap() = true;
|
||||
}
|
||||
let is_shifted = *shift_clone_press.lock().unwrap();
|
||||
if let Some(ch) = key_to_char(&key, is_shifted) {
|
||||
callback_clone(InputEvent::KeyPress(ch));
|
||||
}
|
||||
rdev::EventType::KeyPress(key) => {
|
||||
if key == Key::ShiftLeft || key == Key::ShiftRight {
|
||||
*shift_clone_press.lock().unwrap() = true;
|
||||
}
|
||||
rdev::EventType::KeyRelease(key) => {
|
||||
if key == Key::ShiftLeft || key == Key::ShiftRight {
|
||||
*shift_clone_release.lock().unwrap() = false;
|
||||
}
|
||||
let is_shifted = *shift_clone_press.lock().unwrap();
|
||||
if let Some(ch) = key_to_char(&key, is_shifted) {
|
||||
callback_clone(InputEvent::KeyPress(ch));
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
rdev::EventType::KeyRelease(key) => {
|
||||
if key == Key::ShiftLeft || key == Key::ShiftRight {
|
||||
*shift_clone_release.lock().unwrap() = false;
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
};
|
||||
if let Err(error) = rdev::listen(cb) {
|
||||
eprintln!("rdev error: {:?}", error)
|
||||
|
@ -492,4 +492,4 @@ pub fn key_to_char(key: &Key, is_shifted: bool) -> Option<char> {
|
|||
_ => return None,
|
||||
};
|
||||
s.chars().nth(if is_shifted { 1 } else { 0 })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,4 +120,4 @@ impl SnippetManager {
|
|||
Ok(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ pub fn delete_snippet(app: AppHandle, id: i64) -> Result<(), String> {
|
|||
.delete_snippet(id)
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn import_snippets(app: AppHandle, json_content: String) -> Result<ImportResult, String> {
|
||||
let snippets: Vec<ImportSnippet> =
|
||||
|
|
|
@ -10,4 +10,4 @@ pub struct Snippet {
|
|||
pub content: String,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue