repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-cli/src/node.rs | libs/gl-cli/src/node.rs | use crate::error::{Error, Result};
use crate::model;
use crate::util::{self, CREDENTIALS_FILE_NAME};
use clap::Subcommand;
use futures::stream::StreamExt;
use gl_client::pb::StreamLogRequest;
use gl_client::{bitcoin::Network, pb::cln};
use std::path::Path;
pub struct Config<P: AsRef<Path>> {
pub data_dir: P,
p... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-cli/src/lib.rs | libs/gl-cli/src/lib.rs | use crate::error::Result;
use clap::{Parser, Subcommand};
use gl_client::bitcoin::Network;
use std::{path::PathBuf, str::FromStr};
mod error;
pub mod model;
mod node;
mod scheduler;
mod signer;
mod util;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub struct Cli {
/// The directo... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-cli/src/error.rs | libs/gl-cli/src/error.rs | // -- Contains errors and formating for errors.
use crate::util;
pub type Result<T, E = Error> = core::result::Result<T, E>;
#[derive(thiserror::Error, core::fmt::Debug)]
pub enum Error {
#[error("{0}")]
Custom(String),
#[error("Seed not found: {0}")]
SeedNotFoundError(String),
#[error("Credenti... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-cli/src/util.rs | libs/gl-cli/src/util.rs | use dirs;
use gl_client::bitcoin::secp256k1::rand::{self, RngCore};
use gl_client::credentials;
use std::path::PathBuf;
use std::{
fs::{self, File},
io::Write,
path::Path,
};
use thiserror;
pub const SEED_FILE_NAME: &str = "hsm_secret";
pub const CREDENTIALS_FILE_NAME: &str = "credentials.gfs";
pub const D... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-cli/src/model.rs | libs/gl-cli/src/model.rs | use gl_client::pb::cln::{self, amount_or_any};
#[derive(Debug, Clone)]
enum AmountOrAnyValue {
Any,
Amount(u64),
}
#[derive(Debug, Clone)]
pub struct AmountOrAny {
value: AmountOrAnyValue,
}
impl From<&str> for AmountOrAny {
fn from(value: &str) -> Self {
if value == "any" {
retur... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-cli/src/scheduler.rs | libs/gl-cli/src/scheduler.rs | use crate::error::{Error, Result};
use crate::util;
use clap::Subcommand;
use core::fmt::Debug;
use gl_client::{credentials, pairing, scheduler::Scheduler, signer::Signer};
use lightning_signer::bitcoin::Network;
use std::io::Write;
use std::path::Path;
use std::{fs, io};
use tokio::task;
use util::{CREDENTIALS_FILE_NA... | rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
Blockstream/greenlight | https://github.com/Blockstream/greenlight/blob/28e98f8e093100e576415734630cff4ea9f3421e/libs/gl-cli/src/bin/glcli.rs | libs/gl-cli/src/bin/glcli.rs | use clap::Parser;
use gl_cli::{run, Cli};
#[tokio::main]
async fn main() {
let cli = Cli::parse();
match run(cli).await {
Ok(()) => (),
Err(e) => {
println!("{}", e);
}
}
}
| rust | MIT | 28e98f8e093100e576415734630cff4ea9f3421e | 2026-01-04T20:21:42.079439Z | false |
AndreasBackx/waycorner | https://github.com/AndreasBackx/waycorner/blob/6951316368e8db55d20203c3255176b897518aac/src/config.rs | src/config.rs | use std::{collections::HashMap, env, fs::File, io::Read, path::PathBuf};
use anyhow::{bail, Context, Result};
use regex::Regex;
use serde::{
de::{self, Unexpected},
Deserialize, Deserializer,
};
use tracing::{debug, info};
pub const COLOR_TRANSPARENT: u32 = 0x00_00_00_00;
pub const COLOR_RED: u32 = 0xFF_FF_00... | rust | MIT | 6951316368e8db55d20203c3255176b897518aac | 2026-01-04T20:22:01.198602Z | false |
AndreasBackx/waycorner | https://github.com/AndreasBackx/waycorner/blob/6951316368e8db55d20203c3255176b897518aac/src/wayland.rs | src/wayland.rs | use crate::{
config::{self, CornerConfig, Location},
corner::Corner,
};
use anyhow::{Context, Result};
use crossbeam_utils::thread;
use smithay_client_toolkit::shm::Format;
use smithay_client_toolkit::{
data_device::DataDeviceHandler,
default_environment,
environment::{Environment, SimpleGlobal},
... | rust | MIT | 6951316368e8db55d20203c3255176b897518aac | 2026-01-04T20:22:01.198602Z | false |
AndreasBackx/waycorner | https://github.com/AndreasBackx/waycorner/blob/6951316368e8db55d20203c3255176b897518aac/src/main.rs | src/main.rs | mod config;
mod corner;
mod wayland;
use anyhow::Result;
use clap::Parser;
use config::get_configs;
use std::path::PathBuf;
use wayland::Wayland;
/// Hot corners for Wayland.
/// Waycorner allows you to create anchors on specified locations of your monitors and execute a command of your choice.
#[derive(Parser)]
#[cl... | rust | MIT | 6951316368e8db55d20203c3255176b897518aac | 2026-01-04T20:22:01.198602Z | false |
AndreasBackx/waycorner | https://github.com/AndreasBackx/waycorner/blob/6951316368e8db55d20203c3255176b897518aac/src/corner.rs | src/corner.rs | use std::{
borrow::Borrow,
cmp,
process::Command,
sync::{
mpsc::{channel, Receiver, Sender},
Arc, Mutex,
},
time::{Duration, Instant},
};
use anyhow::Result;
use regex::Regex;
use tracing::{debug, info};
use crate::config::CornerConfig;
#[derive(Debug, PartialEq)]
pub enum Cor... | rust | MIT | 6951316368e8db55d20203c3255176b897518aac | 2026-01-04T20:22:01.198602Z | false |
svenstaro/memefs | https://github.com/svenstaro/memefs/blob/975822eccca35d3c6559ff433a9b0fe1c396a396/src/main.rs | src/main.rs | use clap::{
crate_authors, crate_description, crate_name, crate_version, value_t_or_exit, App, AppSettings,
Arg,
};
use fuse::{
FileAttr, FileType, Filesystem, ReplyAttr, ReplyData, ReplyDirectory, ReplyEntry, Request,
};
use lazy_static::lazy_static;
use libc::ENOENT;
use serde_json::Value;
use std::cmp::m... | rust | MIT | 975822eccca35d3c6559ff433a9b0fe1c396a396 | 2026-01-04T20:21:54.711749Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollview/src/lib.rs | tui-scrollview/src/lib.rs | //! A [Ratatui] widget to build smooth scrollable views. Part of the [tui-widgets] suite by [Joshka].
//!
//! 
//!
//! (Note: a github bug stops the example gif above being displayed, but you can view it at:
//! <https://vhs.charm.sh/vhs-6PuT3pdwSTp4aTvKrCBx9F... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollview/src/state.rs | tui-scrollview/src/state.rs | use ratatui_core::layout::{Position, Size};
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash)]
pub struct ScrollViewState {
/// The offset is the number of rows and columns to shift the scroll view by.
pub(crate) offset: Position,
/// The size of the scroll view. Not set until the first render cal... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollview/src/scroll_view.rs | tui-scrollview/src/scroll_view.rs | use ratatui_core::buffer::Buffer;
use ratatui_core::layout::{Rect, Size};
use ratatui_core::widgets::{StatefulWidget, Widget};
use ratatui_widgets::scrollbar::{Scrollbar, ScrollbarOrientation, ScrollbarState};
use crate::ScrollViewState;
/// A widget that can scroll its contents
///
/// Allows you to render a widget ... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollview/examples/tabs.rs | tui-scrollview/examples/tabs.rs | //! An example of using multiple tabs each with a scrollable view, as well as how state can be
//! managed across multiple tabs using Stateful Widgets.
//!
//! This example uses the `unstable-widget-ref` feature in Ratatui to allow the tab widgets to
//! created once and then reused across multiple frames. Each tab has... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollview/examples/horizontal.rs | tui-scrollview/examples/horizontal.rs | use std::io;
use color_eyre::Result;
use ratatui::crossterm::event::{self, Event, KeyCode, KeyEventKind};
use ratatui::layout::Size;
use ratatui::widgets::{Paragraph, Wrap};
use ratatui::DefaultTerminal;
use tui_scrollview::{ScrollView, ScrollViewState};
fn main() -> Result<()> {
color_eyre::install()?;
let t... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollview/examples/scrollview.rs | tui-scrollview/examples/scrollview.rs | use std::io::{self};
use color_eyre::Result;
use ratatui::buffer::Buffer;
use ratatui::crossterm::event::{self, Event, KeyCode, KeyEventKind};
use ratatui::layout::{Constraint, Direction, Layout, Rect, Size};
use ratatui::style::palette::tailwind;
use ratatui::style::{Color, Stylize};
use ratatui::text::{Line, Text};
... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-qrcode/src/lib.rs | tui-qrcode/src/lib.rs | //! A [Ratatui] widget to render crisp, scan-happy QR codes in the terminal. Part of the
//! [tui-widgets] suite by [Joshka].
//!
//! 
//!
//! [![Crate badge]][Crate]
//! [![Docs Badge]][Docs]
//! [![Deps Badge]][Dependency Status]
//! [![License Badge]][Licens... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | true |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-qrcode/examples/qrcode.rs | tui-qrcode/examples/qrcode.rs | use qrcode::QrCode;
use ratatui::crossterm::event;
use ratatui::{DefaultTerminal, Frame};
use tui_qrcode::{Colors, QrCodeWidget};
fn main() -> color_eyre::Result<()> {
color_eyre::install()?;
let terminal = ratatui::init();
let result = run(terminal);
ratatui::restore();
result
}
fn run(mut termin... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/src/lib.rs | src/lib.rs | //! A collection of useful widgets for building terminal user interfaces using [Ratatui].
//!
//! [Ratatui]: https://crates.io/crates/ratatui
//!
//! This is a crate that combines multiple previously standalone crates into one in order simplify
//! maintenance and to make it easier to use the widgets together.
//!
//! ... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-cards/src/lib.rs | tui-cards/src/lib.rs | //! A [Ratatui] widget to render charming playing cards in the terminal. Part of the [tui-widgets]
//! suite by [Joshka].
//!
//! 
//!
//! [![Crate badge]][Crate]
//! [![Docs Badge]][Docs]
//! [![Deps Badge]][Dependency Status]
//! [![License Badge]][License]
... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-cards/examples/card.rs | tui-cards/examples/card.rs | use itertools::Itertools;
use ratatui::crossterm::event::{self, Event, KeyCode, KeyEvent};
use ratatui::layout::Rect;
use ratatui::style::{Color, Stylize};
use ratatui::widgets::Block;
use ratatui::Frame;
use strum::IntoEnumIterator;
use tui_cards::{Card, Rank, Suit};
fn main() -> color_eyre::Result<()> {
color_ey... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-prompts/src/lib.rs | tui-prompts/src/lib.rs | //! A [Ratatui] widget set for friendly prompts and input flows. Part of the [tui-widgets] suite by
//! [Joshka].
//!
//! [![Crate badge]][Crate]
//! [![Docs Badge]][Docs]
//! [![Deps Badge]][Dependency Status]
//! [![License Badge]][License]
//! [![Coverage Badge]][Coverage]
//! [![Discord Badge]][Ratatui Discord]
//!... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-prompts/src/status.rs | tui-prompts/src/status.rs | use ratatui_core::style::Stylize;
use ratatui_core::text::Span;
/// The result of a prompt.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Status {
#[default]
Pending,
Aborted,
Done,
}
impl Status {
#[must_use]
pub const fn is_pending(&self) -> bool {
matches!(sel... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-prompts/src/prompt.rs | tui-prompts/src/prompt.rs | use std::iter::once;
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
use itertools::chain;
use ratatui_core::layout::Rect;
use ratatui_core::terminal::Frame;
use ratatui_core::widgets::StatefulWidget;
use unicode_width::UnicodeWidthChar;
use crate::Status;
/// A prompt that can be drawn to a t... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-prompts/src/text_state.rs | tui-prompts/src/text_state.rs | use std::borrow::Cow;
use crate::prelude::*;
use crate::State;
#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)]
pub struct TextState<'a> {
status: Status,
focus: FocusState,
position: usize,
cursor: (u16, u16),
value: Cow<'a, str>,
}
impl<'a> TextState<'a> {
#[must_use]
pub const fn ... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-prompts/src/text_prompt.rs | tui-prompts/src/text_prompt.rs | use std::borrow::Cow;
use std::vec;
use itertools::Itertools;
use ratatui_core::buffer::Buffer;
use ratatui_core::layout::Rect;
use ratatui_core::style::Stylize;
use ratatui_core::terminal::Frame;
use ratatui_core::text::{Line, Span};
use ratatui_core::widgets::{StatefulWidget, Widget};
use ratatui_widgets::block::Blo... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-prompts/examples/text.rs | tui-prompts/examples/text.rs | mod tui;
use std::thread::sleep;
use std::time::Duration;
use clap::Parser;
use color_eyre::Result;
use ratatui::crossterm::event::{self, Event, KeyEvent, KeyModifiers};
use ratatui::prelude::*;
use ratatui::widgets::*;
use tui::Tui;
use tui_prompts::prelude::*;
#[derive(Parser)]
struct Cli {
#[arg(short, long)]... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-prompts/examples/multi_line.rs | tui-prompts/examples/multi_line.rs | mod tui;
use std::panic;
use std::thread::sleep;
use std::time::Duration;
use clap::Parser;
use color_eyre::Result;
use ratatui::crossterm::event::{self, Event, KeyEvent};
use ratatui::crossterm::{self};
use ratatui::prelude::*;
use ratatui::widgets::*;
use tui::Tui;
use tui_prompts::prelude::*;
#[derive(Parser)]
st... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-prompts/examples/tui/mod.rs | tui-prompts/examples/tui/mod.rs | use std::io::Stderr;
use std::ops::{Deref, DerefMut};
use color_eyre::Result;
use ratatui::crossterm;
use ratatui::prelude::*;
/// A wrapper around the terminal that enables raw mode on creation and disables it on drop.
pub struct Tui {
terminal: Terminal<CrosstermBackend<Stderr>>,
}
impl Tui {
pub fn new() ... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-bar-graph/src/lib.rs | tui-bar-graph/src/lib.rs | //! A [Ratatui] widget to render bold, colorful bar graphs. Part of the [tui-widgets] suite by
//! [Joshka].
//!
//! 
//! 
//!  -> color_eyre::Result<()> {
color_eyre::install()?;
let terminal = ratatui::init();
let result = run(terminal);
ratatui::resto... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-bar-graph/examples/tui-bar-graph.rs | tui-bar-graph/examples/tui-bar-graph.rs | use clap::{Parser, ValueEnum};
use colorgrad::Gradient;
use crossterm::event::{self, Event, KeyEvent, KeyEventKind};
use rand::Rng;
use ratatui::style::palette::tailwind::SLATE;
use ratatui::style::{Color, Stylize};
use ratatui::text::Line;
use ratatui::widgets::{Block, Borders};
use ratatui::{symbols, DefaultTerminal,... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-box-text/src/lib.rs | tui-box-text/src/lib.rs | //! A [Ratatui] widget to draw delightfully boxy text with line-drawing characters. Part of the
//! [tui-widgets] suite by [Joshka].
//!
//! 
//!
//! [![Crate badge]][Crate]
//! [![Docs Badge]][Docs]
//! [![Deps Badge]][Dependency Status]
//! [![License Badge]... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-box-text/examples/box_text.rs | tui-box-text/examples/box_text.rs | use std::iter::zip;
use color_eyre::eyre::Ok;
use ratatui::crossterm::event::{self, Event, KeyCode};
use ratatui::layout::{Constraint, Layout, Rect};
use ratatui::text::Line;
use ratatui::{DefaultTerminal, Frame};
use tui_box_text::BoxChar;
fn main() -> color_eyre::Result<()> {
color_eyre::install()?;
let ter... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-popup/src/lib.rs | tui-popup/src/lib.rs | //! A [Ratatui] widget to show a snappy popup overlay. Part of the [tui-widgets] suite by [Joshka].
//!
//! 
//!
//! The popup widget is a simple widget that renders a popup in the center of the screen.
//!
//! [![Crate badge]][Crate]
//! [![Docs Badge]][Docs]
... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-popup/src/known_size_wrapper.rs | tui-popup/src/known_size_wrapper.rs | use std::fmt::Debug;
use derive_setters::Setters;
use ratatui_core::buffer::Buffer;
use ratatui_core::layout::Rect;
use ratatui_core::widgets::Widget;
use crate::KnownSize;
/// The `KnownSizeWrapper` struct wraps a widget and provides a fixed size for it.
///
/// This struct is used to wrap a widget and provide a fi... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-popup/src/known_size.rs | tui-popup/src/known_size.rs | use ratatui_core::text::Text;
/// A trait for widgets that have a fixed size.
///
/// This trait allows the popup to automatically size itself based on the size of the body widget.
/// Implementing this trait for a widget allows it to be used as the body of a popup. You can also
/// wrap existing widgets in a newtype ... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-popup/src/popup.rs | tui-popup/src/popup.rs | use std::fmt;
use derive_setters::Setters;
use ratatui_core::buffer::Buffer;
use ratatui_core::layout::{Constraint, Rect};
use ratatui_core::style::Style;
use ratatui_core::symbols::border::Set;
use ratatui_core::text::Line;
use ratatui_core::widgets::{StatefulWidget, Widget};
use ratatui_widgets::block::Block;
use ra... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-popup/src/popup_state.rs | tui-popup/src/popup_state.rs | #[cfg(feature = "crossterm")]
use crossterm::event::{MouseButton, MouseEvent, MouseEventKind};
use derive_getters::Getters;
use ratatui_core::layout::Rect;
#[derive(Clone, Debug, Default, Getters)]
pub struct PopupState {
/// The last rendered area of the popup
pub(crate) area: Option<Rect>,
/// A state in... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-popup/examples/state.rs | tui-popup/examples/state.rs | use color_eyre::Result;
use lipsum::lipsum;
use ratatui::crossterm::event::{self, Event, KeyCode, KeyEvent, KeyEventKind};
use ratatui::prelude::{Constraint, Frame, Layout, Rect, Style, Stylize, Text};
use ratatui::widgets::{Paragraph, Wrap};
use ratatui::DefaultTerminal;
use tui_popup::{Popup, PopupState};
fn main() ... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-popup/examples/popup.rs | tui-popup/examples/popup.rs | use color_eyre::Result;
use lipsum::lipsum;
use ratatui::crossterm::event::{self, Event};
use ratatui::prelude::{Rect, Style, Stylize};
use ratatui::widgets::{Paragraph, Wrap};
use ratatui::Frame;
use tui_popup::Popup;
fn main() -> Result<()> {
color_eyre::install()?;
let mut terminal = ratatui::init();
le... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-popup/examples/paragraph.rs | tui-popup/examples/paragraph.rs | use color_eyre::Result;
use lipsum::lipsum;
use ratatui::crossterm::event::{self, Event, KeyCode};
use ratatui::prelude::{Rect, Span, Style, Stylize, Text};
use ratatui::widgets::{Paragraph, Wrap};
use ratatui::Frame;
use tui_popup::{KnownSizeWrapper, Popup};
fn main() -> Result<()> {
color_eyre::install()?;
l... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-big-text/src/big_text.rs | tui-big-text/src/big_text.rs | use std::cmp::min;
use derive_builder::Builder;
use font8x8::UnicodeFonts;
use ratatui_core::buffer::Buffer;
use ratatui_core::layout::{Alignment, Rect};
use ratatui_core::style::Style;
use ratatui_core::text::{Line, StyledGrapheme};
use ratatui_core::widgets::Widget;
use crate::PixelSize;
/// Displays one or more l... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | true |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-big-text/src/lib.rs | tui-big-text/src/lib.rs | //! A [Ratatui] widget to render gloriously oversized pixel text using glyphs from the [font8x8]
//! crate. Part of the [tui-widgets] suite by [Joshka].
//!
//! 
//!
//! [![Crate badge]][Crate]
//! [![Docs Badge]][Docs]
//! [![Deps Badge]][Dependency Status]
/... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-big-text/src/pixel_size.rs | tui-big-text/src/pixel_size.rs | #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default)]
pub enum PixelSize {
#[default]
/// A pixel from the 8x8 font is represented by a full character cell in the terminal.
Full,
/// A pixel from the 8x8 font is represented by a half (upper/lower) character cell in the
/// terminal.
HalfHe... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | true |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-big-text/examples/big_text.rs | tui-big-text/examples/big_text.rs | use color_eyre::Result;
use ratatui::layout::Offset;
use ratatui::prelude::{Frame, Style, Stylize};
use ratatui::text::Line;
use tui_big_text::BigText;
mod common;
fn main() -> Result<()> {
color_eyre::install()?;
common::run(render)?;
Ok(())
}
fn render(frame: &mut Frame) {
let title = Line::from("t... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-big-text/examples/alignment.rs | tui-big-text/examples/alignment.rs | use color_eyre::Result;
use ratatui::layout::{Constraint, Layout, Offset};
use ratatui::prelude::{Frame, Stylize};
use ratatui::text::Line;
use tui_big_text::{BigText, PixelSize};
mod common;
fn main() -> Result<()> {
color_eyre::install()?;
common::run(render)?;
Ok(())
}
fn render(frame: &mut Frame) {
... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-big-text/examples/pixel_size.rs | tui-big-text/examples/pixel_size.rs | use color_eyre::Result;
use ratatui::prelude::*;
use tui_big_text::{BigText, PixelSize};
mod common;
fn main() -> Result<()> {
color_eyre::install()?;
common::run(render)?;
Ok(())
}
fn render(frame: &mut Frame) {
let title = Line::from("tui-big-text pixel size demo. <q> quit")
.centered()
... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-big-text/examples/stopwatch.rs | tui-big-text/examples/stopwatch.rs | use std::io::{self, Stdout};
use std::time::{Duration, Instant};
use color_eyre::eyre::{bail, Context};
use color_eyre::Result;
use crossterm::event::{self, KeyCode};
use crossterm::execute;
use crossterm::terminal::{
disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen,
};
use futures::{F... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-big-text/examples/common/mod.rs | tui-big-text/examples/common/mod.rs | //! common module for examples
use std::io;
use color_eyre::Result;
use crossterm::terminal::{
disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen,
};
use crossterm::ExecutableCommand;
use ratatui::prelude::CrosstermBackend;
/// A type alias for the terminal
type Terminal = ratatui::Ter... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollbar/src/lengths.rs | tui-scrollbar/src/lengths.rs | /// Bundle content and viewport lengths to avoid ambiguous arguments.
///
/// This struct is a convenience for readability. Use a struct literal so each field is named at
/// the call site:
///
/// ```rust
/// use tui_scrollbar::ScrollLengths;
///
/// let lengths = ScrollLengths {
/// content_len: 200,
/// view... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollbar/src/lib.rs | tui-scrollbar/src/lib.rs | //! Smooth, fractional scrollbars for Ratatui. Part of the [tui-widgets] suite by [Joshka].
//!
//! 
//!
//! [![Crate badge]][Crate]
//! [![Docs Badge]][Docs]
//! [![Deps Badge]][Dependency Status]
//! [![License Badge]][License]
//! [![Coverage Badg... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollbar/src/glyphs.rs | tui-scrollbar/src/glyphs.rs | //! Glyph configuration for scrollbar rendering.
/// Glyphs used to render the track, arrows, and thumb.
///
/// Arrays use indices 0..=7 to represent 1/8th through full coverage.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct GlyphSet {
/// Track glyph for vertical scrollbars.
pub track_vertical: char,
... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollbar/src/metrics.rs | tui-scrollbar/src/metrics.rs | //! Pure scrollbar geometry and hit testing.
//!
//! This module contains the math behind thumb sizing and positioning. It is backend-agnostic and
//! does not touch terminal rendering, making it suitable for unit tests and hit testing.
//!
//! Use [`ScrollMetrics`] when you need the thumb geometry without rendering a ... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollbar/src/input.rs | tui-scrollbar/src/input.rs | //! Input types and interaction state for scrollbars.
//!
//! ## Design notes
//!
//! These types are intentionally backend-agnostic and small. The widget does not own scroll state;
//! it returns a [`ScrollCommand`] so the application can decide how to apply offsets. This keeps
//! the API compatible with any event lo... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollbar/src/scrollbar/interaction.rs | tui-scrollbar/src/scrollbar/interaction.rs | //! Input handling and hit-testing helpers for the scrollbar widget.
//!
//! This module groups pointer/wheel handling so the main widget definition stays focused on
//! configuration and rendering. The functions here are pure in/out helpers that return
//! [`ScrollCommand`] values for the application to apply.
//!
//!... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollbar/src/scrollbar/render.rs | tui-scrollbar/src/scrollbar/render.rs | //! Rendering helpers and `Widget` implementation for [`ScrollBar`].
//!
//! The core widget delegates rendering to these helpers so the draw logic is grouped separately
//! from configuration and input handling. Keep rendering changes localized here.
use ratatui_core::buffer::Buffer;
use ratatui_core::layout::Rect;
u... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollbar/src/scrollbar/mod.rs | tui-scrollbar/src/scrollbar/mod.rs | //! Rendering and interaction for proportional scrollbars.
//!
//! This module provides the widget, glyph selection, and interaction helpers. The pure math lives
//! in [`crate::metrics`].
//!
//! # How the parts interact
//!
//! 1. Your app owns `content_len`, `viewport_len`, and `offset`.
//! 2. [`ScrollMetrics`] con... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollbar/examples/scrollbar_mouse.rs | tui-scrollbar/examples/scrollbar_mouse.rs | //! Mouse + keyboard-driven scrollbar demo with smooth subcell movement.
//!
//! If you are new to this crate, this is the fastest way to see the full interaction model:
//! a horizontal scrollbar on the bottom edge and a vertical scrollbar on the right edge, both
//! wired to the same input flow your app would use. Th... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
joshka/tui-widgets | https://github.com/joshka/tui-widgets/blob/8521548a9e8348d029bd1721dfee4b6e0e71bf52/tui-scrollbar/examples/scrollbar.rs | tui-scrollbar/examples/scrollbar.rs | //! Fractional scrollbar step showcase.
//!
//! This example renders every 1/8th thumb step for both horizontal and vertical scrollbars so
//! you can visually compare partial glyphs and track alignment.
//!
//! Press `q` or `Esc` to exit.
//!
//! ## Structure
//!
//! - Calculation helpers (`build_metrics`, `step_entry... | rust | Apache-2.0 | 8521548a9e8348d029bd1721dfee4b6e0e71bf52 | 2026-01-04T20:22:07.469528Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/lib.rs | src/lib.rs | pub mod directory;
pub mod fuzzy;
pub mod query;
pub mod query_part;
| rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/query_part.rs | src/query_part.rs | use std::{env::home_dir, path::PathBuf};
use crate::directory::{scored_directories, sub_directories, Directory};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum QueryPart {
/// ~
Tilde,
/// .. (two or more dots)
Back(u32),
/// /
Root,
/// - (one or more dashes)
Skip(u32),
/// A... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/ui.rs | src/ui.rs | use dialoguer::{theme::ColorfulTheme, Select};
pub fn select(title: &str, options: Vec<String>) -> Option<String> {
if let Some(selection) = Select::with_theme(&ColorfulTheme::default())
.with_prompt(title)
.items(&options)
.default(0)
.interact_opt()
.unwrap()
{
... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/query.rs | src/query.rs | use crate::directory::{sub_directories, Directory};
use crate::query_part::QueryPart;
use std::path::{Path, PathBuf};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Query {
query: String,
parts: Vec<QueryPart>,
}
impl From<String> for Query {
fn from(query: String) -> Self {
let mut enhanced_qu... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/main.rs | src/main.rs | use clap::Parser;
use cmd::LacyCli;
use crate::cmd::Run;
mod cmd;
mod directory;
mod fuzzy;
mod query;
mod query_part;
mod ui;
fn main() {
LacyCli::parse().run();
}
| rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/directory.rs | src/directory.rs | use std::{
env, fs,
path::{Path, PathBuf},
};
use crate::fuzzy::fuzzy_match_score;
pub fn get_current_directory() -> PathBuf {
env::current_dir().unwrap_or(PathBuf::from("/"))
}
/// Returns all directories for the given path
pub fn get_all_directories_in(path: &Path) -> Vec<Directory> {
let dirs_res ... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/fuzzy.rs | src/fuzzy.rs | /// Creates a score of how much the input and the pattern match
///
/// The higher the score the better. There is no max score.
pub fn fuzzy_match_score(input: &str, pattern: &str) -> i32 {
let mut score = 0;
if input
.to_lowercase()
.contains(pattern.to_lowercase().as_str())
{
score... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/cmd/complete.rs | src/cmd/complete.rs | use crate::{
cmd::{Complete, Run},
directory::get_current_directory,
query::Query,
};
impl Run for Complete {
fn run(&self) {
let query = Query::from(self.query.clone());
println!(
"{}",
query
.completions(get_current_directory().as_path())
... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/cmd/prompt.rs | src/cmd/prompt.rs | use std::{collections::HashSet, fs, path::PathBuf};
use crate::{
cmd::{Prompt, Run},
directory::get_current_directory,
query::Query,
ui,
};
impl Run for Prompt {
fn run(&self) {
let query = Query::from(self.query.clone());
/*
_ if first_query_part.starts_with("-")
... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/cmd/commands.rs | src/cmd/commands.rs | use clap::{Parser, Subcommand};
const HELP_TEMPLATE: &str = "
_ _ ____ __
| | / \\ / _\\ V /
| |_ | o ( (_ \\ /
|___||_n_|\\__||_|
v{version}
https://github.com/timothebot/lacy
{about}{before-help}
{usage-heading}
{tab}{usage}
{all-args}{after-help}
";
#[derive(Parser, Debug)]
#[command(
version,
... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/cmd/mod.rs | src/cmd/mod.rs | mod commands;
mod complete;
mod init;
mod prompt;
pub use crate::cmd::commands::*;
pub trait Run {
fn run(&self);
}
impl Run for LacyCli {
fn run(&self) {
match &self.command {
LacyCommand::Prompt(cmd) => cmd.run(),
LacyCommand::Init(cmd) => cmd.run(),
LacyCommand:... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/src/cmd/init.rs | src/cmd/init.rs | use upon::{value, Engine, Error};
use crate::cmd::{Init, Run};
impl Run for Init {
fn run(&self) {
println!(
"{}",
match shell_config(
self.shell.as_str(),
&self.cd_cmd,
&self.cmd,
&self.custom_fuzzy
) {
... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
timothebot/lacy | https://github.com/timothebot/lacy/blob/12f056c9f4eca7af8afbda8ba33a0c5e23c33742/tests/integration_tests.rs | tests/integration_tests.rs | use std::{fs, os::unix::fs::symlink, path::PathBuf};
use lacy::query::Query;
use tempfile::TempDir;
struct TempEnv {
dir: TempDir,
}
impl TempEnv {
fn new() -> Self {
let tmpdir = tempfile::tempdir().unwrap();
let dir_list = vec![
"alpha/beta/gamma3",
"alpha/beta/delta... | rust | MIT | 12f056c9f4eca7af8afbda8ba33a0c5e23c33742 | 2026-01-04T20:22:09.206135Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/page.rs | src/page.rs | //! Page related functions.
use crate::os;
use std::sync::Once;
/// Returns the operating system's page size.
///
/// This function uses an internally cached page size, and can be called
/// repeatedly without incurring a significant performance penalty.
///
/// # Examples
///
/// ```
/// # use region::page;
/// let ... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/lib.rs | src/lib.rs | #![deny(
clippy::all,
clippy::missing_inline_in_public_items,
clippy::ptr_as_ptr,
clippy::print_stdout,
missing_docs,
nonstandard_style,
unused,
warnings
)]
// Temporarily allow these until bitflags deps is upgraded to 2.x
#![allow(clippy::bad_bit_mask)]
//! Cross-platform virtual memory API.
//!
//! Th... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/lock.rs | src/lock.rs | use crate::{os, util, Result};
/// Locks one or more memory regions to RAM.
///
/// The memory pages within the address range is guaranteed to stay in RAM
/// except for specials cases, such as hibernation and memory starvation. It
/// returns a [`LockGuard`], which [`unlock`]s the affected regions once
/// dropped.
/... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/alloc.rs | src/alloc.rs | use std::mem::ManuallyDrop;
use crate::{os, page, util, Error, Protection, Result};
/// A handle to an owned region of memory.
///
/// This handle does not dereference to a slice, since the underlying memory may
/// have been created with [`Protection::NONE`].
#[allow(clippy::len_without_is_empty)]
pub struct Allocat... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/error.rs | src/error.rs | //! Error types and utilities.
use std::error::Error as StdError;
use std::{fmt, io};
/// The result type used by this library.
pub type Result<T> = std::result::Result<T, Error>;
/// A collection of possible errors.
#[derive(Debug)]
pub enum Error {
/// The queried memory is unmapped.
///
/// This does not ne... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/util.rs | src/util.rs | use crate::{page, Error, Result};
/// Validates & rounds an address-size pair to their respective page boundary.
pub fn round_to_page_boundaries<T>(address: *const T, size: usize) -> Result<(*const T, usize)> {
if size == 0 {
return Err(Error::InvalidParameter("size"));
}
let size = (address as usize % page... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/protect.rs | src/protect.rs | use crate::{os, util, Protection, QueryIter, Region, Result};
/// Changes the memory protection of one or more pages.
///
/// The address range may overlap one or more pages, and if so, all pages
/// spanning the range will be modified. The previous protection flags are not
/// preserved (if you desire to preserve the... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/query.rs | src/query.rs | use crate::{os, util, Error, Region, Result};
/// An iterator over the [`Region`]s that encompass an address range.
///
/// This `struct` is created by [`query_range`]. See its documentation for more.
pub struct QueryIter {
iterator: Option<os::QueryIter>,
origin: *const (),
}
impl QueryIter {
pub(crate) fn new... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/os/unix.rs | src/os/unix.rs | use crate::{Error, Protection, Result};
use libc::{MAP_ANON, MAP_FAILED, MAP_FIXED, MAP_PRIVATE};
use libc::{PROT_EXEC, PROT_READ, PROT_WRITE};
use std::io;
pub fn page_size() -> usize {
unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize }
}
pub unsafe fn alloc(base: *const (), size: usize, protection: Protection)... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/os/illumos.rs | src/os/illumos.rs | use crate::{Error, Protection, Region, Result};
use std::fs::File;
use std::io::Read;
pub struct QueryIter {
vmmap: Vec<u8>,
vmmap_index: usize,
upper_bound: usize,
}
impl QueryIter {
pub fn new(origin: *const (), size: usize) -> Result<QueryIter> {
// Do not use a buffered reader here to avoid multiple r... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/os/macos.rs | src/os/macos.rs | use crate::{Error, Protection, Region, Result};
use mach2::vm_prot::*;
pub struct QueryIter {
region_address: mach2::vm_types::mach_vm_address_t,
upper_bound: usize,
}
impl QueryIter {
pub fn new(origin: *const (), size: usize) -> Result<QueryIter> {
Ok(QueryIter {
region_address: origin as _,
u... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/os/linux.rs | src/os/linux.rs | use crate::{Error, Protection, Region, Result};
use std::fs;
pub struct QueryIter {
proc_maps: String,
upper_bound: usize,
offset: usize,
}
impl QueryIter {
pub fn new(origin: *const (), size: usize) -> Result<Self> {
// Do not use a buffered reader here to avoid multiple read(2) calls to the
// proc ... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/os/netbsd.rs | src/os/netbsd.rs | use crate::{Error, Protection, Region, Result};
use libc::{c_char, c_int, c_void, free, getpid, pid_t};
use std::io;
pub struct QueryIter {
vmmap: *mut kinfo_vmentry,
vmmap_len: usize,
vmmap_index: usize,
upper_bound: usize,
}
impl QueryIter {
pub fn new(origin: *const (), size: usize) -> Result<QueryIter> ... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/os/windows.rs | src/os/windows.rs | use crate::{Error, Protection, Region, Result};
use std::cmp::{max, min};
use std::ffi::c_void;
use std::io;
use std::mem::{size_of, MaybeUninit};
use std::sync::Once;
use windows_sys::Win32::System::Memory::{
VirtualAlloc, VirtualFree, VirtualLock, VirtualProtect, VirtualQuery, VirtualUnlock,
MEMORY_BASIC_INFORMAT... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/os/mod.rs | src/os/mod.rs | #[cfg(windows)]
mod windows;
#[cfg(windows)]
pub use self::windows::*;
#[cfg(unix)]
mod unix;
#[cfg(unix)]
pub use self::unix::*;
#[cfg(any(target_os = "macos", target_os = "ios"))]
mod macos;
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub use self::macos::*;
#[cfg(any(target_os = "linux", target_os = "a... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/os/openbsd.rs | src/os/openbsd.rs | use crate::{Error, Protection, Region, Result};
use libc::{c_int, c_uint, c_ulong, getpid, sysctl, CTL_KERN, KERN_PROC_VMMAP};
use std::io;
pub struct QueryIter {
mib: [c_int; 3],
vmentry: kinfo_vmentry,
previous_boundary: usize,
upper_bound: usize,
}
impl QueryIter {
pub fn new(origin: *const (), size: usi... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
darfink/region-rs | https://github.com/darfink/region-rs/blob/7302d9c166e63a4c7aa8e951904d0b33f399a924/src/os/freebsd.rs | src/os/freebsd.rs | use crate::{Error, Protection, Region, Result};
use libc::{
c_int, c_void, free, getpid, kinfo_getvmmap, kinfo_vmentry, KVME_PROT_EXEC, KVME_PROT_READ,
KVME_PROT_WRITE, KVME_TYPE_DEFAULT,
};
use std::io;
pub struct QueryIter {
vmmap: *mut kinfo_vmentry,
vmmap_len: usize,
vmmap_index: usize,
upper_bound: us... | rust | MIT | 7302d9c166e63a4c7aa8e951904d0b33f399a924 | 2026-01-04T20:21:40.023200Z | false |
Charlie-XIAO/tauri-plugin-desktop-underlay | https://github.com/Charlie-XIAO/tauri-plugin-desktop-underlay/blob/d5200ed0a70ecec83dd707087bbbcda2c7abeef3/build.rs | build.rs | const COMMANDS: &[&str] = &[
"is_desktop_underlay",
"set_desktop_underlay",
"toggle_desktop_underlay",
];
fn main() {
tauri_plugin::Builder::new(COMMANDS).build();
}
| rust | MIT | d5200ed0a70ecec83dd707087bbbcda2c7abeef3 | 2026-01-04T20:21:17.039147Z | false |
Charlie-XIAO/tauri-plugin-desktop-underlay | https://github.com/Charlie-XIAO/tauri-plugin-desktop-underlay/blob/d5200ed0a70ecec83dd707087bbbcda2c7abeef3/src/lib.rs | src/lib.rs | #![doc = include_str!("../README.md")]
use tauri::plugin::{Builder, TauriPlugin};
use tauri::{generate_handler, Manager, Runtime};
mod commands;
mod core;
mod ext;
pub use ext::DesktopUnderlayExt;
/// Initialize the desktop-underlay plugin.
pub fn init<R: Runtime>() -> TauriPlugin<R> {
Builder::new("desktop-und... | rust | MIT | d5200ed0a70ecec83dd707087bbbcda2c7abeef3 | 2026-01-04T20:21:17.039147Z | false |
Charlie-XIAO/tauri-plugin-desktop-underlay | https://github.com/Charlie-XIAO/tauri-plugin-desktop-underlay/blob/d5200ed0a70ecec83dd707087bbbcda2c7abeef3/src/ext.rs | src/ext.rs | use anyhow::Result;
use tauri::{Runtime, WebviewWindow, Window};
/// A window extension that provides desktop underlay functionalities.
pub trait DesktopUnderlayExt {
/// Check whether the window is desktop underlay.
fn is_desktop_underlay(&self) -> bool;
/// Set the window as desktop underlay or revert i... | rust | MIT | d5200ed0a70ecec83dd707087bbbcda2c7abeef3 | 2026-01-04T20:21:17.039147Z | false |
Charlie-XIAO/tauri-plugin-desktop-underlay | https://github.com/Charlie-XIAO/tauri-plugin-desktop-underlay/blob/d5200ed0a70ecec83dd707087bbbcda2c7abeef3/src/commands.rs | src/commands.rs | use tauri::{command, Manager, Runtime, Window};
use crate::DesktopUnderlayExt;
#[command]
pub async fn is_desktop_underlay<R: Runtime>(
window: Window<R>,
label: Option<String>,
) -> tauri::Result<bool> {
let target_window = {
if let Some(label) = label {
window
.get_we... | rust | MIT | d5200ed0a70ecec83dd707087bbbcda2c7abeef3 | 2026-01-04T20:21:17.039147Z | false |
Charlie-XIAO/tauri-plugin-desktop-underlay | https://github.com/Charlie-XIAO/tauri-plugin-desktop-underlay/blob/d5200ed0a70ecec83dd707087bbbcda2c7abeef3/src/core/macos.rs | src/core/macos.rs | use std::ffi::c_void;
use std::os::raw::c_ulong;
use anyhow::Result;
use objc2::msg_send;
use objc2::runtime::AnyObject;
extern "C" {
fn CGWindowLevelForKey(key: i32) -> i32;
}
// 1 << 0 - NSWindowCollectionBehaviorCanJoinAllSpaces
// 1 << 4 - NSWindowCollectionBehaviorStationary
// 1 << 6 - NSWindowCollectionBe... | rust | MIT | d5200ed0a70ecec83dd707087bbbcda2c7abeef3 | 2026-01-04T20:21:17.039147Z | false |
Charlie-XIAO/tauri-plugin-desktop-underlay | https://github.com/Charlie-XIAO/tauri-plugin-desktop-underlay/blob/d5200ed0a70ecec83dd707087bbbcda2c7abeef3/src/core/linux.rs | src/core/linux.rs | use anyhow::Result;
use gdk::WindowTypeHint;
use gtk::prelude::GtkWindowExt;
use gtk::ApplicationWindow;
/// Set the window as a desktop underlay.
pub(super) unsafe fn set_underlay(gtk_window: ApplicationWindow) -> Result<()> {
gtk_window.set_type_hint(WindowTypeHint::Desktop);
Ok(())
}
/// Unset the window f... | rust | MIT | d5200ed0a70ecec83dd707087bbbcda2c7abeef3 | 2026-01-04T20:21:17.039147Z | false |
Charlie-XIAO/tauri-plugin-desktop-underlay | https://github.com/Charlie-XIAO/tauri-plugin-desktop-underlay/blob/d5200ed0a70ecec83dd707087bbbcda2c7abeef3/src/core/windows.rs | src/core/windows.rs | use anyhow::{bail, Result};
use windows::core::{s, BOOL};
use windows::Win32::Foundation::{HWND, LPARAM, WPARAM};
use windows::Win32::UI::WindowsAndMessaging::{
EnumWindows, FindWindowA, FindWindowExA, SendMessageTimeoutA, SetParent, SMTO_NORMAL,
};
/// Helper function to find the WorkerW window.
unsafe extern "sy... | rust | MIT | d5200ed0a70ecec83dd707087bbbcda2c7abeef3 | 2026-01-04T20:21:17.039147Z | false |
Charlie-XIAO/tauri-plugin-desktop-underlay | https://github.com/Charlie-XIAO/tauri-plugin-desktop-underlay/blob/d5200ed0a70ecec83dd707087bbbcda2c7abeef3/src/core/mod.rs | src/core/mod.rs | use std::sync::Mutex;
use anyhow::Result;
use tauri::{Manager, Runtime, Window};
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "macos")]
mod macos;
#[cfg(target_os = "windows")]
mod windows;
macro_rules! dispatch_to_main_thread {
($window:expr, $f:expr) => {{
let (tx, rx) = std::sync::mpsc::ch... | rust | MIT | d5200ed0a70ecec83dd707087bbbcda2c7abeef3 | 2026-01-04T20:21:17.039147Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.