chore: add rustfmt config
This commit is contained in:
parent
b021887c6c
commit
9895bd4b43
15 changed files with 136 additions and 144 deletions
15
.zed/settings.json
Normal file
15
.zed/settings.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"format_on_save": "on",
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
"check": {
|
||||
"command": "clippy",
|
||||
},
|
||||
"rustfmt": {
|
||||
"extraArgs": ["+nightly"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -3,9 +3,11 @@
|
|||
|
||||
pub mod user;
|
||||
|
||||
use cosmic_config::{CosmicConfigEntry, cosmic_config_derive::CosmicConfigEntry};
|
||||
use cosmic_config::CosmicConfigEntry;
|
||||
use cosmic_config::cosmic_config_derive::CosmicConfigEntry;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{collections::HashMap, num::NonZeroU32};
|
||||
use std::collections::HashMap;
|
||||
use std::num::NonZeroU32;
|
||||
|
||||
pub const APP_ID: &str = "com.system76.CosmicGreeter";
|
||||
pub const CONFIG_VERSION: u64 = 1;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
use cosmic_comp_config::output::randr;
|
||||
use cosmic_config::CosmicConfigEntry;
|
||||
use kdl::KdlDocument;
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
fs,
|
||||
io::Read,
|
||||
os::unix::fs::OpenOptionsExt,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use std::collections::BTreeMap;
|
||||
use std::fs;
|
||||
use std::io::Read;
|
||||
use std::os::unix::fs::OpenOptionsExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub use cosmic_applets_config::time::TimeAppletConfig;
|
||||
pub use cosmic_bg_config::{Color, Source as BgSource, state::State as BgState};
|
||||
pub use cosmic_bg_config::state::State as BgState;
|
||||
pub use cosmic_bg_config::{Color, Source as BgSource};
|
||||
pub use cosmic_comp_config::{CosmicCompConfig, XkbConfig, ZoomConfig};
|
||||
pub use cosmic_theme::{Theme, ThemeBuilder};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
use color_eyre::eyre::Context;
|
||||
use cosmic_greeter_daemon::{UserData, UserFilter};
|
||||
use std::{env, error::Error, ffi::CString, future::pending, io};
|
||||
use std::error::Error;
|
||||
use std::ffi::CString;
|
||||
use std::future::pending;
|
||||
use std::{env, io};
|
||||
use tracing::metadata::LevelFilter;
|
||||
use tracing::warn;
|
||||
use tracing_subscriber::{EnvFilter, fmt, prelude::*};
|
||||
use zbus::{DBusError, connection::Builder};
|
||||
use tracing_subscriber::prelude::*;
|
||||
use tracing_subscriber::{EnvFilter, fmt};
|
||||
use zbus::DBusError;
|
||||
use zbus::connection::Builder;
|
||||
|
||||
//IMPORTANT: this function is critical to the security of this proxy. It must ensure that the
|
||||
// callback is executed with the permissions of the specified user id. A good test is to see if
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use greetd_ipc::{AuthMessageType, ErrorType, Request, Response, codec::TokioCodec};
|
||||
use greetd_ipc::codec::TokioCodec;
|
||||
use greetd_ipc::{AuthMessageType, ErrorType, Request, Response};
|
||||
use std::{env, fs, io, thread};
|
||||
use tokio::net::UnixListener;
|
||||
|
||||
|
|
|
|||
1
rustfmt.toml
Normal file
1
rustfmt.toml
Normal file
|
|
@ -0,0 +1 @@
|
|||
imports_granularity = "Module"
|
||||
|
|
@ -1,20 +1,15 @@
|
|||
use cosmic::{
|
||||
app::{Core, Task},
|
||||
iced::runtime::core::window::Id as SurfaceId,
|
||||
iced::{
|
||||
self, Rectangle, Size, Subscription,
|
||||
core::SmolStr,
|
||||
event::{
|
||||
self,
|
||||
wayland::{Event as WaylandEvent, OutputEvent, SessionLockEvent},
|
||||
},
|
||||
keyboard::{Event as KeyEvent, Key, Modifiers},
|
||||
},
|
||||
widget,
|
||||
};
|
||||
use cosmic::app::{Core, Task};
|
||||
use cosmic::iced::core::SmolStr;
|
||||
use cosmic::iced::event::wayland::{Event as WaylandEvent, OutputEvent, SessionLockEvent};
|
||||
use cosmic::iced::event::{self};
|
||||
use cosmic::iced::keyboard::{Event as KeyEvent, Key, Modifiers};
|
||||
use cosmic::iced::runtime::core::window::Id as SurfaceId;
|
||||
use cosmic::iced::{self, Rectangle, Size, Subscription};
|
||||
use cosmic::widget;
|
||||
use cosmic_config::{ConfigSet, CosmicConfigEntry};
|
||||
use cosmic_greeter_daemon::{BgSource, CosmicCompConfig, UserData};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use wayland_client::protocol::wl_output::WlOutput;
|
||||
|
||||
pub const DEFAULT_MENU_ITEM_HEIGHT: f32 = 36.;
|
||||
|
|
|
|||
|
|
@ -8,63 +8,51 @@ use cctk::sctk::reexports::calloop;
|
|||
use color_eyre::eyre::WrapErr;
|
||||
use cosmic::app::{Core, Settings, Task};
|
||||
use cosmic::cctk::wayland_protocols::xdg::shell::client::xdg_positioner::Gravity;
|
||||
use cosmic::cosmic_config::{self, ConfigSet};
|
||||
use cosmic::cosmic_theme::{self, CosmicPalette};
|
||||
use cosmic::desktop::fde::{DesktopEntry, get_languages_from_env};
|
||||
use cosmic::iced::event::listen_with;
|
||||
use cosmic::iced::runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings;
|
||||
use cosmic::iced::{Point, Size, window};
|
||||
use cosmic::widget::{id_container, text};
|
||||
use cosmic::{
|
||||
Element,
|
||||
cosmic_config::{self, ConfigSet},
|
||||
executor,
|
||||
iced::runtime::core::window::Id as SurfaceId,
|
||||
iced::{
|
||||
self, Alignment, Background, Border, Length, Subscription,
|
||||
event::wayland::OutputEvent,
|
||||
futures::SinkExt,
|
||||
platform_specific::{
|
||||
runtime::wayland::layer_surface::{IcedMargin, IcedOutput, SctkLayerSurfaceSettings},
|
||||
shell::wayland::commands::layer_surface::{
|
||||
use cosmic::iced::event::wayland::OutputEvent;
|
||||
use cosmic::iced::futures::SinkExt;
|
||||
use cosmic::iced::platform_specific::runtime::wayland::layer_surface::{
|
||||
IcedMargin, IcedOutput, SctkLayerSurfaceSettings,
|
||||
};
|
||||
use cosmic::iced::platform_specific::shell::wayland::commands::layer_surface::{
|
||||
Anchor, KeyboardInteractivity, Layer, destroy_layer_surface, get_layer_surface,
|
||||
},
|
||||
shell::wayland::commands::subsurface::reposition_subsurface,
|
||||
},
|
||||
},
|
||||
theme, widget,
|
||||
};
|
||||
use cosmic::{
|
||||
cosmic_theme::{self, CosmicPalette},
|
||||
desktop::fde::{DesktopEntry, get_languages_from_env},
|
||||
surface,
|
||||
use cosmic::iced::platform_specific::shell::wayland::commands::subsurface::reposition_subsurface;
|
||||
use cosmic::iced::runtime::core::window::Id as SurfaceId;
|
||||
use cosmic::iced::runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings;
|
||||
use cosmic::iced::{
|
||||
self, Alignment, Background, Border, Length, Point, Size, Subscription, window,
|
||||
};
|
||||
use cosmic::widget::{id_container, text};
|
||||
use cosmic::{Element, executor, surface, theme, widget};
|
||||
use cosmic_greeter_config::Config as CosmicGreeterConfig;
|
||||
use cosmic_greeter_daemon::{UserData, UserFilter};
|
||||
use cosmic_randr_shell::{KdlParseWithError, List};
|
||||
use cosmic_settings_a11y_manager_subscription::{AccessibilityEvent, AccessibilityRequest};
|
||||
use greetd_ipc::Request;
|
||||
use kdl::KdlDocument;
|
||||
use std::collections::{HashMap, hash_map};
|
||||
use std::error::Error;
|
||||
use std::num::NonZeroU32;
|
||||
use std::process::Stdio;
|
||||
use std::sync::LazyLock;
|
||||
use std::{
|
||||
collections::{HashMap, hash_map},
|
||||
error::Error,
|
||||
fs, io,
|
||||
num::NonZeroU32,
|
||||
process,
|
||||
sync::Arc,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use std::sync::{Arc, LazyLock};
|
||||
use std::time::{Duration, Instant};
|
||||
use std::{fs, io, process};
|
||||
use tokio::process::Child;
|
||||
use tokio::time;
|
||||
use tracing::metadata::LevelFilter;
|
||||
use tracing::warn;
|
||||
use tracing_subscriber::{EnvFilter, fmt, prelude::*};
|
||||
use wayland_client::{Proxy, protocol::wl_output::WlOutput};
|
||||
use tracing_subscriber::prelude::*;
|
||||
use tracing_subscriber::{EnvFilter, fmt};
|
||||
use wayland_client::Proxy;
|
||||
use wayland_client::protocol::wl_output::WlOutput;
|
||||
use zbus::{Connection, proxy};
|
||||
|
||||
use crate::{
|
||||
common::{self, Common, DEFAULT_MENU_ITEM_HEIGHT},
|
||||
fl,
|
||||
};
|
||||
use crate::common::{self, Common, DEFAULT_MENU_ITEM_HEIGHT};
|
||||
use crate::fl;
|
||||
|
||||
static USERNAME_ID: LazyLock<iced::id::Id> = LazyLock::new(|| iced::id::Id::new("username-id"));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use i18n_embed::{
|
||||
DefaultLocalizer, LanguageLoader, Localizer,
|
||||
fluent::{FluentLanguageLoader, fluent_language_loader},
|
||||
};
|
||||
use i18n_embed::fluent::{FluentLanguageLoader, fluent_language_loader};
|
||||
use i18n_embed::{DefaultLocalizer, LanguageLoader, Localizer};
|
||||
use rust_embed::RustEmbed;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,45 +4,37 @@
|
|||
use color_eyre::eyre::WrapErr;
|
||||
use cosmic::app::{Core, Settings, Task};
|
||||
use cosmic::cctk::wayland_protocols::xdg::shell::client::xdg_positioner::Gravity;
|
||||
use cosmic::iced::runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings;
|
||||
use cosmic::iced::{Point, Rectangle, Size};
|
||||
use cosmic::surface;
|
||||
use cosmic::{
|
||||
Element, executor,
|
||||
iced::runtime::core::window::Id as SurfaceId,
|
||||
iced::{
|
||||
self, Alignment, Background, Border, Length, Subscription,
|
||||
event::wayland::{OutputEvent, SessionLockEvent},
|
||||
futures::{self, SinkExt},
|
||||
platform_specific::shell::wayland::commands::session_lock::{
|
||||
use cosmic::iced::event::wayland::{OutputEvent, SessionLockEvent};
|
||||
use cosmic::iced::futures::{self, SinkExt};
|
||||
use cosmic::iced::platform_specific::shell::wayland::commands::session_lock::{
|
||||
destroy_lock_surface, get_lock_surface, lock, unlock,
|
||||
},
|
||||
},
|
||||
theme, widget,
|
||||
};
|
||||
use cosmic::iced::runtime::core::window::Id as SurfaceId;
|
||||
use cosmic::iced::runtime::platform_specific::wayland::subsurface::SctkSubsurfaceSettings;
|
||||
use cosmic::iced::{
|
||||
self, Alignment, Background, Border, Length, Point, Rectangle, Size, Subscription,
|
||||
};
|
||||
use cosmic::{Element, executor, surface, theme, widget};
|
||||
use cosmic_config::CosmicConfigEntry;
|
||||
use cosmic_greeter_daemon::{TimeAppletConfig, UserData};
|
||||
use std::any::TypeId;
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::os::fd::OwnedFd;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use std::{
|
||||
any::TypeId,
|
||||
env,
|
||||
ffi::{CStr, CString},
|
||||
fs,
|
||||
os::fd::OwnedFd,
|
||||
path::PathBuf,
|
||||
process,
|
||||
sync::Arc,
|
||||
};
|
||||
use tokio::{sync::mpsc, task};
|
||||
use std::{env, fs, process};
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::task;
|
||||
use tracing::level_filters::LevelFilter;
|
||||
use tracing::warn;
|
||||
use tracing_subscriber::{EnvFilter, fmt, prelude::*};
|
||||
use wayland_client::{Proxy, protocol::wl_output::WlOutput};
|
||||
use tracing_subscriber::prelude::*;
|
||||
use tracing_subscriber::{EnvFilter, fmt};
|
||||
use wayland_client::Proxy;
|
||||
use wayland_client::protocol::wl_output::WlOutput;
|
||||
|
||||
use crate::{
|
||||
common::{self, Common, DEFAULT_MENU_ITEM_HEIGHT},
|
||||
fl,
|
||||
};
|
||||
use crate::common::{self, Common, DEFAULT_MENU_ITEM_HEIGHT};
|
||||
use crate::fl;
|
||||
|
||||
fn lockfile_opt() -> Option<PathBuf> {
|
||||
let runtime_dir = dirs::runtime_dir()?;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
use cosmic::iced::{
|
||||
Subscription,
|
||||
futures::{SinkExt, StreamExt, channel::mpsc},
|
||||
};
|
||||
use logind_zbus::{
|
||||
manager::{InhibitType, ManagerProxy},
|
||||
session::SessionProxy,
|
||||
};
|
||||
use std::{any::TypeId, error::Error, os::fd::OwnedFd, sync::Arc, time::Duration};
|
||||
use cosmic::iced::Subscription;
|
||||
use cosmic::iced::futures::channel::mpsc;
|
||||
use cosmic::iced::futures::{SinkExt, StreamExt};
|
||||
use logind_zbus::manager::{InhibitType, ManagerProxy};
|
||||
use logind_zbus::session::SessionProxy;
|
||||
use std::any::TypeId;
|
||||
use std::error::Error;
|
||||
use std::os::fd::OwnedFd;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use zbus::Connection;
|
||||
|
||||
use crate::{common, locker::Message};
|
||||
use crate::common;
|
||||
use crate::locker::Message;
|
||||
|
||||
pub async fn power_off() -> zbus::Result<()> {
|
||||
let connection = Connection::system().await?;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
use cosmic::iced::{
|
||||
Subscription,
|
||||
futures::{SinkExt, StreamExt, channel::mpsc},
|
||||
};
|
||||
use cosmic_dbus_networkmanager::{device::SpecificDevice, nm::NetworkManager};
|
||||
use std::{any::TypeId, cmp, time::Duration};
|
||||
use cosmic::iced::Subscription;
|
||||
use cosmic::iced::futures::channel::mpsc;
|
||||
use cosmic::iced::futures::{SinkExt, StreamExt};
|
||||
use cosmic_dbus_networkmanager::device::SpecificDevice;
|
||||
use cosmic_dbus_networkmanager::nm::NetworkManager;
|
||||
use std::any::TypeId;
|
||||
use std::cmp;
|
||||
use std::time::Duration;
|
||||
use zbus::{Connection, Result};
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
|
|
|||
18
src/time.rs
18
src/time.rs
|
|
@ -1,17 +1,13 @@
|
|||
use anyhow::bail;
|
||||
use async_fn_stream::StreamEmitter;
|
||||
use cosmic::{
|
||||
Element, Task, style,
|
||||
widget::{column, text},
|
||||
};
|
||||
use cosmic::widget::{column, text};
|
||||
use cosmic::{Element, Task, style};
|
||||
use futures_util::StreamExt;
|
||||
use icu::{
|
||||
datetime::{
|
||||
DateTimeFormatter, DateTimeFormatterPreferences, fieldsets, input::DateTime,
|
||||
options::TimePrecision,
|
||||
},
|
||||
locale::{Locale, preferences::extensions::unicode::keywords::HourCycle},
|
||||
};
|
||||
use icu::datetime::input::DateTime;
|
||||
use icu::datetime::options::TimePrecision;
|
||||
use icu::datetime::{DateTimeFormatter, DateTimeFormatterPreferences, fieldsets};
|
||||
use icu::locale::Locale;
|
||||
use icu::locale::preferences::extensions::unicode::keywords::HourCycle;
|
||||
use jiff::tz::TimeZone;
|
||||
use jiff_icu::ConvertFrom;
|
||||
use std::time::Duration;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
use cosmic::iced::{
|
||||
Subscription,
|
||||
futures::{SinkExt, StreamExt, channel::mpsc},
|
||||
stream,
|
||||
};
|
||||
use cosmic::iced::futures::channel::mpsc;
|
||||
use cosmic::iced::futures::{SinkExt, StreamExt};
|
||||
use cosmic::iced::{Subscription, stream};
|
||||
use futures_util::select;
|
||||
use std::{any::TypeId, time::Duration};
|
||||
use std::any::TypeId;
|
||||
use std::time::Duration;
|
||||
use upower_dbus::{BatteryState, BatteryType, UPowerProxy};
|
||||
use zbus::{Connection, Result};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,8 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use cctk::sctk::reexports::calloop;
|
||||
use cosmic::iced::{
|
||||
self, Subscription,
|
||||
futures::{self, SinkExt},
|
||||
stream,
|
||||
};
|
||||
use cosmic::iced::futures::{self, SinkExt};
|
||||
use cosmic::iced::{self, Subscription, stream};
|
||||
use cosmic_settings_a11y_manager_subscription::{
|
||||
self as thread, AccessibilityEvent, AccessibilityRequest,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue