From adf8decc5bb7d6260b596ae9d05ccc9a23a690c6 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 2 Oct 2023 10:15:08 -0600 Subject: [PATCH] Add justfile --- Cargo.lock | 6 ++--- justfile | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 16 +++++++++---- 3 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 justfile diff --git a/Cargo.lock b/Cargo.lock index 1ad4c2d..6beff70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -484,7 +484,7 @@ checksum = "aadd183e815348c0649051b1c43418643208f8ed13c8a84da7215b4e1cf42714" dependencies = [ "bitflags 2.4.0", "log", - "polling 3.1.0", + "polling 3.2.0", "rustix 0.38.14", "slab", "thiserror", @@ -2603,9 +2603,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7571075a670bb8e02350c4d1c27d934aabdce416aa91a95d58dc9e21267dad3c" +checksum = "62a79e457c9898100b4298d57d69ec53d06f9a6ed352431ce5f377e082d2e846" dependencies = [ "cfg-if", "concurrent-queue", diff --git a/justfile b/justfile new file mode 100644 index 0000000..3d98be9 --- /dev/null +++ b/justfile @@ -0,0 +1,67 @@ +name := 'cosmic-greeter' +export APPID := 'com.system76.CosmicGreeter' + +rootdir := '' +prefix := '/usr' + +base-dir := absolute_path(clean(rootdir / prefix)) + +export INSTALL_DIR := base-dir / 'share' + +bin-src := 'target' / 'release' / name +bin-dst := base-dir / 'bin' / name + +# Default recipe which runs `just build-release` +default: build-release + +# Runs `cargo clean` +clean: + cargo clean + +# `cargo clean` and removes vendored dependencies +clean-dist: clean + rm -rf .cargo vendor vendor.tar + +# Compiles with debug profile +build-debug *args: + cargo build {{args}} + +# Compiles with release profile +build-release *args: (build-debug '--release' args) + +# Compiles release profile with vendored dependencies +build-vendored *args: vendor-extract (build-release '--frozen --offline' args) + +# Runs a clippy check +check *args: + cargo clippy --all-features {{args}} -- -W clippy::pedantic + +# Runs a clippy check with JSON message format +check-json: (check '--message-format=json') + +# Run with debug logs +run *args: + env RUST_LOG=debug RUST_BACKTRACE=1 cargo run --release {{args}} + +# Installs files +install: + install -Dm0755 {{bin-src}} {{bin-dst}} + +# Uninstalls installed files +uninstall: + rm {{bin-dst}} + +# Vendor dependencies locally +vendor: + mkdir -p .cargo + cargo vendor --sync Cargo.toml \ + | head -n -1 > .cargo/config + echo 'directory = "vendor"' >> .cargo/config + tar pcf vendor.tar vendor + rm -rf vendor + +# Extracts vendored dependencies +vendor-extract: + #!/usr/bin/env sh + rm -rf vendor + tar pxf vendor.tar diff --git a/src/main.rs b/src/main.rs index 375c7b6..4bf8df2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,12 +12,11 @@ use tokio::fs::{File, OpenOptions}; fn main() -> Result<(), Box> { let settings = Settings::default() .antialiasing(true) - .client_decorations(false) + .client_decorations(true) .debug(false) - .default_icon_theme("Pop") + .default_icon_theme("Cosmic") .default_text_size(16.0) .scale_factor(1.0) - .size((1024, 768)) .theme(cosmic::Theme::dark()); cosmic::app::run::(settings, ())?; @@ -63,7 +62,7 @@ impl cosmic::Application for App { type Message = Message; /// The unique application ID to supply to the window manager. - const APP_ID: &'static str = "org.cosmic.AppDemo"; + const APP_ID: &'static str = "com.system76.CosmicGreeter"; fn core(&self) -> &Core { &self.core @@ -74,7 +73,14 @@ impl cosmic::Application for App { } /// Creates the application, and optionally emits command on initialize. - fn init(core: Core, input: Self::Flags) -> (Self, Command) { + fn init(mut core: Core, _flags: Self::Flags) -> (Self, Command) { + core.window.show_window_menu = false; + core.window.show_headerbar = false; + core.window.sharp_corners = true; + core.window.show_maximize = false; + core.window.show_minimize = false; + core.window.use_template = false; + ( App { core,