//! Lazy initialized urxvt scratch window. #![feature(std_misc)] extern crate i3; use std::env; use std::time::Duration; /// Used to identify the window. use i3::tree::get_win_property; /// Scratch related imports. use i3::scratch::{ScratchArgs, do_scratch, make_intent}; /// The command to start the application, started on a temporary workspace. /// Tells urxvt to use "urxvt-scratch" as its `instance`. static COMMAND: &'static str = "exec urxvt -name urxvt-scratch -geometry 148x51"; fn main() { do_scratch(&ScratchArgs { // i3 mark to use for the scratch window. mark: "urxvt-scratch", // startup command cmd: COMMAND, // Specify how to find the window on starup. // Return true when the window matches. match_win: &|w, _new| { // Identify using the `instance` of the window. get_win_property(w, "instance") == "urxvt-scratch" }, // Allow "show" "hide" or "toggle" as first command line argument. // Omitted argument means "toggle". intent: make_intent(env::args().skip(1).next().as_ref().map(|s| &s[..])), // Allow the window some time to resize on startup. delay_move: Some(Duration::milliseconds(20)) }).unwrap(); }