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