Merge pull request #40 from pop-os/time-to-fix-sytling_jammy

Time to fix sytling
This commit is contained in:
Brock 2022-12-21 17:13:39 -07:00 committed by GitHub
commit ceff811072
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 368 additions and 261 deletions

File diff suppressed because it is too large Load diff

View file

@ -8,8 +8,5 @@ license = "GPL-3.0-or-later"
icon-loader = { version = "0.3.6", features = ["gtk"] }
tokio = { version = "1.20.1", features=["full"] }
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet"] }
# libcosmic = { path = "../../../../libcosmic", default-features = false, features = ["wayland", "applet"] }
# iced_sctk = { git = "https://github.com/pop-os/iced-sctk" }
# sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", commit = "f1d9c3ef9cfbd508d986f7f98b2fc267fcc39b84" }
nix = "0.24.1"
chrono = { version = "0.4.23", features = ["clock"] }

View file

@ -6,16 +6,18 @@ use cosmic::iced::wayland::{
use cosmic::iced::{
executor, time,
widget::{button, column, text},
window, Alignment, Application, Color, Command, Subscription,
window, Alignment, Application, Color, Command, Length, Subscription,
};
use cosmic::iced_style::application::{self, Appearance};
use cosmic::theme;
use cosmic::{Element, Theme};
use chrono::{DateTime, Local, Timelike};
use std::time::Duration;
pub fn main() -> cosmic::iced::Result {
let helper = CosmicAppletHelper::default();
let mut helper = CosmicAppletHelper::default();
helper.window_size(120, 16);
Time::run(helper.window_settings())
}
@ -119,7 +121,7 @@ impl Application for Time {
window::Id::new(0),
new_id,
(400, 300),
None,
Some(60),
None,
);
get_popup(popup_settings)
@ -136,11 +138,15 @@ impl Application for Time {
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
match id {
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
SurfaceIdWrapper::Window(_) => {
button(text(self.now.format("%b %-d %-I:%M %p").to_string()))
.on_press(Message::TogglePopup)
.into()
}
SurfaceIdWrapper::Window(_) => button(
column![text(self.now.format("%b %-d %-I:%M %p").to_string())]
.width(Length::Fill)
.align_items(Alignment::Center),
)
.on_press(Message::TogglePopup)
.style(theme::Button::Text)
.width(Length::Units(120))
.into(),
SurfaceIdWrapper::Popup(_) => {
use std::os::unix::process::ExitStatusExt;
let calendar = std::str::from_utf8(