Compare commits

..

No commits in common. "258d4639d7942a6e05325ca0b89b430abcb736ae" and "867514362a982a93029e730be49e53a9517b6bfc" have entirely different histories.

15 changed files with 70 additions and 1079 deletions

1
.gitignore vendored
View file

@ -2,4 +2,3 @@ result
.direnv/ .direnv/
programs/*/target programs/*/target
target target
*openapi.json

927
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
[workspace] [workspace]
resolver = "2" resolver = "2"
members = [ "programs/bar-pinger", "programs/bar-ws-monitor", members = [ "programs/bar-ws-monitor",
"programs/jrnl" "programs/jrnl"
, "programs/traveldings"] ]

View file

@ -87,8 +87,6 @@
])) ]))
rs-toolchain rs-toolchain
pkgs.haskell-language-server pkgs.haskell-language-server
pkgs.pkg-config
pkgs.openssl
]; ];
}; };
nixosConfigurations = { nixosConfigurations = {

View file

@ -1,3 +1,7 @@
.topBar {
margin-bottom: 2px;
}
label { label {
font: 14pt "FiraCode Nerd Font"; font: 14pt "FiraCode Nerd Font";
} }

View file

@ -6,7 +6,6 @@
}: { }: {
programs.wofi.enable = true; programs.wofi.enable = true;
programs.swaylock.enable = true; programs.swaylock.enable = true;
services.network-manager-applet.enable = true;
xdg.portal = { xdg.portal = {
enable = true; enable = true;
@ -65,7 +64,11 @@
}; };
startup = [ startup = [
{ {
command = "eww open-many topBar bottomBar"; command = "eww open topBar; eww open bottomBar";
}
{
command = "pkill nm-applet; sleep 1 && nm-applet";
always = true;
} }
{ {
command = "sleep 1 && mullvad-gui"; command = "sleep 1 && mullvad-gui";
@ -74,16 +77,6 @@
bars = []; bars = [];
menu = "wofi -d"; menu = "wofi -d";
modifier = "Mod4"; modifier = "Mod4";
assigns = {
"1" = [
{class = "^Signal$";}
{class = "^Element$";}
{class = "^Evolution$";}
];
"2" = [
{app_id = "^firefox$";}
];
};
keybindings = with { keybindings = with {
#mod = config.xsession.windowManager.i3.config.modifier; #mod = config.xsession.windowManager.i3.config.modifier;
# mod = "Mod1"; # mod = "Mod1";
@ -119,6 +112,14 @@
# rofi fuckery # rofi fuckery
"${mod}+d" = "exec wofi -S drun --allow-images"; "${mod}+d" = "exec wofi -S drun --allow-images";
"${mod}+i" = "exec rofimoji --selector wofi -f alchemical_symbols anatolian_hieroglyphs emojis braille_patterns box_drawing chess_symbols emoticons geometric_shapes gothic greek_extended math mathematical_alphanumeric_symbols mathematical_operators miscellaneous_symbols miscellaneous_mathematical_symbols-a miscellaneous_mathematical_symbols-b miscellaneous_symbols_and_arrows miscellaneous_symbols_and_pictographs miscellaneous_technical modi modifier_tone_letters musical_symbols nerd_font number_forms shorthand_format_controls specials variation_selectors vertical_forms -a copy"; "${mod}+i" = "exec rofimoji --selector wofi -f alchemical_symbols anatolian_hieroglyphs emojis braille_patterns box_drawing chess_symbols emoticons geometric_shapes gothic greek_extended math mathematical_alphanumeric_symbols mathematical_operators miscellaneous_symbols miscellaneous_mathematical_symbols-a miscellaneous_mathematical_symbols-b miscellaneous_symbols_and_arrows miscellaneous_symbols_and_pictographs miscellaneous_technical modi modifier_tone_letters musical_symbols nerd_font number_forms shorthand_format_controls specials variation_selectors vertical_forms -a copy";
# TODO: wayland
# "${mod}+d" = "exec --no-startup-id rofi -show drun -theme ${../../other/rofi-themes/applauncher.rasi}";
# "${mod}+space" = "exec --no-startup-id rofi -show combi -combi-show window#run -modes combi -theme ${../../other/rofi-themes/applauncher.rasi}";
# "${mod}+i" = "exec --no-startup-id rofimoji -f alchemical_symbols anatolian_hieroglyphs emojis braille_patterns box_drawing chess_symbols emoticons geometric_shapes gothic greek_extended math mathematical_alphanumeric_symbols mathematical_operators miscellaneous_symbols miscellaneous_mathematical_symbols-a miscellaneous_mathematical_symbols-b miscellaneous_symbols_and_arrows miscellaneous_symbols_and_pictographs miscellaneous_technical modi modifier_tone_letters musical_symbols nerd_font number_forms shorthand_format_controls specials variation_selectors vertical_forms -a copy";
# "${mod}+Shift+e" = "exec --no-startup-id rofi -show \"desktopctl\" -modes \"desktopctl:${desktop-ctl.outPath}/bin/desktopctl\" -theme ${../../other/rofi-themes/applauncher.rasi}";
# "${mod}+m" = "exec --no-startup-id menu-qalc";
# "${mod}+o" = "exec --no-startup-id rofi -show searchwolf -modes \"searchwolf:${searchwolf.outPath}/bin/searchwolf\"";
# audio # audio
"XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status"; "XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status";
@ -137,11 +138,16 @@
"XF86KbdBrightnessUp" = "exec brillo -kA 10.0"; "XF86KbdBrightnessUp" = "exec brillo -kA 10.0";
"XF86KbdBrightnessDown" = "exec brillo -kU 10.0"; "XF86KbdBrightnessDown" = "exec brillo -kU 10.0";
# macros
# "${mod}+q" = "exec em-record.sh";
# "${mod}+p" = "exec em-play.sh";
# "${mod}+Shift+p" = "exec em-play-loop.sh";
# permaclip
# "${mod}+c" = "exec rofi -show register -modes \"register:${pc-set.outPath}/bin/pc-set.sh\" -theme gruvbox-dark";
# "${mod}+v" = "exec rofi -show register -modes \"register:${pc-get.outPath}/bin/pc-get.sh\" -theme gruvbox-dark";
}; };
workspaceAutoBackAndForth = true;
focus = {
wrapping = "yes";
};
fonts = { fonts = {
names = ["Atkinson Hyperlegible"]; names = ["Atkinson Hyperlegible"];
style = "Regular"; style = "Regular";

View file

@ -51,7 +51,6 @@ def main [] {
let next_events = open ~/Docs/dates.csv let next_events = open ~/Docs/dates.csv
| update datetime {|ev| $ev.datetime | into datetime } | update datetime {|ev| $ev.datetime | into datetime }
| sort-by datetime | sort-by datetime
| filter {|ev| ($ev.datetime > (date now))}
| first | first
| each {|ev| $"(ansi attr_bold)($ev.event)(ansi reset) in (ansi attr_bold)(tfmt ($ev.datetime - (date now)))s(ansi reset)" }; | each {|ev| $"(ansi attr_bold)($ev.event)(ansi reset) in (ansi attr_bold)(tfmt ($ev.datetime - (date now)))s(ansi reset)" };
print $"Hi jade, you're on HRT for (ansi reset)(ansi attr_bold)((date now) - ('2024-02-18T20:53' | into datetime) | format duration month)s(ansi reset) now! | Next Event: ($next_events)"; print $"Hi jade, you're on HRT for (ansi reset)(ansi attr_bold)((date now) - ('2024-02-18T20:53' | into datetime) | format duration month)s(ansi reset) now! | Next Event: ($next_events)";

View file

@ -1,6 +0,0 @@
[package]
name = "bar-pinger"
version = "0.1.0"
edition = "2021"
[dependencies]

View file

@ -1,5 +0,0 @@
// const ADDRS: [&str] = ["katzen.cafe", "fucktorio.s10e.de", "9.9.9.9"];
fn main() {
// let pingers = ADDRS.iter.map(|addr| Command::new("ping").args([addr]));
}

View file

@ -1,13 +0,0 @@
[package]
name = "traveldings"
version = "0.1.0"
edition = "2021"
[dependencies]
serde = { version = "1.0.209", features = ["derive"] }
serde_json = "1.0.128"
reqwest = {version = "0.12.7", default-features = false, features = ["rustls-tls", "charset", "http2"]}
tokio = { version = "1", features = ["full"] }
anyhow = "1"
chrono = { version = "0.4", features = ["serde"]}
clap = { version = "4.5", features = ["derive"]}

View file

@ -1 +0,0 @@
pub mod current_journey;

View file

@ -1,9 +0,0 @@
use crate::traewelling::TraewellingClient;
pub async fn get_current_journey() -> anyhow::Result<()> {
let client = TraewellingClient::new()?;
println!("active: {:#?}", client.get_active_checkin().await?);
Ok(())
}

View file

@ -1,35 +0,0 @@
use std::{default, fs};
use clap::{Parser, Subcommand};
use commands::current_journey::get_current_journey;
use reqwest::{
header::{self, HeaderMap},
ClientBuilder,
};
use traewelling::model::{Container, Status};
mod commands;
mod traewelling;
#[derive(Parser)]
struct Cli {
#[command(subcommand)]
subcommand: Subcommands,
}
#[derive(Subcommand, Clone)]
enum Subcommands {
/// Watch for a current journey and give out json info about it
Current,
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let args = Cli::parse();
match args.subcommand {
Subcommands::Current => get_current_journey().await?,
};
Ok(())
}

View file

@ -1,56 +0,0 @@
use std::{fmt, fs};
use model::{Container, Status};
use reqwest::{
header::{self, HeaderMap},
Client, ClientBuilder,
};
const KEY_PATH: &str = "/home/jade/Docs/traveldings-key";
const USER_AGENT: &str = "s10e/traveldings";
const TRAEWELLING_API_URL: &str = "https://traewelling.de/api/v1";
pub struct TraewellingClient {
client: Client,
}
impl TraewellingClient {
pub fn new() -> anyhow::Result<Self> {
let mut headers = HeaderMap::new();
let token = fs::read_to_string(KEY_PATH)?;
let key = header::HeaderValue::from_str(&format!("Bearer {token}"))?;
println!("meow");
headers.insert("Authorization", key);
headers.insert(
header::ACCEPT,
header::HeaderValue::from_static("application/json"),
);
Ok(Self {
client: ClientBuilder::new()
.user_agent("s10e/traveldings")
.default_headers(headers)
.build()?,
})
}
pub async fn get_active_checkin(&self) -> anyhow::Result<Status> {
let txt = self
.client
.get(Self::fmt_url("user/statuses/active"))
.send()
.await?
.text()
.await?;
println!("{txt}");
let res: Container<Status> = serde_json::de::from_str(&txt)?;
Ok(res.data)
}
fn fmt_url(path: impl fmt::Display) -> String {
format!("{TRAEWELLING_API_URL}/{path}")
}
}
pub mod model;

View file

@ -1,47 +0,0 @@
use chrono::{DateTime, FixedOffset};
use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct Container<D> {
pub data: D,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Status {
train: TransportResource,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct TransportResource {
category: String,
line_name: String,
distance: u32,
duration: u32,
operator: OperatorResource,
origin: StopOverResource,
destination: StopOverResource,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct StopOverResource {
name: String,
ril_identifier: Option<String>,
arrival: Option<DateTime<FixedOffset>>,
arrival_planned: Option<DateTime<FixedOffset>>,
arrival_real: Option<DateTime<FixedOffset>>,
departure: Option<DateTime<FixedOffset>>,
departure_planned: Option<DateTime<FixedOffset>>,
departure_real: Option<DateTime<FixedOffset>>,
platform: Option<String>,
departure_platform_planned: Option<String>,
departure_platform_real: Option<String>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct OperatorResource {
name: String,
}