Skip to content

Commit

Permalink
Merge pull request #417 from JakeStanger/various
Browse files Browse the repository at this point in the history
Various Small Changes
  • Loading branch information
JakeStanger authored Jan 24, 2024
2 parents a2a7e2e + cb2f9b0 commit bfec312
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 11 deletions.
42 changes: 42 additions & 0 deletions docs/Compiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,45 @@ cargo build --release --no-default-features \
| workspaces+sway | Enables the `workspaces` module with support for Sway. |
| workspaces+hyprland | Enables the `workspaces` module with support for Hyprland. |

## Speeding up compiling

With the full feature set, Ironbar can take a good while to compile.
There are a couple of tricks which can be used to improve compile times.

## Linker

The default GCC linker is *slow* - it takes nearly half of the compile time.
As an alternative, you can use [mold](https://github.com/rui314/mold).

Install the package for your distro, create/modify the `.cargo/config.toml` file inside the project dir,
then add the following:

```toml
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
```

## Codegen Backend

> [!WARNING]
> The Cranelift backend is experimental and requires the use of the nightly compiler.
> It is designed for development builds only.
If working on the Ironbar codebase, you may see some benefit from using the [Cranelift](https://github.com/rust-lang/rustc_codegen_cranelift) compiler backend.
This is known to shave a further few seconds off the compile time (bringing down from 10 to 7-8 on my own hardware).

Firstly install the component:

```shell
rustup component add rustc-codegen-cranelift-preview --toolchain nightly
```

Then create/modify the `.cargo/config.toml` file inside the project dir, and add the following:

```toml
[unstable]
codegen-backend = true

[profile.dev]
codegen-backend = "cranelift"
```
10 changes: 8 additions & 2 deletions examples/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
box, menubar, button {
background-color: @color_bg;
background-image: none;
box-shadow: none;
}

button, label {
Expand All @@ -27,6 +28,11 @@ button:hover {
background-color: @color_bg_dark;
}

scale trough {
min-width: 1px;
min-height: 2px;
}

#bar {
border-top: 1px solid @color_border;
}
Expand Down Expand Up @@ -85,7 +91,7 @@ button:hover {
margin-right: 4px;
}

.launcher .item:not(.focused):hover {
.launcher .ifix examtem:not(.focused):hover {
background-color: @color_bg_dark;
}

Expand All @@ -94,7 +100,7 @@ button:hover {
}

.launcher .focused {
border-bottom: 2px solid @color_border_active;
border-bottom: 1px solid @color_border_active;
}

.launcher .urgent {
Expand Down
12 changes: 3 additions & 9 deletions src/desktop_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ fn find_desktop_file_by_filedata(app_id: &str, files: &[PathBuf]) -> Option<Path
let files = files
.iter()
.filter_map(|file| {
let Some(parsed_desktop_file) = parse_desktop_file(file) else {
return None;
};
let parsed_desktop_file = parse_desktop_file(file)?;

desktop_files_cache.insert(file.clone(), parsed_desktop_file.clone());
Some((file.clone(), parsed_desktop_file))
Expand Down Expand Up @@ -165,9 +163,7 @@ fn parse_desktop_file(path: &Path) -> Option<DesktopFile> {

file.lines()
.filter_map(|line| {
let Some((key, value)) = line.split_once('=') else {
return None;
};
let (key, value) = line.split_once('=')?;

let key = key.trim();
let value = value.trim();
Expand All @@ -190,9 +186,7 @@ fn parse_desktop_file(path: &Path) -> Option<DesktopFile> {

/// Attempts to get the icon name from the app's `.desktop` file.
pub fn get_desktop_icon_name(app_id: &str) -> Option<String> {
let Some(path) = find_desktop_file(app_id) else {
return None;
};
let path = find_desktop_file(app_id)?;

let mut desktop_files_cache = lock!(desktop_files());

Expand Down

0 comments on commit bfec312

Please sign in to comment.