Theme quick reload (#1)
Co-authored-by: Alexandru Macocian <amacocian@yahoo.com> Reviewed-on: #1
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
# Maintainer: Radu Macocian <radu@macocian.com>
|
||||
pkgname=omni-launcher
|
||||
pkgver=0.0.2
|
||||
pkgver=0.0.3
|
||||
pkgrel=1
|
||||
pkgdesc="Application launcher overlay built on Quickshell, with calculator, unit/currency conversion, unicode search and Giphy search"
|
||||
arch=('any')
|
||||
url="https://git.estatecloud.org/radumaco/omni-launcher"
|
||||
license=('GPL-3.0-or-later')
|
||||
depends=('quickshell' 'qt6-declarative' 'wl-clipboard' 'curl' 'python' 'glib2')
|
||||
depends=('quickshell' 'qt6-declarative' 'wl-clipboard' 'curl' 'python' 'glib2' 'inotify-tools')
|
||||
optdepends=('hyprland: close-on-workspace-change and focus-grab integration')
|
||||
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
|
||||
sha256sums=('48922f27a6cf06c7d78313ddc52c92cf5b1b434f80bfe6e1f7d0f41f631bea98')
|
||||
|
||||
package() {
|
||||
cd "$srcdir/$pkgname"
|
||||
cd "$srcdir/$pkgname"
|
||||
|
||||
install -dm755 "$pkgdir/usr/share/$pkgname"
|
||||
install -m644 qml/* "$pkgdir/usr/share/$pkgname/"
|
||||
install -dm755 "$pkgdir/usr/share/$pkgname"
|
||||
install -m644 qml/* "$pkgdir/usr/share/$pkgname/"
|
||||
|
||||
install -Dm755 bin/omni-launcher "$pkgdir/usr/bin/omni-launcher"
|
||||
install -Dm755 bin/omni-launcher-toggle "$pkgdir/usr/bin/omni-launcher-toggle"
|
||||
install -Dm755 bin/omni-launcher "$pkgdir/usr/bin/omni-launcher"
|
||||
install -Dm755 bin/omni-launcher-toggle "$pkgdir/usr/bin/omni-launcher-toggle"
|
||||
|
||||
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
|
||||
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
|
||||
}
|
||||
|
||||
+37
-2
@@ -25,6 +25,7 @@ QtObject {
|
||||
property string borderColor: ""
|
||||
|
||||
property bool loaded: false
|
||||
readonly property string configPath: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/omni-launcher/config.json"
|
||||
|
||||
function _apply(obj) {
|
||||
if (typeof obj.fontFamily === "string" && obj.fontFamily.length > 0) fontFamily = obj.fontFamily;
|
||||
@@ -46,9 +47,43 @@ QtObject {
|
||||
if (typeof colors.border === "string" && colors.border.length > 0) borderColor = colors.border;
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
_load();
|
||||
_startWatcher();
|
||||
}
|
||||
|
||||
function _load() {
|
||||
_loader.running = false;
|
||||
_loader.command = ["cat", configPath];
|
||||
_loader.running = true;
|
||||
}
|
||||
|
||||
function _startWatcher() {
|
||||
_watcher.running = false;
|
||||
_watcher.command = [
|
||||
"sh", "-c",
|
||||
"while inotifywait -q -e close_write " + JSON.stringify(configPath) + " 2>/dev/null; do echo CHANGED; done"
|
||||
];
|
||||
_watcher.running = true;
|
||||
}
|
||||
|
||||
property Process _watcher: Process {
|
||||
running: false
|
||||
stdout: SplitParser {
|
||||
splitMarker: "\n"
|
||||
onRead: line => {
|
||||
if (line.indexOf("CHANGED") >= 0) {
|
||||
console.log("omni-launcher: config changed, reloading");
|
||||
root._load();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onExited: root._startWatcher()
|
||||
}
|
||||
|
||||
property Process _loader: Process {
|
||||
running: true
|
||||
command: ["sh", "-c", "cat \"${XDG_CONFIG_HOME:-$HOME/.config}/omni-launcher/config.json\" 2>/dev/null"]
|
||||
running: false
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const text = (this.text || "").trim();
|
||||
|
||||
Reference in New Issue
Block a user