Log screensaver inhibitors
This commit is contained in:
parent
1cdce673df
commit
d6d811e1f8
1 changed files with 15 additions and 1 deletions
|
|
@ -30,6 +30,13 @@ impl Screensaver {
|
||||||
) -> u32 {
|
) -> u32 {
|
||||||
let cookie = self.last_cookie.fetch_add(1, Ordering::Relaxed) + 1;
|
let cookie = self.last_cookie.fetch_add(1, Ordering::Relaxed) + 1;
|
||||||
if let Some(sender) = header.sender() {
|
if let Some(sender) = header.sender() {
|
||||||
|
log::info!(
|
||||||
|
"Added screensaver inhibitor for application '{}' {:?}, reason: {}, cookie: {}",
|
||||||
|
application_name,
|
||||||
|
sender,
|
||||||
|
reason_for_inhibit,
|
||||||
|
cookie
|
||||||
|
);
|
||||||
self.inhibitors.lock().unwrap().push(Inhibitor {
|
self.inhibitors.lock().unwrap().push(Inhibitor {
|
||||||
cookie,
|
cookie,
|
||||||
application_name,
|
application_name,
|
||||||
|
|
@ -43,7 +50,14 @@ impl Screensaver {
|
||||||
fn un_inhibit(&mut self, cookie: u32) {
|
fn un_inhibit(&mut self, cookie: u32) {
|
||||||
let mut inhibitors = self.inhibitors.lock().unwrap();
|
let mut inhibitors = self.inhibitors.lock().unwrap();
|
||||||
if let Some(idx) = inhibitors.iter().position(|x| x.cookie == cookie) {
|
if let Some(idx) = inhibitors.iter().position(|x| x.cookie == cookie) {
|
||||||
inhibitors.remove(idx);
|
let inhibitor = inhibitors.remove(idx);
|
||||||
|
log::info!(
|
||||||
|
"Removed screensaver inhibitor for application '{}' {:?}, reason: {}, cookie: {}",
|
||||||
|
inhibitor.application_name,
|
||||||
|
inhibitor.client,
|
||||||
|
inhibitor.reason_for_inhibit,
|
||||||
|
inhibitor.cookie
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue