Add justfile

This commit is contained in:
Jeremy Soller 2023-10-02 10:15:08 -06:00
parent cb07b6255e
commit adf8decc5b
No known key found for this signature in database
GPG key ID: DCFCA852D3906975
3 changed files with 81 additions and 8 deletions

6
Cargo.lock generated
View file

@ -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",

67
justfile Normal file
View file

@ -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

View file

@ -12,12 +12,11 @@ use tokio::fs::{File, OpenOptions};
fn main() -> Result<(), Box<dyn std::error::Error>> {
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::<App>(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<Self::Message>) {
fn init(mut core: Core, _flags: Self::Flags) -> (Self, Command<Self::Message>) {
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,