refactor: use menu button
This commit is contained in:
parent
df63a5d141
commit
d80a801fe5
12 changed files with 60 additions and 138 deletions
17
Cargo.lock
generated
17
Cargo.lock
generated
|
|
@ -935,7 +935,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"atomicwrites",
|
||||
"cosmic-config-derive",
|
||||
|
|
@ -949,7 +948,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config-derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
|
|
@ -1048,7 +1046,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-theme"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"almost",
|
||||
"cosmic-config",
|
||||
|
|
@ -1062,7 +1059,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-time"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-time#71116b2eefb536bedbd3438e70cba49d54c3a5d5"
|
||||
dependencies = [
|
||||
"float-cmp",
|
||||
"libcosmic",
|
||||
|
|
@ -2412,7 +2408,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced"
|
||||
version = "0.10.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"iced_accessibility",
|
||||
"iced_core",
|
||||
|
|
@ -2427,7 +2422,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_accessibility"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"accesskit_unix",
|
||||
|
|
@ -2436,7 +2430,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_core"
|
||||
version = "0.10.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"iced_accessibility",
|
||||
|
|
@ -2451,7 +2444,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_futures"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"iced_core",
|
||||
|
|
@ -2464,7 +2456,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_graphics"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bytemuck",
|
||||
|
|
@ -2482,7 +2473,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_renderer"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"iced_graphics",
|
||||
"iced_tiny_skia",
|
||||
|
|
@ -2495,7 +2485,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_runtime"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"iced_accessibility",
|
||||
"iced_core",
|
||||
|
|
@ -2507,7 +2496,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_sctk"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"enum-repr",
|
||||
"float-cmp",
|
||||
|
|
@ -2531,7 +2519,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_style"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"iced_core",
|
||||
"once_cell",
|
||||
|
|
@ -2541,7 +2528,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_tiny_skia"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cosmic-text",
|
||||
|
|
@ -2559,7 +2545,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_wgpu"
|
||||
version = "0.11.1"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bytemuck",
|
||||
|
|
@ -2581,7 +2566,6 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_widget"
|
||||
version = "0.1.3"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"iced_renderer",
|
||||
"iced_runtime",
|
||||
|
|
@ -2853,7 +2837,6 @@ checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
|
|||
[[package]]
|
||||
name = "libcosmic"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#589b66175242e8f82f60a116e76f2c51783b70a2"
|
||||
dependencies = [
|
||||
"apply",
|
||||
"ashpd",
|
||||
|
|
|
|||
10
Cargo.toml
10
Cargo.toml
|
|
@ -37,10 +37,10 @@ libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = fa
|
|||
lto = "thin"
|
||||
# lto = "fat"
|
||||
|
||||
# [patch."https://github.com/pop-os/cosmic-time"]
|
||||
# cosmic-time = { path = "../cosmic-time" }
|
||||
# [patch."https://github.com/pop-os/libcosmic"]
|
||||
# libcosmic = { path = "../libcosmic" }
|
||||
# cosmic-config = { path = "../libcosmic/cosmic-config" }
|
||||
[patch."https://github.com/pop-os/cosmic-time"]
|
||||
cosmic-time = { path = "../cosmic-time" }
|
||||
[patch."https://github.com/pop-os/libcosmic"]
|
||||
libcosmic = { path = "../libcosmic" }
|
||||
cosmic-config = { path = "../libcosmic/cosmic-config" }
|
||||
[patch."https://github.com/Smithay/client-toolkit"]
|
||||
sctk = { git = "https://github.com/smithay/client-toolkit//", package = "smithay-client-toolkit", rev = "dc8c4a0" }
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
mod localize;
|
||||
|
||||
use cosmic::app::Command;
|
||||
use cosmic::applet::menu_button;
|
||||
use cosmic::iced::widget;
|
||||
use cosmic::iced::Limits;
|
||||
use cosmic::iced_runtime::core::alignment::Horizontal;
|
||||
|
||||
use cosmic::applet::button_theme;
|
||||
use cosmic::widget::{button, divider, icon};
|
||||
use cosmic::Renderer;
|
||||
|
||||
|
|
@ -458,10 +458,7 @@ impl cosmic::Application for Audio {
|
|||
container(divider::horizontal::light())
|
||||
.padding([12, 24])
|
||||
.width(Length::Fill),
|
||||
button(text(fl!("sound-settings")).size(14))
|
||||
.style(button_theme())
|
||||
.padding([8, 24])
|
||||
.width(Length::Fill)
|
||||
menu_button(text(fl!("sound-settings")).size(14))
|
||||
]
|
||||
.align_items(Alignment::Start)
|
||||
.padding([8, 0]);
|
||||
|
|
@ -487,8 +484,7 @@ fn revealer(
|
|||
column![revealer_head(open, title, selected, toggle)].width(Length::Fill),
|
||||
|col, (id, name)| {
|
||||
col.push(
|
||||
button(text(name).size(14))
|
||||
.style(button_theme())
|
||||
menu_button(text(name).size(14))
|
||||
.on_press(change(id.clone()))
|
||||
.width(Length::Fill)
|
||||
.padding([8, 48]),
|
||||
|
|
@ -506,13 +502,10 @@ fn revealer_head(
|
|||
selected: String,
|
||||
toggle: Message,
|
||||
) -> cosmic::widget::Button<'static, Message, Renderer> {
|
||||
button(column![
|
||||
menu_button(column![
|
||||
text(title).width(Length::Fill).size(14),
|
||||
text(selected).size(10),
|
||||
])
|
||||
.style(button_theme())
|
||||
.padding([8, 24])
|
||||
.width(Length::Fill)
|
||||
.on_press(toggle)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use crate::upower_device::{device_subscription, DeviceDbusEvent};
|
|||
use crate::upower_kbdbacklight::{
|
||||
kbd_backlight_subscription, KeyboardBacklightRequest, KeyboardBacklightUpdate,
|
||||
};
|
||||
use cosmic::applet::menu_button;
|
||||
use cosmic::iced::alignment::Horizontal;
|
||||
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||
use cosmic::iced::{
|
||||
|
|
@ -19,7 +20,7 @@ use cosmic::iced::{
|
|||
use cosmic::iced_runtime::core::layout::Limits;
|
||||
use cosmic::iced_style::application;
|
||||
use cosmic::widget::{button, divider, horizontal_space, icon};
|
||||
use cosmic::{applet::button_theme, Command};
|
||||
use cosmic::Command;
|
||||
use cosmic::{Element, Theme};
|
||||
use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline};
|
||||
|
||||
|
|
@ -326,7 +327,7 @@ impl cosmic::Application for CosmicBatteryApplet {
|
|||
container(divider::horizontal::light())
|
||||
.width(Length::Fill)
|
||||
.padding([0, 12]),
|
||||
button(
|
||||
menu_button(
|
||||
row![
|
||||
column![
|
||||
text(fl!("battery")).size(14),
|
||||
|
|
@ -345,11 +346,8 @@ impl cosmic::Application for CosmicBatteryApplet {
|
|||
]
|
||||
.align_items(Alignment::Center)
|
||||
)
|
||||
.style(button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectProfile(Power::Battery))
|
||||
.width(Length::Fill),
|
||||
button(
|
||||
.on_press(Message::SelectProfile(Power::Battery)),
|
||||
menu_button(
|
||||
row![
|
||||
column![
|
||||
text(fl!("balanced")).size(14),
|
||||
|
|
@ -368,11 +366,8 @@ impl cosmic::Application for CosmicBatteryApplet {
|
|||
]
|
||||
.align_items(Alignment::Center)
|
||||
)
|
||||
.style(button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectProfile(Power::Balanced))
|
||||
.width(Length::Fill),
|
||||
button(
|
||||
.on_press(Message::SelectProfile(Power::Balanced)),
|
||||
menu_button(
|
||||
row![
|
||||
column![
|
||||
text(fl!("performance")).size(14),
|
||||
|
|
@ -391,10 +386,7 @@ impl cosmic::Application for CosmicBatteryApplet {
|
|||
]
|
||||
.align_items(Alignment::Center)
|
||||
)
|
||||
.style(button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectProfile(Power::Performance))
|
||||
.width(Length::Fill),
|
||||
.on_press(Message::SelectProfile(Power::Performance)),
|
||||
container(divider::horizontal::light())
|
||||
.width(Length::Fill)
|
||||
.padding([0, 12]),
|
||||
|
|
@ -450,11 +442,8 @@ impl cosmic::Application for CosmicBatteryApplet {
|
|||
container(divider::horizontal::light())
|
||||
.width(Length::Fill)
|
||||
.padding([0, 12]),
|
||||
button(text(fl!("power-settings")).size(14).width(Length::Fill))
|
||||
.style(button_theme())
|
||||
menu_button(text(fl!("power-settings")).size(14).width(Length::Fill))
|
||||
.on_press(Message::OpenBatterySettings)
|
||||
.width(Length::Fill)
|
||||
.padding([8, 24])
|
||||
]
|
||||
.spacing(8)
|
||||
.padding([8, 0]),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::bluetooth::{BluerDeviceStatus, BluerRequest, BluerState};
|
||||
use cosmic::applet::menu_button;
|
||||
use cosmic::widget::button::StyleSheet;
|
||||
use cosmic::{applet::button_theme, Command};
|
||||
use cosmic::Command;
|
||||
use cosmic::{
|
||||
iced::{
|
||||
self,
|
||||
|
|
@ -352,27 +353,22 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
BluerDeviceStatus::Disconnected | BluerDeviceStatus::Pairing => continue,
|
||||
};
|
||||
|
||||
known_bluetooth = known_bluetooth.push(
|
||||
button(row)
|
||||
.style(button_theme())
|
||||
.on_press(match dev.status {
|
||||
BluerDeviceStatus::Connected => {
|
||||
Message::Request(BluerRequest::DisconnectDevice(dev.address))
|
||||
}
|
||||
BluerDeviceStatus::Disconnected => {
|
||||
Message::Request(BluerRequest::PairDevice(dev.address))
|
||||
}
|
||||
BluerDeviceStatus::Paired => {
|
||||
Message::Request(BluerRequest::ConnectDevice(dev.address))
|
||||
}
|
||||
BluerDeviceStatus::Connecting => {
|
||||
Message::Request(BluerRequest::CancelConnect(dev.address))
|
||||
}
|
||||
BluerDeviceStatus::Disconnecting => Message::Ignore, // Start connecting?
|
||||
BluerDeviceStatus::Pairing => Message::Ignore, // Cancel pairing?
|
||||
})
|
||||
.width(Length::Fill),
|
||||
);
|
||||
known_bluetooth = known_bluetooth.push(menu_button(row).on_press(match dev.status {
|
||||
BluerDeviceStatus::Connected => {
|
||||
Message::Request(BluerRequest::DisconnectDevice(dev.address))
|
||||
}
|
||||
BluerDeviceStatus::Disconnected => {
|
||||
Message::Request(BluerRequest::PairDevice(dev.address))
|
||||
}
|
||||
BluerDeviceStatus::Paired => {
|
||||
Message::Request(BluerRequest::ConnectDevice(dev.address))
|
||||
}
|
||||
BluerDeviceStatus::Connecting => {
|
||||
Message::Request(BluerRequest::CancelConnect(dev.address))
|
||||
}
|
||||
BluerDeviceStatus::Disconnecting => Message::Ignore, // Start connecting?
|
||||
BluerDeviceStatus::Pairing => Message::Ignore, // Cancel pairing?
|
||||
}));
|
||||
}
|
||||
|
||||
let mut content = column![
|
||||
|
|
@ -407,7 +403,7 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
} else {
|
||||
"go-next-symbolic"
|
||||
};
|
||||
let available_connections_btn = button(row![
|
||||
let available_connections_btn = menu_button(row![
|
||||
text(fl!("other-devices"))
|
||||
.size(14)
|
||||
.width(Length::Fill)
|
||||
|
|
@ -419,7 +415,6 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
.width(Length::Fixed(24.0))
|
||||
.height(Length::Fixed(24.0))
|
||||
])
|
||||
.style(Button::Text)
|
||||
.padding([8, 24])
|
||||
.on_press(Message::ToggleVisibleDevices(!self.show_visible_devices));
|
||||
content = content.push(available_connections_btn);
|
||||
|
|
@ -499,14 +494,10 @@ impl cosmic::Application for CosmicBluetoothApplet {
|
|||
.width(Length::Fill)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(12);
|
||||
visible_devices = visible_devices.push(
|
||||
button(row.width(Length::Fill))
|
||||
.style(button_theme())
|
||||
.on_press(Message::Request(BluerRequest::PairDevice(
|
||||
dev.address.clone(),
|
||||
)))
|
||||
.width(Length::Fill),
|
||||
);
|
||||
visible_devices =
|
||||
visible_devices.push(menu_button(row.width(Length::Fill)).on_press(
|
||||
Message::Request(BluerRequest::PairDevice(dev.address.clone())),
|
||||
));
|
||||
visible_devices_count += 1;
|
||||
}
|
||||
list_column.push(visible_devices.into());
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::dbus::{self, PowerDaemonProxy};
|
|||
use crate::fl;
|
||||
use crate::graphics::{get_current_graphics, set_graphics, Graphics};
|
||||
use cosmic::app::command::message::cosmic;
|
||||
use cosmic::applet::menu_button;
|
||||
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||
use cosmic::iced_runtime::core::alignment::Horizontal;
|
||||
use cosmic::iced_runtime::core::Alignment;
|
||||
|
|
@ -9,10 +10,7 @@ use cosmic::iced_style::application;
|
|||
use cosmic::theme::Button;
|
||||
use cosmic::widget::divider::horizontal;
|
||||
use cosmic::widget::{horizontal_space, icon, Container, Icon};
|
||||
use cosmic::{
|
||||
applet::{button_theme, cosmic_panel_config::PanelAnchor},
|
||||
Command,
|
||||
};
|
||||
use cosmic::{applet::cosmic_panel_config::PanelAnchor, Command};
|
||||
use cosmic::{
|
||||
iced::widget::{column, container, row, text},
|
||||
iced::{self, Length},
|
||||
|
|
@ -252,7 +250,6 @@ impl cosmic::Application for Window {
|
|||
.padding([0, self.core.applet.suggested_size().0 / 2])
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(Button::Text)
|
||||
.on_press(Message::TogglePopup)
|
||||
.padding(8)
|
||||
.width(Length::Shrink)
|
||||
|
|
@ -263,7 +260,7 @@ impl cosmic::Application for Window {
|
|||
|
||||
fn view_window(&self, _id: window::Id) -> Element<Message> {
|
||||
let content_list = vec![
|
||||
button(
|
||||
menu_button(
|
||||
row![
|
||||
column![
|
||||
text(format!("{} {}", fl!("integrated"), fl!("graphics"))).size(14),
|
||||
|
|
@ -274,12 +271,9 @@ impl cosmic::Application for Window {
|
|||
]
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectGraphicsMode(Graphics::Integrated))
|
||||
.width(Length::Fill)
|
||||
.into(),
|
||||
button(
|
||||
menu_button(
|
||||
row![
|
||||
column![text(format!("{} {}", fl!("nvidia"), fl!("graphics"))).size(14)]
|
||||
.width(Length::Fill),
|
||||
|
|
@ -287,12 +281,9 @@ impl cosmic::Application for Window {
|
|||
]
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectGraphicsMode(Graphics::Nvidia))
|
||||
.width(Length::Fill)
|
||||
.into(),
|
||||
button(
|
||||
menu_button(
|
||||
row![
|
||||
column![
|
||||
text(format!("{} {}", fl!("hybrid"), fl!("graphics"))).size(14),
|
||||
|
|
@ -303,12 +294,9 @@ impl cosmic::Application for Window {
|
|||
]
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectGraphicsMode(Graphics::Hybrid))
|
||||
.width(Length::Fill)
|
||||
.into(),
|
||||
button(
|
||||
menu_button(
|
||||
row![
|
||||
column![
|
||||
text(format!("{} {}", fl!("compute"), fl!("graphics"))).size(14),
|
||||
|
|
@ -319,10 +307,7 @@ impl cosmic::Application for Window {
|
|||
]
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(button_theme())
|
||||
.padding([8, 24])
|
||||
.on_press(Message::SelectGraphicsMode(Graphics::Compute))
|
||||
.width(Length::Fill)
|
||||
.into(),
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -550,7 +550,7 @@ impl cosmic::Application for CosmicNetworkApplet {
|
|||
.text_size(14)
|
||||
.width(Length::Fill)
|
||||
)
|
||||
.padding([0, 12]),
|
||||
.padding([0, 24]),
|
||||
divider::horizontal::light(),
|
||||
]
|
||||
.align_items(Alignment::Center)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
mod localize;
|
||||
mod subscriptions;
|
||||
|
||||
use cosmic::applet::menu_button;
|
||||
use cosmic::cosmic_config::{config_subscription, Config, CosmicConfigEntry};
|
||||
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||
use cosmic::iced::Limits;
|
||||
|
|
@ -9,7 +10,7 @@ use cosmic::iced::{
|
|||
window, Alignment, Length, Subscription,
|
||||
};
|
||||
use cosmic::iced_core::alignment::Horizontal;
|
||||
use cosmic::{applet::button_theme, Command};
|
||||
use cosmic::Command;
|
||||
|
||||
use cosmic::iced_style::application;
|
||||
|
||||
|
|
@ -505,17 +506,13 @@ impl cosmic::Application for Notifications {
|
|||
}
|
||||
}
|
||||
|
||||
// todo put into libcosmic doing so will fix the row_button's border radius
|
||||
fn row_button(content: Vec<Element<Message>>) -> cosmic::widget::Button<Message, Renderer> {
|
||||
button(
|
||||
menu_button(
|
||||
Row::with_children(content)
|
||||
.spacing(4)
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fixed(36.0))
|
||||
.padding([0, 24])
|
||||
.style(button_theme())
|
||||
}
|
||||
|
||||
fn text_icon(name: &str, size: u16) -> cosmic::widget::Icon {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|||
use std::process;
|
||||
use std::time::Duration;
|
||||
|
||||
use cosmic::applet::button_theme;
|
||||
use cosmic::applet::menu_button;
|
||||
use cosmic::iced;
|
||||
use cosmic::iced::alignment::{Horizontal, Vertical};
|
||||
use cosmic::iced::event::wayland::{self, LayerEvent};
|
||||
|
|
@ -351,14 +351,11 @@ impl cosmic::Application for Power {
|
|||
// ### UI Helplers
|
||||
|
||||
fn row_button(content: Vec<Element<Message>>) -> cosmic::widget::Button<Message, Renderer> {
|
||||
button(
|
||||
menu_button(
|
||||
Row::with_children(content)
|
||||
.spacing(4)
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.style(button_theme())
|
||||
.width(Length::Fill)
|
||||
.padding([8, 24])
|
||||
}
|
||||
|
||||
fn power_buttons(name: &str, msg: String) -> cosmic::widget::Button<Message, Renderer> {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use cosmic::applet::button_theme;
|
||||
use cosmic::applet::menu_button;
|
||||
use cosmic::iced;
|
||||
|
||||
use crate::subscriptions::status_notifier_item::{Layout, StatusNotifierItem};
|
||||
|
|
@ -161,13 +161,10 @@ fn layout_view(layout: &Layout, expanded: Option<i32>) -> cosmic::Element<Msg> {
|
|||
}
|
||||
|
||||
fn row_button(content: Vec<cosmic::Element<Msg>>) -> cosmic::widget::Button<Msg, cosmic::Renderer> {
|
||||
cosmic::widget::button(
|
||||
menu_button(
|
||||
iced::widget::Row::with_children(content)
|
||||
.spacing(8)
|
||||
.align_items(iced::Alignment::Center)
|
||||
.width(iced::Length::Fill),
|
||||
)
|
||||
.style(button_theme())
|
||||
.width(iced::Length::Fill)
|
||||
.padding([8, 24])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::fl;
|
||||
use cosmic::app::Core;
|
||||
use cosmic::applet::button_theme;
|
||||
use cosmic::applet::menu_button;
|
||||
use cosmic::cosmic_config::{ConfigGet, ConfigSet, CosmicConfigEntry};
|
||||
use cosmic::cosmic_theme::ThemeBuilder;
|
||||
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||
|
|
@ -280,10 +280,7 @@ impl cosmic::Application for Window {
|
|||
)
|
||||
.push(
|
||||
container(
|
||||
button(text(fl!("view-all-shortcuts")).size(14))
|
||||
.width(Length::Fill)
|
||||
.style(button_theme())
|
||||
.padding(8)
|
||||
menu_button(text(fl!("view-all-shortcuts")).size(14))
|
||||
.on_press(Message::ViewAllShortcuts),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
|
|
@ -307,10 +304,7 @@ impl cosmic::Application for Window {
|
|||
)
|
||||
.push(
|
||||
container(
|
||||
button(text(fl!("floating-window-exceptions")).size(14))
|
||||
.width(Length::Fill)
|
||||
.padding(8)
|
||||
.style(button_theme())
|
||||
menu_button(text(fl!("floating-window-exceptions")).size(14))
|
||||
.on_press(Message::OpenFloatingWindowExceptions),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
|
|
@ -318,10 +312,7 @@ impl cosmic::Application for Window {
|
|||
)
|
||||
.push(
|
||||
container(
|
||||
button(text(fl!("window-management-settings")).size(14))
|
||||
.width(Length::Fill)
|
||||
.padding(8)
|
||||
.style(button_theme())
|
||||
menu_button(text(fl!("window-management-settings")).size(14))
|
||||
.on_press(Message::OpenWindowManagementSettings),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
|
|
|
|||
|
|
@ -210,8 +210,7 @@ impl cosmic::Application for Time {
|
|||
date_time_col
|
||||
},
|
||||
)
|
||||
.on_press(Message::TogglePopup)
|
||||
.style(theme::Button::Text);
|
||||
.on_press(Message::TogglePopup);
|
||||
|
||||
if let Some(tracker) = self.rectangle_tracker.as_ref() {
|
||||
tracker.container(0, button).into()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue