From 23e638285a41d3831936ec107065e65957293371 Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Sat, 12 Oct 2024 18:18:28 +0200 Subject: [PATCH] setup for menu --- Cargo.lock | 116 +++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 4 +- src/cli.rs | 16 +++++++ src/main.rs | 13 +++++- src/menu/mod.rs | 17 +++++++ 5 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 src/cli.rs create mode 100644 src/menu/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 5653f8f..1f32848 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -115,6 +115,55 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.89" @@ -708,6 +757,46 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "clap" +version = "4.5.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim 0.11.1", +] + +[[package]] +name = "clap_derive" +version = "4.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote 1.0.37", + "syn 2.0.79", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + [[package]] name = "clipboard-win" version = "5.4.0" @@ -739,6 +828,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + [[package]] name = "com" version = "0.6.0" @@ -1000,7 +1095,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote 1.0.37", - "strsim", + "strsim 0.10.0", "syn 1.0.109", ] @@ -2020,6 +2115,12 @@ version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.10.5" @@ -3625,6 +3726,7 @@ checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" name = "rshell" version = "0.1.0" dependencies = [ + "clap", "color_quant", "cushy", "hsl", @@ -4071,6 +4173,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "subtle" version = "2.6.1" @@ -4641,6 +4749,12 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "v_frame" version = "0.3.8" diff --git a/Cargo.toml b/Cargo.toml index f84ad9a..584b9f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "rshell" +description = "Another GUI shell" version = "0.1.0" edition = "2021" @@ -16,4 +17,5 @@ http-cache-reqwest = "0.14.0" color_quant = "1.0" hsl = "0.1.1" itertools = "0.10.0" -palette = "0.7.3" \ No newline at end of file +palette = "0.7.3" +clap = { version = "4.5.20", features = ["derive"] } diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..834a334 --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,16 @@ +use clap::{Parser, Subcommand}; + +/// Simple program to greet a person +#[derive(Parser, Debug)] +#[command(version, about, long_about = None)] +pub struct Args { + #[clap(subcommand)] + pub cmd: Commands, +} + +#[derive(Subcommand, Debug)] +pub enum Commands { + Bar, + Menu, + Power +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 3057619..f753ba3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,24 @@ use bar::start_bar; +use clap::Parser; +use cli::{Args, Commands}; use cushy::{PendingApp, Run, TokioRuntime}; +use menu::start_menu; mod vibrancy; mod theme; mod bar; +mod cli; +mod menu; fn main() -> cushy::Result { + let args = Args::parse(); let mut app = PendingApp::new(TokioRuntime::default()); - start_bar(&mut app)?; + + match args.cmd { + Commands::Bar => start_bar(&mut app)?, + Commands::Menu => start_menu(&mut app)?, + Commands::Power => todo!(), + } app.run() } \ No newline at end of file diff --git a/src/menu/mod.rs b/src/menu/mod.rs new file mode 100644 index 0000000..b1a17c3 --- /dev/null +++ b/src/menu/mod.rs @@ -0,0 +1,17 @@ +use cushy::{kludgine::app::winit::window::WindowLevel, widget::MakeWidget, Application, Open}; + +pub fn start_menu(app: &mut impl Application) -> cushy::Result { + let mut window = "Hello, World!" + .pad() + .into_window() + .transparent() + .app_name("rshell") + .decorated(false) + // .resizable(false) + .window_level(WindowLevel::AlwaysOnTop); + + window.sans_serif_font_family.push(cushy::styles::FamilyOwned::Name("Iosevka NF".into())); + + window + .open(app).map(|_| ()) +} \ No newline at end of file