refactor: set locations of auto popup hover
This commit is contained in:
parent
b96d5f520b
commit
0d27b2e02a
11 changed files with 11 additions and 43 deletions
|
|
@ -12,4 +12,5 @@ Icon=com.system76.CosmicAppletAudio-symbolic
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-CosmicApplet=true
|
X-CosmicApplet=true
|
||||||
X-CosmicHoverPopup=true
|
# Indicates that the auto-hover click should go to the "end" of the hover popup
|
||||||
|
X-CosmicHoverPopup=End
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ use cosmic::applet::token::subscription::{
|
||||||
};
|
};
|
||||||
use cosmic::cctk::sctk::reexports::calloop;
|
use cosmic::cctk::sctk::reexports::calloop;
|
||||||
use cosmic::cosmic_config::CosmicConfigEntry;
|
use cosmic::cosmic_config::CosmicConfigEntry;
|
||||||
use cosmic::iced::event::listen_with;
|
|
||||||
use cosmic::iced::widget;
|
use cosmic::iced::widget;
|
||||||
use cosmic::iced::Limits;
|
use cosmic::iced::Limits;
|
||||||
use cosmic::iced::{
|
use cosmic::iced::{
|
||||||
|
|
@ -33,7 +32,6 @@ use cosmic::widget::Row;
|
||||||
use cosmic::widget::{divider, icon};
|
use cosmic::widget::{divider, icon};
|
||||||
use cosmic::Renderer;
|
use cosmic::Renderer;
|
||||||
use cosmic::{Element, Theme};
|
use cosmic::{Element, Theme};
|
||||||
use cosmic_time::Duration;
|
|
||||||
use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline};
|
use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline};
|
||||||
use iced::wayland::popup::{destroy_popup, get_popup};
|
use iced::wayland::popup::{destroy_popup, get_popup};
|
||||||
use iced::widget::container;
|
use iced::widget::container;
|
||||||
|
|
@ -74,7 +72,6 @@ pub struct Audio {
|
||||||
config: AudioAppletConfig,
|
config: AudioAppletConfig,
|
||||||
player_status: Option<mpris_subscription::PlayerStatus>,
|
player_status: Option<mpris_subscription::PlayerStatus>,
|
||||||
token_tx: Option<calloop::channel::Sender<TokenRequest>>,
|
token_tx: Option<calloop::channel::Sender<TokenRequest>>,
|
||||||
waiting: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Audio {
|
impl Audio {
|
||||||
|
|
@ -154,9 +151,6 @@ pub enum Message {
|
||||||
MprisRequest(MprisRequest),
|
MprisRequest(MprisRequest),
|
||||||
Token(TokenUpdate),
|
Token(TokenUpdate),
|
||||||
OpenSettings,
|
OpenSettings,
|
||||||
Wait,
|
|
||||||
WaitDone,
|
|
||||||
CursorLeft,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Audio {
|
impl Audio {
|
||||||
|
|
@ -289,7 +283,6 @@ impl cosmic::Application for Audio {
|
||||||
icon_name: "audio-volume-high-symbolic".to_string(),
|
icon_name: "audio-volume-high-symbolic".to_string(),
|
||||||
input_icon_name: "audio-input-microphone-symbolic".to_string(),
|
input_icon_name: "audio-input-microphone-symbolic".to_string(),
|
||||||
token_tx: None,
|
token_tx: None,
|
||||||
waiting: true,
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
Command::none(),
|
Command::none(),
|
||||||
|
|
@ -496,11 +489,6 @@ impl cosmic::Application for Audio {
|
||||||
self.player_status = None;
|
self.player_status = None;
|
||||||
}
|
}
|
||||||
Message::MprisRequest(r) => {
|
Message::MprisRequest(r) => {
|
||||||
// HACK avoid activating MPRIS from a panel popup auto-click event
|
|
||||||
// instead, open the popup
|
|
||||||
if self.waiting {
|
|
||||||
return self.update(Message::TogglePopup);
|
|
||||||
}
|
|
||||||
let Some(player_status) = self.player_status.as_ref() else {
|
let Some(player_status) = self.player_status.as_ref() else {
|
||||||
tracing::error!("No player found");
|
tracing::error!("No player found");
|
||||||
return Command::none();
|
return Command::none();
|
||||||
|
|
@ -562,18 +550,6 @@ impl cosmic::Application for Audio {
|
||||||
cosmic::process::spawn(cmd);
|
cosmic::process::spawn(cmd);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Message::Wait => {
|
|
||||||
self.waiting = true;
|
|
||||||
return Command::perform(tokio::time::sleep(Duration::from_millis(20)), |_| {
|
|
||||||
cosmic::app::Message::App(Message::WaitDone)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Message::WaitDone => {
|
|
||||||
self.waiting = false;
|
|
||||||
}
|
|
||||||
Message::CursorLeft => {
|
|
||||||
self.waiting = true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Command::none()
|
Command::none()
|
||||||
|
|
@ -585,15 +561,6 @@ impl cosmic::Application for Audio {
|
||||||
self.timeline
|
self.timeline
|
||||||
.as_subscription()
|
.as_subscription()
|
||||||
.map(|(_, now)| Message::Frame(now)),
|
.map(|(_, now)| Message::Frame(now)),
|
||||||
listen_with(|e, _status| match e {
|
|
||||||
cosmic::iced::Event::Mouse(cosmic::iced::mouse::Event::CursorEntered) => {
|
|
||||||
Some(Message::Wait)
|
|
||||||
}
|
|
||||||
cosmic::iced::Event::Mouse(cosmic::iced::mouse::Event::CursorLeft) => {
|
|
||||||
Some(Message::CursorLeft)
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
}),
|
|
||||||
self.core.watch_config(Self::APP_ID).map(|u| {
|
self.core.watch_config(Self::APP_ID).map(|u| {
|
||||||
for err in u.errors {
|
for err in u.errors {
|
||||||
tracing::error!(?err, "Error watching config");
|
tracing::error!(?err, "Error watching config");
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,4 @@ Icon=com.system76.CosmicAppletBattery-symbolic
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-CosmicApplet=true
|
X-CosmicApplet=true
|
||||||
X-CosmicHoverPopup=true
|
X-CosmicHoverPopup=Start
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,4 @@ Icon=com.system76.CosmicAppletBluetooth-symbolic
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-CosmicApplet=true
|
X-CosmicApplet=true
|
||||||
X-CosmicHoverPopup=true
|
X-CosmicHoverPopup=Auto
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,4 @@ Icon=com.system76.CosmicAppletInputSources-symbolic
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-CosmicApplet=true
|
X-CosmicApplet=true
|
||||||
X-CosmicHoverPopup=true
|
X-CosmicHoverPopup=Auto
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,4 @@ Icon=com.system76.CosmicAppletNetwork-symbolic
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-CosmicApplet=true
|
X-CosmicApplet=true
|
||||||
X-CosmicHoverPopup=true
|
X-CosmicHoverPopup=Auto
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,4 @@ Icon=com.system76.CosmicAppletNotifications-symbolic
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-CosmicApplet=true
|
X-CosmicApplet=true
|
||||||
X-NotificationsApplet=true
|
X-NotificationsApplet=true
|
||||||
X-CosmicHoverPopup=true
|
X-CosmicHoverPopup=Auto
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,4 @@ Icon=com.system76.CosmicAppletPower-symbolic
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-CosmicApplet=true
|
X-CosmicApplet=true
|
||||||
X-CosmicHoverPopup=true
|
X-CosmicHoverPopup=Auto
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,4 @@ Icon=com.system76.CosmicAppletStatusArea
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-CosmicApplet=true
|
X-CosmicApplet=true
|
||||||
X-CosmicHoverPopup=true
|
X-CosmicHoverPopup=Auto
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,4 @@ StartupNotify=true
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-CosmicApplet=true
|
X-CosmicApplet=true
|
||||||
X-HostWaylandDisplay=true
|
X-HostWaylandDisplay=true
|
||||||
X-CosmicHoverPopup=true
|
X-CosmicHoverPopup=Auto
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,5 @@ Icon=com.system76.CosmicAppletTime-symbolic
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
X-CosmicApplet=true
|
X-CosmicApplet=true
|
||||||
X-HostWaylandDisplay=true
|
X-HostWaylandDisplay=true
|
||||||
X-CosmicHoverPopup=true
|
X-CosmicHoverPopup=Auto
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue