]> git.vanrenterghem.biz Git - Dotty.git/commitdiff
Voeg Zathura Emacs keybindings toe. master
authorFrederik Vanrenterghem <frederik@vanrenterghem.biz>
Tue, 7 May 2024 12:17:13 +0000 (20:17 +0800)
committerFrederik Vanrenterghem <frederik@vanrenterghem.biz>
Tue, 7 May 2024 12:17:13 +0000 (20:17 +0800)
bash/.bashrc
emacs/.emacs.d/init.el
i3/.config/i3/config
i3status/.config/i3status/config
mimeapps/.config/mimeapps.list [new file with mode: 0644]
zathura/.config/zathura/zathurarc [new file with mode: 0644]

index 141a601122d61ac62efb989c2855eea7999b71a0..12b51840e0a52f24eb53c3204185a44cf145a3c5 100644 (file)
@@ -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"
index 8b56c188e591bd2c1ecb921769e314c3e93faded..a26675a98d86aad4d6045d50edaa4ed3e1305171 100644 (file)
@@ -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)
 
 (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)
 (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")
 
index e2a1d760ce0626fbf74309bd41245bb542002110..0c260d3b179fd28212d92b81f8d0743fde48eb3b 100644 (file)
@@ -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
index ff54e46fc9cc4b17f21533eb1f9a41e0476258f4..1bcc848f1b2111abd8009723773eb4ac41ae9e18 100644 (file)
@@ -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 (file)
index 0000000..23c8062
--- /dev/null
@@ -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 (file)
index 0000000..2323e51
--- /dev/null
@@ -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] <C-b> scroll left
+map [normal] <C-n> scroll down
+map [normal] <C-p> scroll up
+map [normal] <C-f> scroll right
+map [normal] <C-g> abort
+map [insert] <C-g> abort
+map [normal] <C-[> abort
+map [normal] <A-\<> goto top
+map [normal] <A-\>> goto bottom
+map [normal] a adjust_window best-fit
+map [normal] s adjust_window width
+map [normal] F display_link
+map [normal] <C-c> 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] <A-Right> navigate next
+map [normal] <A-Left> navigate previous
+map [normal] <PageDown> scroll full-down
+map [normal] <PageUp> scroll full-up
+map [normal] <C-P> print
+map [normal] c recolor
+map [normal] R reload
+map [normal] v rotate rotate_cw
+map [normal] V rotate rotate_ccw
+map [normal] <Left> scroll left
+map [normal] <Up> scroll up
+map [normal] <Down> scroll down
+map [normal] <Right> scroll right
+map [normal] <A-a> scroll half-left
+map [normal] <C-V> scroll half-down
+map [normal] <A-V> scroll half-up
+map [normal] <A-e> scroll half-right
+map [normal] <C-a> scroll full-left
+map [normal] <C-v> scroll full-down
+map [normal] <Return> scroll full-down
+map [normal] <A-v> scroll full-up
+map [normal] <C-e> scroll full-right
+map [normal] <Space> scroll full-down
+map [normal] <C-h> scroll full-up
+map [normal] <BackSpace> scroll full-up
+map [normal] <S-Space> scroll full-up
+map [normal] l jumplist backward
+map [normal] r jumplist forward
+map [normal] <A-r> bisect forward
+map [normal] <A-l> bisect backward
+# still need to use '/' to trigger search
+map [normal] <C-s> search forward
+map [normal] <C-r> search backward
+map [normal] p snap_to_page
+map [normal] <C-i> toggle_index
+map [normal] i toggle_index
+map [normal] <Tab> toggle_index
+map [normal] <A-s> toggle_statusbar
+map [normal] <A-i> 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] <A-P> toggle_presentation
+map [normal] <A-F> toggle_fullscreen
+map [normal] j toggle_fullscreen
+map [fullscreen] j toggle_fullscreen
+map [fullscreen] q toggle_fullscreen
+map [fullscreen] <C-b> scroll left
+map [fullscreen] <C-n> scroll down
+map [fullscreen] <C-p> scroll up
+map [fullscreen] <C-f> scroll right
+map [fullscreen] <C-g> abort
+map [fullscreen] <C-[> abort
+map [fullscreen] <A-\<> goto top
+map [fullscreen] <A-\>> goto bottom
+map [fullscreen] a adjust_window best-fit
+map [fullscreen] s adjust_window width
+map [fullscreen] F display_link
+map [fullscreen] <C-c> 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] <A-Right> navigate next
+map [fullscreen] <A-Left> navigate previous
+map [fullscreen] <PageDown> scroll full-down
+map [fullscreen] <PageUp> scroll full-up
+map [fullscreen] <C-P> print
+map [fullscreen] c recolor
+map [fullscreen] R reload
+map [fullscreen] v rotate rotate_cw
+map [fullscreen] V rotate rotate_ccw
+map [fullscreen] <Left> scroll left
+map [fullscreen] <Up> scroll up
+map [fullscreen] <Down> scroll down
+map [fullscreen] <Right> scroll right
+map [fullscreen] <A-a> scroll half-left
+map [fullscreen] <C-V> scroll half-down
+map [fullscreen] <A-V> scroll half-up
+map [fullscreen] <A-e> scroll half-right
+map [fullscreen] <C-a> scroll full-left
+map [fullscreen] <C-v> scroll full-down
+map [fullscreen] <Return> scroll full-down
+map [fullscreen] <A-v> scroll full-up
+map [fullscreen] <C-e> scroll full-right
+map [fullscreen] <Space> scroll full-down
+map [fullscreen] <C-h> scroll full-up
+map [fullscreen] <BackSpace> scroll full-up
+map [fullscreen] <S-Space> scroll full-up
+map [fullscreen] l jumplist backward
+map [fullscreen] r jumplist forward
+map [fullscreen] <A-r> bisect forward
+map [fullscreen] <A-l> bisect backward
+map [fullscreen] <C-s> search forward
+map [fullscreen] <C-r> search backward
+map [fullscreen] p snap_to_page
+map [fullscreen] i toggle_index
+map [fullscreen] <C-i> toggle_index
+map [fullscreen] <Tab> toggle_index
+map [fullscreen] <A-s> toggle_statusbar
+map [fullscreen] <A-i> 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] <A-s> toggle_statusbar
+map [index] q toggle_index
+map [index] i toggle_index
+map [index] <C-p> navigate_index up
+map [index] <C-h> navigate_index up
+map [index] <BackSpace> navigate_index up
+map [index] <C-n> navigate_index down
+map [index] <A-v> navigate_index up
+map [index] <C-v> navigate_index down
+map [index] \< navigate_index top
+map [index] \> navigate_index bottom
+map [index] <A-\<> navigate_index top
+map [index] <A-\>> navigate_index bottom
+map [index] <C-b> navigate_index collapse
+map [index] <C-f> navigate_index expand
+map [index] <C-i> navigate_index expand-all
+map [index] <A-i> navigate_index collapse-all
+map [index] <Up> navigate_index up
+map [index] <Down> navigate_index down
+map [index] <Left> navigate_index collapse
+map [index] <Right> navigate_index expand
+map [index] <C-m> navigate_index select
+map [index] <Space> navigate_index select
+map [index] <Return> navigate_index select
+map [index] <C-j> navigate_index select
+map [index] <Esc> toggle_index
+map [index] <C-[> toggle_index
+map [index] <C-g> toggle_index
+map [index] <C-c> toggle_index
+map [presentation] i toggle_index
+map [presentation] r navigate next
+map [presentation] <Down> navigate next
+map [presentation] <Right> navigate next
+map [presentation] <PageDown> navigate next
+map [presentation] <Space> navigate next
+map [presentation] l navigate previous
+map [presentation] <Left> navigate previous
+map [presentation] <Up> navigate previous
+map [presentation] <PageUp> navigate previous
+map [presentation] <S-Space> navigate previous
+map [presentation] <BackSpace> navigate previous
+map [presentation] <F5> toggle_presentation
+map [presentation] q toggle_presentation
+map [presentation] <C-h> navigate previous
+map [presentation] <M-v> navigate previous
+map [presentation] <C-v> navigate next
+map [presentation] <A-\<> goto top
+map [presentation] <A-\>> goto bottom