Skip to content

Commit

Permalink
design: make PANEL_SIZE a constant
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
  • Loading branch information
ryanabx committed Sep 22, 2024
1 parent 8b3b483 commit 8203eb4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 22 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

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

10 changes: 7 additions & 3 deletions src/app_tray/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ use iced::{
Element, Length, Task, Theme,
};

use crate::{component_theme::button_style, config::AppTrayConfig, desktop_entry::EntryInfo};
use crate::{
component_theme::{button_style, PANEL_SIZE},
config::AppTrayConfig,
desktop_entry::EntryInfo,
};

pub mod compositor;

Expand Down Expand Up @@ -82,8 +86,8 @@ impl<'a> AppTray<'a> {
Element::from(
iced::widget::container(x)
// .width(Length::Fill)
.width(48)
.height(48)
.width(PANEL_SIZE as u16)
.height(PANEL_SIZE as u16)
.padding(4.0),
)
});
Expand Down
2 changes: 2 additions & 0 deletions src/component_theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use iced::{
Background, Border, Theme,
};

pub const PANEL_SIZE: u32 = 48;

pub fn button_style(
theme: &Theme,
status: button::Status,
Expand Down
17 changes: 12 additions & 5 deletions src/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::rc::Rc;
use iced::{
border::Radius,
platform_specific::{
runtime::wayland::layer_surface::{IcedOutput, SctkLayerSurfaceSettings},
runtime::wayland::layer_surface::{IcedMargin, IcedOutput, SctkLayerSurfaceSettings},
shell::commands::layer_surface::get_layer_surface,
},
widget::{column, row, text},
Expand All @@ -15,6 +15,7 @@ use wayland_protocols_wlr::layer_shell;

use crate::{
app_tray::{AppTray, AppTrayMessage},
component_theme::PANEL_SIZE,
config::PanelConfig,
desktop_entry::DesktopEntryCache,
settings_tray::{SettingsTray, SettingsTrayMessage},
Expand Down Expand Up @@ -43,12 +44,18 @@ impl<'a> Panel<'a> {
layer: smithay_client_toolkit::shell::wlr_layer::Layer::Top,
// keyboard_interactivity: todo!(),
pointer_interactivity: true,
anchor: Anchor::LEFT.union(Anchor::BOTTOM).union(Anchor::RIGHT),
anchor: Anchor::BOTTOM.union(Anchor::LEFT).union(Anchor::RIGHT),
output: IcedOutput::Active,
// namespace: todo!(),
// margin: todo!(),
size: Some((None, Some(48))),
exclusive_zone: 48,
// margin: IcedMargin {
// top: 5,
// right: 5,
// left: 5,
// bottom: 5,
// },
// size: Some((None, Some(48))),
size: Some((None, Some(PANEL_SIZE))),
exclusive_zone: PANEL_SIZE as i32,
// size_limits: todo!(),
..Default::default()
});
Expand Down
6 changes: 3 additions & 3 deletions src/start_menu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use iced::{
};

use crate::{
component_theme::button_style,
component_theme::{button_style, PANEL_SIZE},
components::app_icon,
desktop_entry::{DesktopEntryCache, EntryInfo},
};
Expand Down Expand Up @@ -40,8 +40,8 @@ impl<'a> StartMenu<'a> {
.style(Self::tray_button_style)
.on_press(StartMenuMessage::MenuToggle),
)
.width(48)
.height(48)
.width(PANEL_SIZE as u16)
.height(PANEL_SIZE as u16)
.padding(4.0)
.into()
}
Expand Down

0 comments on commit 8203eb4

Please sign in to comment.