Actually react to urgency and impove default config

timeout_old
Tassilo Horn 3 years ago
parent c3764926c5
commit 41199b2f09
  1. 18
      src/con.rs
  2. 20
      src/config.rs

@ -149,8 +149,22 @@ impl<'a> DisplayFormat for Window<'a> {
}); });
fmt.replace("{id}", format!("{}", self.get_id()).as_str()) fmt.replace("{id}", format!("{}", self.get_id()).as_str())
.replace("{urgency_start}", urgency_start.as_str()) .replace(
.replace("{urgency_end}", urgency_end.as_str()) "{urgency_start}",
if self.is_urgent() {
urgency_start.as_str()
} else {
""
},
)
.replace(
"{urgency_end}",
if self.is_urgent() {
urgency_end.as_str()
} else {
""
},
)
.replace("{app_name}", self.get_app_name()) .replace("{app_name}", self.get_app_name())
.replace( .replace(
"{workspace_name}", "{workspace_name}",

@ -28,12 +28,12 @@ impl Default for Config {
}), }),
format: Some(Format { format: Some(Format {
window_format: Some( window_format: Some(
"\"{title}\"\t{app_name} on workspace {workspace_name}\t({id})" "{urgency_start}<b>“{title}”</b>{urgency_end}\t<i>{app_name}</i> on workspace {workspace_name}\t<span alpha=\"20000\">({id})</span>"
.to_string(), .to_string(),
), ),
workspace_format: Some("Workspace {name}\t({id})".to_string()), workspace_format: Some("<b>Workspace {name}</b>\t<span alpha=\"20000\">({id})</span>".to_string()),
urgency_start: Some(String::new()), urgency_start: Some("<span background=\"darkred\" foreground=\"yellow\">".to_string()),
urgency_end: Some(String::new()) urgency_end: Some("</span>".to_string())
}), }),
} }
} }
@ -84,13 +84,19 @@ pub fn load_config() -> Config {
save_config(Config::default()); save_config(Config::default());
// Tell the user that a fresh default config has been created. // Tell the user that a fresh default config has been created.
std::process::Command::new("swaynag") std::process::Command::new("swaynag")
.arg("--background")
.arg("00FF44")
.arg("--text")
.arg("0000CC")
.arg("--message") .arg("--message")
.arg( .arg(
"Welcome to swayr. ".to_owned() "Welcome to swayr! ".to_owned()
+ "I've created a fresh (but boring) config for you in " + "I've created a fresh config for use with wofi for you in "
+ &path.to_string_lossy() + &path.to_string_lossy()
+ ".", + ". Adapt it to your needs.",
) )
.arg("--type")
.arg("warning")
.arg("--dismiss-button") .arg("--dismiss-button")
.arg("Thanks!") .arg("Thanks!")
.spawn() .spawn()

Loading…
Cancel
Save