Add weechet and hera
This commit is contained in:
parent
3fc85de877
commit
0bd3b5c406
|
@ -4,7 +4,7 @@ extern crate task_hookrs;
|
|||
extern crate error_chain;
|
||||
|
||||
use std::rc::Rc;
|
||||
use rust_scripts::hotkeys::{run, term, menu, main_loop, Next};
|
||||
use rust_scripts::hotkeys::{run, run_cmd, term, menu, main_loop, Next};
|
||||
use rust_scripts::kassandra::{kassandra, change_state, new_tasks};
|
||||
use rust_scripts::error::Result;
|
||||
|
||||
|
@ -53,6 +53,17 @@ quick_main!(|| -> Result<()> {
|
|||
"Messaging",
|
||||
vec![
|
||||
run("Mails", "evolution"),
|
||||
run_cmd(
|
||||
"Weechat",
|
||||
vec![
|
||||
"st".into(),
|
||||
"-e".into(),
|
||||
"ssh".into(),
|
||||
"-t".into(),
|
||||
"hera".into(),
|
||||
"tmux -L weechat attach".into(),
|
||||
]
|
||||
),
|
||||
run("Riot", "firefox --new-window https://riot.im/app"),
|
||||
run("WhatsApp", "firefox --new-window https://web.whatsapp.com"),
|
||||
run("Telegram", "telegram-desktop"),
|
||||
|
@ -91,6 +102,7 @@ quick_main!(|| -> Result<()> {
|
|||
vec![
|
||||
run("neo", "setxkbmap de neo"),
|
||||
run("qwertz", "setxkbmap de"),
|
||||
run("qwerty", "setxkbmap us"),
|
||||
],
|
||||
);
|
||||
let monitor = term("Monitor", "htop");
|
||||
|
@ -122,6 +134,7 @@ quick_main!(|| -> Result<()> {
|
|||
("kitchen", "kitchen"),
|
||||
("vorstand", "vorstand"),
|
||||
("shells", "shells"),
|
||||
("hera", "hera"),
|
||||
("charon", "charon"),
|
||||
].into_iter()
|
||||
.map(|(name, login)| term(name, &format!("ssh {}", login)))
|
||||
|
|
|
@ -20,6 +20,17 @@ pub fn run<T: Into<String>>(name: T, command: &str) -> Item {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn run_cmd<T: Into<String>>(name: T, command: Command) -> Item {
|
||||
(
|
||||
name.into(),
|
||||
Do(Rc::new(move || {
|
||||
mk_cmd(command.clone()).exec();
|
||||
Ok(Exit)
|
||||
})),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
pub fn term_cmd(command: &str) -> String {
|
||||
format!(
|
||||
"{} -e {}",
|
||||
|
|
|
@ -78,11 +78,22 @@ enum Location {
|
|||
Anywhere,
|
||||
}
|
||||
|
||||
#[derive(Copy, Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
||||
enum MPD {
|
||||
#[serde(rename = "apollo")]
|
||||
Apollo,
|
||||
#[serde(rename = "whisky")]
|
||||
Whisky,
|
||||
#[serde(rename = "kitchen")]
|
||||
Kitchen,
|
||||
}
|
||||
|
||||
#[derive(Copy, Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
||||
struct State {
|
||||
mode: Mode,
|
||||
location: Location,
|
||||
connectivity: Connectivity,
|
||||
mpd: MPD,
|
||||
}
|
||||
|
||||
fn task_blocked(cache: &TaskCache, task: &Task) -> bool {
|
||||
|
@ -126,17 +137,19 @@ fn get_state() -> Result<State> {
|
|||
s.push(".kassandra_state");
|
||||
s
|
||||
};
|
||||
Ok(if let Ok(state_file) = File::open(&state_path) {
|
||||
from_reader(state_file)?
|
||||
} else {
|
||||
if let Ok(state_file) = File::open(&state_path) {
|
||||
if let Ok(state) = from_reader(state_file) {
|
||||
return Ok(state);
|
||||
}
|
||||
}
|
||||
let state = State {
|
||||
mode: Mode::Orga,
|
||||
connectivity: Connectivity::Online,
|
||||
location: Location::Anywhere,
|
||||
mpd: MPD::Apollo,
|
||||
};
|
||||
save_state(&state)?;
|
||||
state
|
||||
})
|
||||
Ok(state)
|
||||
}
|
||||
|
||||
fn enter_new_task<T: DialogProvider, S: Into<String>>(dialog: &mut T, msg: S) -> Result<Task> {
|
||||
|
|
|
@ -74,10 +74,7 @@ pub fn update_tasks(cache: &mut TaskCache) -> Result<()> {
|
|||
"Sortiere Inbox Auslandskoordination",
|
||||
"Sortiere Inbox Kiva",
|
||||
"Update nixos apollo",
|
||||
"Update home apollo",
|
||||
"Update home fb4",
|
||||
"Update home hera",
|
||||
"Update home charon",
|
||||
"Update home hephaistos",
|
||||
"Klavier üben",
|
||||
]),
|
||||
daily(),
|
||||
|
|
Loading…
Reference in a new issue