Compare commits

..

5 Commits

Author SHA1 Message Date
d26e2dbce6 Support for wayland clipboard 2026-01-26 13:30:20 +01:00
397704f046 Add keybind for windows compatability 2026-01-24 11:20:20 +01:00
413ad5305a Use minimap for scrollbar 2026-01-22 13:58:03 +01:00
519de17eaa Ignore geometry files 2026-01-22 13:47:06 +01:00
f6cdc61863 Use farmg package instead of static default frame 2026-01-22 13:43:49 +01:00
3 changed files with 69 additions and 10 deletions

1
.gitignore vendored
View File

@@ -30,3 +30,4 @@ eln-cache
straight/
dark-mode
org-persist/
*.frameg

38
frameg.el Normal file
View File

@@ -0,0 +1,38 @@
;; https://www.reddit.com/r/emacs/comments/4ermj9/comment/d237n0i/?utm_source=share&utm_medium=web2x&context=3
;; Custom functions/hooks for persisting/loading frame geometry upon save/load
(defun save-frameg ()
"Gets the current frame's geometry and saves to ~/.emacs.frameg."
(let ((frameg-font (frame-parameter (selected-frame) 'font))
(frameg-left (frame-parameter (selected-frame) 'left))
(frameg-top (frame-parameter (selected-frame) 'top))
(frameg-width (frame-parameter (selected-frame) 'width))
(frameg-height (frame-parameter (selected-frame) 'height))
(frameg-file (expand-file-name ".emacs.frameg" user-emacs-directory)))
(with-temp-buffer
;; Turn off backup for this file
(make-local-variable 'make-backup-files)
(setq make-backup-files nil)
(insert
";;; This file stores the previous emacs frame's geometry.\n"
";;; Last generated " (current-time-string) ".\n"
"(setq initial-frame-alist\n"
" '("
(format " (top . %d)\n" (max frameg-top 0))
(format " (left . %d)\n" (max frameg-left 0))
(format " (width . %d)\n" (max frameg-width 0))
(format " (height . %d)))\n" (max frameg-height 0)))
(when (file-writable-p frameg-file)
(write-file frameg-file)))))
(defun load-frameg ()
"Loads ~/.emacs.frameg which should load the previous frame's geometry."
(let ((frameg-file (expand-file-name ".emacs.frameg" user-emacs-directory)))
(when (file-readable-p frameg-file)
(load-file frameg-file))))
;; Special work to do ONLY when there is a window system being used
(if window-system
(progn
(add-hook 'after-init-hook 'load-frameg)
(add-hook 'kill-emacs-hook 'save-frameg)))

38
init.el
View File

@@ -47,22 +47,23 @@
(delete-file dark-mode-file)
(with-temp-buffer
(write-file dark-mode-file)))
(modus-themes-toggle))))
;; Default frame size
(setq default-frame-alist
(append (list '(width . 90) '(height . 45)
'(vertical-scroll-bars . nil)
'(internal-border-width . 5)))))
(modus-themes-toggle)))))
;; Disable some UI elements
(tool-bar-mode -1)
(menu-bar-mode -1)
(tooltip-mode -1)
(fringe-mode -1)
(scroll-bar-mode -1)
;; The minimap gives a much better scrolling experience
(use-package minimap
:straight t
:config
(minimap-mode)
(setq minimap-window-location 'right)
(setq minimap-width-fraction 0.10))
(scroll-bar-mode t)
(set-window-scroll-bars (minibuffer-window) nil nil nil nil 1)
;; Font settings
(set-face-attribute 'default nil :font "Iosevka Fixed SS05-12")
@@ -83,6 +84,21 @@
(setq auto-save-default nil)
(setq create-lockfiles nil)
(when (getenv "WAYLAND_DISPLAY")
;; Without this, copy and pasting from other wayland apps into
;; emacs-pgtk doesn't work.
;; https://www.emacswiki.org/emacs/CopyAndPaste#h5o-4
(setq wl-copy-process nil)
(defun wl-copy (text)
(setq wl-copy-process (make-process :name "wl-copy"
:buffer nil
:command '("wl-copy" "-f" "-n")
:connection-type 'pipe
:noquery t))
(process-send-string wl-copy-process text)
(process-send-eof wl-copy-process))
(setq interprogram-cut-function 'wl-copy))
;; Dired settings
(defun embark-open-externally (file)
"Open FILE externally using the default application of the system."
@@ -176,6 +192,7 @@
(global-auto-revert-mode 1)
;; Keybindings
(bind-key "M-<f4>" 'kill-emacs)
(bind-key "C-x k" 'kill-buffer-with-prejudice)
(bind-key "C-w" 'kill-buffer-with-prejudice)
(bind-key "C-x C-k" 'kill-buffer-and-window)
@@ -433,6 +450,9 @@
(when (current-buffer-matches-file-p) (set-buffer-modified-p nil))
(kill-buffer))
;; saving/restoring of the default frame
(load "~/.emacs.d/frameg.el")
;; movies.org package
(load "~/.emacs.d/org-movies.el" 'noerror)