Skip to main content

ActivitySpec

Struct ActivitySpec 

Source
pub struct ActivitySpec {
Show 15 fields pub key: Option<String>, pub compact: String, pub expanded: Option<String>, pub expand_for: Option<Duration>, pub payload: Value, pub priority: Priority, pub timeout: Option<Duration>, pub interruptible: bool, pub same_priority: SamePriority, pub modal: bool, pub overlay: Option<String>, pub passive: bool, pub fleeting: bool, pub over_fullscreen: bool, pub output: Option<String>,
}
Expand description

Everything a module says about an activity it wants to show.

As JSON, only compact is required, and durations are milliseconds: {"compact": "Timer", "timeout_ms": 4000}.

Fields§

§key: Option<String>

Replaces the module’s existing activity with the same key.

§compact: String

View shown by default: modules/<module>/<compact>.qml.

§expanded: Option<String>

View shown after a click. Without one, clicks go to the module.

§expand_for: Option<Duration>

Opens on the expanded view for this long, then collapses.

§payload: Value

What the views get as payload.

§priority: Priority

Who shows first, and who interrupts whom.

§timeout: Option<Duration>

Time on screen before the activity ends. None never times out.

§interruptible: bool

Whether a higher priority may interrupt it. Priority::TOP interrupts anything.

§same_priority: SamePriority

What it does when the shown activity has the same priority.

§modal: bool

Takes the keyboard while shown; a click outside the island dismisses it.

§overlay: Option<String>

A full-screen view under the island on every monitor.

§passive: bool

Never closes on a click outside, for feedback like the volume OSD that shows while the user is busy elsewhere.

§fleeting: bool

Shown at once or not at all, never queued or suspended: feedback like the volume OSD is stale by the time it would come back.

§over_fullscreen: bool

Shows over a fullscreen window, like a game, which hides the island otherwise. A modal activity shows there without it. For feedback on something the user just did, like a screenshot or a volume key.

§output: Option<String>

The monitor a modal activity shows on. The daemon picks one from [island] panels when the module leaves it out.

Implementations§

Source§

impl ActivitySpec

Source

pub fn new(compact: impl Into<String>) -> Self

A normal-priority, interruptible activity with no timeout.

Source

pub fn key(self, key: impl Into<String>) -> Self

Replaces the module’s activity with the same key, wherever it is, instead of adding one. With the same view too, the view updates in place.

Source

pub fn expanded(self, view: impl Into<String>) -> Self

The view a click opens. Without one, clicks go to the module as Clicked.

Source

pub fn expand_for(self, duration: Duration) -> Self

Opens on the expanded view, which needs one, and collapses after duration on screen. A keyed replacement that sets it again opens it again.

Source

pub fn payload(self, payload: Value) -> Self

What the views get as payload.

Source

pub fn priority(self, priority: Priority) -> Self

See Priority; Priority::NORMAL by default.

Source

pub fn timeout(self, timeout: Duration) -> Self

Ends it after this long on screen. The time only runs while it’s shown, not hovered and not expanded.

Source

pub fn uninterruptible(self) -> Self

Nothing below Priority::TOP interrupts it.

Source

pub fn modal(self) -> Self

For views that take typing, like a launcher.

Source

pub fn overlay(self, view: impl Into<String>) -> Self

Draws view over every monitor, under the island, while the activity shows: modules/<module>/<view>.qml, which gets the payload and its screen. Makes the activity modal. The island waits to show the activity until the overlay’s ready property is true, so an overlay can capture the screen before the island changes.

Source

pub fn passive(self) -> Self

Never closes on a click outside: see ActivitySpec::passive.

Source

pub fn fleeting(self) -> Self

Never waits behind another activity: see ActivitySpec::fleeting.

Source

pub fn over_fullscreen(self) -> Self

Shows over a fullscreen window: see ActivitySpec::over_fullscreen.

Source

pub fn output(self, output: impl Into<String>) -> Self

Shows the activity on this monitor’s island only, whatever [island] panels or notices say. Each monitor has an island of its own, so it waits only behind what that one shows.

Source

pub fn same_priority(self, rule: SamePriority) -> Self

SamePriority::Queue by default.

Trait Implementations§

Source§

impl Clone for ActivitySpec

Source§

fn clone(&self) -> ActivitySpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ActivitySpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ActivitySpec

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ActivitySpec

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ActivitySpec

Source§

fn eq(&self, other: &ActivitySpec) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ActivitySpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ActivitySpec

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.