From dcf66659d0e87e619a1a881b2745eb68dbcd41a1 Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Mon, 31 Jan 2022 22:28:13 +0100 Subject: [PATCH] feat: Enable Undistract Me for Linux (#3547) In #1019 the undistract feature has been added to starship without enabling it by default due to the system dependency on libdbus. With recent versions of notify-rust the dependency is no longer required and the feature can be enabled by default. --- .github/workflows/workflow.yml | 11 ----------- Cargo.toml | 2 +- docs/config/README.md | 5 ----- src/modules/cmd_duration.rs | 14 -------------- 4 files changed, 1 insertion(+), 31 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 46b2e577..18b45d2b 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -26,9 +26,6 @@ jobs: profile: minimal components: rustfmt - - name: Setup | libdbus (ubuntu) - run: sudo apt-get install libdbus-1-dev - - name: Build | Format run: cargo fmt --all -- --check @@ -46,10 +43,6 @@ jobs: - name: Setup | Cache uses: Swatinem/rust-cache@v1 - - name: Setup | libdbus (ubuntu) - if: matrix.os == 'ubuntu-latest' - run: sudo apt-get install libdbus-1-dev - - name: Setup | Rust uses: actions-rs/toolchain@v1.0.7 with: @@ -144,10 +137,6 @@ jobs: - name: Setup | Checkout uses: actions/checkout@v2.4.0 - - name: Setup | libdbus (ubuntu) - if: matrix.os == 'ubuntu-latest' - run: sudo apt-get install libdbus-1-dev - - name: Setup | Cache uses: Swatinem/rust-cache@v1 diff --git a/Cargo.toml b/Cargo.toml index b6544156..84eecabf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ git2 = { version = "0.13.25", default-features = false } indexmap = { version = "1.8.0", features = ["serde"] } local_ipaddress = "0.1.3" log = { version = "0.4.14", features = ["std"] } -notify-rust = { version = "4.5.5", optional = true } +notify-rust = "4.5.5" once_cell = "1.9.0" open = "2.0.2" os_info = "3.1.0" diff --git a/docs/config/README.md b/docs/config/README.md index ab772167..3a41a321 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -609,11 +609,6 @@ running `eval $(starship init $0)`, and then proceed as normal. | `min_time_to_notify` | `45_000` | Shortest duration for notification (in milliseconds). | | `notification_timeout` | | Duration to show notification for (in milliseconds). If unset, notification timeout will be determined by daemon. Not all notification daemons honor this option. | -::: tip - -Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship -supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`. - ::: ### Variables diff --git a/src/modules/cmd_duration.rs b/src/modules/cmd_duration.rs index 133db31e..628714ea 100644 --- a/src/modules/cmd_duration.rs +++ b/src/modules/cmd_duration.rs @@ -51,20 +51,6 @@ pub fn module<'a>(context: &'a Context) -> Option> { Some(undistract_me(module, &config, elapsed)) } -#[cfg(not(feature = "notify-rust"))] -fn undistract_me<'a, 'b>( - module: Module<'a>, - config: &'b CmdDurationConfig, - _elapsed: u128, -) -> Module<'a> { - if config.show_notifications { - log::debug!("This version of starship was built without notification support."); - } - - module -} - -#[cfg(feature = "notify-rust")] fn undistract_me<'a, 'b>( module: Module<'a>, config: &'b CmdDurationConfig,