Improvements to scrolling + other optimizations

This commit is contained in:
Emmet 2023-08-26 15:58:45 -05:00
parent dc0a87f941
commit e1005f80a4
6 changed files with 81 additions and 42 deletions

View file

@ -589,6 +589,22 @@
"type": "github"
}
},
"phscroll": {
"flake": false,
"locked": {
"lastModified": 1691993740,
"narHash": "sha256-r5lmBpkhmWVzOIHJH8eitC4Vk9c1JKpMeHm8aAbzo1M=",
"owner": "misohena",
"repo": "phscroll",
"rev": "7f60f69af31e6fcebcf51d0be6bb3f9b9d569ef6",
"type": "github"
},
"original": {
"owner": "misohena",
"repo": "phscroll",
"type": "github"
}
},
"revealjs": {
"flake": false,
"locked": {
@ -614,6 +630,7 @@
"nix-doom-emacs": "nix-doom-emacs",
"nixpkgs": "nixpkgs_2",
"org-nursery": "org-nursery",
"phscroll": "phscroll",
"rust-overlay": "rust-overlay",
"stylix": "stylix"
}

View file

@ -1,7 +1,7 @@
{
description = "Flake of LibrePhoenix";
outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix, eaf, eaf-browser, org-nursery, blocklist-hosts, rust-overlay, ... }@inputs:
outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix, eaf, eaf-browser, org-nursery, phscroll, blocklist-hosts, rust-overlay, ... }@inputs:
let
# ---- SYSTEM SETTINGS ---- #
system = "x86_64-linux"; # system arch
@ -67,6 +67,7 @@
inherit (inputs) eaf;
inherit (inputs) eaf-browser;
inherit (inputs) org-nursery;
inherit (inputs) phscroll;
};
};
};
@ -111,6 +112,10 @@
url = "github:chrisbarrett/nursery";
flake = false;
};
phscroll = {
url = "github:misohena/phscroll";
flake = false;
};
blocklist-hosts = {
url = "github:StevenBlack/hosts";
flake = false;

View file

@ -28,8 +28,8 @@
(remove-hook 'doom-init-ui-hook '+unicode-init-fonts-h)
;; Transparent background
(set-frame-parameter (selected-frame) 'alpha '(90 . 90))
(add-to-list 'default-frame-alist '(alpha . (90 . 90)))
(set-frame-parameter nil 'alpha-background 90)
(add-to-list 'default-frame-alist '(alpha-background . 90))
;; Icons in completion buffers
(add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)
@ -104,7 +104,7 @@
;; Garbage collection to speed things up
(add-hook 'after-init-hook
#'(lambda ()
(setq gc-cons-threshold (* 100 1000 1000))))
(setq gc-cons-threshold (* 100 1024 1024))))
(add-hook 'focus-out-hook 'garbage-collect)
(run-with-idle-timer 5 t 'garbage-collect)
@ -227,6 +227,24 @@
(no-other-window . t)))
display-buffer-alist)
;; Horizontal scrolling tables
(add-load-path! "~/.emacs.d/phscroll")
(setq org-startup-truncated nil)
(with-eval-after-load "org"
(require 'org-phscroll))
(setq phscroll-calculate-in-pixels t)
;; Smooth scrolling
(good-scroll-mode 1)
(setq good-scroll-duration 0.5
good-scroll-step 270
good-scroll-render-rate 0.03)
(global-set-key (kbd "<next>") #'good-scroll-up-full-screen)
(global-set-key (kbd "<prior>") #'good-scroll-down-full-screen)
(require 'org-download)
;; Drag-and-drop to `dired`
@ -990,36 +1008,6 @@ https://github.com/magit/magit/issues/460 (@cpitclaudel)."
"k" 'evil-previous-visual-line
"q" 'helpful-kill-buffers)
;;;-- Load emacs application framework;;;--
(use-package! eaf
:load-path "~/.emacs.d/eaf/"
:init
:custom
(eaf-browser-continue-where-left-off t)
(eaf-browser-enable-adblocker t)
(browse-url-browser-function 'eaf-open-browser) ;; Make EAF Browser my default browser
:config
(defalias 'browse-web #'eaf-open-browser)
(require 'eaf-browser)
(require 'eaf-evil)
(define-key key-translation-map (kbd "SPC")
(lambda (prompt)
(if (derived-mode-p 'eaf-mode)
(pcase eaf--buffer-app-name
("browser" (if (string= (eaf-call-sync "eval_function" eaf--buffer-id "is_focus") "True")
(kbd "SPC")
(kbd eaf-evil-leader-key)))
(_ (kbd "SPC")))
(kbd "SPC")))))
(setq browse-url-browser-function 'browse-url-default-browser)
(map! :leader
:desc "Open web browser"
"o w" #'eaf-open-browser-with-history)
;;;-- Load emacs direnv;;;--
(require 'direnv)
(direnv-mode)

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, eaf, eaf-browser, org-nursery, theme, ... }:
{ config, lib, pkgs, eaf, eaf-browser, org-nursery, phscroll, theme, ... }:
let
themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+theme)+"/polarity.txt"));
dashboardLogo = ./. + "/nix-" + themePolarity + ".png";
@ -87,4 +87,7 @@ in
source = ./scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh;
executable = true;
};
home.file.".emacs.d/phscroll" = {
source = "${phscroll}";
};
}

View file

@ -77,9 +77,9 @@ Doom Emacs is traditionally installed by cloning the repository ([[https://githu
;; I also like evil mode visual movement
(map! :map evil-normal-state-map
:desc "Move to next visual line"
"j" 'evil-next-visual-line
"j" 'evil-next-line
:desc "Move to previous visual line"
"k" 'evil-previous-visual-line)
"k" 'evil-previous-line)
;; Theme and font
(setq custom-theme-directory "~/.emacs.d/themes")
@ -89,8 +89,8 @@ Doom Emacs is traditionally installed by cloning the repository ([[https://githu
(remove-hook 'doom-init-ui-hook '+unicode-init-fonts-h)
;; Transparent background
(set-frame-parameter (selected-frame) 'alpha '(90 . 90))
(add-to-list 'default-frame-alist '(alpha . (90 . 90)))
(set-frame-parameter nil 'alpha-background 90)
(add-to-list 'default-frame-alist '(alpha-background . 90))
;; Icons in completion buffers
(add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)
@ -165,7 +165,7 @@ Doom Emacs is traditionally installed by cloning the repository ([[https://githu
;; Garbage collection to speed things up
(add-hook 'after-init-hook
#'(lambda ()
(setq gc-cons-threshold (* 100 1000 1000))))
(setq gc-cons-threshold (* 100 1024 1024))))
(add-hook 'focus-out-hook 'garbage-collect)
(run-with-idle-timer 5 t 'garbage-collect)
@ -295,6 +295,24 @@ Doom Emacs is traditionally installed by cloning the repository ([[https://githu
(no-other-window . t)))
display-buffer-alist)
;; Horizontal scrolling tables
(add-load-path! "~/.emacs.d/phscroll")
(setq org-startup-truncated nil)
(with-eval-after-load "org"
(require 'org-phscroll))
(setq phscroll-calculate-in-pixels t)
;; Smooth scrolling
(good-scroll-mode 1)
(setq good-scroll-duration 0.5
good-scroll-step 270
good-scroll-render-rate 0.03)
(global-set-key (kbd "<next>") #'good-scroll-up-full-screen)
(global-set-key (kbd "<prior>") #'good-scroll-down-full-screen)
#+END_SRC
*** Org Download, Image Capture, and Opening Files in External Programs
#+BEGIN_SRC emacs-lisp :tangle config.el
@ -1172,7 +1190,8 @@ I don't have this active right now since it's kinda weird with pgtk...
#+END_SRC
** EAF
#+BEGIN_SRC emacs-lisp :tangle config.el
EAF doesn't work on Wayland :(
#+BEGIN_SRC emacs-lisp
;;;-- Load emacs application framework;;;--
(use-package! eaf
:load-path "~/.emacs.d/eaf/"
@ -1476,11 +1495,13 @@ Any git package can be configured for a particular commit or branch:
(package! ob-mermaid)
(package! focus)
(package! olivetti)
(package! good-scroll)
(package! async)
#+END_SRC
* Nix Integration
In order to have Nix load my Doom Emacs configuration [[./doom.nix][doom.nix]], which I source in the =imports= block of my [[../../home.nix][home.nix]].
#+BEGIN_SRC nix :tangle doom.nix
{ config, lib, pkgs, eaf, eaf-browser, org-nursery, theme, ... }:
{ config, lib, pkgs, eaf, eaf-browser, org-nursery, phscroll, theme, ... }:
let
themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+theme)+"/polarity.txt"));
dashboardLogo = ./. + "/nix-" + themePolarity + ".png";
@ -1569,5 +1590,8 @@ in
source = ./scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh;
executable = true;
};
home.file.".emacs.d/phscroll" = {
source = "${phscroll}";
};
}
#+END_SRC

View file

@ -19,3 +19,5 @@
(package! ob-mermaid)
(package! focus)
(package! olivetti)
(package! good-scroll)
(package! async)