Skip to content

Commit

Permalink
chore(Workspace): hide features unsupported by comp
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Nov 8, 2024
1 parent 05e38a1 commit 64a07a7
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 179 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

250 changes: 125 additions & 125 deletions cosmic-settings/src/pages/desktop/workspaces.rs

Large diffs are not rendered by default.

21 changes: 1 addition & 20 deletions cosmic-settings/src/pages/input/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::app;
use crate::{app, utils::system_has_touchpad};
use cosmic::{
cosmic_config::{self, ConfigGet, ConfigSet},
Task,
Expand Down Expand Up @@ -200,22 +200,3 @@ impl page::AutoBind<crate::pages::Message> for Page {
}
}
}

/// Uses `udev` to check if a touchpad device exists on the system.
fn system_has_touchpad() -> bool {
let Ok(mut enumerator) = udev::Enumerator::new() else {
return false;
};

let _res = enumerator.match_subsystem("input");

let Ok(mut devices) = enumerator.scan_devices() else {
return false;
};

devices.any(|device| {
device
.property_value("ID_INPUT_TOUCHPAD")
.map_or(false, |value| value == "1")
})
}
19 changes: 19 additions & 0 deletions cosmic-settings/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,25 @@ pub fn map_stderr_output(result: io::Result<process::Output>) -> Result<(), Stri
})
}

/// Uses `udev` to check if a touchpad device exists on the system.
pub fn system_has_touchpad() -> bool {
let Ok(mut enumerator) = udev::Enumerator::new() else {
return false;
};

let _res = enumerator.match_subsystem("input");

let Ok(mut devices) = enumerator.scan_devices() else {
return false;
};

devices.any(|device| {
device
.property_value("ID_INPUT_TOUCHPAD")
.map_or(false, |value| value == "1")
})
}

/// Creates a slab with predefined items
#[macro_export]
macro_rules! slab {
Expand Down
7 changes: 3 additions & 4 deletions resources/assets/workspace-orientation-bottom-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 10 additions & 12 deletions resources/assets/workspace-orientation-left-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/assets/workspace-orientation-right-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 8 additions & 9 deletions resources/assets/workspace-orientation-top-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions resources/assets/workspace-separate-display-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions resources/assets/workspace-span-display-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 64a07a7

Please sign in to comment.