From f77cd4d815a10070d4f5261295ac09fa7e8df730 Mon Sep 17 00:00:00 2001 From: Doloro1978 Date: Mon, 31 Aug 2026 17:42:04 +0100 Subject: [PATCH] slop 2 --- flake.lock | 23 ++++++++++++++++++++++- flake.nix | 26 ++++++++++++++++++++++---- src/main.rs | 22 ++++++++++++++-------- 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/flake.lock b/flake.lock index 4df2caa..6753e23 100644 --- a/flake.lock +++ b/flake.lock @@ -53,7 +53,28 @@ "inputs": { "crane": "crane", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1788165049, + "narHash": "sha256-en4IoUeCqvq9F66YhwOrUFw1nc70OBhrJwrzfalezvY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "d03cd474bd97389dcc2e8cd3b3bb6b8c6e346b1a", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } }, "systems": { diff --git a/flake.nix b/flake.nix index c52099d..d17babe 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,11 @@ crane.url = "github:ipetkov/crane"; flake-utils.url = "github:numtide/flake-utils"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; outputs = @@ -16,13 +21,25 @@ crane, flake-utils, ... - }: + }@inputs: flake-utils.lib.eachDefaultSystem ( system: let - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = import inputs.nixpkgs { + inherit system; + overlays = [ (import inputs.rust-overlay) ]; + }; - craneLib = crane.mkLib pkgs; + craneLib = (inputs.crane.mkLib pkgs).overrideToolchain ( + p: + p.rust-bin.nightly.latest.default.override { + extensions = [ + "rustc-codegen-cranelift-preview" + "rust-analyzer" + "rust-src" + ]; + } + ); # Runtime/shared libraries required by iced/iced_layershell/winit. # winit dlopens libwayland at runtime, so these must be on @@ -46,7 +63,8 @@ # git-initialized, so cleanCargoSource would otherwise copy target/). src = pkgs.lib.cleanSourceWith { src = ./.; - filter = path: type: + filter = + path: type: let base = baseNameOf (toString path); in diff --git a/src/main.rs b/src/main.rs index 9c904e5..87898f0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use iced::widget::{column, container, mouse_area, text}; use iced::{window, Alignment, Element, Length, Rectangle, Task, Theme}; use iced_layershell::daemon; use iced_layershell::reexport::{Anchor, PopupAnchor, PopupGravity}; -use iced_layershell::settings::{LayerShellSettings, StartMode, Settings}; +use iced_layershell::settings::{LayerShellSettings, Settings, StartMode}; use iced_layershell::to_layer_message; /// Height of the bar in logical pixels. @@ -208,7 +208,10 @@ fn capture_bounds(module: Module) -> Task { } impl advanced_widget::Operation for FindBounds { - fn traverse(&mut self, operate: &mut dyn FnMut(&mut dyn advanced_widget::Operation)) { + fn traverse( + &mut self, + operate: &mut dyn FnMut(&mut dyn advanced_widget::Operation), + ) { // Delegate traversal so widgets can visit their children; the // container id is matched in `container` above. operate(self); @@ -264,10 +267,14 @@ fn bar_view(_bar: &Bar) -> Element<'static, Message> { } } - container(column(children).width(Length::Fill).align_x(Alignment::Center)) - .padding(8) - .align_x(Alignment::Center) - .into() + container( + column(children) + .width(Length::Fill) + .align_x(Alignment::Center), + ) + .padding(8) + .align_x(Alignment::Center) + .into() } /// Standalone button wrapped in MouseArea for click capture. The container @@ -309,8 +316,7 @@ fn popup_view<'a>(bar: &'a Bar) -> Element<'a, Message> { .width(Length::Fill) .align_x(Alignment::Center), column(items).spacing(1), - mouse_area(text("close").size(12)) - .on_press(Message::ClosePopup(popup_id)), + mouse_area(text("close").size(12)).on_press(Message::ClosePopup(popup_id)), ] .spacing(1) .into()