mirror of
https://github.com/librekeys/picoforge.git
synced 2026-07-28 08:01:19 -07:00
chore: update shell config for gpui compilation and make configu update async
This commit is contained in:
Generated
+18
-18
@@ -6,11 +6,11 @@
|
|||||||
"rust-analyzer-src": "rust-analyzer-src"
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1769064677,
|
"lastModified": 1770102568,
|
||||||
"narHash": "sha256-Upa108vGOlaOBGQTmmLEKuWekBm519u42A/oYSjTs+4=",
|
"narHash": "sha256-VYwA9FmakKJ3zLfAd7bdj9xIB9PzfISLoYh6eZl+EuQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"rev": "439e81e0b40781e16c444ca1c7fcd1cf8c5c406c",
|
"rev": "592daa37b5a3175c61541329b64d6c1972303bc1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1768135262,
|
"lastModified": 1769996383,
|
||||||
"narHash": "sha256-PVvu7OqHBGWN16zSi6tEmPwwHQ4rLPU9Plvs8/1TUBY=",
|
"narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "80daad04eddbbf5a4d883996a73f3f542fa437ac",
|
"rev": "57928607ea566b5db3ad13af0e57e921e6b12381",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -38,11 +38,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1768886240,
|
"lastModified": 1770019141,
|
||||||
"narHash": "sha256-C2TjvwYZ2VDxYWeqvvJ5XPPp6U7H66zeJlRaErJKoEM=",
|
"narHash": "sha256-VKS4ZLNx4PNrABoB0L8KUpc1fE7CLpQXQs985tGfaCU=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "80e4adbcf8992d3fd27ad4964fbb84907f9478b0",
|
"rev": "cb369ef2efd432b3cdf8622b0ffc0a97a02f3137",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -54,11 +54,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1765674936,
|
"lastModified": 1769909678,
|
||||||
"narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=",
|
"narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85",
|
"rev": "72716169fe93074c333e8d0173151350670b824c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -69,11 +69,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1769018530,
|
"lastModified": 1770115704,
|
||||||
"narHash": "sha256-MJ27Cy2NtBEV5tsK+YraYr2g851f3Fl1LpNHDzDX15c=",
|
"narHash": "sha256-KHFT9UWOF2yRPlAnSXQJh6uVcgNcWlFqqiAZ7OVlHNc=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "88d3861acdd3d2f0e361767018218e51810df8a1",
|
"rev": "e6eae2ee2110f3d31110d5c222cd395303343b08",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -93,11 +93,11 @@
|
|||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1768996281,
|
"lastModified": 1770026591,
|
||||||
"narHash": "sha256-s+TolkG0f98fR6RtBEmymBb8RHmZ04U3SL8cjoqog2k=",
|
"narHash": "sha256-VZlloygYDmozJwbZZkCSNpiPhNdOW/AA0b6LmNBZ3xU=",
|
||||||
"owner": "rust-lang",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"rev": "2d124215693f13dcf6ad097a02acdd473c80e447",
|
"rev": "74eca73f3b0a41b80228b8e499c7547cc8b2effa",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -2,22 +2,22 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
libraries = with pkgs; [
|
libraries = with pkgs; [
|
||||||
at-spi2-atk
|
|
||||||
atkmm
|
|
||||||
cairo
|
|
||||||
gdk-pixbuf
|
|
||||||
glib
|
|
||||||
gtk3
|
|
||||||
harfbuzz
|
|
||||||
librsvg
|
|
||||||
libsoup_3
|
|
||||||
pango
|
|
||||||
webkitgtk_4_1
|
|
||||||
libcanberra-gtk3
|
|
||||||
pcsclite
|
pcsclite
|
||||||
hidapi
|
hidapi
|
||||||
mesa
|
mesa
|
||||||
udev
|
udev
|
||||||
|
libxkbcommon
|
||||||
|
vulkan-loader
|
||||||
|
wayland
|
||||||
|
libglvnd
|
||||||
|
wayland-protocols
|
||||||
|
libunwind
|
||||||
|
libdrm
|
||||||
|
xorg.libX11
|
||||||
|
xorg.libXcursor
|
||||||
|
xorg.libXi
|
||||||
|
xorg.libXrandr
|
||||||
|
xorg.libxcb
|
||||||
];
|
];
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
@@ -28,29 +28,17 @@ let
|
|||||||
openssl_3
|
openssl_3
|
||||||
librsvg
|
librsvg
|
||||||
git
|
git
|
||||||
|
|
||||||
# Development tools
|
# Development tools
|
||||||
rustc
|
rustc
|
||||||
mold
|
mold
|
||||||
cargo
|
cargo
|
||||||
deno
|
deno
|
||||||
nodejs_22
|
nodejs_22
|
||||||
|
|
||||||
# Tauri 2 dependencies
|
# GPUI
|
||||||
at-spi2-atk
|
libxkbcommon
|
||||||
atkmm
|
|
||||||
cairo
|
|
||||||
gdk-pixbuf
|
|
||||||
glib
|
|
||||||
gtk3
|
|
||||||
harfbuzz
|
|
||||||
librsvg
|
|
||||||
libsoup_3
|
|
||||||
pango
|
|
||||||
webkitgtk_4_1
|
|
||||||
libcanberra-gtk3
|
|
||||||
packagekit
|
|
||||||
|
|
||||||
# Hardware
|
# Hardware
|
||||||
pcsclite
|
pcsclite
|
||||||
hidapi
|
hidapi
|
||||||
@@ -62,14 +50,14 @@ pkgs.mkShell {
|
|||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
|
||||||
export GTK_PATH=${pkgs.libcanberra-gtk3}/lib/gtk-3.0:${pkgs.packagekit}/lib/gtk-3.0:$GTK_PATH
|
# export GTK_PATH=${pkgs.libcanberra-gtk3}/lib/gtk-3.0:${pkgs.packagekit}/lib/gtk-3.0:$GTK_PATH
|
||||||
export XDG_DATA_DIRS=$GSETTINGS_SCHEMAS_PATH:$XDG_DATA_DIRS
|
export XDG_DATA_DIRS=$GSETTINGS_SCHEMAS_PATH:$XDG_DATA_DIRS
|
||||||
export RUSTFLAGS="-C link-arg=-fuse-ld=mold"
|
export RUSTFLAGS="-C link-arg=-fuse-ld=mold"
|
||||||
|
|
||||||
# Try to uncomment the following lines if you encounter EGL_BAD_PARAMETER errors:
|
# Try to uncomment the following lines if you encounter EGL_BAD_PARAMETER errors:
|
||||||
# export LIBGL_ALWAYS_SOFTWARE=1
|
# export LIBGL_ALWAYS_SOFTWARE=1
|
||||||
# export WEBKIT_DISABLE_COMPOSITING_MODE=1
|
# export WEBKIT_DISABLE_COMPOSITING_MODE=1
|
||||||
|
|
||||||
echo "Nix development environment loaded!"
|
echo "Nix development environment loaded!"
|
||||||
echo "Available tools: rustc, cargo, deno, node, tauri"
|
echo "Available tools: rustc, cargo, deno, node, tauri"
|
||||||
'';
|
'';
|
||||||
|
|||||||
+7
-9
@@ -66,10 +66,9 @@ impl ApplicationRoot {
|
|||||||
|
|
||||||
match io::read_device_details() {
|
match io::read_device_details() {
|
||||||
Ok(status) => {
|
Ok(status) => {
|
||||||
self.state.device_status = Some(status);
|
self.state.device_status = Some(status.clone());
|
||||||
self.state.error = None;
|
self.state.error = None;
|
||||||
|
|
||||||
// If successful, try to get FIDO info
|
|
||||||
match io::get_fido_info() {
|
match io::get_fido_info() {
|
||||||
Ok(fido) => {
|
Ok(fido) => {
|
||||||
self.state.fido_info = Some(fido);
|
self.state.fido_info = Some(fido);
|
||||||
@@ -79,6 +78,12 @@ impl ApplicationRoot {
|
|||||||
self.state.fido_info = None;
|
self.state.fido_info = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(config_view) = &self.config_view {
|
||||||
|
config_view.update(cx, |view, cx| {
|
||||||
|
view.update_device_status(Some(status), cx);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
self.state.device_status = None;
|
self.state.device_status = None;
|
||||||
@@ -171,13 +176,6 @@ impl Render for ApplicationRoot {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
view.update(cx, |view, cx| {
|
|
||||||
view.update_status(
|
|
||||||
self.state.device_status.clone(),
|
|
||||||
window,
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
view.clone().into_any_element()
|
view.clone().into_any_element()
|
||||||
}
|
}
|
||||||
ActiveView::Security => {
|
ActiveView::Security => {
|
||||||
|
|||||||
+62
-23
@@ -1,6 +1,5 @@
|
|||||||
use crate::device::io;
|
use crate::device::io;
|
||||||
use crate::device::types::{AppConfigInput, FullDeviceStatus};
|
use crate::device::types::{AppConfigInput, FullDeviceStatus};
|
||||||
use crate::ui::colors;
|
|
||||||
use crate::ui::components::{card::Card, page_view::PageView};
|
use crate::ui::components::{card::Card, page_view::PageView};
|
||||||
use crate::ui::ui_types::{LedDriverType, UsbIdentityPreset};
|
use crate::ui::ui_types::{LedDriverType, UsbIdentityPreset};
|
||||||
use gpui::*;
|
use gpui::*;
|
||||||
@@ -67,6 +66,7 @@ pub struct ConfigView {
|
|||||||
loading: bool,
|
loading: bool,
|
||||||
device_status: Option<FullDeviceStatus>,
|
device_status: Option<FullDeviceStatus>,
|
||||||
is_custom_vendor: bool,
|
is_custom_vendor: bool,
|
||||||
|
_task: Option<Task<()>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConfigView {
|
impl ConfigView {
|
||||||
@@ -209,10 +209,11 @@ impl ConfigView {
|
|||||||
loading: false,
|
loading: false,
|
||||||
device_status: device_status.clone(),
|
device_status: device_status.clone(),
|
||||||
is_custom_vendor,
|
is_custom_vendor,
|
||||||
|
_task: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply_changes(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
fn apply_changes(&mut self, _window: &mut Window, cx: &mut Context<Self>) {
|
||||||
let status = if let Some(s) = &self.device_status {
|
let status = if let Some(s) = &self.device_status {
|
||||||
s
|
s
|
||||||
} else {
|
} else {
|
||||||
@@ -256,10 +257,8 @@ impl ConfigView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Driver Value
|
|
||||||
let driver_idx = self.led_driver_select.read(cx).selected_index(cx);
|
let driver_idx = self.led_driver_select.read(cx).selected_index(cx);
|
||||||
if let Some(idx) = driver_idx {
|
if let Some(idx) = driver_idx {
|
||||||
// Map index back to enum value safely
|
|
||||||
if let Some(driver) = LedDriverType::all().get(idx.row) {
|
if let Some(driver) = LedDriverType::all().get(idx.row) {
|
||||||
let val = driver.value();
|
let val = driver.value();
|
||||||
if Some(val) != current_config.led_driver {
|
if Some(val) != current_config.led_driver {
|
||||||
@@ -293,7 +292,6 @@ impl ConfigView {
|
|||||||
changes.enable_secp256k1 = Some(self.enable_secp256k1);
|
changes.enable_secp256k1 = Some(self.enable_secp256k1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we have any changes
|
|
||||||
let has_changes = changes.vid.is_some()
|
let has_changes = changes.vid.is_some()
|
||||||
|| changes.pid.is_some()
|
|| changes.pid.is_some()
|
||||||
|| changes.product_name.is_some()
|
|| changes.product_name.is_some()
|
||||||
@@ -314,28 +312,50 @@ impl ConfigView {
|
|||||||
self.loading = true;
|
self.loading = true;
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
|
||||||
let result = io::write_config(changes, status.method.clone(), None);
|
let entity = cx.entity().downgrade();
|
||||||
|
let method = status.method.clone();
|
||||||
|
|
||||||
self.loading = false;
|
self._task = Some(cx.spawn(async move |_, cx| {
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
match result {
|
cx.background_executor()
|
||||||
Ok(msg) => {
|
.timer(Duration::from_millis(500))
|
||||||
log::info!("Success: {}", msg);
|
.await;
|
||||||
|
|
||||||
if let Ok(new_status) = io::read_device_details() {
|
let result = io::write_config(changes, method, None);
|
||||||
log::info!(
|
|
||||||
"Refreshed device status. LED Steady: {}",
|
let _ = entity.update(cx, |this, cx| {
|
||||||
new_status.config.led_steady
|
this.loading = false;
|
||||||
);
|
|
||||||
self.update_status(Some(new_status), window, cx);
|
match result {
|
||||||
|
Ok(msg) => {
|
||||||
|
log::info!("Success: {}", msg);
|
||||||
|
|
||||||
|
if let Ok(new_status) = io::read_device_details() {
|
||||||
|
log::info!(
|
||||||
|
"Refreshed device status. LED Steady: {}",
|
||||||
|
new_status.config.led_steady
|
||||||
|
);
|
||||||
|
|
||||||
|
let config = &new_status.config;
|
||||||
|
|
||||||
|
this.led_dimmable = config.led_dimmable;
|
||||||
|
this.led_steady = config.led_steady;
|
||||||
|
this.power_cycle = config.power_cycle_on_reset;
|
||||||
|
this.enable_secp256k1 = config.enable_secp256k1;
|
||||||
|
|
||||||
|
this.device_status = Some(new_status);
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::error!("Error saving config: {}", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
log::error!("Error saving config: {}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
});
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_status(
|
pub fn update_status(
|
||||||
@@ -395,6 +415,25 @@ impl ConfigView {
|
|||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn update_device_status(
|
||||||
|
&mut self,
|
||||||
|
status: Option<FullDeviceStatus>,
|
||||||
|
cx: &mut Context<Self>,
|
||||||
|
) {
|
||||||
|
if self.device_status == status {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
self.device_status = status.clone();
|
||||||
|
let config = status.as_ref().map(|s| &s.config);
|
||||||
|
|
||||||
|
self.led_dimmable = config.map(|c| c.led_dimmable).unwrap_or(true);
|
||||||
|
self.led_steady = config.map(|c| c.led_steady).unwrap_or(false);
|
||||||
|
self.power_cycle = config.map(|c| c.power_cycle_on_reset).unwrap_or(false);
|
||||||
|
self.enable_secp256k1 = config.map(|c| c.enable_secp256k1).unwrap_or(true);
|
||||||
|
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
|
|
||||||
fn render_identity_card(&self, theme: &Theme) -> impl IntoElement {
|
fn render_identity_card(&self, theme: &Theme) -> impl IntoElement {
|
||||||
let content = v_flex()
|
let content = v_flex()
|
||||||
.gap_4()
|
.gap_4()
|
||||||
@@ -528,7 +567,7 @@ impl ConfigView {
|
|||||||
.child(content)
|
.child(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_touch_card(&self, theme: &Theme) -> impl IntoElement {
|
fn render_touch_card(&self, _theme: &Theme) -> impl IntoElement {
|
||||||
let content = v_flex().gap_4().child(
|
let content = v_flex().gap_4().child(
|
||||||
v_flex()
|
v_flex()
|
||||||
.gap_2()
|
.gap_2()
|
||||||
|
|||||||
Reference in New Issue
Block a user