Skip to content

Commit

Permalink
Merge pull request #87 from MalpenZibo/release-0.4.0
Browse files Browse the repository at this point in the history
Release 0.4.0
  • Loading branch information
MalpenZibo authored Jan 21, 2025
2 parents bf85cce + fb2aebd commit bfb28c0
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 40 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.4.0] - 2025-01-19

A big update with new features and new configurations!

The configuration file must be updated to adapt to the new stuff.

### Added

- Multi monitor support
Expand All @@ -19,6 +25,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update to pop-os Iced 14.0-dev
- Dynamic menu positioning

### Thanks

- @fiersik for participating in the discussions
- @ReshetnikovPavel for the proposal of the new dynamic modules system configuration

## [0.3.1] - 2024-12-13

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "ashell"
description = "Barely customizable Wayland status bar for Hyprland compositor."
homepage = "https://github.com/MalpenZibo/ashell"
version = "0.3.1"
version = "0.4.0"
edition = "2021"
rust-version = "1.81"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A ready to go Wayland status bar for Hyprland.
Feel free to fork this project and customize it for your needs or just open an
issue to request a particular feature.

> If you have an issue with the transparency you could try launching ashell with WGPU_BACKEND=gl. This env var forces wgpu to use OpenGL instead of Vulkan. It seems that wgpu has some issues with AMD GPU and Vulkan transparency.
> If you have graphical issues like missing transparency or graphical artifact you could launch ashell with WGPU_BACKEND=gl. This env var forces wgpu to use OpenGL instead of Vulkan
### Does it only work on Hyprland?

Expand Down
23 changes: 4 additions & 19 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ use crate::{
menu::{menu_wrapper, MenuSize, MenuType},
modules::{
self, app_launcher::AppLauncher, clipboard::Clipboard, clock::Clock,
keyboard_layout::KeyboardLayout, keyboard_submap::KeyboardSubmap, privacy::PrivacyMessage,
keyboard_layout::KeyboardLayout, keyboard_submap::KeyboardSubmap, privacy::Privacy,
settings::Settings, system_info::SystemInfo, tray::TrayModule, updates::Updates,
window_title::WindowTitle, workspaces::Workspaces,
},
outputs::{HasOutput, Outputs},
position_button::ButtonUIRef,
services::{privacy::PrivacyService, ReadOnlyService, ServiceEvent},
style::ashell_theme,
utils, HEIGHT,
};
Expand Down Expand Up @@ -39,7 +38,7 @@ pub struct App {
pub keyboard_submap: KeyboardSubmap,
pub tray: TrayModule,
pub clock: Clock,
pub privacy: Option<PrivacyService>,
pub privacy: Privacy,
pub settings: Settings,
}

Expand Down Expand Up @@ -84,7 +83,7 @@ impl App {
keyboard_submap: KeyboardSubmap::default(),
tray: TrayModule::default(),
clock: Clock::default(),
privacy: None,
privacy: Privacy::default(),
settings: Settings::default(),
},
task,
Expand Down Expand Up @@ -196,21 +195,7 @@ impl App {
self.clock.update(message);
Task::none()
}
Message::Privacy(msg) => match msg {
PrivacyMessage::Event(event) => match event {
ServiceEvent::Init(service) => {
self.privacy = Some(service);
Task::none()
}
ServiceEvent::Update(data) => {
if let Some(privacy) = self.privacy.as_mut() {
privacy.update(data);
}
Task::none()
}
ServiceEvent::Error(_) => Task::none(),
},
},
Message::Privacy(msg) => self.privacy.update(msg),
Message::Settings(message) => {
self.settings
.update(message, &self.config.settings, &mut self.outputs)
Expand Down
4 changes: 2 additions & 2 deletions src/modules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl App {
ModuleName::KeyboardSubmap => self.keyboard_submap.view(()),
ModuleName::Tray => self.tray.view(id),
ModuleName::Clock => self.clock.view(&self.config.clock.format),
ModuleName::Privacy => self.privacy.as_ref().and_then(|p| p.view(())),
ModuleName::Privacy => self.privacy.view(()),
ModuleName::Settings => self.settings.view(()),
}
}
Expand All @@ -242,7 +242,7 @@ impl App {
ModuleName::KeyboardSubmap => self.keyboard_submap.subscription(()),
ModuleName::Tray => self.tray.subscription(()),
ModuleName::Clock => self.clock.subscription(()),
ModuleName::Privacy => self.privacy.as_ref().and_then(|p| p.subscription(())),
ModuleName::Privacy => self.privacy.subscription(()),
ModuleName::Settings => self.settings.subscription(()),
}
}
Expand Down
71 changes: 55 additions & 16 deletions src/modules/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,76 @@ use super::{Module, OnModulePress};
use crate::{
app,
components::icons::{icon, Icons},
services::{
privacy::{PrivacyData, PrivacyService},
ReadOnlyService, ServiceEvent,
},
services::{privacy::PrivacyService, ReadOnlyService, ServiceEvent},
};
use iced::{
widget::{container, Row},
Alignment, Element, Subscription, Task,
};
use iced::{widget::Row, Alignment, Element, Subscription};

#[derive(Debug, Clone)]
pub enum PrivacyMessage {
Event(ServiceEvent<PrivacyService>),
}

impl Module for PrivacyData {
#[derive(Debug, Default, Clone)]
pub struct Privacy {
pub service: Option<PrivacyService>,
}

impl Privacy {
pub fn update(&mut self, message: PrivacyMessage) -> Task<crate::app::Message> {
match message {
PrivacyMessage::Event(event) => match event {
ServiceEvent::Init(service) => {
self.service = Some(service);
Task::none()
}
ServiceEvent::Update(data) => {
if let Some(privacy) = self.service.as_mut() {
privacy.update(data);
}
Task::none()
}
ServiceEvent::Error(_) => Task::none(),
},
}
}
}

impl Module for Privacy {
type ViewData<'a> = ();
type SubscriptionData<'a> = ();

fn view(
&self,
_: Self::ViewData<'_>,
) -> Option<(Element<app::Message>, Option<OnModulePress>)> {
if !self.no_access() {
Some((
Row::new()
.push_maybe(self.screenshare_access().then(|| icon(Icons::ScreenShare)))
.push_maybe(self.webcam_access().then(|| icon(Icons::Webcam)))
.push_maybe(self.microphone_access().then(|| icon(Icons::Mic1)))
.align_y(Alignment::Center)
.spacing(8)
if let Some(service) = self.service.as_ref() {
if !service.no_access() {
Some((
container(
Row::new()
.push_maybe(
service
.screenshare_access()
.then(|| icon(Icons::ScreenShare)),
)
.push_maybe(service.webcam_access().then(|| icon(Icons::Webcam)))
.push_maybe(service.microphone_access().then(|| icon(Icons::Mic1)))
.align_y(Alignment::Center)
.spacing(8),
)
.style(|theme| container::Style {
text_color: Some(theme.extended_palette().danger.weak.color),
..Default::default()
})
.into(),
None,
))
None,
))
} else {
None
}
} else {
None
}
Expand Down

0 comments on commit bfb28c0

Please sign in to comment.