From: Frederik Vanrenterghem Date: Tue, 7 May 2024 12:17:13 +0000 (+0800) Subject: Voeg Zathura Emacs keybindings toe. X-Git-Url: http://git.vanrenterghem.biz/Dotty.git/commitdiff_plain/HEAD?hp=ca2c01d9f2131e5158c7fdf3ac96b62ca4de63ad Voeg Zathura Emacs keybindings toe. --- diff --git a/bash/.bashrc b/bash/.bashrc index 141a601..12b5184 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -31,3 +31,4 @@ export PYENV_ROOT="$HOME/.pyenv" [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)" +export PATH="$PATH:$HOME/scripts" diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 8b56c18..a26675a 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -11,7 +11,9 @@ ;; Use light theme ;;(load-theme 'leuven t) +(require 'modus-themes) (load-theme 'modus-operandi t) +(setq modus-themes-mixed-fonts t) ;; ESS - for working in R (autoload 'R-mode "ess-site.el" "Major mode for editing R source." t) @@ -24,6 +26,11 @@ (require 'org) +;; Automatically flow lines based on window width and use +;; variable width fonts in org-mode. +(add-hook 'org-mode-hook 'visual-line-mode) +(add-hook 'org-mode-hook 'variable-pitch-mode) + ;; Auctex (load "auctex.el" nil t t) (load "preview-latex.el" nil t t) @@ -122,12 +129,57 @@ (require 'mu4e) (setq mail-user-agent 'mu4e-user-agent) (setq mu4e-get-mail-command "mbsync io") +(setq mu4e-update-interval 600) (setq mu4e-use-fancy-chars t) (setq mu4e-view-show-images t) (setq mu4e-sent-folder "/Sent" mu4e-drafts-folder "/Drafts" mu4e-trash-folder "/Trash") - +;; Create custom spam status header and show in message view +(add-to-list 'mu4e-header-info-custom + '(:spam-status . + ( :name "Spam-Status" ;; long name, as seen in the message-view + :shortname "Spam" ;; short name, as seen in the headers view + :help "The Spam status" ;; tooltip + ;; uses mu4e-fetch-field which is rel. slow, so only appropriate + ;; for mu4e-view-fields, and _not_ mu4e-headers-fields + :function (lambda (msg) + (or (string-join (seq-take (split-string (or (mu4e-fetch-field msg "X-Spam-Status") "") " ") 2) " ") ""))))) +(add-to-list 'mu4e-view-fields :spam-status) + +;; Resize image attachments when sending email +(defvar mu4e-resize-image-types '("jpg" "png" "svg" "jpeg") + "List of attached image types to resize.") + +(defvar mu4e-inhibit-resize nil) + +(defun mu4e-resize-image-attachments () + (unless mu4e-inhibit-resize + (let (cmds + (image-types + (mapconcat #'identity mu4e-resize-image-types "\\|"))) + (save-excursion + (message-goto-body-1) + (while (re-search-forward + (format "<#part.+\\(filename=\"\\)\\(.+\\(\\.%s\\)\\)\"" + image-types) + nil t) + (let* ((infile (match-string-no-properties 2)) + (outfile (concat (temporary-file-directory) + (file-name-nondirectory infile)))) + (push (format "convert %s -resize 1200x1200\\> %s" + (shell-quote-argument infile) + (shell-quote-argument outfile)) + cmds) + (replace-match outfile t t nil 2))) + (mapcar #'shell-command cmds))))) + +(add-hook 'message-send-hook 'mu4e-resize-image-attachments) + +(defun mu4e-inhibit-resize() + (interactive) + (set (make-local-variable 'mu4e-inhibit-resize) t)) + ;; Load configuration for website ;(load "mustache-html") diff --git a/i3/.config/i3/config b/i3/.config/i3/config index e2a1d76..0c260d3 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -40,11 +40,29 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork # and nm-applet is a desktop environment-independent system tray GUI for it. exec --no-startup-id nm-applet +## Control brightness +bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5% +bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%- + # Use pactl to adjust volume in PulseAudio. +# Notification via dunst - TODO refactor as per https://github.com/dunst-project/dunst/blob/master/contrib/progress-notify.sh +exec --no-startup-id dunst + set $refresh_i3status killall -SIGUSR1 i3status -bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status -bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status -bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status && dunstify -a "changeVolume" -u low -i audio-volume-medium \ + -h int:value:"$(pamixer --get-volume)" "Volume: $(pamixer --get-volume)%" \ + -h string:x-dunst-stack-tag:volume \ + -h string:hlcolor:#3397ff +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && \ +$refresh_i3status && \ +dunstify -a "changeVolume" -u low -i audio-volume-low \ + -h int:value:"$(pamixer --get-volume)" "Volume: $(pamixer --get-volume)%" \ + -h string:x-dunst-stack-tag:volume \ + -h string:hlcolor:#3397ff + +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status && dunstify -t 2000 -u low -i audio-volume-muted \ +-h string:x-dunst-stack-tag:volume "Muted" + bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status # Use Mouse+$mod to drag floating windows to their wanted position diff --git a/i3status/.config/i3status/config b/i3status/.config/i3status/config index ff54e46..1bcc848 100644 --- a/i3status/.config/i3status/config +++ b/i3status/.config/i3status/config @@ -33,8 +33,8 @@ ethernet _first_ { battery all { format = "%status %percentage %remaining" - status_chr = "⚡ CHR" - status_bat = "🔋 BAT" + status_chr = "⚡" + status_bat = "🔋" status_unk = "? UNK" status_full = "☻ FULL" low_threshold = 10 @@ -59,7 +59,7 @@ volume master { format_muted = "♪: muted (%volume)" device = "pulse:alsa_output.pci-0000_00_1f.3.analog-stereo" } - + tztime local { format = "%Y-%m-%d %H:%M:%S" } diff --git a/mimeapps/.config/mimeapps.list b/mimeapps/.config/mimeapps.list new file mode 100644 index 0000000..23c8062 --- /dev/null +++ b/mimeapps/.config/mimeapps.list @@ -0,0 +1,84 @@ +[Added Associations] +application/pdf=org.gnome.Evince.desktop;libreoffice-writer.desktop; +application/vnd.adobe.adept+xml=com.calibre_ebook.calibre.desktop; +application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop; +application/x-remmina=org.remmina.Remmina.desktop; +application/xhtml+xml=firefox.desktop; +image/bmp=org.gnome.eog.desktop; +image/gif=org.gnome.eog.desktop; +image/jpeg=gimp.desktop;feh.desktop;eog.desktop; +image/jpg=org.gnome.eog.desktop; +image/pjpeg=org.gnome.eog.desktop; +image/png=gimp.desktop;org.gnome.eog.desktop;eog.desktop; +image/svg+xml=org.gnome.eog.desktop; +image/svg+xml-compressed=org.gnome.eog.desktop; +image/tiff=org.gnome.eog.desktop; +image/vnd.wap.wbmp=org.gnome.eog.desktop; +image/x-bmp=org.gnome.eog.desktop; +image/x-gray=org.gnome.eog.desktop; +image/x-icb=org.gnome.eog.desktop; +image/x-icns=org.gnome.eog.desktop; +image/x-ico=org.gnome.eog.desktop; +image/x-pcx=org.gnome.eog.desktop; +image/x-png=org.gnome.eog.desktop; +image/x-portable-anymap=org.gnome.eog.desktop; +image/x-portable-bitmap=org.gnome.eog.desktop; +image/x-portable-graymap=org.gnome.eog.desktop; +image/x-portable-pixmap=org.gnome.eog.desktop; +image/x-xbitmap=org.gnome.eog.desktop; +image/x-xpixmap=org.gnome.eog.desktop; +text/csv=libreoffice-calc.desktop; +text/html=firefox.desktop; +text/plain=emacs.desktop;calibre-gui.desktop;vim.desktop; +text/x-readme=wine-extension-txt.desktop; +x-scheme-handler/http=firefox.desktop; +x-scheme-handler/https=firefox.desktop; +x-scheme-handler/mailto=org.gnome.Evolution.desktop; +x-scheme-handler/rdp=org.remmina.Remmina.desktop; +x-scheme-handler/remmina=org.remmina.Remmina.desktop; +x-scheme-handler/spice=org.remmina.Remmina.desktop; +x-scheme-handler/vnc=org.remmina.Remmina.desktop; +text/x-opml+xml=emacs.desktop; + +[Default Applications] +application/x-remmina=org.remmina.Remmina.desktop +application/xhtml+xml=firefox.desktop +image/bmp=org.gnome.eog.desktop +image/gif=org.gnome.eog.desktop +image/jpeg=org.gnome.eog.desktop +image/jpg=org.gnome.eog.desktop +image/pjpeg=org.gnome.eog.desktop +image/png=org.gnome.eog.desktop +image/svg+xml=org.gnome.eog.desktop +image/svg+xml-compressed=org.gnome.eog.desktop +image/tiff=org.gnome.eog.desktop +image/vnd.wap.wbmp=org.gnome.eog.desktop +image/x-bmp=org.gnome.eog.desktop +image/x-gray=org.gnome.eog.desktop +image/x-icb=org.gnome.eog.desktop +image/x-icns=org.gnome.eog.desktop +image/x-ico=org.gnome.eog.desktop +image/x-pcx=org.gnome.eog.desktop +image/x-png=org.gnome.eog.desktop +image/x-portable-anymap=org.gnome.eog.desktop +image/x-portable-bitmap=org.gnome.eog.desktop +image/x-portable-graymap=org.gnome.eog.desktop +image/x-portable-pixmap=org.gnome.eog.desktop +image/x-xbitmap=org.gnome.eog.desktop +image/x-xpixmap=org.gnome.eog.desktop +text/csv=libreoffice-calc.desktop +text/html=firefox.desktop +text/plain=emacs.desktop; +x-scheme-handler/http=firefox.desktop +x-scheme-handler/https=firefox.desktop +x-scheme-handler/mailto=org.gnome.Evolution.desktop +x-scheme-handler/msteams=teams.desktop +x-scheme-handler/rdp=org.remmina.Remmina.desktop +x-scheme-handler/remmina=org.remmina.Remmina.desktop +x-scheme-handler/spice=org.remmina.Remmina.desktop +x-scheme-handler/vnc=org.remmina.Remmina.desktop +application/pdf=org.pwmt.zathura.desktop + +[Removed Associations] +application/xhtml+xml=chromium.desktop; +text/html=chromium.desktop; diff --git a/zathura/.config/zathura/zathurarc b/zathura/.config/zathura/zathurarc new file mode 100644 index 0000000..2323e51 --- /dev/null +++ b/zathura/.config/zathura/zathurarc @@ -0,0 +1,208 @@ +# Being an Emacs user, it is natural for me to use emacs-like and info-like keybindings for zathura. +# +# Zathura configuration documentation is available at +# https://git.pwmt.org/pwmt/zathura/-/blob/e5d2ca487147e79d0bb7acbf5174cd9dcc92a86c/doc/man/zathurarc.5.rst +# A full list of available functions and default keybindings is available at +# https://git.pwmt.org/pwmt/zathura/-/blob/e5d2ca487147e79d0bb7acbf5174cd9dcc92a86c/zathura/config.c#L301 +# +# If you want to integrate Zathura with Emacs AUCTeX mode, see +# [emacs wiki](https://www.emacswiki.org/emacs/AUCTeX). +# +# Put the following inside `$XDG_CONFIG_HOME/zathura/zathurarc + +## niceties +# when selecting text with mouse, +# copy to clipboard +set selection-clipboard clipboard + +# keep several lines of text when +# scrolling a screenful +set scroll-full-overlap 0.2 + +# see documentation for details +set scroll-page-aware true +set window-title-basename true +set adjust-open width +set statusbar-home-tilde true +set vertical-center true +set synctex true +# large bold font easier on the eyes in index mode +# status bar can be disabled with A-s +set font "FreeSans bold 16" +set zoom-step 3 + +map [normal] scroll left +map [normal] scroll down +map [normal] scroll up +map [normal] scroll right +map [normal] abort +map [insert] abort +map [normal] abort +map [normal] goto top +map [normal] > goto bottom +map [normal] a adjust_window best-fit +map [normal] s adjust_window width +map [normal] F display_link +map [normal] copy_link +map [normal] f follow +map [normal] m mark_add +map [normal] \' mark_evaluate +map [normal] \, navigate next +map [normal] \. navigate previous +map [normal] navigate next +map [normal] navigate previous +map [normal] scroll full-down +map [normal] scroll full-up +map [normal] print +map [normal] c recolor +map [normal] R reload +map [normal] v rotate rotate_cw +map [normal] V rotate rotate_ccw +map [normal] scroll left +map [normal] scroll up +map [normal] scroll down +map [normal] scroll right +map [normal] scroll half-left +map [normal] scroll half-down +map [normal] scroll half-up +map [normal] scroll half-right +map [normal] scroll full-left +map [normal] scroll full-down +map [normal] scroll full-down +map [normal] scroll full-up +map [normal] scroll full-right +map [normal] scroll full-down +map [normal] scroll full-up +map [normal] scroll full-up +map [normal] scroll full-up +map [normal] l jumplist backward +map [normal] r jumplist forward +map [normal] bisect forward +map [normal] bisect backward +# still need to use '/' to trigger search +map [normal] search forward +map [normal] search backward +map [normal] p snap_to_page +map [normal] toggle_index +map [normal] i toggle_index +map [normal] toggle_index +map [normal] toggle_statusbar +map [normal] focus_inputbar +map [normal] d toggle_page_mode +map [normal] q quit +map [normal] + zoom in +map [normal] - zoom out +map [normal] = zoom in +map [normal] toggle_presentation +map [normal] toggle_fullscreen +map [normal] j toggle_fullscreen +map [fullscreen] j toggle_fullscreen +map [fullscreen] q toggle_fullscreen +map [fullscreen] scroll left +map [fullscreen] scroll down +map [fullscreen] scroll up +map [fullscreen] scroll right +map [fullscreen] abort +map [fullscreen] abort +map [fullscreen] goto top +map [fullscreen] > goto bottom +map [fullscreen] a adjust_window best-fit +map [fullscreen] s adjust_window width +map [fullscreen] F display_link +map [fullscreen] copy_link +map [fullscreen] f follow +map [fullscreen] m mark_add +map [fullscreen] \' mark_evaluate +map [fullscreen] \, navigate next +map [fullscreen] \. navigate previous +map [fullscreen] navigate next +map [fullscreen] navigate previous +map [fullscreen] scroll full-down +map [fullscreen] scroll full-up +map [fullscreen] print +map [fullscreen] c recolor +map [fullscreen] R reload +map [fullscreen] v rotate rotate_cw +map [fullscreen] V rotate rotate_ccw +map [fullscreen] scroll left +map [fullscreen] scroll up +map [fullscreen] scroll down +map [fullscreen] scroll right +map [fullscreen] scroll half-left +map [fullscreen] scroll half-down +map [fullscreen] scroll half-up +map [fullscreen] scroll half-right +map [fullscreen] scroll full-left +map [fullscreen] scroll full-down +map [fullscreen] scroll full-down +map [fullscreen] scroll full-up +map [fullscreen] scroll full-right +map [fullscreen] scroll full-down +map [fullscreen] scroll full-up +map [fullscreen] scroll full-up +map [fullscreen] scroll full-up +map [fullscreen] l jumplist backward +map [fullscreen] r jumplist forward +map [fullscreen] bisect forward +map [fullscreen] bisect backward +map [fullscreen] search forward +map [fullscreen] search backward +map [fullscreen] p snap_to_page +map [fullscreen] i toggle_index +map [fullscreen] toggle_index +map [fullscreen] toggle_index +map [fullscreen] toggle_statusbar +map [fullscreen] focus_inputbar +map [fullscreen] d toggle_page_mode +map [fullscreen] + zoom in +map [fullscreen] - zoom out +map [fullscreen] = zoom in +# status bar will obscure last item in index mode +map [index] toggle_statusbar +map [index] q toggle_index +map [index] i toggle_index +map [index] navigate_index up +map [index] navigate_index up +map [index] navigate_index up +map [index] navigate_index down +map [index] navigate_index up +map [index] navigate_index down +map [index] \< navigate_index top +map [index] \> navigate_index bottom +map [index] navigate_index top +map [index] > navigate_index bottom +map [index] navigate_index collapse +map [index] navigate_index expand +map [index] navigate_index expand-all +map [index] navigate_index collapse-all +map [index] navigate_index up +map [index] navigate_index down +map [index] navigate_index collapse +map [index] navigate_index expand +map [index] navigate_index select +map [index] navigate_index select +map [index] navigate_index select +map [index] navigate_index select +map [index] toggle_index +map [index] toggle_index +map [index] toggle_index +map [index] toggle_index +map [presentation] i toggle_index +map [presentation] r navigate next +map [presentation] navigate next +map [presentation] navigate next +map [presentation] navigate next +map [presentation] navigate next +map [presentation] l navigate previous +map [presentation] navigate previous +map [presentation] navigate previous +map [presentation] navigate previous +map [presentation] navigate previous +map [presentation] navigate previous +map [presentation] toggle_presentation +map [presentation] q toggle_presentation +map [presentation] navigate previous +map [presentation] navigate previous +map [presentation] navigate next +map [presentation] goto top +map [presentation] > goto bottom