From 670ab793daefbd0c9784b8000926b4b2a18fd001 Mon Sep 17 00:00:00 2001 From: developomp Date: Sat, 3 Dec 2022 20:27:51 +0900 Subject: [PATCH] rewrite pomky project description --- .vscode/settings.json | 5 ++ markdown/portfolio/pomky.md | 91 ++++++++++++++++++++++++++++++++----- 2 files changed, 85 insertions(+), 11 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 41503bf..5511e50 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,12 +6,14 @@ "editor.insertSpaces": false, "cSpell.words": [ "bspwm", + "cairographics", "classnet", "developomp", "developomp's", "dompurify", "elasticlunr", "Fontawesome", + "Freedesktop", "hljs", "hongik", "Jimin", @@ -19,10 +21,13 @@ "Librewolf", "polybar", "Pomky", + "rainmeter", "sxhkd", + "tauri", "texmath", "tinycolor", "ungoogled", + "unixporn", "YYYYMMDD" ], "[svg]": { diff --git a/markdown/portfolio/pomky.md b/markdown/portfolio/pomky.md index ad54e17..6e45aff 100644 --- a/markdown/portfolio/pomky.md +++ b/markdown/portfolio/pomky.md @@ -5,20 +5,89 @@ image: /img/portfolio/pomky.png repo: https://github.com/developomp/pomky badges: - rust + - gtk + - cairographics --- - - ## Introduction -Pomky was created to solve some problems/limitations that exists in the conky project. -Primarily the lack of a GUI editor and the primitive layout system. +If you're into desktop customization, chances are, you're using (or used) +[rainmeter][rainmeter]. In case you don't know what that is, it is by far the +most popular desktop customization tool. Think of Windows 7 widgets on steroid. -To fix these issues, pomky uses gtk for the GUI and windowing. -This allows the UI to be edited using software such as [glade](https://gitlab.gnome.org/GNOME/glade) -which is much more flexible and is better for quick UI testing. +However, rainmeter only works in the Windows Operating System. Which means Linux +users like me have to look elsewhere for alternatives. Fortunately, there are +projects like [conky][conky] and [polybar][polybar], so getting started should +not be too difficult especially with the endless supply of ideas, references, +and guides from communities such as [r/unixporn][unixporn]. -It is currently replaced by [smon](https://github.com/developomp/smon) de to [some wayland issues](https://github.com/developomp/pomky/issues/12). +When I first switched to Linux back in 2017, I was somewhat satisfied with my +simple conky widgets, but I knew I had to eventually do something about its +primitive configuration system that prevented me from making anything with +complexity without looking like a card pyramid that could collapse at the +slightest disturbance. So one day in December 2021, after finishing +[The Rust Book][the-rust-book], I decided to make my own tailor-made system +monitor as my first rust project. + +## Challenges + +### What framework to use + +When I first started the project, I considered using [tauri][tauri] which is +basically [ElectronJS][electronjs] but with rust & WebKit for backend and is +much more lightweight. + +However, that plan quickly fall apart when it turned out to be impossible to +make a window that acted like it's part of the desktop (like the task bar) +instead of a regular window without access to the lower level code. In technical +terms, I wasn't able to mark the window as `_NET_WM_WINDOW_TYPE_DESKTOP` +([FreeDesktop Documentation][freedesktop-docs]). This is now possible thanks to +[tauri-apps/tao#522][tauri-always-on-bottom] PR being merged, but at the time, +there was no simple and clean solution. + +After going through different options, I ended up implementing everything from +scratch using the [rust binding for gtk][gtk-rs]. This allowed me to simply set +a `WindowTypeHint` ([GDK documentation][gdk-docs]) and expect everything to work +flawlessly. This also allowed me to use powerful GUI design tools such as +[glade][glade]. + +### Drawing graphs + +Although GTK doesn't provide any usable built-in graph & chart components, +developers can still implement their own using the +[Cairo Graphics Library][cairographics] which is part of the +[GTK architecture][gtk-architecture]. + +After reading some documentations and way more google searches than I'd like to +admit, I was able to make a simple graph and bar component I was happy with. + +## Future + +Although the end result looks rather marvelous if you ask me, there are several +rough edges I'd like to smooth out. For starters, it acts erratically on +[Wayland][wayland] (getting a title bar all of a sudden, moving out of its set +position, etc.), gets drawn over other window when switching workspaces, has +higher CPU usage than other system monitors, has unpredictable CPU spikes, etc. + +Which is why in the future, I'll be using [eww][eww]: yet another Linux widget +system written in rust. The way it works is very similar to pomky behind the +scenes (uses gtk, draws with cairo, custom components, all the good stuff), but +it is better than pomky in almost every conceivable way. It is more configurable +, more lightweight, more modular, and solves the previously mentioned issues. + +[rainmeter]: https://www.rainmeter.net "rainmeter" +[conky]: https://github.com/brndnmtthws/conky "conky" +[polybar]: https://github.com/polybar/polybar "polybar" +[unixporn]: https://www.reddit.com/r/unixporn "unixporn" +[the-rust-book]: https://doc.rust-lang.org/book "The Rust Book" +[tauri]: https://tauri.app "tauri" +[electronjs]: https://www.electronjs.org "ElectronJS" +[freedesktop-docs]: https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm45299620502752 "Freedesktop Documentation" +[tauri-always-on-bottom]: https://github.com/tauri-apps/tao/pull/522 "tauri-apps/tao PR #522" +[gtk-rs]: https://gtk-rs.org "gtk-rs" +[gdk-docs]: https://docs.gtk.org/gdk3/enum.WindowTypeHint.html#desktop "GDK Documentation" +[glade]: https://wiki.gnome.org/Apps/Glade "Glade" +[cairographics]: https://www.cairographics.org "Cairo Graphics" +[gtk-architecture]: https://www.gtk.org/docs/architecture "GTK architecture" +[wayland]: https://wayland.freedesktop.org "Wayland" +[eww]: https://github.com/elkowar/eww "eww"