Status

Struct Status 

Source
pub struct Status {
    pub tabs: [Tab; 2],
    pub index: usize,
    pub fuzzy: Option<FuzzyFinder<String>>,
    pub menu: MenuHolder,
    pub session: Session,
    pub internal_settings: InternalSettings,
    pub focus: Focus,
    pub fm_sender: Arc<Sender<FmEvents>>,
    pub previewer: Previewer,
    pub thumbnail_manager: Option<ThumbnailManager>,
    /* private fields */
}
Expand description

Holds every mutable parameter of the application itself, except for the “display” information. It holds 2 tabs (left & right), even if only one can be displayed sometimes. It knows which tab is selected, which files are flagged, which jump target is selected, a cache of normal file colors, if we have to display one or two tabs and if all details are shown or only the filename. Mutation of this struct are mostly done externally, by the event crate : crate::event_exec.

Fields§

§tabs: [Tab; 2]

Vector of Tab, each of them are displayed in a separate tab.

§index: usize

Index of the current selected tab

§fuzzy: Option<FuzzyFinder<String>>

Fuzzy finder of files by name

§menu: MenuHolder

Navigable menu

§session: Session

Display settings

§internal_settings: InternalSettings

Internal settings

§focus: Focus

Window being focused currently

§fm_sender: Arc<Sender<FmEvents>>

Sender of events

§previewer: Previewer

Non bloking preview builder

§thumbnail_manager: Option<ThumbnailManager>

Preview manager

Implementations§

Source§

impl Status

Source

pub fn arc_mutex_new( size: Size, opener: Opener, binds: &Bindings, fm_sender: Arc<Sender<FmEvents>>, ) -> Result<Arc<Mutex<RawMutex, Self>>>

Creates a new status for the application. It requires most of the information (arguments, configuration, height of the terminal, the formated help string). Status is wraped around by an Arc, Mutex from parking_lot.

Source

pub fn current_tab(&self) -> &Tab

Returns a non mutable reference to the selected tab.

Source

pub fn current_tab_mut(&mut self) -> &mut Tab

Returns a mutable reference to the selected tab.

Source

pub fn current_tab_path_str(&self) -> String

Returns a string representing the current path in the selected tab.

Source

pub fn must_quit(&self) -> bool

True if a quit event was registered in the selected tab.

Source

pub fn focus_follow_index(&mut self)

Give the focus to the selected tab.

Source

pub fn set_focus_from_mode(&mut self)

Give to focus to the left / right file / menu depending of which mode is selected.

Source

pub fn next(&mut self)

Select the other tab if two are displayed. Does nothing otherwise.

Source

pub fn select_tab_from_col(&mut self, col: u16) -> Result<()>

Select the left or right tab depending on where the user clicked.

Source

pub fn set_focus_from_pos(&mut self, row: u16, col: u16) -> Result<Window>

Set focus from a mouse coordinates. When a mouse event occurs, focus is given to the window where it happened.

Source

pub fn click(&mut self, binds: &Bindings, row: u16, col: u16) -> Result<()>

Execute a click at row, col. Action depends on which window was clicked.

Source

pub fn enter_from_preview(&mut self) -> Result<()>

Action when user press enter on a preview. If the preview is a tree in right tab, the left file will be selected in the left tab. Otherwise, we open the file if it exists in the file tree.

Source

pub fn tab_select_row(&mut self, row: u16) -> Result<()>

Select a given row, if there’s something in it. Returns an error if the clicked row is above the headers margin.

Source

pub fn sync_tabs(&mut self, direction: Direction) -> Result<()>

Sync right tab from left tab path or vice versa.

Source

pub fn second_window_height(&self) -> Result<usize>

Height of the second window (menu). Watchout : it’s always ~height / 2 - 2, even if menu is closed.

Source

pub fn select_left(&mut self)

Select the left tab

Source

pub fn select_right(&mut self)

Select the right tab

Source

pub fn refresh_shortcuts(&mut self)

Refresh every disk information. It also refreshes the disk list, which is usefull to detect removable medias. It may be very slow… There’s surelly a better way, like doing it only once in a while or on demand.

Source

pub fn disk_spaces_of_selected(&self) -> String

Returns the disk spaces for the selected tab..

Source

pub fn term_size(&self) -> Size

Returns the size of the terminal (width, height)

Source

pub fn term_width(&self) -> u16

Returns the width of the terminal window.

Source

pub fn clear_preview_right(&mut self)

Clears the right preview

Source

pub fn refresh_view(&mut self) -> Result<()>

Refresh the current view, reloading the files. Move the selection to top.

Source

pub fn reset_tabs_view(&mut self) -> Result<()>

Reset the view of every tab.

Source

pub fn leave_menu_mode(&mut self) -> Result<()>

Leave an edit mode and refresh the menu. It should only be called when edit mode isn’t nothing.

Source

pub fn leave_preview(&mut self) -> Result<()>

Leave the preview or flagged display mode. Should only be called when :

  1. No menu is opened

AND

  1. Display mode is preview or flagged.
Source

pub fn reset_menu_mode(&mut self) -> Result<bool>

Reset the edit mode to “Nothing” (closing any menu) and returns true if the display should be refreshed. If the menu is a picker for input history, it will reenter the caller menu. Example: Menu CD -> History of CDs <Esc> -> Menu CD

Source

pub fn refresh_status(&mut self) -> Result<()>

Reset the selected tab view to the default.

Source

pub fn force_clear(&mut self)

Set a “force clear” flag to true, which will reset the display. It’s used when some command or whatever may pollute the terminal. We ensure to clear it before displaying again.

Source

pub fn should_be_cleared(&self) -> bool

Source

pub fn refresh_users(&mut self) -> Result<()>

Refresh the users for every tab

Source

pub fn refresh_tabs(&mut self) -> Result<()>

Refresh the input, completion and every tab.

Source

pub fn resize(&mut self, width: u16, height: u16) -> Result<()>

When a rezise event occurs, we may hide the second panel if the width isn’t sufficiant to display enough information. We also need to know the new height of the terminal to start scrolling up or down.

Source

pub fn update_second_pane_for_preview(&mut self) -> Result<()>

Check if the second pane should display a preview and force it.

Source

pub fn thumbnail_directory_video(&mut self)

Build all the video thumbnails of a directory Build the the thumbnail manager if it hasn’t been initialised yet. If there’s still files in the queue, they’re cleared first.

Source

pub fn thumbnail_queue_clear(&self)

Clear the thumbnail queue

Source

pub fn check_preview(&mut self) -> Result<()>

Check if the previewer has sent a preview.

If the previewer has sent a preview, it’s attached to the correct tab. Returns an error if the previewer disconnected. Does nothing otherwise.

Source

pub fn should_tabs_images_be_cleared(&self) -> bool

Does any tab set its flag for image to be cleared on next display ?

Source

pub fn set_tabs_images_cleared(&mut self)

Reset the tab flags to false. Called when their image have be cleared.

Source

pub fn set_menu_mode(&mut self, index: usize, menu_mode: Menu) -> Result<()>

Set an edit mode for the tab at index. Refresh the view.

Source

pub fn set_menu_mode_no_refresh( &mut self, index: usize, menu_mode: Menu, ) -> Result<()>

Set the menu and without querying a refresh.

Source

pub fn set_height_for_menu_mode( &mut self, index: usize, menu_mode: Menu, ) -> Result<()>

Set the height of the menu and scroll to the selected item.

Source

pub fn set_dual_pane_if_wide_enough(&mut self) -> Result<()>

Set dual pane if the term is big enough

Source

pub fn clear_flags_and_reset_view(&mut self) -> Result<()>

Empty the flagged files, reset the view of every tab.

Source

pub fn flagged_in_current_dir(&self) -> Vec<PathBuf>

Returns a vector of path of files which are both flagged and in current directory. It’s necessary since the user may have flagged files OUTSIDE of current directory before calling Bulkrename. It may be confusing since the same filename can be used in different places.

Source

pub fn flag_all(&mut self)

Flag all files in the current directory or current tree.

Source

pub fn reverse_flags(&mut self)

Reverse every flag in current directory. Flagged files in other directory aren’t affected.

Source

pub fn toggle_flag_for_children(&mut self)

Flag all file (everything but directories) which are children of a directory.

Source

pub fn toggle_flag_for_selected(&mut self)

Flag the selected file if any

Source

pub fn jump_flagged(&mut self) -> Result<()>

Jumps to the selected flagged file.

Source

pub fn cut_or_copy_flagged_files(&mut self, cut_or_copy: CopyMove) -> Result<()>

Execute a move or a copy of the flagged files to current directory. A progress bar is displayed (invisible for small files) and a notification is sent every time, even for 0 bytes files…

Source

pub fn copy_next_file_in_queue(&mut self) -> Result<()>

Copy the next file in copy queue

Source

pub fn paste_input(&mut self, pasted: &str) -> Result<()>

Paste a text into an input box.

Source

pub fn paste_pathes(&mut self, pasted: &str) -> Result<()>

Paste a path a move or copy file in current directory.

Source

pub fn fuzzy_init(&mut self, kind: FuzzyKind)

Init the fuzzy finder

Source

pub fn fuzzy_find_files(&mut self) -> Result<()>

Sets the fuzzy finder to find files

Source

pub fn fuzzy_help(&mut self, help: String) -> Result<()>

Sets the fuzzy finder to match against help lines

Source

pub fn fuzzy_find_lines(&mut self) -> Result<()>

Sets the fuzzy finder to match against text file content

Source

pub fn fuzzy_select(&mut self) -> Result<()>

Action when a fuzzy item is selected. It depends of the kind of fuzzy: files / line: go to this file, help: execute the selected action.

Source

pub fn fuzzy_toggle_flag_selected(&mut self) -> Result<()>

Source

pub fn fuzzy_leave(&mut self) -> Result<()>

Exits the fuzzy finder and drops its instance

Source

pub fn fuzzy_backspace(&mut self) -> Result<()>

Deletes a char to the left in fuzzy finder.

Source

pub fn fuzzy_delete(&mut self) -> Result<()>

Delete all chars to the right in fuzzy finder.

Source

pub fn fuzzy_left(&mut self) -> Result<()>

Move cursor to the left in fuzzy finder

Source

pub fn fuzzy_right(&mut self) -> Result<()>

Move cursor to the right in fuzzy finder

Source

pub fn fuzzy_start(&mut self) -> Result<()>

Move selection to the start (top)

Source

pub fn fuzzy_end(&mut self) -> Result<()>

Move selection to the end (bottom)

Source

pub fn fuzzy_navigate(&mut self, direction: FuzzyDirection) -> Result<()>

Navigate to a FuzzyDirection.

Source

pub fn fuzzy_tick(&mut self)

Issue a tick to the fuzzy finder

Source

pub fn fuzzy_resize(&mut self, height: usize)

Resize the fuzzy finder according to given height

Source

pub fn input_history_next(&mut self) -> Result<()>

Replace the current input by the next result from history

Source

pub fn input_history_prev(&mut self) -> Result<()>

Replace the current input by the previous result from history

Source

pub fn input_and_complete( &mut self, input_completed: InputCompleted, c: char, ) -> Result<()>

Push the typed char c into the input string and fill the completion menu with results.

Source

pub fn complete(&mut self, input_completed: InputCompleted) -> Result<()>

Source

pub fn complete_tab(&mut self, input_completed: InputCompleted) -> Result<()>

Update the input string with the current selection and fill the completion menu with results.

Select the currently proposed item in search mode. This is usefull to allow the user to select an item when moving with up or down.

Source

pub fn complete_cd_move(&mut self) -> Result<()>

Move to the input path if possible.

Source

pub fn input_regex(&mut self, char: char) -> Result<()>

Update the flagged files depending of the input regex.

Source

pub fn flag_from_regex(&mut self) -> Result<()>

Flag every file matching a typed regex. Move to the “first” found match

Source

pub fn open_selected_file(&mut self) -> Result<()>

Open a the selected file with its opener

Source

pub fn open_single_file(&mut self, path: &Path) -> Result<()>

Opens the selected file (single)

Source

pub fn open_flagged_files(&mut self) -> Result<()>

Open every flagged file with their respective opener.

Source

pub fn umount_iso_drive(&mut self) -> Result<()>

Currently unused. Umount an iso device.

Source

pub fn mount_encrypted_drive(&mut self) -> Result<()>

Mount an encrypted device. If sudo password isn’t set, asks for it and returns, Else if device keypass isn’t set, asks for it and returns, Else, mount the device.

Source

pub fn umount_encrypted_drive(&mut self) -> Result<()>

Unmount the selected device. Will ask first for a sudo password which is immediatly forgotten.

Source

pub fn mount_normal_device(&mut self) -> Result<()>

Mount the selected encrypted device. Will ask first for sudo password and passphrase. Those passwords are always dropped immediatly after the commands are run.

Source

pub fn go_to_normal_drive(&mut self) -> Result<()>

Move to the selected device mount point.

Source

pub fn go_to_mount_per_index(&mut self, c: char) -> Result<()>

Move to the mount point based on its onscreen index

Source

pub fn umount_normal_device(&mut self) -> Result<()>

Unmount the selected device. Will ask first for a sudo password which is immediatly forgotten.

Source

pub fn eject_removable_device(&mut self) -> Result<()>

Ejects a removable device (usb key, mtp etc.).

Source

pub fn execute_shell_command_from_input(&mut self) -> Result<bool>

Reads and parse a shell command. Some arguments may be expanded. See crate::modes::shell_command_parser for more information.

Source

pub fn execute_shell_command( &mut self, shell_command: String, files: Option<Vec<String>>, capture_output: bool, ) -> Result<bool>

Parse and execute a shell command and expand tokens like %s, %t etc.

Source

pub fn execute_password_command( &mut self, action: Option<MountAction>, dest: PasswordUsage, ) -> Result<()>

Attach the typed password to the correct receiver and execute the command requiring a password.

Source

pub fn marks_new(&mut self, c: char) -> Result<()>

Execute a new mark, saving it to a config file for futher use.

Source

pub fn marks_jump_char(&mut self, c: char) -> Result<()>

Execute a jump to a mark, moving to a valid path. If the saved path is invalid, it does nothing but reset the view.

Source

pub fn temp_marks_new(&mut self, c: char) -> Result<()>

Execute a new temp mark, saving it temporary for futher use.

Source

pub fn temp_marks_erase(&mut self) -> Result<()>

Erase the current mark

Source

pub fn temp_marks_jump_char(&mut self, c: char) -> Result<()>

Execute a jump to a temporay mark, moving to a valid path. If the saved path is invalid, it does nothing but reset the view.

Source

pub fn confirm_delete_files(&mut self) -> Result<()>

Recursively delete all flagged files. If we try to delete the current root of the tab, nothing is deleted but a warning is displayed.

Source

pub fn confirm_trash_empty(&mut self) -> Result<()>

Empty the trash folder permanently.

Source

pub fn bulk_ask_filenames(&mut self) -> Result<()>

Ask the new filenames and set the confirmation mode.

Source

pub fn bulk_execute(&mut self) -> Result<()>

Execute a bulk create / rename

Source

pub fn confirm_bulk_action(&mut self) -> Result<()>

Execute the bulk action.

Source

pub fn dispatch_password( &mut self, action: Option<MountAction>, dest: PasswordUsage, sudo_command: Option<String>, ) -> Result<()>

Dispatch the known password depending of which component set the PasswordUsage.

Source

pub fn preview_command_output(&mut self, output: String, command: String)

Set the display to preview a command output

Source

pub fn update_nvim_listen_address(&mut self)

Set the nvim listen address from what the user typed.

Source

pub fn confirm( &mut self, c: char, confirmed_action: NeedConfirmation, ) -> Result<()>

Execute a command requiring a confirmation (Delete, Move or Copy). The action is only executed if the user typed the char y

Source

pub fn header_action(&mut self, col: u16, binds: &Bindings) -> Result<()>

Execute an action when the header line was clicked.

Source

pub fn footer_action(&mut self, col: u16, binds: &Bindings) -> Result<()>

Execute an action when the footer line was clicked.

Source

pub fn chmod(&mut self) -> Result<()>

Change permission of the flagged files. Once the user has typed an octal permission like 754, it’s applied to the file. Nothing is done if the user typed nothing or an invalid permission like 955.

Source

pub fn set_mode_chmod(&mut self) -> Result<()>

Enter the chmod mode where user can chmod a file.

Source

pub fn run_custom_command(&mut self, string: &str) -> Result<()>

Execute a custom event on the selected file

Source

pub fn compress(&mut self) -> Result<()>

Compress the flagged files into an archive. Compression method is chosen by the user. The archive is created in the current directory and is named “archive.tar.??” or “archive.zip”. Files which are above the CWD are filtered out since they can’t be added to an archive. Archive creation depends on CWD so we ensure it’s set to the selected tab.

Source

pub fn sort_by_char(&mut self, c: char) -> Result<()>

Sort all file in a tab with a sort key which is selected according to which char was pressed.

Source

pub fn canvas_width(&self) -> Result<u16>

The width of a displayed canvas.

Source

pub fn filter(&mut self) -> Result<()>

Set a new filter. Doesn’t reset the input.

Source

pub fn input_filter(&mut self, c: char) -> Result<()>

input the typed char and update the filterkind.

Source

pub fn open_picker(&mut self) -> Result<()>

Open the picker menu. Does nothing if already in a picker.

Source

pub fn cloud_load_config(&mut self) -> Result<()>

Load the selected cloud configuration file from the config folder and open navigation the menu.

Source

pub fn cloud_open(&mut self) -> Result<()>

Open the cloud menu. If no cloud has been selected yet, all cloud config file will be displayed. if a cloud has been selected, it will open it.

Source

pub fn cloud_disconnect(&mut self) -> Result<()>

Disconnect from the current cloud and open the picker

Source

pub fn cloud_enter_delete_mode(&mut self) -> Result<()>

Enter the delete mode and ask confirmation. Only the currently selected file can be deleted.

Source

pub fn cloud_confirm_delete(&mut self) -> Result<()>

Delete the selected file once a confirmation has been received from the user.

Source

pub fn cloud_update_metadata(&mut self) -> Result<()>

Update the metadata of the current file.

Source

pub fn cloud_enter_newdir_mode(&mut self) -> Result<()>

Ask the user to enter a name for the new directory.

Source

pub fn cloud_create_newdir(&mut self, dirname: String) -> Result<()>

Create the new directory in current path with the name the user entered.

Source

pub fn cloud_upload_selected_file(&mut self) -> Result<()>

Upload the current file (tree or directory mode) the the current remote path.

Source

pub fn cloud_enter_file_or_dir(&mut self) -> Result<()>

Enter a file (download it) or the directory (explore it).

Source

pub fn cloud_move_to_parent(&mut self) -> Result<()>

Move to the parent folder if possible. Nothing is done in the root folder.

Source

pub fn toggle_flag_visual(&mut self)

Source

pub fn parse_ipc(&mut self, msg: String) -> Result<()>

Parse and execute the received IPC message. IPC message can currently be of 3 forms:

  • GO <path> -> cd to this path and select the file.
  • KEY <key> -> act as if the key was pressed. <key> should be formated like in the config file.
  • ACTION <action> -> execute the action. Similar to :<action><Enter>. <action> should be formated like in the config file.

Other messages are ignored. Failed messages (path don’t exists, wrongly formated key or action) are ignored silently.

Auto Trait Implementations§

§

impl Freeze for Status

§

impl !RefUnwindSafe for Status

§

impl Send for Status

§

impl !Sync for Status

§

impl Unpin for Status

§

impl !UnwindSafe for Status

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeSend for T
where T: Send,