Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find an alternative to pango/cairo for penrose_ui #272

Closed
sminez opened this issue Jul 9, 2023 · 3 comments
Closed

Find an alternative to pango/cairo for penrose_ui #272

sminez opened this issue Jul 9, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@sminez
Copy link
Owner

sminez commented Jul 9, 2023

The pango and cairo dependencies brought in by penrose_ui account for massive amount of the dependency tree that we end up pulling in. Given that the UI of the status bar widgets is really quite minimal, it would be nice to find a more lightweight alternative if possible.

penrose_ui v0.1.3 (/home/innes/repos/personal/penrose/crates/penrose_ui)
├── cairo-rs v0.17.10
│   ├── bitflags v1.3.2
│   ├── cairo-sys-rs v0.17.10
│   │   ├── glib-sys v0.17.10
│   │   │   └── libc v0.2.147
│   │   │   [build-dependencies]
│   │   │   └── system-deps v6.1.1
│   │   │       ├── cfg-expr v0.15.3
│   │   │       │   ├── smallvec v1.11.0
│   │   │       │   └── target-lexicon v0.12.8
│   │   │       ├── heck v0.4.1
│   │   │       ├── pkg-config v0.3.27
│   │   │       ├── toml v0.7.6
│   │   │       │   ├── serde v1.0.169
│   │   │       │   ├── serde_spanned v0.6.3
│   │   │       │   │   └── serde v1.0.169
│   │   │       │   ├── toml_datetime v0.6.3
│   │   │       │   │   └── serde v1.0.169
│   │   │       │   └── toml_edit v0.19.12
│   │   │       │       ├── indexmap v2.0.0
│   │   │       │       │   ├── equivalent v1.0.0
│   │   │       │       │   └── hashbrown v0.14.0
│   │   │       │       ├── serde v1.0.169
│   │   │       │       ├── serde_spanned v0.6.3 (*)
│   │   │       │       ├── toml_datetime v0.6.3 (*)
│   │   │       │       └── winnow v0.4.9
│   │   │       └── version-compare v0.1.1
│   │   └── libc v0.2.147
│   │   [build-dependencies]
│   │   └── system-deps v6.1.1 (*)
│   ├── glib v0.17.10
│   │   ├── bitflags v1.3.2
│   │   ├── futures-channel v0.3.28
│   │   │   └── futures-core v0.3.28
│   │   ├── futures-core v0.3.28
│   │   ├── futures-executor v0.3.28
│   │   │   ├── futures-core v0.3.28
│   │   │   ├── futures-task v0.3.28
│   │   │   └── futures-util v0.3.28
│   │   │       ├── futures-core v0.3.28
│   │   │       ├── futures-macro v0.3.28 (proc-macro)
│   │   │       │   ├── proc-macro2 v1.0.64
│   │   │       │   │   └── unicode-ident v1.0.10
│   │   │       │   ├── quote v1.0.29
│   │   │       │   │   └── proc-macro2 v1.0.64 (*)
│   │   │       │   └── syn v2.0.24
│   │   │       │       ├── proc-macro2 v1.0.64 (*)
│   │   │       │       ├── quote v1.0.29 (*)
│   │   │       │       └── unicode-ident v1.0.10
│   │   │       ├── futures-task v0.3.28
│   │   │       ├── pin-project-lite v0.2.10
│   │   │       ├── pin-utils v0.1.0
│   │   │       └── slab v0.4.8
│   │   │           [build-dependencies]
│   │   │           └── autocfg v1.1.0
│   │   ├── futures-task v0.3.28
│   │   ├── futures-util v0.3.28 (*)
│   │   ├── gio-sys v0.17.10
│   │   │   ├── glib-sys v0.17.10 (*)
│   │   │   ├── gobject-sys v0.17.10
│   │   │   │   ├── glib-sys v0.17.10 (*)
│   │   │   │   └── libc v0.2.147
│   │   │   │   [build-dependencies]
│   │   │   │   └── system-deps v6.1.1 (*)
│   │   │   └── libc v0.2.147
│   │   │   [build-dependencies]
│   │   │   └── system-deps v6.1.1 (*)
│   │   ├── glib-macros v0.17.10 (proc-macro)
│   │   │   ├── anyhow v1.0.71
│   │   │   ├── heck v0.4.1
│   │   │   ├── proc-macro-crate v1.3.1
│   │   │   │   ├── once_cell v1.18.0
│   │   │   │   └── toml_edit v0.19.12 (*)
│   │   │   ├── proc-macro-error v1.0.4
│   │   │   │   ├── proc-macro-error-attr v1.0.4 (proc-macro)
│   │   │   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   │   └── quote v1.0.29 (*)
│   │   │   │   │   [build-dependencies]
│   │   │   │   │   └── version_check v0.9.4
│   │   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   │   ├── quote v1.0.29 (*)
│   │   │   │   └── syn v1.0.109
│   │   │   │       ├── proc-macro2 v1.0.64 (*)
│   │   │   │       ├── quote v1.0.29 (*)
│   │   │   │       └── unicode-ident v1.0.10
│   │   │   │   [build-dependencies]
│   │   │   │   └── version_check v0.9.4
│   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   ├── quote v1.0.29 (*)
│   │   │   └── syn v1.0.109 (*)
│   │   ├── glib-sys v0.17.10 (*)
│   │   ├── gobject-sys v0.17.10 (*)
│   │   ├── libc v0.2.147
│   │   ├── memchr v2.5.0
│   │   ├── once_cell v1.18.0
│   │   ├── smallvec v1.11.0
│   │   └── thiserror v1.0.43
│   │       └── thiserror-impl v1.0.43 (proc-macro)
│   │           ├── proc-macro2 v1.0.64 (*)
│   │           ├── quote v1.0.29 (*)
│   │           └── syn v2.0.24 (*)
│   ├── libc v0.2.147
│   ├── once_cell v1.18.0
│   └── thiserror v1.0.43 (*)
├── pango v0.17.10
│   ├── bitflags v1.3.2
│   ├── gio v0.17.10
│   │   ├── bitflags v1.3.2
│   │   ├── futures-channel v0.3.28 (*)
│   │   ├── futures-core v0.3.28
│   │   ├── futures-io v0.3.28
│   │   ├── futures-util v0.3.28 (*)
│   │   ├── gio-sys v0.17.10 (*)
│   │   ├── glib v0.17.10 (*)
│   │   ├── libc v0.2.147
│   │   ├── once_cell v1.18.0
│   │   ├── pin-project-lite v0.2.10
│   │   ├── smallvec v1.11.0
│   │   └── thiserror v1.0.43 (*)
│   ├── glib v0.17.10 (*)
│   ├── libc v0.2.147
│   ├── once_cell v1.18.0
│   └── pango-sys v0.17.10
│       ├── glib-sys v0.17.10 (*)
│       ├── gobject-sys v0.17.10 (*)
│       └── libc v0.2.147
│       [build-dependencies]
│       └── system-deps v6.1.1 (*)
├── pangocairo v0.17.10
│   ├── bitflags v1.3.2
│   ├── cairo-rs v0.17.10 (*)
│   ├── glib v0.17.10 (*)
│   ├── libc v0.2.147
│   ├── pango v0.17.10 (*)
│   └── pangocairo-sys v0.17.10
│       ├── cairo-sys-rs v0.17.10 (*)
│       ├── glib-sys v0.17.10 (*)
│       ├── libc v0.2.147
│       └── pango-sys v0.17.10 (*)
│       [build-dependencies]
│       └── system-deps v6.1.1 (*)
├── penrose v0.3.2 (/home/innes/repos/personal/penrose)
│   ├── anymap v0.12.1
│   ├── bitflags v2.3.3
│   ├── nix v0.26.2
│   │   ├── bitflags v1.3.2
│   │   ├── cfg-if v1.0.0
│   │   ├── libc v0.2.147
│   │   ├── memoffset v0.7.1
│   │   │   [build-dependencies]
│   │   │   └── autocfg v1.1.0
│   │   ├── pin-utils v0.1.0
│   │   └── static_assertions v1.1.0
│   ├── penrose_keysyms v0.1.1 (/home/innes/repos/personal/penrose/crates/penrose_keysyms)
│   │   ├── strum v0.25.0
│   │   │   └── strum_macros v0.25.1 (proc-macro)
│   │   │       ├── heck v0.4.1
│   │   │       ├── proc-macro2 v1.0.64 (*)
│   │   │       ├── quote v1.0.29 (*)
│   │   │       ├── rustversion v1.0.13 (proc-macro)
│   │   │       └── syn v2.0.24 (*)
│   │   └── strum_macros v0.25.1 (proc-macro) (*)
│   ├── strum v0.25.0 (*)
│   ├── strum_macros v0.25.1 (proc-macro) (*)
│   ├── thiserror v1.0.43 (*)
│   ├── tracing v0.1.37
│   │   ├── cfg-if v1.0.0
│   │   ├── log v0.4.19
│   │   ├── pin-project-lite v0.2.10
│   │   ├── tracing-attributes v0.1.26 (proc-macro)
│   │   │   ├── proc-macro2 v1.0.64 (*)
│   │   │   ├── quote v1.0.29 (*)
│   │   │   └── syn v2.0.24 (*)
│   │   └── tracing-core v0.1.31
│   │       └── once_cell v1.18.0
│   └── x11rb v0.12.0
│       ├── as-raw-xcb-connection v1.0.0
│       ├── gethostname v0.3.0
│       │   └── libc v0.2.147
│       ├── libc v0.2.147
│       ├── nix v0.26.2 (*)
│       └── x11rb-protocol v0.12.0
│           └── nix v0.26.2 (*)
├── thiserror v1.0.43 (*)
├── tracing v0.1.37 (*)
└── x11rb v0.12.0 (*)
@sminez
Copy link
Owner Author

sminez commented Jul 15, 2023

This is the diff needed to move my personal config over to the new API: sminez/my-penrose-config@0b9cb6b

A clean release build of my window manager following the change then looks like this:

❯ make build && sudo make install
:: Rebuilding in release mode...
   Compiling proc-macro2 v1.0.64
   Compiling unicode-ident v1.0.10
   Compiling quote v1.0.29
   Compiling cfg-if v1.0.0
   Compiling once_cell v1.18.0
   Compiling libc v0.2.147
   Compiling autocfg v1.1.0
   Compiling serde v1.0.169
   Compiling pkg-config v0.3.27
   Compiling memoffset v0.7.1
   Compiling syn v2.0.24
   Compiling rustversion v1.0.13
   Compiling tracing-core v0.1.31
   Compiling heck v0.4.1
   Compiling static_assertions v1.1.0
   Compiling bitflags v1.3.2
   Compiling nix v0.26.2
   Compiling pin-project-lite v0.2.10
   Compiling thiserror v1.0.41
   Compiling x11rb v0.12.0
   Compiling gethostname v0.3.0
   Compiling x11 v2.21.0
   Compiling yeslogic-fontconfig-sys v4.0.1
   Compiling libloading v0.8.0
   Compiling regex-syntax v0.6.29
   Compiling x11rb-protocol v0.12.0
   Compiling regex-syntax v0.7.3
   Compiling tracing-attributes v0.1.26
   Compiling strum_macros v0.25.1
   Compiling strum v0.25.0
   Compiling tracing v0.1.37
   Compiling thiserror-impl v1.0.41
   Compiling serde_json v1.0.100
   Compiling lazy_static v1.4.0
   Compiling penrose_keysyms v0.3.3 (/home/innes/repos/personal/penrose/crates/penrose_keysyms)
   Compiling regex-automata v0.3.2
   Compiling regex-automata v0.1.10
   Compiling dlib v0.5.2
   Compiling bitflags v2.3.3
   Compiling anymap v0.12.1
   Compiling const-cstr v0.3.0
   Compiling log v0.4.19
   Compiling ryu v1.0.14
   Compiling itoa v1.0.8
   Compiling overload v0.1.1
   Compiling anyhow v1.0.71
   Compiling nu-ansi-term v0.46.0
   Compiling tracing-log v0.1.3
   Compiling penrose v0.3.3 (/home/innes/repos/personal/penrose)
   Compiling regex v1.9.1
   Compiling matchers v0.1.0
   Compiling sharded-slab v0.1.4
   Compiling tracing-serde v0.1.3
   Compiling thread_local v1.1.7
   Compiling smallvec v1.11.0
   Compiling penrose_ui v0.3.3 (/home/innes/repos/personal/penrose/crates/penrose_ui)
   Compiling tracing-subscriber v0.3.17
   Compiling penrose-sminez v0.2.0 (/home/innes/.config/penrose)
    Finished release [optimized] target(s) in 1m 09s
:: Installing binaries...
:: Installing utility scripts...
:: Done

·····················································  1m 10s  08:14:36
❯ du -sh target
196M    target

@sminez
Copy link
Owner Author

sminez commented Jul 15, 2023

This also reduces my resulting binary size from 8.4MB to 3.5MB 🎉

sminez added a commit that referenced this issue Jul 16, 2023
* #272 replacing usage of pango and cairo with xlib and fontconfig

* #272 fixing text offset

* #272 sorting out dependencies and feature flags

* #272 adding missing build dep for CI

* #272 simplifying TextStyle and making it Copy

* #272 fixing broken doctests

* simplifying method implementations for Color

* ensuring that graphics state is cleaned up when status bars are recreated

* adding safety comments and warn level linting for future missing safety comments

* documenting the updated penrose_ui crate
@sminez
Copy link
Owner Author

sminez commented Jul 16, 2023

Implemented in #274

@sminez sminez closed this as completed Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant