Compare commits

...
Author SHA1 Message Date
8ead7e6eb0
iced-template: use more efficient nixpkgs input 2026-08-22 17:36:09 -07:00
9c3419782b
iced-template: remove nonexistent icon 2026-08-22 17:36:00 -07:00
27f6371c2c
iced-template: factor out Element, explicit Error
the type alias Element is quite useful for defining subfunctions for view
and it also helps to not pull unnecessary things into scope
2026-08-22 17:35:56 -07:00
3 changed files with 13 additions and 15 deletions

17
flake.lock generated
View file

@ -20,18 +20,15 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1785747939, "lastModified": 1786862985,
"narHash": "sha256-D740uKsMbgsfK2oaDenJLLPIZfq7W0/g4KN/Fls8eKs=", "narHash": "sha256-kSR/jfpR4cE26YRZ8exQkoRbEA30vyWimajwZANYYaE=",
"owner": "nixos", "rev": "e5bdc4a41d4c072fe1e3787eaa0320a384741d44",
"repo": "nixpkgs", "type": "tarball",
"rev": "104240a772428cc2e20d8fd86c9ddbb886bbaff2", "url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1055335.e5bdc4a41d4c/nixexprs.tar.zst?lastModified=1786862985&rev=e5bdc4a41d4c072fe1e3787eaa0320a384741d44"
"type": "github"
}, },
"original": { "original": {
"owner": "nixos", "type": "tarball",
"ref": "nixpkgs-unstable", "url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst"
"repo": "nixpkgs",
"type": "github"
} }
}, },
"root": { "root": {

View file

@ -1,6 +1,6 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
@ -49,7 +49,6 @@
desktopItem = pkgs.makeDesktopItem { desktopItem = pkgs.makeDesktopItem {
inherit name; inherit name;
desktopName = name; desktopName = name;
icon = name;
exec = name; exec = name;
}; };
in in

View file

@ -1,4 +1,6 @@
use iced::{Color, Element, Renderer, Task, Theme, application, theme, widget}; use iced::{Color, Task, application, theme, widget};
type Element<'a> = iced::Element<'a, Message, iced::Theme, iced::Renderer>;
enum Message {} enum Message {}
@ -11,12 +13,12 @@ impl State {
fn update(&mut self, message: Message) -> Task<Message> { fn update(&mut self, message: Message) -> Task<Message> {
Task::none() Task::none()
} }
fn view(&self) -> Element<'_, Message, Theme, Renderer> { fn view(&self) -> Element<'_> {
widget::text("hiiiiiii").into() widget::text("hiiiiiii").into()
} }
} }
pub fn run() -> Result<(), impl std::error::Error> { pub fn run() -> Result<(), iced::Error> {
application(State::new, State::update, State::view) application(State::new, State::update, State::view)
.theme(theme::Theme::custom( .theme(theme::Theme::custom(
"high-contrast-dark", "high-contrast-dark",