Compare commits

...

5 commits

6 changed files with 279 additions and 5 deletions

View file

@ -64,6 +64,10 @@
home-xmodmap-service home-xmodmap-service
home-openssh-service home-openssh-service
home-kitty-service)) home-kitty-service))
#:use-module ((oni home services autokey)
#:select (home-autokey-service-type))
#:use-module ((oni home services copyq)
#:select (home-copyq-service-type))
#:use-module ((oni home services dunst) #:use-module ((oni home services dunst)
#:select (home-dunst-default-service)) #:select (home-dunst-default-service))
#:use-module ((oni home services emacs) #:use-module ((oni home services emacs)
@ -76,7 +80,8 @@
home-emacs-dashboard-configuration home-emacs-dashboard-configuration
home-emacs-eros-service-type home-emacs-eros-service-type
home-emacs-ace-link-service-type home-emacs-ace-link-service-type
home-emacs-ace-link-configuration)) home-emacs-ace-link-configuration
home-emacs-golden-ratio-service-type))
#:use-module ((oni home services environment) #:use-module ((oni home services environment)
#:select (home-environment-service)) #:select (home-environment-service))
#:use-module ((oni home services flameshot) #:use-module ((oni home services flameshot)
@ -420,13 +425,18 @@
(list (list
(local-file "../services/emacs/oni-helpful.el"))))) (local-file "../services/emacs/oni-helpful.el")))))
(service home-emacs-yasnippet-capf-service-type) (service home-emacs-yasnippet-capf-service-type)
(service home-emacs-dashboard-service-type) (service home-emacs-dashboard-service-type
(home-emacs-dashboard-configuration
(configurations
(list
(local-file "../services/emacs/oni-dashboard.el")))))
(service home-emacs-eros-service-type) (service home-emacs-eros-service-type)
(service home-emacs-ace-link-service-type (service home-emacs-ace-link-service-type
(home-emacs-ace-link-configuration (home-emacs-ace-link-configuration
(default-key "C-S-e") (default-key "C-S-e")
(goto-address-key "C-S-e") (goto-address-key "C-S-e")
(org-mode-key "C-S-e"))) (org-mode-key "C-S-e")))
(service home-emacs-golden-ratio-service-type)
(service home-flameshot-service-type) (service home-flameshot-service-type)
@ -474,4 +484,7 @@
(user-primary-email "tom@ryuslash.org") (user-primary-email "tom@ryuslash.org")
(user-other-email '("ryuslash@gmail.com" "tom@iactor.nl")) (user-other-email '("ryuslash@gmail.com" "tom@iactor.nl"))
(new-ignore '(".nnmaildir" ".mbsyncstate" ".uidvalidity" (new-ignore '(".nnmaildir" ".mbsyncstate" ".uidvalidity"
".mbsyncstate.journal" ".mbsyncstate.new"))))))) ".mbsyncstate.journal" ".mbsyncstate.new"))))
(service home-autokey-service-type)
(service home-copyq-service-type))))

View file

@ -0,0 +1,57 @@
(define-module (oni home services autokey)
#:use-module ((gnu services configuration)
#:select (define-configuration/no-serialization))
#:use-module ((gnu packages python-xyz)
#:select (autokey))
#:use-module ((gnu home services)
#:select (service-type
service-extension
home-profile-service-type))
#:use-module ((gnu home services shepherd)
#:select (home-shepherd-service-type
shepherd-service))
#:use-module ((guix packages)
#:select (package?))
#:use-module ((guix gexp)
#:select (gexp
file-append))
#:export (home-autokey-service-type
home-autokey-configuration))
(define-configuration/no-serialization home-autokey-configuration
(package
(package autokey)
"Package to use for setting autokey")
(auto-start?
(boolean #t)
"Automatically start autokey on startup?"))
(define (add-autokey-packages config)
(list (home-autokey-configuration-package config)))
(define (home-autokey-shepherd-service config)
(list
(shepherd-service
(documentation "Start autokey")
(provision '(autokey))
(auto-start? (home-autokey-configuration-auto-start? config))
(start
#~(make-forkexec-constructor
(list #$(file-append (home-autokey-configuration-package config) "/bin/autokey-gtk"))
#:log-file (format #f "~a/.local/var/log/autokey.log" (getenv "HOME"))))
(stop #~(make-kill-destructor)))))
(define home-autokey-service-type
(service-type
(name 'home-autokey)
(extensions
(list (service-extension
home-profile-service-type
add-autokey-packages)
(service-extension
home-shepherd-service-type
home-autokey-shepherd-service)))
(compose identity)
(default-value (home-autokey-configuration))
(description "Install and configure autokey.")))

View file

@ -0,0 +1,57 @@
(define-module (oni home services copyq)
#:use-module ((gnu services configuration)
#:select (define-configuration/no-serialization))
#:use-module ((gnu packages xdisorg)
#:select (copyq))
#:use-module ((gnu home services)
#:select (service-type
service-extension
home-profile-service-type))
#:use-module ((gnu home services shepherd)
#:select (home-shepherd-service-type
shepherd-service))
#:use-module ((guix packages)
#:select (package?))
#:use-module ((guix gexp)
#:select (gexp
file-append))
#:export (home-copyq-service-type
home-copyq-configuration))
(define-configuration/no-serialization home-copyq-configuration
(package
(package copyq)
"Package to use for settings copyq.")
(auto-start?
(boolean #t)
"Automatically start copyq on startup?"))
(define (add-copyq-packages config)
(list (home-copyq-configuration-package config)))
(define (home-copyq-shepherd-service config)
(list
(shepherd-service
(documentation "Start copyq")
(provision '(copyq))
(auto-start? (home-copyq-configuration-auto-start? config))
(start
#~(make-forkexec-constructor
(list #$(file-append (home-copyq-configuration-package config) "/bin/copyq"))
#:log-file (format #f "~a/.local/var/log/copyq.log" (getenv "HOME"))))
(stop #~(make-kill-destructor)))))
(define home-copyq-service-type
(service-type
(name 'home-copyq)
(extensions
(list (service-extension
home-profile-service-type
add-copyq-packages)
(service-extension
home-shepherd-service-type
home-copyq-shepherd-service)))
(compose identity)
(default-value (home-copyq-configuration))
(description "Install and configure copyq.")))

View file

@ -30,7 +30,8 @@
#:use-module ((guix packages) #:use-module ((guix packages)
#:select (package?)) #:select (package?))
#:use-module ((oni packages emacs) #:use-module ((oni packages emacs)
#:select (emacs-yasnippet-capf)) #:select (emacs-yasnippet-capf
emacs-golden-ratio))
#:export (home-emacs-service-type #:export (home-emacs-service-type
home-emacs-configuration home-emacs-configuration
@ -48,7 +49,10 @@
home-emacs-eros-configuration home-emacs-eros-configuration
home-emacs-ace-link-service-type home-emacs-ace-link-service-type
home-emacs-ace-link-configuration)) home-emacs-ace-link-configuration
home-emacs-golden-ratio-service-type
home-emacs-golden-ratio-configuration))
(define-maybe string) (define-maybe string)
@ -298,3 +302,40 @@
(compose identity) (compose identity)
(default-value (home-emacs-ace-link-configuration)) (default-value (home-emacs-ace-link-configuration))
(description "Install and configure emacs-ace-link."))) (description "Install and configure emacs-ace-link.")))
(define-configuration/no-serialization home-emacs-golden-ratio-configuration
(package
(package emacs-golden-ratio)
"Package to use for setting emacs-golden-ratio.")
(configurations
(text-config '())
"Configuration for emacs-golden-ratio."))
(define (add-emacs-golden-ratio-configuration config)
(home-emacs-extension
(configurations
(append
(list (mixed-text-file "golden-ratio-config"
";;;;; golden-ratio-config starts here.\n"
"(golden-ratio-mode)\n"
"(with-eval-after-load 'ace-window\n"
" (advice-add 'ace-window :after #'golden-ratio))\n"
";;;;; golden-ratio-config ends here.\n"))
(home-emacs-golden-ratio-configuration-configurations config)))))
(define (add-emacs-golden-ratio-packages config)
(list (home-emacs-golden-ratio-configuration-package config)))
(define home-emacs-golden-ratio-service-type
(service-type
(name 'home-emacs-golden-ratio)
(extensions
(list (service-extension
home-emacs-service-type
add-emacs-golden-ratio-configuration)
(service-extension
home-profile-service-type
add-emacs-golden-ratio-packages)))
(compose identity)
(default-value (home-emacs-golden-ratio-configuration))
(description "Install and configure emacs-golden-ratio.")))

View file

@ -0,0 +1,78 @@
;;; oni-dashboard.el --- Customization for the dashboard module -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(defun oni-dashboard-insert-random-note (_)
"Insert a link to a random note from my Roam database."
(dashboard-insert-heading "Today's Note:" "n")
(insert "\n ")
(dashboard-insert-shortcut 'random-note "n" "Today's Note:")
(let ((element (seq-random-elt (org-roam-node-read--completions))))
(widget-create 'link
:notify (lambda (&rest _)
(find-file (org-roam-node-file (cdr element)))
(goto-char (org-roam-node-point (cdr element))))
:button-prefix ""
:button-suffix ""
(string-trim-right (car element)))))
(defun oni-dashboard-insert-random-wiki-page (_)
"Insert a link to a random Emacs Wiki page."
(dashboard-insert-heading "Today's Wiki page:" "w")
(insert "\n ")
(dashboard-insert-shortcut 'random-wiki-page "w" "Today's Wiki page:")
(let ((text-beginning-marker (point-marker)))
(insert "Loading...")
(url-retrieve "https://www.emacswiki.org/emacs?action=random"
(lambda (&rest _args)
(let ((info (prog1 (cons (url-recreate-url url-current-object)
(progn
(search-forward "<title>")
(let ((beginning (point)))
(search-forward "</title>")
(forward-char -8)
(buffer-substring-no-properties beginning (point)))))
(kill-buffer))))
(with-current-buffer (marker-buffer text-beginning-marker)
(let ((inhibit-read-only t))
(save-excursion
(goto-char (marker-position text-beginning-marker))
(delete-char 10)
(widget-create 'url-link
:format (format "%%[%s%%]" (cdr info))
:button-suffix ""
:button-prefix ""
(car info)))))))
nil
t)))
(add-to-list 'dashboard-item-generators '(random-wiki-page . oni-dashboard-insert-random-wiki-page))
(add-to-list 'dashboard-items '(random-wiki-page))
(require 'org-roam)
(add-to-list 'dashboard-item-generators '(random-note . oni-dashboard-insert-random-note))
(add-to-list 'dashboard-items '(random-note))
(provide 'oni-dashboard)
;;; oni-dashboard.el ends here

View file

@ -444,3 +444,31 @@ new-theme for a while. I couldn't think of a name so I named it after him.")
(description (description
"This package provides an Emacs-based interface to the Notmuch mail "This package provides an Emacs-based interface to the Notmuch mail
system."))) system.")))
(define-public emacs-golden-ratio
(let ((commit "375c9f287dfad68829582c1e0a67d0c18119dab9")
(revision "0"))
(package
(name "emacs-golden-ratio")
(version (git-version "1.0.0" revision commit))
(source
(origin
(uri (git-reference
(url "https://github.com/roman/golden-ratio.el.git")
(commit commit)))
(method git-fetch)
(file-name (git-file-name name version))
(sha256
(base32 "0a635a3h6jx0clgwmhwc48i14y3xy5q29y37lp2sjnbxx1hlmkli"))))
(build-system emacs-build-system)
(home-page "https://github.com/roman/golden-ratio.el")
(synopsis "Automatic resizing of Emacs windows to the golden ratio")
(description "When working with many windows at the same time, each window has a size that is
not convenient for editing.
golden-ratio helps on this issue by resizing automatically the windows you are
working on to the size specified in the \"Golden Ratio\". The window that has
the main focus will have the perfect size for editing, while the ones that are
not being actively edited will be re-sized to a smaller size that doesn't get in
the way, but at the same time will be readable enough to know it's content.")
(license license:expat))))