pub struct WindowFilter {
pub window_index: IntegerRange,
pub desktop_index: IntegerRange,
pub window_title: TextPattern,
pub process_name: TextPattern,
pub action: FilterAction,
pub target_desktop: i64,
}
Expand description
Specifies how to filter all windows to select a subset and also what action should be applied to the selected windows.
Fields§
§window_index: IntegerRange
This index is lower if the window was recently accessed. Limiting this index is therefore a way to only affect recently used windows.
Note: uses zero-based indexing.
desktop_index: IntegerRange
The index of the virtual desktop that window should be on. If the window is pinned then that is always allowed.
Note: uses zero-based indexing.
window_title: TextPattern
The text in the title bar of a window.
process_name: TextPattern
The name of the process that created and owns a window.
action: FilterAction
The action to preform on windows that match all the conditions in this filter.
target_desktop: i64
If the action specifies that the window should move then this specifies the desktop it should be moved to.
Note: uses zero-based indexing.
Implementations§
Source§impl WindowFilter
impl WindowFilter
pub fn deserialize_from_xml(xml: &str) -> Result<Vec<Self>, Box<dyn Error>>
pub fn serialize_to_xml( filters: &[WindowFilter], ) -> Result<String, Box<dyn Error>>
pub fn find_first_action<'a>( filters: &'a [Self], window_index: i32, window: &WindowInfo, ) -> Option<&'a Self>
Sourcepub fn check_window(&self, window_index: i32, window: &WindowInfo) -> bool
pub fn check_window(&self, window_index: i32, window: &WindowInfo) -> bool
Check if this filter/rule applies to a specific widow.
The window_index
should use zero-based indexing.
Sourcepub fn display_target_desktop(&self) -> impl Display
pub fn display_target_desktop(&self) -> impl Display
Display a short string with information about the action and the targeted desktop. (Displays target desktop with one-based indexing.)
Trait Implementations§
Source§impl Clone for WindowFilter
impl Clone for WindowFilter
Source§fn clone(&self) -> WindowFilter
fn clone(&self) -> WindowFilter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for WindowFilter
impl Debug for WindowFilter
Source§impl Default for WindowFilter
impl Default for WindowFilter
Source§fn default() -> WindowFilter
fn default() -> WindowFilter
Source§impl<'de> Deserialize<'de> for WindowFilter
impl<'de> Deserialize<'de> for WindowFilter
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for WindowFilter
impl Ord for WindowFilter
Source§fn cmp(&self, other: &WindowFilter) -> Ordering
fn cmp(&self, other: &WindowFilter) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for WindowFilter
impl PartialEq for WindowFilter
Source§impl PartialOrd for WindowFilter
impl PartialOrd for WindowFilter
Source§impl Serialize for WindowFilter
impl Serialize for WindowFilter
impl Eq for WindowFilter
impl StructuralPartialEq for WindowFilter
Auto Trait Implementations§
impl Freeze for WindowFilter
impl RefUnwindSafe for WindowFilter
impl Send for WindowFilter
impl Sync for WindowFilter
impl Unpin for WindowFilter
impl UnwindSafe for WindowFilter
Blanket Implementations§
§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
§impl<T> ConvUtil for T
impl<T> ConvUtil for T
§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Source§impl<T> DynWithDefault for T
impl<T> DynWithDefault for T
Source§fn with_default_mut(
&mut self,
f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut (dyn Any + 'static)),
)
fn with_default_mut( &mut self, f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut (dyn Any + 'static)), )
self
and the second argument
is the new temporary default value. The callback can then modify the
value as needed.Source§fn clear_and_inspect_old(
&mut self,
f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut (dyn Any + 'static)),
)
fn clear_and_inspect_old( &mut self, f: &mut dyn FnMut(&mut dyn DynWithDefault, &mut (dyn Any + 'static)), )
self
to a new default value and inspect the previous value as the
second argument to the callback.fn clear(&mut self)
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.