;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- ;; Place your private configuration here! Remember, you do not need to run 'doom ;; sync' after modifying this file! ;; Some functionality uses this to identify you, e.g. GPG configuration, email ;; clients, file templates and snippets. It is optional. ;; (setq user-full-name "John Doe" ;; user-mail-address "john@doe.com") ;; Doom exposes five (optional) variables for controlling fonts in Doom: ;; ;; - `doom-font' -- the primary font to use ;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable) ;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for ;; presentations or streaming. ;; - `doom-symbol-font' -- for symbols ;; - `doom-serif-font' -- for the `fixed-pitch-serif' face ;; ;; See 'C-h v doom-font' for documentation and more examples of what they ;; accept. For example: ;; ;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light) ;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13)) ;; ;; If you or Emacs can't find your font, use 'M-x describe-font' to look them ;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to ;; refresh your font settings. If Emacs still can't find your font, it likely ;; wasn't installed correctly. Font issues are rarely Doom issues! ;; There are two ways to load a theme. Both assume the theme is installed and ;; available. You can either set `doom-theme' or manually load a theme with the ;; `load-theme' function. This is the default: (setq doom-theme 'doom-one) ;; This determines the style of line numbers in effect. If set to `nil', line ;; numbers are disabled. For relative line numbers, set this to `relative'. (setq display-line-numbers-type t) ;; Whenever you reconfigure a package, make sure to wrap your config in an ;; `with-eval-after-load' block, otherwise Doom's defaults may override your ;; settings. E.g. ;; ;; (with-eval-after-load 'PACKAGE ;; (setq x y)) ;; ;; The exceptions to this rule: ;; ;; - Setting file/directory variables (like `org-directory') ;; - Setting variables which explicitly tell you to set them before their ;; package is loaded (see 'C-h v VARIABLE' to look them up). ;; - Setting doom variables (which start with 'doom-' or '+'). ;; ;; Here are some additional functions/macros that will help you configure Doom. ;; ;; - `load!' for loading external *.el files relative to this one ;; - `add-load-path!' for adding directories to the `load-path', relative to ;; this file. Emacs searches the `load-path' when you load packages with ;; `require' or `use-package'. ;; - `map!' for binding new keys ;; ;; To get information about any of these functions/macros, move the cursor over ;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). ;; This will open documentation for it, including demos of how they are used. ;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces, ;; etc). ;; ;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how ;; they are implemented. ;; Ustawiamy poprawną ścieżkę do notatek od razu (setq org-roam-directory "/storage/emulated/0/Documents/NotatkiOrg/") (setq org-id-locations-file "/storage/emulated/0/Documents/NotatkiOrg/.orgids") ;; Wymuszamy, żeby Emacs wczytał bazę Org-roam zaraz po starcie (after! org-roam (setq org-roam-db-location (concat org-roam-directory ".org-roam.db"))) ;; Trik na Androida: Odśwież dostęp do plików przy starcie (add-hook 'after-init-hook (lambda () (unless (file-exists-p org-roam-directory) (message "Budzenie systemu plików Androida...") (directory-files org-roam-directory)))) (defun my/org-roam-take-photo-ui () "Otwiera aplikację aparatu, kompresuje zdjęcie z galerii i wstawia link relatywny." (interactive) (let* ((assets-dir "/storage/emulated/0/Documents/NotatkiOrg/assets/") ;; Standardowy katalog, do którego systemowy aparat zapisuje zdjęcia (camera-dir "/storage/emulated/0/DCIM/Camera/") (filename (format-time-string "IMG_%Y%m%d_%H%M%S.jpg")) (target-path (concat assets-dir filename))) (unless (file-exists-p assets-dir) (make-directory assets-dir t)) ;; 1. Wywołanie natywnej aplikacji aparatu przez Android Activity Manager (shell-command "am start -a android.media.action.STILL_IMAGE_CAMERA") ;; 2. Emacs czeka, aż zrobisz zdjęcie i wrócisz (read-string "Zrób zdjęcie, wróć do Termuxa i wciśnij [ENTER]...") ;; 3. Wyszukiwanie najnowszego zdjęcia (po dacie modyfikacji) w folderze DCIM (let ((newest-file (string-trim (shell-command-to-string (format "ls -t %s*.jpg 2>/dev/null | head -1" camera-dir))))) (if (string-empty-p newest-file) (message "Błąd: Nie znaleziono żadnego zdjęcia w %s!" camera-dir) ;; 4. Kompresja i zapisanie zdjęcia w formacie docelowym za pomocą ImageMagick ;; Flaga -resize 1600x1600 skaluje zdjęcie (zachowując proporcje), ;; a -quality 75 zmniejsza rozmiar pliku bez dużej straty wizualnej. (shell-command (format "magick '%s' -resize 1600x1600 -quality 75 '%s'" newest-file target-path)) ;; 5. Wstawienie linku do pliku z użyciem ścieżki relatywnej (insert (format "[[./assets/%s]]\n" filename)) (message "Zrobione! Załączono lekki plik: %s" filename))))) (require 'json) (defun my/termux-voice-to-text () "Uruchamia mikrofon, czeka na zakończenie i wstawia tekst." (interactive) (message "Otwieram mikrofon... Czekam na głos!") ;; Używamy termux-dialog, który grzecznie czeka na koniec dyktowania (let* ((json-string (shell-command-to-string "termux-dialog speech")) ;; Parsujemy wynikowy JSON od Termuxa (json-data (ignore-errors (json-read-from-string json-string))) ;; Wyciągamy sam wyraz/zdanie z pola "text" (voice-text (when json-data (cdr (assoc 'text json-data))))) ;; Sprawdzamy, czy faktycznie coś powiedzieliśmy (if (and voice-text (not (string-empty-p (string-trim voice-text)))) (progn ;; Wstawiamy tekst ze spacją na końcu (insert (string-trim voice-text) " ") ;; Opcjonalnie: Wymuszamy wejście w tryb INSERT (Evil mode) ;; po wklejeniu tekstu, żebyś mógł pisać dalej. (when (bound-and-true-p evil-mode) (evil-insert-state)) (message "Tekst wstawiony pomyślnie!")) (message "Nic nie usłyszałem lub anulowano.")))) (defun my/org-roam-attach-android-manager () "Wybiera plik przez natywny menedżer plików, generuje nazwę z datą i zapisuje w assets." (interactive) (let* ((assets-dir "/storage/emulated/0/Documents/NotatkiOrg/assets/") ;; Emacs pyta tylko o rozszerzenie, żeby plik był poprawnie rozpoznawany (ext (read-string "Podaj rozszerzenie pliku (np. pdf, zip, jpg): ")) ;; Zabezpieczenie: jeśli wpiszesz ".pdf" zamiast "pdf", kropka nie ulegnie zdublowaniu (clean-ext (if (string-prefix-p "." ext) (substring ext 1) ext)) ;; Generowanie nazwy: FILE_ROKMIESIACDZIEN_GODZINAMINUTASEKUNDA.rozszerzenie (filename (concat (format-time-string "FILE_%Y%m%d_%H%M%S.") clean-ext)) (target-path (concat assets-dir filename))) (unless (file-exists-p assets-dir) (make-directory assets-dir t)) (message "Otwieram systemowy menedżer plików...") ;; Wywołanie termux-storage-get. Zapisuje wskazany plik bezpośrednio do target-path. (let ((exit-code (call-process "termux-storage-get" nil nil nil target-path))) (if (eq exit-code 0) (progn (insert (format "[[./assets/%s]]\n" filename)) (message "Sukces! Załączono plik jako: %s" filename)) (message "Anulowano lub wystąpił błąd. Plik nie został dodany."))))) ;; --- PRZYPISANIE SKRÓTÓW --- (map! :leader (:prefix ("n" . "notes") :desc "Zrób zdjęcie (aparat)" "r c" #'my/org-roam-take-photo-ui :desc "Dyktowanie głosowe" "r v" #'my/termux-voice-to-text :desc "Wstaw plik (Put file)" "r p" #'my/org-roam-attach-android-manager )) (after! org-roam (setq org-roam-capture-templates '(("d" "domyślna" plain "%?" :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") :unnarrowed t) ("s" "sprzęt / magazyn" plain "\n* Opis\n%?\n\n* Logistyka\nLokalizacja:\n\n* Obraz\n" :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: :magazyn:fpv:\n") :unnarrowed t)))) (use-package! org-fc :after hydra :config (setq org-fc-directories '("/storage/emulated/0/Documents/NotatkiOrg/assets/cards")) (require 'org-fc-hydra))