pub struct Item { /* private fields */ }
Expand description
An Alfred script filter item.
Implementations
sourceimpl Item
impl Item
sourcepub fn uid(self, uid: impl Into<String>) -> Self
pub fn uid(self, uid: impl Into<String>) -> Self
Set the UID for this item.
This is a unique identifier for the item which allows help Alfred to learn about this item for subsequent sorting and ordering of the user’s actioned results.
It is important that you use the same UID throughout subsequent executions of your script to take advantage of Alfred’s knowledge and sorting. If you would like Alfred to always show the results in the order you return them from your script, exclude the UID field.
sourcepub fn arg(self, arg: impl Into<String>) -> Self
pub fn arg(self, arg: impl Into<String>) -> Self
Set the argument which is passed through the workflow to the connected output action.
While this attribute is optional, it’s highly recommended that you populate this as it’s the string which is passed to your connected output actions. If excluded, you won’t know which result item the user has selected.
sourcepub fn icon(self, icon: Icon) -> Self
pub fn icon(self, icon: Icon) -> Self
Set the icon displayed in the result row.
Workflows are run from their workflow folder, so you can reference icons stored in your workflow relatively.
sourcepub fn valid(self, valid: bool) -> Self
pub fn valid(self, valid: bool) -> Self
Set whether this item is valid or not.
If an item is valid then Alfred will action this item when the user presses return. If the item is not valid, Alfred will do nothing. This allows you to intelligently prevent Alfred from actioning a result based on the current query passed into your script.
If you exclude the valid attribute, Alfred assumes that your item is valid.
sourcepub fn matches(self, matches: impl Into<String>) -> Self
pub fn matches(self, matches: impl Into<String>) -> Self
Set the text that Alfred will match against.
This field enables you to define what Alfred matches against when the workflow is set to “Alfred Filters Results”. If match is present, it fully replaces matching on the title property.
Note that the match field is always treated as case insensitive, and intelligently treated as diacritic insensitive. If the search query contains a diacritic, the match becomes diacritic sensitive.
sourcepub fn autocomplete(self, autocomplete: impl Into<String>) -> Self
pub fn autocomplete(self, autocomplete: impl Into<String>) -> Self
Set the autocomplete value for this item.
An optional but recommended string you can provide which is populated into Alfred’s search field if the user auto-complete’s the selected result (⇥ by default).
sourcepub fn copy_text(self, copy: impl Into<String>) -> Self
pub fn copy_text(self, copy: impl Into<String>) -> Self
Set the text the user will get when copying the selected result row with ⌘C or displaying large type with ⌘L.
If these are not defined, you will inherit Alfred’s standard behaviour where the arg is copied to the Clipboard or used for Large Type.
sourcepub fn large_type_text(self, large_type: impl Into<String>) -> Self
pub fn large_type_text(self, large_type: impl Into<String>) -> Self
Set the text the user will get when displaying large type with ⌘L.
If this is not defined, you will inherit Alfred’s standard behaviour where the arg is used for Large Type.
sourcepub fn quicklook_url(self, quicklook_url: impl Into<String>) -> Self
pub fn quicklook_url(self, quicklook_url: impl Into<String>) -> Self
Set the Quick Look URL for the item.
This will be visible if the user uses the Quick Look feature within Alfred (tapping shift, or ⌘Y). This field will also accept a file path, both absolute and relative to home using ~/.
If absent, Alfred will attempt to use the arg as the quicklook URL.
sourcepub fn modifier(self, modifier: Modifier) -> Self
pub fn modifier(self, modifier: Modifier) -> Self
Add a modifier key configuration.
This gives you control over how the modifier keys react. For example you can define the valid attribute to mark if the result is valid based on the modifier selection and set a different arg to be passed out if actioned with the modifier.
Trait Implementations
impl Eq for Item
impl StructuralEq for Item
impl StructuralPartialEq for Item
Auto Trait Implementations
impl RefUnwindSafe for Item
impl Send for Item
impl Sync for Item
impl Unpin for Item
impl UnwindSafe for Item
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more