[][src]Trait i3status_rs::blocks::ConfigBlock

pub trait ConfigBlock: Block {
    type Config;
    fn new(
        id: usize,
        block_config: Self::Config,
        shared_config: SharedConfig,
        update_request: Sender<Task>
    ) -> Result<Self, Error>
    where
        Self: Sized
; fn override_on_click(&mut self) -> Option<&mut Option<String>> { ... } }

The ConfigBlock trait combines a constructor (new(...)) and an associated configuration type to form a block that can be instantiated from a piece of TOML (from the block configuration). The associated type has to be a deserializable struct, which you can then use to get your configurations from. The template shows you how to instantiate a simple Text widget. For more info on how to use widgets, just look into other Blocks. More documentation to come.

The sender object can be used to send asynchronous update request for any block from a separate thread, provide you know the Block's ID. This advanced feature can be used to reduce the number of system calls by asynchronously waiting for events. A usage example can be found in the Music block, which updates only when dbus signals a new song.

Associated Types

type Config[src]

Loading content...

Required methods

fn new(
    id: usize,
    block_config: Self::Config,
    shared_config: SharedConfig,
    update_request: Sender<Task>
) -> Result<Self, Error> where
    Self: Sized
[src]

Creates a new block from the relevant configuration.

Loading content...

Provided methods

fn override_on_click(&mut self) -> Option<&mut Option<String>>[src]

TODO: write documentation

Loading content...

Implementors

impl ConfigBlock for Apt[src]

type Config = AptConfig

impl ConfigBlock for Backlight[src]

type Config = BacklightConfig

impl ConfigBlock for Battery[src]

type Config = BatteryConfig

impl ConfigBlock for Bluetooth[src]

type Config = BluetoothConfig

impl ConfigBlock for Cpu[src]

type Config = CpuConfig

impl ConfigBlock for Custom[src]

type Config = CustomConfig

impl ConfigBlock for CustomDBus[src]

type Config = CustomDBusConfig

impl ConfigBlock for DiskSpace[src]

type Config = DiskSpaceConfig

impl ConfigBlock for Docker[src]

type Config = DockerConfig

impl ConfigBlock for FocusedWindow[src]

type Config = FocusedWindowConfig

impl ConfigBlock for Github[src]

type Config = GithubConfig

impl ConfigBlock for Hueshift[src]

type Config = HueshiftConfig

impl ConfigBlock for IBus[src]

type Config = IBusConfig

impl ConfigBlock for KDEConnect[src]

type Config = KDEConnectConfig

impl ConfigBlock for KeyboardLayout[src]

type Config = KeyboardLayoutConfig

impl ConfigBlock for Load[src]

type Config = LoadConfig

impl ConfigBlock for Memory[src]

type Config = MemoryConfig

impl ConfigBlock for Music[src]

type Config = MusicConfig

impl ConfigBlock for Net[src]

type Config = NetConfig

impl ConfigBlock for NetworkManager[src]

type Config = NetworkManagerConfig

impl ConfigBlock for Notify[src]

type Config = NotifyConfig

impl ConfigBlock for NvidiaGpu[src]

type Config = NvidiaGpuConfig

impl ConfigBlock for Pacman[src]

type Config = PacmanConfig

impl ConfigBlock for Pomodoro[src]

type Config = PomodoroConfig

impl ConfigBlock for Sound[src]

type Config = SoundConfig

impl ConfigBlock for SpeedTest[src]

type Config = SpeedTestConfig

impl ConfigBlock for Taskwarrior[src]

type Config = TaskwarriorConfig

impl ConfigBlock for Temperature[src]

type Config = TemperatureConfig

impl ConfigBlock for Template[src]

type Config = TemplateConfig

impl ConfigBlock for Time[src]

type Config = TimeConfig

impl ConfigBlock for Toggle[src]

type Config = ToggleConfig

impl ConfigBlock for Uptime[src]

type Config = UptimeConfig

impl ConfigBlock for Watson[src]

type Config = WatsonConfig

impl ConfigBlock for Weather[src]

type Config = WeatherConfig

impl ConfigBlock for Xrandr[src]

type Config = XrandrConfig

Loading content...