diff --git a/azos-core b/azos-core index 1e46de4..60e0dc1 160000 --- a/azos-core +++ b/azos-core @@ -1 +1 @@ -Subproject commit 1e46de4e6f43a6930db82516411a6d69e2442c62 +Subproject commit 60e0dc1820294541c8eb729022850065afd1d7c9 diff --git a/features/git-config/default.nix b/features/git-config/default.nix index 14bdcef..7ef8770 100644 --- a/features/git-config/default.nix +++ b/features/git-config/default.nix @@ -15,7 +15,7 @@ enable = true; signing = { key = "6D17E295C70E2674"; - signByDefault = true; + signByDefault = false; }; settings = { credential.helper = "!pass-git-helper $@"; diff --git a/features/lauretta/emacs/config.org b/features/lauretta/emacs/config.org index 025982d..09c5125 100644 --- a/features/lauretta/emacs/config.org +++ b/features/lauretta/emacs/config.org @@ -333,6 +333,42 @@ With prefix ARG, prompt for a pattern then select from matches." (define-key azos/roam-keymap (kbd "B") #'azos/roam/backup) #+end_src +** Printing + +#+begin_src emacs-lisp +(defun azos/print-buffer (&optional arg) + "Print the current buffer. +For image/PDF/doc buffers, sends the file path to lp directly. +For text buffers, uses lpr-buffer. +With C-u, interactively prompt for scaling, B&W, and orientation options." + (interactive "P") + (let* ((image-p (derived-mode-p 'image-mode 'pdf-view-mode 'doc-view-mode)) + (scale (when arg (y-or-n-p "Fit to page? "))) + (bw (when arg (y-or-n-p "Black and white? "))) + (landscape (when (and arg image-p) (y-or-n-p "Landscape? "))) + (lp-opts (concat + (when scale " -o fit-to-page") + (when bw " -o print-color-mode=monochrome") + (when landscape " -o landscape")))) + (if image-p + (if buffer-file-name + (progn + (shell-command + (concat "lp" lp-opts " " (shell-quote-argument buffer-file-name))) + (message "Sent %s to printer%s%s%s." + (file-name-nondirectory buffer-file-name) + (if scale " [scaled]" "") + (if bw " [B&W]" "") + (if landscape " [landscape]" ""))) + (error "Buffer has no associated file")) + (let ((lpr-switches + (append lpr-switches + (when bw '("-o print-color-mode=monochrome"))))) + (lpr-buffer))))) + +(define-key azos/global-minor-mode/open-keymap (kbd "P") #'azos/print-buffer) +#+end_src + * Provide #+begin_src emacs-lisp diff --git a/features/printing/default.nix b/features/printing/default.nix new file mode 100644 index 0000000..6103145 --- /dev/null +++ b/features/printing/default.nix @@ -0,0 +1,55 @@ +{...}: { + config.flake.modules.nixos.printing = { + lib, + config, + pkgs, + ... + }: let + webpFilter = pkgs.writeShellScript "webptopdf" '' + if [ $# -ge 6 ]; then + INPUT="$6" + TMPFILE="" + else + TMPFILE=$(mktemp /tmp/cups-webp-XXXXXX.webp) + cat > "$TMPFILE" + INPUT="$TMPFILE" + fi + TMPOUT=$(mktemp /tmp/cups-webp-XXXXXX.pdf) + ${pkgs.imagemagick}/bin/magick "$INPUT" "$TMPOUT" + cat "$TMPOUT" + rm -f "$TMPOUT" + [ -n "$TMPFILE" ] && rm -f "$TMPFILE" + ''; + + webpCupsMime = pkgs.runCommand "webp-cups-mime" {} '' + mkdir -p $out/lib/cups/filter $out/share/cups/mime + cp ${webpFilter} $out/lib/cups/filter/webptopdf + chmod +x $out/lib/cups/filter/webptopdf + echo 'image/webp webp string(0,"RIFF") string(8,"WEBP")' > $out/share/cups/mime/webp.types + echo 'image/webp application/pdf 0 webptopdf' > $out/share/cups/mime/webp.convs + ''; + in { + options.azos.printing.enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + }; + + config = lib.mkIf config.azos.printing.enable { + services.printing = { + enable = true; + drivers = [pkgs.hplip webpCupsMime]; + }; + + environment.systemPackages = [pkgs.hplip]; + + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + users.users.aner.extraGroups = ["lp"]; + }; + }; +} diff --git a/features/qutebrowser/config.py b/features/qutebrowser/config.py index 0f10d3b..45eb8ab 100644 --- a/features/qutebrowser/config.py +++ b/features/qutebrowser/config.py @@ -58,3 +58,5 @@ c.fonts.hints = "bold 13px 'LiberationMono'" #Set highdpi c.qt.highdpi = True c.zoom.default = 70 + +c.qt.args = ['renderer-process-limit=6'] diff --git a/nixos/configuration.nix b/nixos/configuration.nix index fbd1482..e8cc835 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -20,6 +20,7 @@ suiteModules.nixos.virtualization suiteModules.nixos.binfmt suiteModules.nixos.attic + suiteModules.nixos.printing ]; boot.loader.grub = { @@ -87,6 +88,7 @@ azos.suites.exwm.enable = true; azos.attic.enable = true; + azos.printing.enable = true; home-manager = { extraSpecialArgs = {inherit inputs outputs suiteModules pkgs;};