Compare commits

..
Author SHA1 Message Date
a38b0ca3dc
feat: start work on edit mode 2026-08-29 22:04:45 -07:00
5 changed files with 503 additions and 470 deletions

745
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -13,19 +13,3 @@ rfd = "0.17.2"
[dependencies.iced]
version = "0.14.0"
[profile.debug]
debug = true
strip = "none"
debug-assertions = true
overflow-checks = true
[profile.dev]
debug = false
debug-assertions = false
overflow-checks = false
[profile.release]
codegen-units = 1
lto = "fat"
strip = "symbols"

36
flake.lock generated
View file

@ -1,15 +1,30 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1785782307,
"narHash": "sha256-MPaRdVkf6zZP5fCPxYCi8Dr4pZzgmXzg8T9nVEbp3Mw=",
"owner": "ipetkov",
"repo": "crane",
"rev": "2c71e194474d13de031d729b729c968ddbe3507f",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1794427683,
"narHash": "sha256-o7ey9gEilsxaifqJWnBDlYSKbNWYQYtKwDyXeZU2kaU=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cd489559845d81f673a12885576016c65cbe9363",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@ -20,11 +35,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1795234589,
"narHash": "sha256-pAEASBc6wof0S58XcSEdZoQ2iFQDkCnZwH+wFLrkd1Q=",
"rev": "2786a2a72088ecf32aea5b3ec52099e6a7cff78f",
"lastModified": 1786862985,
"narHash": "sha256-kSR/jfpR4cE26YRZ8exQkoRbEA30vyWimajwZANYYaE=",
"rev": "e5bdc4a41d4c072fe1e3787eaa0320a384741d44",
"type": "tarball",
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1125864.2786a2a72088/nixexprs.tar.zst?lastModified=1795234589&rev=2786a2a72088ecf32aea5b3ec52099e6a7cff78f"
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1055335.e5bdc4a41d4c/nixexprs.tar.zst?lastModified=1786862985&rev=e5bdc4a41d4c072fe1e3787eaa0320a384741d44"
},
"original": {
"type": "tarball",
@ -33,17 +48,18 @@
},
"root": {
"inputs": {
"crane": "crane",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1791244623,
"narHash": "sha256-uuanbkFk8a313Zfrxdcz8Us/yQtaxNnKJtX8v0ZPpd8=",
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "d36eeed142f88b5a636f2e3856a53c61654cf29b",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {

154
flake.nix
View file

@ -2,6 +2,8 @@
inputs = {
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
};
@ -10,95 +12,105 @@
inputs.flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
lib = inputs.nixpkgs.lib;
pkgs = import inputs.nixpkgs { inherit system; };
lib = pkgs.lib;
craneLib = inputs.crane.mkLib pkgs;
src = lib.sourceFilesBySuffices ./. [
"Cargo.toml"
"Cargo.lock"
".rs"
];
cargoToml = fromTOML (builtins.readFile "${src}/Cargo.toml");
cargoToml = fromTOML (builtins.readFile ./Cargo.toml);
name = cargoToml.package.name;
bin =
{
rustPlatform,
dlDeps =
with pkgs;
[
# needed for both x11 and wayland
libxkbcommon
libGL
autoPatchelfHook,
libx11
libxcursor
libxi
libxcb
]
++ lib.optionals stdenv.hostPlatform.isLinux [
vulkan-loader
wayland
libxkbcommon,
wayland,
vulkan-loader,
dbus.lib
];
moreSupport ? false,
libGL,
libx11,
libxcursor,
libxi,
commonArgs = {
# all that's needed for artifacts and checks
nativeBuildInputs = with pkgs; [
# pkg-config
];
buildInputs = with pkgs; [
];
libgcc,
}:
rustPlatform.buildRustPackage {
inherit name src;
strictDeps = true;
__structuredAttrs = true;
nativeBuildInputs = [
autoPatchelfHook
];
buildInputs = [
libgcc
];
runtimeDependencies = [
libxkbcommon
wayland
vulkan-loader
]
++ lib.optionals moreSupport [
libGL
libx11
libxcursor
libxi
];
src = ./.;
};
cargoLock.lockFile = "${src}/Cargo.lock";
# Build *just* the cargo dependencies,
# to reuse them for build and test derivations.
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
postFixup =
let
desktopItem = pkgs.makeDesktopItem {
inherit name;
desktopName = name;
exec = name;
};
in
/* sh */ ''
# Build the actual crate itself,
# reusing the dependency artifacts from above.
crate =
let
desktopItem = pkgs.makeDesktopItem {
inherit name;
desktopName = name;
exec = name;
};
in
craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
nativeBuildInputs = commonArgs.nativeBuildInputs ++ [
pkgs.autoPatchelfHook
];
buildInputs = commonArgs.buildInputs ++ [
pkgs.libgcc
];
runtimeDependencies = dlDeps;
doCheck = false;
postFixup = ''
cp -rs "${desktopItem}"/* "$out"
'';
strictDeps = true;
__structuredAttrs = true;
};
default = pkgs.callPackage bin { };
}
);
in
{
packages.default = default;
packages.default = crate;
devShells.default = pkgs.mkShell {
inputsFrom = [ default ];
checks = {
crate-clippy = craneLib.cargoClippy (
commonArgs
// {
inherit cargoArtifacts;
env.RUSTFLAGS = builtins.concatStringsSep " " [
"-Clink-arg=-Wl,-rpath,${lib.makeLibraryPath default.runtimeDependencies}"
"-Clink-arg=-fuse-ld=mold"
];
cargoClippyExtraArgs = "-- --deny warnings";
}
);
};
packages = with pkgs; [
clippy
rustfmt
rust-analyzer
devShells.default = craneLib.devShell {
env.LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps;
mold
];
inputsFrom = [ crate ];
packages = [ pkgs.rust-analyzer ];
strictDeps = true;
__structuredAttrs = true;
};
}
);

View file

@ -39,6 +39,7 @@ enum Message {
ChangeQuery(String),
Copy,
Edit,
FocusNext,
FocusPrevious,
@ -65,6 +66,8 @@ struct State {
selected_field: db::BasicField,
query: String,
editing_entry: Option<keepass::db::EntryId>,
status: Cow<'static, str>,
error: Cow<'static, str>,
}
@ -182,6 +185,13 @@ impl State {
}
}
Message::Edit => {
self.editing_entry = self
.db_view
.get(self.selected_entry)
.map(|entry| entry.id());
}
Message::FocusNext => return widget::operation::focus_next(),
Message::FocusPrevious => return widget::operation::focus_previous(),
Message::FocusSearch => return widget::operation::focus("search"),
@ -404,7 +414,7 @@ impl State {
Key::Character("y" | "c") if db_loaded => Some(Message::Copy),
Key::Named(key::Named::Escape) => Some(Message::ChangeQuery(String::new())),
Key::Character("e") if db_loaded => Some(Message::Edit),
Key::Character("q") => Some(Message::Quit),