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