galaaz 2.1.10.pre.6 → 2.1.10.pre.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1175b28a0271d54017f9688e6436c326da0305c6b383285d9a4adb11538018d
4
- data.tar.gz: 43c3c80c7764e8a959d45b382a781c1a504e4ea7b3c7028dc3763e8c3493b04e
3
+ metadata.gz: 49086d9d91136759ccda55167c3c7ba0960257b2ea01f552f11ea24c7bf0eb00
4
+ data.tar.gz: a0227e50a79166c1d05c0609235f68e6be7504ff8fe6872b66821f274603b498
5
5
  SHA512:
6
- metadata.gz: a038c5ac9ff9eaacd0cd85af5e8613675e27157e2eea28b006d15d6b9083f8059b65b45e5ad8eedacffba22b464c68e288c82f1c2cb2dbf0c3074526f16eaa2e
7
- data.tar.gz: 4f2eb91d9ccf66c15ad503116a0e14602491b73623eca7395ca2a2dedc6342e900f34ba2d838405879660ff62a74b7fed62163658a6ea33ae0085108affc7149
6
+ metadata.gz: 2ca73b7ea17b312f2213095f98215ebc8688e15c2127eda29c863b374e85583e71e78b9259e396e9ad88e876180a561128e05015b72f3d138b8f133fe08f5433
7
+ data.tar.gz: c2824ae862e18e6f39b4e8590431d45c6ead857727b530d90c8edf95fc5e548c527d8c935ad544fbd3da17b03fa56d16165e0fe24787316ba0ef4dc66ec22def
data/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.1.10.pre.8
6
+
7
+ ### Fixed
8
+
9
+ - Omarchy `galaaz-add` arrow: on pacman mirror 404s (stale DB), refresh with
10
+ `pacman -Sy` and retry install before failing.
11
+ - Omarchy arrow-glib build: auto-install `glib2-devel` + `cmake` (and other
12
+ build deps) via the add wrapper — no manual `pacman`; default `-j1`, add
13
+ build swap when RAM is low, compile in a systemd user scope with heartbeats
14
+ so OOM kills the build instead of the TUI. Stage B (red-arrow) stays on the
15
+ menu Arrow / ledger / demo path.
16
+
17
+ ## 2.1.10.pre.7
18
+
19
+ ### Added
20
+
21
+ - Omarchy: Nautilus Scripts under **Scripts → Galaaz** (Gknit HTML / PDF /
22
+ Choose Format) installed by `galaaz omarchy` and core configure.
23
+ - Omarchy `galaaz-add` for arrow/ledger/demo: install Arch `arrow` and build
24
+ matching Arrow GLib into `/usr/local` so `red-arrow` can compile.
25
+
5
26
  ## 2.1.10.pre.6
6
27
 
7
28
  ### Changed
data/lib/galaaz/cli.rb CHANGED
@@ -29,6 +29,12 @@ module Galaaz
29
29
  ['galaaz-gknit.sh', 'omarchy-galaaz-gknit', true],
30
30
  ['debug-galaaz.sh', 'omarchy-galaaz-debug', true]
31
31
  ].freeze
32
+ # Installed under ~/.local/share/nautilus/scripts/Galaaz/ (Scripts → Galaaz).
33
+ OMARCHY_NAUTILUS_SCRIPTS = [
34
+ ['gknit-html', 'Gknit HTML'],
35
+ ['gknit-pdf', 'Gknit PDF'],
36
+ ['gknit-choose-format', 'Gknit Choose Format']
37
+ ].freeze
32
38
  OMARCHY_MENU_FILE = 'omarchy-menu.jsonc'
33
39
  # Standalone family "galaaz" (debug). Menu uses the merged Omarchy brand font.
34
40
  OMARCHY_FONT_REL = File.join('fonts', 'galaaz.ttf')
@@ -181,6 +187,7 @@ module Galaaz
181
187
  Writes:
182
188
  ~/.local/bin/omarchy-install-galaaz (and add/remove/guide/gknit/debug)
183
189
  ~/.config/omarchy/extensions/omarchy-menu.jsonc
190
+ ~/.local/share/nautilus/scripts/Galaaz/ (right-click → Scripts → Galaaz)
184
191
  ~/.local/share/fonts/galaaz/galaaz.ttf
185
192
  ~/.local/share/fonts/omarchy-with-galaaz.ttf (family omarchy + U+E90E)
186
193
 
@@ -232,6 +239,13 @@ module Galaaz
232
239
  puts " font galaaz: #{File.file?(font) ? font : 'MISSING'}"
233
240
  merged = File.expand_path('~/.local/share/fonts/omarchy-with-galaaz.ttf')
234
241
  puts " font omarchy+galaaz: #{File.file?(merged) ? merged : 'MISSING'}"
242
+ nautilus = File.expand_path('~/.local/share/nautilus/scripts/Galaaz')
243
+ if Dir.exist?(nautilus)
244
+ entries = Dir.children(nautilus).reject { |n| n.start_with?('.') }.sort
245
+ puts " nautilus Scripts/Galaaz: #{entries.empty? ? 'empty' : entries.join(', ')}"
246
+ else
247
+ puts ' nautilus Scripts/Galaaz: MISSING'
248
+ end
235
249
  bundled = File.join(root, 'script', 'omarchy')
236
250
  puts " gem overlay: #{File.directory?(bundled) ? bundled : 'MISSING (reinstall gem)'}"
237
251
  0
@@ -256,6 +270,7 @@ module Galaaz
256
270
  base = "https://raw.githubusercontent.com/#{OMARCHY_GITHUB_REPO}/#{ref}/script/omarchy"
257
271
  puts "galaaz omarchy: fetching #{base}/…"
258
272
  names = OMARCHY_BIN_FILES.map(&:first) + [OMARCHY_MENU_FILE, OMARCHY_FONT_REL, OMARCHY_MERGED_FONT_REL]
273
+ names += OMARCHY_NAUTILUS_SCRIPTS.map { |src, _| File.join('nautilus-scripts', src) }
259
274
  names.uniq.each do |name|
260
275
  url = "#{base}/#{name}"
261
276
  dest = File.join(tmp, name)
@@ -291,9 +306,25 @@ module Galaaz
291
306
  FileUtils.cp(menu_src, menu_dest)
292
307
  puts "galaaz omarchy: #{menu_dest}"
293
308
 
309
+ install_omarchy_nautilus_scripts_from!(src_dir)
294
310
  install_omarchy_font_from!(src_dir)
295
311
  end
296
312
 
313
+ def install_omarchy_nautilus_scripts_from!(src_dir)
314
+ src_root = File.join(src_dir, 'nautilus-scripts')
315
+ dest_root = File.expand_path('~/.local/share/nautilus/scripts/Galaaz')
316
+ FileUtils.mkdir_p(dest_root)
317
+ OMARCHY_NAUTILUS_SCRIPTS.each do |src_name, dest_name|
318
+ src = File.join(src_root, src_name)
319
+ abort_unless(File.file?(src), "missing #{src}")
320
+ dest = File.join(dest_root, dest_name)
321
+ FileUtils.cp(src, dest)
322
+ FileUtils.chmod(0o755, dest)
323
+ puts "galaaz omarchy: #{dest}"
324
+ end
325
+ puts 'galaaz omarchy: Nautilus → right-click .Rmd → Scripts → Galaaz'
326
+ end
327
+
297
328
  def install_omarchy_font_from!(src_dir)
298
329
  # 1) Standalone galaaz.ttf (family galaaz) — debugging / fc-list checks.
299
330
  src = File.join(src_dir, OMARCHY_FONT_REL)
@@ -616,9 +647,24 @@ module Galaaz
616
647
  pkgs = read_pkg_list('arrow.txt')
617
648
  install_cran!(pkgs)
618
649
  if RUBY_ENGINE == 'ruby'
619
- puts 'galaaz add arrow: gem install red-arrow (CRuby Stage B writer)'
620
- unless system('gem', 'install', 'red-arrow', '--no-document')
621
- warn 'galaaz add arrow: red-arrow gem install failed (need Apache Arrow GLib / libarrow-glib). R arrow is installed; Ruby IPC writer may be unavailable.'
650
+ ENV['PKG_CONFIG_PATH'] = [
651
+ '/usr/local/lib/pkgconfig',
652
+ '/usr/local/lib64/pkgconfig',
653
+ ENV['PKG_CONFIG_PATH']
654
+ ].compact.reject(&:empty?).join(File::PATH_SEPARATOR)
655
+ glib_ok = system('pkg-config', '--exists', 'arrow-glib')
656
+ if glib_ok
657
+ puts 'galaaz add arrow: gem install red-arrow (CRuby Stage B writer; MAKEFLAGS=-j1)'
658
+ # Parallel native builds often OOM small Omarchy/TryOmarchy VMs.
659
+ ok = system({ 'MAKEFLAGS' => '-j1', 'PKG_CONFIG_PATH' => ENV['PKG_CONFIG_PATH'] },
660
+ 'gem', 'install', 'red-arrow', '--no-document')
661
+ unless ok
662
+ warn 'galaaz add arrow: red-arrow gem install failed. R arrow is installed; ' \
663
+ 'Ruby IPC writer may be unavailable.'
664
+ end
665
+ else
666
+ warn 'galaaz add arrow: arrow-glib not found (pkg-config); skipping red-arrow. ' \
667
+ 'On Omarchy use omarchy-galaaz-add arrow so Stage B GLib is built first.'
622
668
  end
623
669
  else
624
670
  warn 'galaaz add arrow: on JRuby, set GALAAZ_ARROW_JARS (or ~/arrow_jars) and JAVA_OPTS nio opens for Arrow Java'
@@ -108,6 +108,211 @@ ensure_pandoc() {
108
108
  return 0
109
109
  }
110
110
 
111
+ pkg_add() {
112
+ if command -v omarchy-pkg-add >/dev/null 2>&1; then
113
+ omarchy-pkg-add "$@"
114
+ elif command -v pacman >/dev/null 2>&1; then
115
+ sudo pacman -S --noconfirm --needed "$@"
116
+ else
117
+ echo "ERROR: need omarchy-pkg-add or pacman to install: $*" >&2
118
+ return 1
119
+ fi
120
+ }
121
+
122
+ # Stale pacman DBs request old pkg builds that mirrors already deleted (HTTP 404).
123
+ # Sync once, then install. Prefer this for heavy deps like arrow.
124
+ pkg_add_synced() {
125
+ if pkg_add "$@"; then
126
+ return 0
127
+ fi
128
+ echo "WARN: install failed for: $* — refreshing pacman DBs and retrying (common with mirror 404s)" >&2
129
+ if ! command -v pacman >/dev/null 2>&1; then
130
+ return 1
131
+ fi
132
+ if ! sudo pacman -Sy --noconfirm; then
133
+ echo "ERROR: pacman -Sy failed. On Omarchy run Update → Omarchy, then retry." >&2
134
+ return 1
135
+ fi
136
+ # Bypass omarchy-pkg-add here so we use the freshly synced DB.
137
+ if ! sudo pacman -S --noconfirm --needed "$@"; then
138
+ echo "ERROR: still failed to install: $*" >&2
139
+ echo " On Omarchy: Super+Space → Update → Omarchy, then re-run this add-on." >&2
140
+ return 1
141
+ fi
142
+ return 0
143
+ }
144
+
145
+ # red-arrow (Stage B) needs pkg-config "arrow" + "arrow-glib" at the same version.
146
+ # Arch ships C++ Arrow (extra/arrow) but not Arrow GLib — build GLib from the
147
+ # matching Apache tarball. Keep ARROW_USE_PKG_CONFIG=false for CRAN R arrow
148
+ # (LIBARROW_BINARY); pacman arrow is only for the Ruby gem.
149
+ #
150
+ # Small Omarchy/TryOmarchy VMs OOM and kill the TUI during unlimited ninja builds.
151
+ # We: default -j1, optional build swap, compile in a systemd user scope, heartbeat.
152
+ ensure_arrow_for_red_arrow() {
153
+ local major ver tmp tarball url build_dir jobs cache log swapfile avail_mb swap_mb
154
+ local compile_st=0
155
+ major=25
156
+ jobs="${GALAAZ_ARROW_GLIB_JOBS:-1}"
157
+ cache="${HOME}/.cache/galaaz"
158
+ log="${HOME}/.local/share/galaaz/arrow-glib-build.log"
159
+ swapfile="${cache}/arrow-glib.swap"
160
+ mkdir -p "${cache}" "$(dirname "${log}")"
161
+
162
+ echo "==> system: Apache Arrow C++ + GLib (Stage B / red-arrow)"
163
+ echo " build log: ${log}"
164
+ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}"
165
+
166
+ if ! command -v pkg-config >/dev/null 2>&1; then
167
+ pkg_add_synced pkgconf || return 1
168
+ fi
169
+
170
+ if ! pkg-config --exists "arrow >= ${major}" 2>/dev/null; then
171
+ echo "==> install Arch package: arrow"
172
+ if ! pkg_add_synced arrow; then
173
+ echo "ERROR: failed to install Arch arrow (Apache Arrow C++)" >&2
174
+ return 1
175
+ fi
176
+ fi
177
+
178
+ if ! pkg-config --exists "arrow >= ${major}" 2>/dev/null; then
179
+ echo "ERROR: Apache Arrow C++ >= ${major} still missing after pacman install" >&2
180
+ echo " pkg-config --modversion arrow: $(pkg-config --modversion arrow 2>/dev/null || echo none)" >&2
181
+ return 1
182
+ fi
183
+ ver="$(pkg-config --modversion arrow)"
184
+ echo "arrow (C++): ${ver}"
185
+
186
+ if pkg-config --exists "arrow-glib = ${ver}" 2>/dev/null; then
187
+ echo "arrow-glib: $(pkg-config --modversion arrow-glib) (already installed)"
188
+ return 0
189
+ fi
190
+
191
+ echo "==> Arrow GLib ${ver} missing — building from Apache source (required for Stage B)"
192
+ echo " ninja jobs: ${jobs} (override with GALAAZ_ARROW_GLIB_JOBS)"
193
+ # glib2-devel provides glib-mkenums (split from glib2 on Arch); without it meson fails.
194
+ pkg_add_synced meson ninja gobject-introspection glib2 glib2-devel cmake || return 1
195
+
196
+ avail_mb="$(awk '/MemAvailable:/ {print int($2/1024)}' /proc/meminfo 2>/dev/null || echo 0)"
197
+ swap_mb="$(awk '/SwapFree:/ {print int($2/1024)}' /proc/meminfo 2>/dev/null || echo 0)"
198
+ echo " memory: MemAvailable=${avail_mb}MiB SwapFree=${swap_mb}MiB"
199
+ if (( avail_mb + swap_mb < 3500 )); then
200
+ echo "==> low RAM — enabling 4GiB build swap at ${swapfile}"
201
+ if [[ ! -f "${swapfile}" ]]; then
202
+ if ! dd if=/dev/zero of="${swapfile}" bs=1M count=4096 status=none; then
203
+ echo "ERROR: could not create build swap file (need ~4GiB free disk)" >&2
204
+ return 1
205
+ fi
206
+ chmod 600 "${swapfile}"
207
+ mkswap "${swapfile}" >/dev/null
208
+ fi
209
+ if ! sudo swapon "${swapfile}"; then
210
+ echo "ERROR: swapon ${swapfile} failed" >&2
211
+ return 1
212
+ fi
213
+ fi
214
+
215
+ tarball="apache-arrow-${ver}.tar.gz"
216
+ url="https://dlcdn.apache.org/arrow/arrow-${ver}/${tarball}"
217
+ # Prefer ~/.cache over /tmp — /tmp is often tmpfs and competes with the compile for RAM.
218
+ tmp="${cache}/arrow-${ver}-src"
219
+ rm -rf "${tmp}"
220
+ mkdir -p "${tmp}"
221
+ build_dir="${tmp}/apache-arrow-${ver}"
222
+ : >"${log}"
223
+ echo "==> download: ${url}"
224
+ if ! curl -fsSL -o "${tmp}/${tarball}" "${url}"; then
225
+ url="https://archive.apache.org/dist/arrow/arrow-${ver}/${tarball}"
226
+ echo "==> fallback: ${url}"
227
+ if ! curl -fsSL -o "${tmp}/${tarball}" "${url}"; then
228
+ echo "ERROR: failed to download Apache Arrow ${ver} sources" >&2
229
+ sudo swapoff "${swapfile}" 2>/dev/null || true
230
+ rm -rf "${tmp}"
231
+ return 1
232
+ fi
233
+ fi
234
+ if ! tar -xzf "${tmp}/${tarball}" -C "${tmp}"; then
235
+ echo "ERROR: failed to extract ${tarball}" >&2
236
+ sudo swapoff "${swapfile}" 2>/dev/null || true
237
+ rm -rf "${tmp}"
238
+ return 1
239
+ fi
240
+ if [[ ! -d "${build_dir}/c_glib" ]]; then
241
+ echo "ERROR: c_glib missing from ${tarball}" >&2
242
+ sudo swapoff "${swapfile}" 2>/dev/null || true
243
+ rm -rf "${tmp}"
244
+ return 1
245
+ fi
246
+
247
+ echo "==> meson setup arrow-glib ${ver}"
248
+ if ! meson setup "${build_dir}/c_glib.build" "${build_dir}/c_glib" \
249
+ --buildtype=release \
250
+ --prefix=/usr/local \
251
+ -Dgtk_doc=false \
252
+ -Ddoc=false \
253
+ -Dvapi=false >>"${log}" 2>&1; then
254
+ echo "ERROR: meson setup for arrow-glib failed" >&2
255
+ tail -n 40 "${log}" || true
256
+ sudo swapoff "${swapfile}" 2>/dev/null || true
257
+ rm -rf "${tmp}"
258
+ return 1
259
+ fi
260
+
261
+ echo "==> meson compile arrow-glib ${ver} (-j${jobs}) — can take several minutes"
262
+ echo " leave this window open; progress also in ${log}"
263
+ # Isolate from the TUI cgroup when possible so an OOM kills the build, not the terminal.
264
+ set +e
265
+ if command -v systemd-run >/dev/null 2>&1; then
266
+ systemd-run --user --scope --quiet \
267
+ -p MemoryMax=8G \
268
+ -E "PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-}" \
269
+ -E "PATH=${PATH}" \
270
+ meson compile -C "${build_dir}/c_glib.build" -j "${jobs}" >>"${log}" 2>&1 &
271
+ else
272
+ meson compile -C "${build_dir}/c_glib.build" -j "${jobs}" >>"${log}" 2>&1 &
273
+ fi
274
+ local compile_pid=$!
275
+ while kill -0 "${compile_pid}" 2>/dev/null; do
276
+ echo " … still compiling arrow-glib ($(date +%H:%M:%S))"
277
+ sleep 20
278
+ done
279
+ wait "${compile_pid}"
280
+ compile_st=$?
281
+ set -e
282
+
283
+ if [[ "${compile_st}" -ne 0 ]]; then
284
+ echo "ERROR: meson compile for arrow-glib failed (exit ${compile_st}) — often OOM" >&2
285
+ echo " log: ${log}" >&2
286
+ tail -n 40 "${log}" || true
287
+ echo " Retry with more swap free disk, close other apps, or GALAAZ_ARROW_GLIB_JOBS=1" >&2
288
+ sudo swapoff "${swapfile}" 2>/dev/null || true
289
+ rm -rf "${tmp}"
290
+ return 1
291
+ fi
292
+
293
+ echo "==> meson install arrow-glib ${ver}"
294
+ if ! sudo meson install -C "${build_dir}/c_glib.build" >>"${log}" 2>&1; then
295
+ echo "ERROR: meson install for arrow-glib failed" >&2
296
+ tail -n 40 "${log}" || true
297
+ sudo swapoff "${swapfile}" 2>/dev/null || true
298
+ rm -rf "${tmp}"
299
+ return 1
300
+ fi
301
+
302
+ sudo ldconfig 2>/dev/null || true
303
+ sudo swapoff "${swapfile}" 2>/dev/null || true
304
+ rm -rf "${tmp}"
305
+
306
+ if ! pkg-config --exists "arrow-glib = ${ver}" 2>/dev/null; then
307
+ echo "ERROR: arrow-glib ${ver} still missing after build" >&2
308
+ echo " pkg-config --modversion arrow-glib: $(pkg-config --modversion arrow-glib 2>/dev/null || echo none)" >&2
309
+ echo " log: ${log}" >&2
310
+ return 1
311
+ fi
312
+ echo "arrow-glib: $(pkg-config --modversion arrow-glib) (built from Apache ${ver})"
313
+ return 0
314
+ }
315
+
111
316
  pause() {
112
317
  local st=$1
113
318
  echo
@@ -138,15 +343,17 @@ case "${PROFILE}" in
138
343
  fi
139
344
  ;;
140
345
  arrow|ledger|demo)
141
- # R package arrow: do NOT rely on pacman "arrow" for linking Arch libarrow
142
- # often lags CRAN and breaks configure. galaaz add arrow sets LIBARROW_BINARY
143
- # (Apache version-matched prebuilt). Export here too so a stale gem still works
144
- # if the user only refreshed this wrapper.
346
+ # R package arrow: do NOT link pacman arrow (version skew vs CRAN)
347
+ # LIBARROW_BINARY uses Apache's version-matched prebuilt. pacman arrow +
348
+ # built arrow-glib are only for CRuby red-arrow (Stage B).
145
349
  export LIBARROW_BINARY=true
146
350
  export NOT_CRAN=true
147
351
  export LIBARROW_BUILD=false
148
352
  export ARROW_USE_PKG_CONFIG=false
149
353
  echo "==> arrow env: LIBARROW_BINARY=true LIBARROW_BUILD=false ARROW_USE_PKG_CONFIG=false"
354
+ if ! ensure_arrow_for_red_arrow; then
355
+ pause 1
356
+ fi
150
357
  ;;
151
358
  bio|examples) ;;
152
359
  *)
@@ -1,73 +1,130 @@
1
1
  #!/bin/bash
2
- # Safe/debug gknit for Omarchy: force HTML, log everything, keep the window open.
2
+ # Safe/debug gknit for Omarchy: log everything, keep the window open.
3
3
  #
4
4
  # Usage:
5
- # omarchy-galaaz-gknit [path/to/file.Rmd]
6
- # omarchy-galaaz-gknit ~/galaaz-blogs/gknit/gknit.Rmd
5
+ # omarchy-galaaz-gknit [path/to/file.Rmd ...]
6
+ # omarchy-galaaz-gknit --output_format pdf_document path.Rmd
7
+ # omarchy-galaaz-gknit path.Rmd pdf_document # positional format (Nautilus)
7
8
  #
8
- # Many shipped blogs list pdf_document before html_document in YAML. A bare
9
- # `gknit file.Rmd` then tries PDF first (LaTeX) — that often fails hard or OOMs
10
- # a small VM. This wrapper always requests html_document and tees a log.
9
+ # Default format is html_document. Many shipped blogs list pdf_document before
10
+ # html_document in YAML; a bare `gknit file.Rmd` then tries PDF first.
11
11
  set -uo pipefail
12
12
 
13
13
  LOG_DIR="${HOME}/.local/share/galaaz"
14
14
  LOG="${LOG_DIR}/gknit-debug.log"
15
15
  mkdir -p "${LOG_DIR}"
16
16
 
17
- RMD="${1:-${HOME}/galaaz-blogs/oh_my/oh_my.Rmd}"
18
- if [[ ! -f "${RMD}" ]]; then
19
- echo "Missing Rmd: ${RMD}"
20
- echo "Press Enter to close..."
21
- read -r _ || true
22
- exit 1
23
- fi
17
+ FMT="html_document"
18
+ FILES=()
19
+
20
+ while [[ $# -gt 0 ]]; do
21
+ case "$1" in
22
+ --output_format|-o)
23
+ if [[ $# -lt 2 ]]; then
24
+ echo "Missing value for $1"
25
+ echo "Press Enter to close..."
26
+ read -r _ || true
27
+ exit 1
28
+ fi
29
+ FMT="$2"
30
+ shift 2
31
+ ;;
32
+ --)
33
+ shift
34
+ FILES+=("$@")
35
+ break
36
+ ;;
37
+ -*)
38
+ echo "Unknown option: $1"
39
+ echo "Press Enter to close..."
40
+ read -r _ || true
41
+ exit 1
42
+ ;;
43
+ *)
44
+ # Positional: first non-option that is not an existing .Rmd and looks like
45
+ # an rmarkdown format name can be treated as format when FILES already set,
46
+ # or as format when it does not end in .Rmd/.Rmarkdown.
47
+ lower="${1,,}"
48
+ if [[ "${lower}" == *.rmd || "${lower}" == *.rmarkdown ]]; then
49
+ FILES+=("$1")
50
+ elif [[ ${#FILES[@]} -eq 0 && -f "$1" ]]; then
51
+ FILES+=("$1")
52
+ elif [[ "$1" =~ ^(html_document|pdf_document|all|[a-zA-Z0-9_]+)$ ]]; then
53
+ FMT="$1"
54
+ else
55
+ FILES+=("$1")
56
+ fi
57
+ shift
58
+ ;;
59
+ esac
60
+ done
24
61
 
25
- {
26
- echo "=== gknit debug $(date -Iseconds) ==="
27
- echo "rmd: ${RMD}"
28
- echo "cwd: $(pwd)"
29
- echo "forcing: --output_format html_document"
30
- echo "log: ${LOG}"
31
- command -v pandoc >/dev/null && pandoc --version | head -1 || echo "pandoc: MISSING"
32
- command -v gknit >/dev/null && echo "gknit: $(command -v gknit)" || echo "gknit: via mise/wrapper"
33
- free -h 2>/dev/null | head -2 || true
34
- echo
35
- } | tee "${LOG}"
62
+ if [[ ${#FILES[@]} -eq 0 ]]; then
63
+ FILES=("${HOME}/galaaz-blogs/oh_my/oh_my.Rmd")
64
+ fi
36
65
 
37
- # Prefer HTML explicitly — do not let YAML's pdf_document win.
38
- set +e
39
- (
40
- cd "$(dirname "${RMD}")" || exit 1
41
- base="$(basename "${RMD}")"
42
- if command -v mise >/dev/null 2>&1; then
43
- mise x ruby -- gknit --output_format html_document --no_clean "${base}"
44
- else
45
- gknit --output_format html_document --no_clean "${base}"
66
+ overall=0
67
+ for RMD in "${FILES[@]}"; do
68
+ if [[ ! -f "${RMD}" ]]; then
69
+ echo "Missing Rmd: ${RMD}"
70
+ overall=1
71
+ continue
46
72
  fi
47
- ) 2>&1 | tee -a "${LOG}"
48
- st=${PIPESTATUS[0]}
49
- set -e
50
73
 
51
- {
52
- echo
53
- echo "exit: ${st}"
54
- echo "--- recent kernel/OOM hints (if any) ---"
55
- dmesg -T 2>/dev/null | grep -iE 'oom|killed process|out of memory' | tail -5 || echo "(no dmesg access or no OOM lines)"
56
- html="${RMD%.Rmd}.html"
57
- if [[ -f "${html}" ]]; then
58
- echo "html: ${html}"
59
- else
60
- echo "html: not found (knit likely failed before write)"
74
+ {
75
+ echo "=== gknit debug $(date -Iseconds) ==="
76
+ echo "rmd: ${RMD}"
77
+ echo "cwd: $(pwd)"
78
+ echo "forcing: --output_format ${FMT}"
79
+ echo "log: ${LOG}"
80
+ command -v pandoc >/dev/null && pandoc --version | head -1 || echo "pandoc: MISSING"
81
+ command -v gknit >/dev/null && echo "gknit: $(command -v gknit)" || echo "gknit: via mise/wrapper"
82
+ free -h 2>/dev/null | head -2 || true
83
+ echo
84
+ } | tee -a "${LOG}"
85
+
86
+ set +e
87
+ (
88
+ cd "$(dirname "${RMD}")" || exit 1
89
+ base="$(basename "${RMD}")"
90
+ if command -v mise >/dev/null 2>&1; then
91
+ mise x ruby -- gknit --output_format "${FMT}" --no_clean "${base}"
92
+ else
93
+ gknit --output_format "${FMT}" --no_clean "${base}"
94
+ fi
95
+ ) 2>&1 | tee -a "${LOG}"
96
+ st=${PIPESTATUS[0]}
97
+ set +e
98
+
99
+ {
100
+ echo
101
+ echo "exit: ${st}"
102
+ echo "--- recent kernel/OOM hints (if any) ---"
103
+ dmesg -T 2>/dev/null | grep -iE 'oom|killed process|out of memory' | tail -5 || echo "(no dmesg access or no OOM lines)"
104
+ stem="${RMD%.*}"
105
+ case "${FMT}" in
106
+ pdf_document) out="${stem}.pdf" ;;
107
+ html_document|*) out="${stem}.html" ;;
108
+ esac
109
+ if [[ -f "${out}" ]]; then
110
+ echo "output: ${out}"
111
+ else
112
+ echo "output: not found for format ${FMT} (knit likely failed before write)"
113
+ fi
114
+ echo "FULL LOG: ${LOG}"
115
+ } | tee -a "${LOG}"
116
+
117
+ if [[ "${st}" -ne 0 ]]; then
118
+ overall="${st}"
61
119
  fi
62
- echo "FULL LOG: ${LOG}"
63
- } | tee -a "${LOG}"
120
+ done
64
121
 
65
122
  echo
66
- if [[ "${st}" -ne 0 ]]; then
67
- echo "FAILED (exit ${st}). Scroll up or: less ${LOG}"
123
+ if [[ "${overall}" -ne 0 ]]; then
124
+ echo "FAILED (exit ${overall}). Scroll up or: less ${LOG}"
68
125
  else
69
126
  echo "OK."
70
127
  fi
71
128
  echo "Press Enter to close (so a crash mid-run still leaves this log on disk)..."
72
129
  read -r _ || true
73
- exit "${st}"
130
+ exit "${overall}"
@@ -317,6 +317,26 @@ if [[ -f "${SCRIPT_DIR}/galaaz-gknit.sh" ]]; then
317
317
  log "gknit helper: ${HOME}/.local/bin/omarchy-galaaz-gknit"
318
318
  fi
319
319
 
320
+ # Nautilus right-click → Scripts → Galaaz → gknit
321
+ NAUTILUS_SCRIPTS_SRC="${SCRIPT_DIR}/nautilus-scripts"
322
+ NAUTILUS_SCRIPTS_DEST="${HOME}/.local/share/nautilus/scripts/Galaaz"
323
+ if [[ -d "${NAUTILUS_SCRIPTS_SRC}" ]]; then
324
+ mkdir -p "${NAUTILUS_SCRIPTS_DEST}"
325
+ if [[ -f "${NAUTILUS_SCRIPTS_SRC}/gknit-html" ]]; then
326
+ cp "${NAUTILUS_SCRIPTS_SRC}/gknit-html" "${NAUTILUS_SCRIPTS_DEST}/Gknit HTML"
327
+ chmod +x "${NAUTILUS_SCRIPTS_DEST}/Gknit HTML"
328
+ fi
329
+ if [[ -f "${NAUTILUS_SCRIPTS_SRC}/gknit-pdf" ]]; then
330
+ cp "${NAUTILUS_SCRIPTS_SRC}/gknit-pdf" "${NAUTILUS_SCRIPTS_DEST}/Gknit PDF"
331
+ chmod +x "${NAUTILUS_SCRIPTS_DEST}/Gknit PDF"
332
+ fi
333
+ if [[ -f "${NAUTILUS_SCRIPTS_SRC}/gknit-choose-format" ]]; then
334
+ cp "${NAUTILUS_SCRIPTS_SRC}/gknit-choose-format" "${NAUTILUS_SCRIPTS_DEST}/Gknit Choose Format"
335
+ chmod +x "${NAUTILUS_SCRIPTS_DEST}/Gknit Choose Format"
336
+ fi
337
+ log "nautilus Scripts/Galaaz: ${NAUTILUS_SCRIPTS_DEST}"
338
+ fi
339
+
320
340
  mkdir -p "${HOME}/.config/galaaz/profiles"
321
341
  date -Iseconds >"${HOME}/.config/galaaz/profiles/core"
322
342
 
@@ -0,0 +1,61 @@
1
+ #!/bin/bash
2
+ # Nautilus Scripts → Galaaz → Gknit Choose Format
3
+ # Uses NAUTILUS_SCRIPT_SELECTED_FILE_PATHS (newline-separated).
4
+ set -euo pipefail
5
+
6
+ GK="${HOME}/.local/bin/omarchy-galaaz-gknit"
7
+ FILES=()
8
+
9
+ while IFS= read -r f; do
10
+ [[ -z "${f}" ]] && continue
11
+ case "${f,,}" in
12
+ *.rmd|*.rmarkdown) FILES+=("${f}") ;;
13
+ esac
14
+ done <<< "${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS:-}"
15
+
16
+ if [[ ${#FILES[@]} -eq 0 ]]; then
17
+ notify-send "Galaaz" "Select one or more .Rmd files to gknit." 2>/dev/null || true
18
+ exit 1
19
+ fi
20
+
21
+ if [[ ! -x "${GK}" ]]; then
22
+ notify-send "Galaaz" "Missing ${GK}. Run: galaaz omarchy install" 2>/dev/null || true
23
+ exit 1
24
+ fi
25
+
26
+ FMT=""
27
+ if command -v zenity >/dev/null 2>&1; then
28
+ FMT="$(
29
+ zenity --list \
30
+ --title="Galaaz gknit" \
31
+ --text="Output format for ${#FILES[@]} Rmd file(s):" \
32
+ --column="Format" \
33
+ html_document \
34
+ pdf_document \
35
+ all \
36
+ --height=280 \
37
+ --width=360 \
38
+ 2>/dev/null || true
39
+ )"
40
+ elif command -v kdialog >/dev/null 2>&1; then
41
+ FMT="$(
42
+ kdialog --title "Galaaz gknit" --combobox "Output format:" \
43
+ html_document pdf_document all \
44
+ --default html_document 2>/dev/null || true
45
+ )"
46
+ fi
47
+
48
+ if [[ -z "${FMT}" ]]; then
49
+ notify-send "Galaaz" "Format picker cancelled (or install zenity)." 2>/dev/null || true
50
+ exit 0
51
+ fi
52
+
53
+ if command -v omarchy-launch-tui >/dev/null 2>&1; then
54
+ omarchy-launch-tui "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
55
+ elif command -v xdg-terminal-exec >/dev/null 2>&1; then
56
+ xdg-terminal-exec "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
57
+ elif command -v alacritty >/dev/null 2>&1; then
58
+ alacritty -e "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
59
+ else
60
+ "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
61
+ fi
@@ -0,0 +1,39 @@
1
+ #!/bin/bash
2
+ # Nautilus Scripts → Galaaz → Gknit HTML
3
+ # Uses NAUTILUS_SCRIPT_SELECTED_FILE_PATHS (newline-separated).
4
+ set -euo pipefail
5
+
6
+ GK="${HOME}/.local/bin/omarchy-galaaz-gknit"
7
+ FMT="html_document"
8
+ FILES=()
9
+
10
+ while IFS= read -r f; do
11
+ [[ -z "${f}" ]] && continue
12
+ case "${f,,}" in
13
+ *.rmd|*.rmarkdown) FILES+=("${f}") ;;
14
+ esac
15
+ done <<< "${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS:-}"
16
+
17
+ if [[ ${#FILES[@]} -eq 0 ]]; then
18
+ notify-send "Galaaz" "Select one or more .Rmd files to gknit (HTML)." 2>/dev/null || true
19
+ exit 1
20
+ fi
21
+
22
+ if [[ ! -x "${GK}" ]]; then
23
+ notify-send "Galaaz" "Missing ${GK}. Run: galaaz omarchy install" 2>/dev/null || true
24
+ exit 1
25
+ fi
26
+
27
+ launch() {
28
+ if command -v omarchy-launch-tui >/dev/null 2>&1; then
29
+ omarchy-launch-tui "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
30
+ elif command -v xdg-terminal-exec >/dev/null 2>&1; then
31
+ xdg-terminal-exec "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
32
+ elif command -v alacritty >/dev/null 2>&1; then
33
+ alacritty -e "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
34
+ else
35
+ "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
36
+ fi
37
+ }
38
+
39
+ launch
@@ -0,0 +1,39 @@
1
+ #!/bin/bash
2
+ # Nautilus Scripts → Galaaz → Gknit PDF
3
+ # Uses NAUTILUS_SCRIPT_SELECTED_FILE_PATHS (newline-separated).
4
+ set -euo pipefail
5
+
6
+ GK="${HOME}/.local/bin/omarchy-galaaz-gknit"
7
+ FMT="pdf_document"
8
+ FILES=()
9
+
10
+ while IFS= read -r f; do
11
+ [[ -z "${f}" ]] && continue
12
+ case "${f,,}" in
13
+ *.rmd|*.rmarkdown) FILES+=("${f}") ;;
14
+ esac
15
+ done <<< "${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS:-}"
16
+
17
+ if [[ ${#FILES[@]} -eq 0 ]]; then
18
+ notify-send "Galaaz" "Select one or more .Rmd files to gknit (PDF)." 2>/dev/null || true
19
+ exit 1
20
+ fi
21
+
22
+ if [[ ! -x "${GK}" ]]; then
23
+ notify-send "Galaaz" "Missing ${GK}. Run: galaaz omarchy install" 2>/dev/null || true
24
+ exit 1
25
+ fi
26
+
27
+ launch() {
28
+ if command -v omarchy-launch-tui >/dev/null 2>&1; then
29
+ omarchy-launch-tui "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
30
+ elif command -v xdg-terminal-exec >/dev/null 2>&1; then
31
+ xdg-terminal-exec "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
32
+ elif command -v alacritty >/dev/null 2>&1; then
33
+ alacritty -e "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
34
+ else
35
+ "${GK}" --output_format "${FMT}" -- "${FILES[@]}"
36
+ fi
37
+ }
38
+
39
+ launch
data/version.rb CHANGED
@@ -1,2 +1,2 @@
1
1
  $gem_name = "galaaz"
2
- $version="2.1.10.pre.6"
2
+ $version="2.1.10.pre.8"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: galaaz
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.10.pre.6
4
+ version: 2.1.10.pre.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Botafogo
@@ -449,6 +449,9 @@ files:
449
449
  - script/omarchy/galaaz-gknit.sh
450
450
  - script/omarchy/galaaz-guide.sh
451
451
  - script/omarchy/install-galaaz.sh
452
+ - script/omarchy/nautilus-scripts/gknit-choose-format
453
+ - script/omarchy/nautilus-scripts/gknit-html
454
+ - script/omarchy/nautilus-scripts/gknit-pdf
452
455
  - script/omarchy/omarchy-menu.jsonc
453
456
  - script/omarchy/remove-galaaz.sh
454
457
  - specs/all.rb