sort imports
This commit is contained in:
parent
4cde2d02e6
commit
9c1e48a4f6
15 changed files with 136 additions and 104 deletions
|
@ -1,10 +1,12 @@
|
|||
use hyprland::dispatch::{DispatchType, WindowIdentifier};
|
||||
use hyprland::prelude::HyprData;
|
||||
use hyprland::shared::Address;
|
||||
use rayon::prelude::*;
|
||||
use std::{env, sync::Arc};
|
||||
use sysinfo::{Pid, System};
|
||||
|
||||
use hyprland::{
|
||||
dispatch::{DispatchType, WindowIdentifier},
|
||||
prelude::HyprData,
|
||||
shared::Address,
|
||||
};
|
||||
use rayon::prelude::*;
|
||||
use sysinfo::{Pid, System};
|
||||
use worf_lib::{
|
||||
config::{self, Config},
|
||||
desktop::EntryType,
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::process::Command;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use worf_lib::config::{Config, CustomKeyHintLocation};
|
||||
use worf_lib::desktop::{copy_to_clipboard, spawn_fork};
|
||||
use worf_lib::gui::{CustomKeyHint, CustomKeys, ItemProvider, Key, KeyBinding, MenuItem, Modifier};
|
||||
use worf_lib::{config, gui};
|
||||
use std::{collections::HashMap, env, process::Command, thread::sleep, time::Duration};
|
||||
|
||||
use worf_lib::{
|
||||
config::{self, Config, CustomKeyHintLocation},
|
||||
desktop::{copy_to_clipboard, spawn_fork},
|
||||
gui::{self, CustomKeyHint, CustomKeys, ItemProvider, Key, KeyBinding, MenuItem, Modifier},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
struct MenuItemMetaData {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use crate::Error;
|
||||
use std::{env, fs, path::PathBuf, str::FromStr};
|
||||
|
||||
use clap::{Parser, ValueEnum};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use std::{env, fs};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::Error;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Serialize, Deserialize)]
|
||||
pub enum Anchor {
|
||||
Top,
|
||||
|
|
|
@ -2,12 +2,8 @@ use std::{
|
|||
collections::HashMap,
|
||||
env,
|
||||
ffi::OsStr,
|
||||
fs,
|
||||
io,
|
||||
os::unix::{
|
||||
fs::PermissionsExt,
|
||||
prelude::CommandExt,
|
||||
},
|
||||
fs, io,
|
||||
os::unix::{fs::PermissionsExt, prelude::CommandExt},
|
||||
path::{Path, PathBuf},
|
||||
process::{Command, Stdio},
|
||||
time::Instant,
|
||||
|
@ -20,8 +16,8 @@ use regex::Regex;
|
|||
use wl_clipboard_rs::copy::{ClipboardType, MimeType, ServeRequests, Source};
|
||||
|
||||
use crate::{
|
||||
config::{expand_path, Config},
|
||||
Error,
|
||||
config::{Config, expand_path},
|
||||
};
|
||||
|
||||
/// Returns a regex with supported image extensions
|
||||
|
|
|
@ -1,34 +1,37 @@
|
|||
use std::collections::{HashMap, HashSet};
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::thread;
|
||||
use std::time::Instant;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
rc::Rc,
|
||||
sync::{Arc, Mutex, RwLock},
|
||||
thread,
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
use crossbeam::channel;
|
||||
use crossbeam::channel::Sender;
|
||||
use gdk4::Display;
|
||||
use gdk4::gio::File;
|
||||
use gdk4::glib::{MainContext, Propagation};
|
||||
use gdk4::prelude::{Cast, DisplayExt, MonitorExt, SurfaceExt};
|
||||
use gtk4::glib::ControlFlow;
|
||||
use gtk4::prelude::{
|
||||
ApplicationExt, ApplicationExtManual, BoxExt, EditableExt, FlowBoxChildExt, GestureSingleExt,
|
||||
GtkWindowExt, ListBoxRowExt, NativeExt, OrientableExt, WidgetExt,
|
||||
use crossbeam::channel::{self, Sender};
|
||||
use gdk4::{
|
||||
Display,
|
||||
gio::File,
|
||||
glib::{self, MainContext, Propagation},
|
||||
prelude::{Cast, DisplayExt, MonitorExt, SurfaceExt},
|
||||
};
|
||||
use gtk4::{
|
||||
Align, EventControllerKey, Expander, FlowBox, FlowBoxChild, GestureClick, Image, Label,
|
||||
ListBox, ListBoxRow, NaturalWrapMode, Ordering, PolicyType, ScrolledWindow, SearchEntry,
|
||||
Widget, gdk, glib,
|
||||
Align, Application, ApplicationWindow, CssProvider, EventControllerKey, Expander, FlowBox,
|
||||
FlowBoxChild, GestureClick, Image, Label, ListBox, ListBoxRow, NaturalWrapMode, Ordering,
|
||||
Orientation, PolicyType, ScrolledWindow, SearchEntry, Widget,
|
||||
glib::ControlFlow,
|
||||
prelude::{
|
||||
ApplicationExt, ApplicationExtManual, BoxExt, EditableExt, FlowBoxChildExt,
|
||||
GestureSingleExt, GtkWindowExt, ListBoxRowExt, NativeExt, OrientableExt, WidgetExt,
|
||||
},
|
||||
};
|
||||
use gtk4::{Application, ApplicationWindow, CssProvider, Orientation};
|
||||
use gtk4_layer_shell::{Edge, KeyboardMode, LayerShell};
|
||||
use log;
|
||||
use regex::Regex;
|
||||
|
||||
use crate::{
|
||||
Error, config,
|
||||
Error,
|
||||
config::{
|
||||
Anchor, Config, CustomKeyHintLocation, KeyDetectionType, MatchMethod, SortOrder, WrapMode,
|
||||
self, Anchor, Config, CustomKeyHintLocation, KeyDetectionType, MatchMethod, SortOrder,
|
||||
WrapMode,
|
||||
},
|
||||
desktop::known_image_extension_regex_pattern,
|
||||
};
|
||||
|
@ -229,7 +232,7 @@ pub enum Key {
|
|||
Tilde, // ~
|
||||
}
|
||||
|
||||
impl From<gdk::Key> for Key {
|
||||
impl From<gtk4::gdk::Key> for Key {
|
||||
fn from(value: gdk4::Key) -> Self {
|
||||
match value {
|
||||
// Letters
|
||||
|
@ -1396,7 +1399,7 @@ fn create_menu_row<T: Clone + 'static + Send>(
|
|||
let element_clone = element_to_add.clone();
|
||||
|
||||
let click = GestureClick::new();
|
||||
click.set_button(gdk::BUTTON_PRIMARY);
|
||||
click.set_button(gtk4::gdk::BUTTON_PRIMARY);
|
||||
click.connect_pressed(move |_gesture, n_press, _x, _y| {
|
||||
if n_press == 2 {
|
||||
if let Err(e) = handle_selected_item(
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
use crate::config::Config;
|
||||
use crate::desktop::spawn_fork;
|
||||
use crate::gui::{ItemProvider, MenuItem};
|
||||
use crate::modes::drun::{DRunProvider, update_drun_cache_and_run};
|
||||
use crate::modes::file::FileItemProvider;
|
||||
use crate::modes::math::MathProvider;
|
||||
use crate::modes::ssh;
|
||||
use crate::modes::ssh::SshProvider;
|
||||
use crate::{Error, gui};
|
||||
use regex::Regex;
|
||||
|
||||
use crate::{
|
||||
Error,
|
||||
config::Config,
|
||||
desktop::spawn_fork,
|
||||
gui::{self, ItemProvider, MenuItem},
|
||||
modes::{
|
||||
drun::{DRunProvider, update_drun_cache_and_run},
|
||||
file::FileItemProvider,
|
||||
math::MathProvider,
|
||||
ssh,
|
||||
ssh::SshProvider,
|
||||
},
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
enum AutoRunType {
|
||||
Math,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use crate::config::{Config, SortOrder};
|
||||
use crate::gui::{ItemProvider, MenuItem};
|
||||
use crate::{Error, gui};
|
||||
use std::io;
|
||||
use std::io::Read;
|
||||
use std::io::{self, Read};
|
||||
|
||||
use crate::{
|
||||
Error,
|
||||
config::{Config, SortOrder},
|
||||
gui::{self, ItemProvider, MenuItem},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
struct DMenuProvider {
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
use crate::config::{Config, SortOrder};
|
||||
use crate::desktop::{
|
||||
find_desktop_files, get_locale_variants, lookup_name_with_locale, save_cache_file, spawn_fork,
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
path::PathBuf,
|
||||
time::Instant,
|
||||
};
|
||||
use crate::gui::{ItemProvider, MenuItem};
|
||||
use crate::modes::load_cache;
|
||||
use crate::{Error, gui};
|
||||
|
||||
use freedesktop_file_parser::EntryType;
|
||||
use rayon::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::path::PathBuf;
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::{
|
||||
Error,
|
||||
config::{Config, SortOrder},
|
||||
desktop::{
|
||||
find_desktop_files, get_locale_variants, lookup_name_with_locale, save_cache_file,
|
||||
spawn_fork,
|
||||
},
|
||||
gui::{self, ItemProvider, MenuItem},
|
||||
modes::load_cache,
|
||||
};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
struct DRunCache {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::config::{Config, SortOrder};
|
||||
use crate::desktop::copy_to_clipboard;
|
||||
use crate::gui::{ItemProvider, MenuItem};
|
||||
use crate::{Error, gui};
|
||||
use crate::{
|
||||
Error,
|
||||
config::{Config, SortOrder},
|
||||
desktop::copy_to_clipboard,
|
||||
gui::{self, ItemProvider, MenuItem},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct EmojiProvider {
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
use crate::config::{Config, SortOrder, expand_path};
|
||||
use crate::desktop::spawn_fork;
|
||||
use crate::gui::{ItemProvider, MenuItem};
|
||||
use crate::{Error, gui};
|
||||
use std::{
|
||||
fs,
|
||||
os::unix::fs::FileTypeExt,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use regex::Regex;
|
||||
use std::fs;
|
||||
use std::os::unix::fs::FileTypeExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use crate::{
|
||||
Error,
|
||||
config::{Config, SortOrder, expand_path},
|
||||
desktop::spawn_fork,
|
||||
gui::{self, ItemProvider, MenuItem},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct FileItemProvider<T: Clone> {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use crate::config::Config;
|
||||
use crate::gui;
|
||||
use crate::gui::{ItemProvider, MenuItem};
|
||||
use regex::Regex;
|
||||
|
||||
use crate::{
|
||||
config::Config,
|
||||
gui::{self, ItemProvider, MenuItem},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct MathProvider<T: Clone> {
|
||||
menu_item_data: T,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{collections::HashMap, path::PathBuf};
|
||||
|
||||
use crate::desktop::{create_file_if_not_exists, load_cache_file};
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub mod auto;
|
||||
pub mod dmenu;
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
use crate::config::{Config, SortOrder};
|
||||
use crate::desktop::{is_executable, save_cache_file};
|
||||
use crate::gui::{ItemProvider, MenuItem};
|
||||
use crate::modes::load_cache;
|
||||
use crate::{Error, gui};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::ffi::CString;
|
||||
use std::path::PathBuf;
|
||||
use std::{env, fs};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
env,
|
||||
ffi::CString,
|
||||
fs,
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
Error,
|
||||
config::{Config, SortOrder},
|
||||
desktop::{is_executable, save_cache_file},
|
||||
gui::{self, ItemProvider, MenuItem},
|
||||
modes::load_cache,
|
||||
};
|
||||
|
||||
impl ItemProvider<i32> for RunProvider {
|
||||
fn get_elements(&mut self, _: Option<&str>) -> (bool, Vec<MenuItem<i32>>) {
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
use crate::config::{Config, SortOrder};
|
||||
use crate::desktop::spawn_fork;
|
||||
use crate::gui::{ItemProvider, MenuItem};
|
||||
use crate::{Error, gui};
|
||||
use regex::Regex;
|
||||
use std::fs;
|
||||
|
||||
use regex::Regex;
|
||||
|
||||
use crate::{
|
||||
Error,
|
||||
config::{Config, SortOrder},
|
||||
desktop::spawn_fork,
|
||||
gui::{self, ItemProvider, MenuItem},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct SshProvider<T: Clone> {
|
||||
elements: Vec<MenuItem<T>>,
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use std::env;
|
||||
|
||||
use anyhow::anyhow;
|
||||
use worf_lib::config::Mode;
|
||||
use worf_lib::desktop::fork_if_configured;
|
||||
use worf_lib::{Error, config, modes};
|
||||
|
||||
use worf_lib::{Error, config, config::Mode, desktop::fork_if_configured, modes};
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
env_logger::Builder::new()
|
||||
|
|
Loading…
Add table
Reference in a new issue