1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-28 15:56:28 +00:00

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.
This commit is contained in:
Marc Schreiber 2022-01-31 22:28:13 +01:00 committed by GitHub
parent 52b0e6512a
commit dcf66659d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 31 deletions

View File

@ -26,9 +26,6 @@ jobs:
profile: minimal profile: minimal
components: rustfmt components: rustfmt
- name: Setup | libdbus (ubuntu)
run: sudo apt-get install libdbus-1-dev
- name: Build | Format - name: Build | Format
run: cargo fmt --all -- --check run: cargo fmt --all -- --check
@ -46,10 +43,6 @@ jobs:
- name: Setup | Cache - name: Setup | Cache
uses: Swatinem/rust-cache@v1 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 - name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7 uses: actions-rs/toolchain@v1.0.7
with: with:
@ -144,10 +137,6 @@ jobs:
- name: Setup | Checkout - name: Setup | Checkout
uses: actions/checkout@v2.4.0 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 - name: Setup | Cache
uses: Swatinem/rust-cache@v1 uses: Swatinem/rust-cache@v1

View File

@ -38,7 +38,7 @@ git2 = { version = "0.13.25", default-features = false }
indexmap = { version = "1.8.0", features = ["serde"] } indexmap = { version = "1.8.0", features = ["serde"] }
local_ipaddress = "0.1.3" local_ipaddress = "0.1.3"
log = { version = "0.4.14", features = ["std"] } 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" once_cell = "1.9.0"
open = "2.0.2" open = "2.0.2"
os_info = "3.1.0" os_info = "3.1.0"

View File

@ -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). | | `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. | | `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 ### Variables

View File

@ -51,20 +51,6 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
Some(undistract_me(module, &config, elapsed)) 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>( fn undistract_me<'a, 'b>(
module: Module<'a>, module: Module<'a>,
config: &'b CmdDurationConfig, config: &'b CmdDurationConfig,