From 7141c2ef336904e670fdd7cecf5869a5774ea19b Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Thu, 30 Nov 2023 15:20:14 +0100 Subject: [PATCH] . --- home/emacs/init.el | 718 ++++++++++++++++++++++++++++++++++++ home/emacs/init.org | 113 ++++++ home/emacs/templates | 19 + home/home-configuration.scm | 12 +- home/sway/sway | 273 ++++++++++++++ home/waybar/config | 145 ++++++++ home/waybar/style.css | 280 ++++++++++++++ 7 files changed, 1558 insertions(+), 2 deletions(-) create mode 100644 home/emacs/init.el create mode 100644 home/emacs/init.org create mode 100644 home/emacs/templates create mode 100644 home/sway/sway create mode 100644 home/waybar/config create mode 100644 home/waybar/style.css diff --git a/home/emacs/init.el b/home/emacs/init.el new file mode 100644 index 0000000..23cc81d --- /dev/null +++ b/home/emacs/init.el @@ -0,0 +1,718 @@ +;;; init.el --- Description -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2023 Daniel Ziltener +;; +;; Author: Daniel Ziltener +;; Maintainer: Daniel Ziltener +;; Created: November 13, 2023 +;; Modified: November 13, 2023 +;; Version: 0.0.1 +;; Keywords: abbrev bib c calendar comm convenience data docs +;; emulations extensions faces files frames games hardware help +;; hypermedia i18n internal languages lisp local maint mail matching +;; mouse multimedia news outlines processes terminals tex tools unix +;; vc wp +;; Homepage: https://github.com/dziltener@lyrion.ch/init +;; Package-Requires: ((emacs "24.3")) +;; +;; This file is not part of GNU Emacs. +;; +;;; Commentary: +;; +;; Description +;; +;;; Code: +;;;; Requirements +;; Since I am using `cl-defun` in this init file, I need to require +;; `cl-macs`. +(require 'cl-macs) + +;;;; Early Variables +(setq custom-file "~/.emacs.d/custom.el") +(when (file-exists-p custom-file) + (load custom-file)) + +;;;; Personal Information Setup +(setq user-full-name "Daniel Ziltener" + user-mail-address "dziltener@lyrion.ch") + +;; I use `pass` as password storage. +(auth-source-pass-enable) + +;;;; Straight.el + +(defvar bootstrap-version) +(let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 6)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) +;;(setq straight-use-package-by-default t) + +;;;; Package Management Configuration +;; See: https://github.com/radian-software/el-patch +(use-package el-patch) + +;;;; Helper Functions +(cl-defun conditional-keybind + (filter-fn target-fn + &optional (fail-fn #'self-insert-command)) + "Creates a keybinding that checks `filter-fn`. If it succeeds, + `target-fn` is run, otherwise `fail-fn`. If no fail-fn is given, + `self-insert-command` is run instead. + `target-fn` and `fail-fn` must both be interactive." + (lambda (_prefix) + (interactive "P") + (if (funcall filter-fn) + (call-interactively target-fn) + (call-interactively fail-fn)))) + +;;;; Emacs +(use-package emacs + :delight (eldoc-mode " 󰙎") + :custom + (completion-cycle-threshold 10) + (display-time-mode t) + (enable-recursive-minibuffers t) + (enable-remote-dir-locals t) + (fill-column 100) + (global-hl-line-mode t) + (indent-tabs-mode nil) + (menu-bar-mode nil) + (minibuffer-prompt-properties (read-only t cursor-intangible t face minibuffer-prompt)) + (read-extended-command-predicate #'command-completion-default-include-p) + (recentf-mode t) + (scroll-bar-mode nil) + (tab-always-indent 'complete) + (tool-bar-mode nil) + :custom-face + (default ((t (:weight bold :height 113 :width normal :family "VictorMono Nerd Font")))) + :hook + (minibuffer-setup . cursor-intangible-mode) + :config + (advice-add 'risky-local-variable-p :override #'ignore) + (global-display-fill-column-indicator-mode t)) + +;;;; Org Mode +(use-package org + :ensure t + :hook + (org-mode . org-indent-mode) + (org-src-mode . hack-local-variables) + (org-mode . auto-fill-mode) + :config + (setq org-directory "~/org") + (add-to-list 'org-modules 'collector)) + +(use-package org-roam + :ensure t + :custom + (org-roam-directory "~/org/roam") + :config + (progn (org-roam-db-autosync-mode))) + +(use-package consult-notes + :config + (consult-notes-org-roam-mode t)) + +(use-package websocket + :ensure t + :after org-roam) + +(use-package org-roam-ui + :ensure t + :after org-roam + :custom + (org-roam-ui-sync-theme t) + (org-roam-ui-follow t) + (org-roam-ui-update-on-save t) + (org-roam-ui-open-on-start t)) + +(use-package org-modern + :ensure t + :hook + ((org-mode . org-modern-mode) + (org-agenda-finalize . org-modern-agenda))) + +(use-package org-rainbow-tags + :hook + (org-mode . org-rainbow-tags-mode)) + +;;;; Design +(use-package color-theme-modern) +(use-package moe-theme) +(use-package catppuccin-theme + :custom + (catppuccin-flavor 'mocha) + (catppuccin-highlight-matches t) + (catppuccin-italic-comments t) + :custom-face + (font-lock-doc-face ((t (:inherit font-lock-comment-face + :foreground "#fab387")))) + :config + ;;(load-theme 'catppuccin) + ) + +(set-frame-parameter nil 'alpha-background 80) +(add-to-list 'default-frame-alist '(alpha-background . 80)) + +;; (use-package powerline +;; :init +;; (require 'powerline) +;; :config +;; (powerline-default-theme)) + +;; (use-package airline-themes +;; :after powerline +;; :init (require 'airline-themes) +;; :config +;; (load-theme 'airline-badwolf t)) + +(use-package lambda-line + :straight (:type git :host github :repo "lambda-emacs/lambda-line") + :custom + (lambda-line-icon-time t) ;; requires ClockFace font (see below) + (lambda-line-clockface-update-fontset "ClockFaceRect") ;; set clock icon + (lambda-line-position 'bottom) ;; Set position of status-line + (lambda-line-abbrev t) ;; abbreviate major modes + (lambda-line-hspace " ") ;; add some cushion + (lambda-line-prefix t) ;; use a prefix symbol + (lambda-line-prefix-padding nil) ;; no extra space for prefix + (lambda-line-status-invert nil) ;; no invert colors + (lambda-line-gui-ro-symbol " ⨂") ;; symbols + (lambda-line-gui-mod-symbol " ⬤") + (lambda-line-gui-rw-symbol "  ") + (lambda-line-vc-symbol "  ") + (lambda-line-space-top +.50) ;; padding on top and bottom of line + (lambda-line-space-bottom -.50) + (lambda-line-symbol-position 0.1) ;; adjust the vertical placement of symbol + :config + ;; add evil indicator + (advice-add 'lambda-line-compose :around + (lambda (orig-fun status name primary tertiary secondary) + (funcall orig-fun + status + (concat name evil-mode-line-tag) + primary tertiary secondary))) + ;; activate lambda-line + (lambda-line-mode) + (lambda-line-clockface-update-fontset "ClockFaceRect") + (customize-set-variable 'flymake-mode-line-counter-format '("" flymake-mode-line-error-counter flymake-mode-line-warning-counter flymake-mode-line-note-counter "")) + (customize-set-variable 'flymake-mode-line-format '(" " flymake-mode-line-exception flymake-mode-line-counters)) + ;; set divider line in footer + (when (eq lambda-line-position 'top) + (setq-default mode-line-format (list "%_")) + (setq mode-line-format (list "%_")))) + +(use-package lambda-themes + :straight (:type git :host github :repo "lambda-emacs/lambda-themes") + :custom + (lambda-themes-set-italic-comments t) + (lambda-themes-set-italic-keywords t) + (lambda-themes-set-variable-pitch t) + :config + ;; load preferred theme + (load-theme 'lambda-dark)) + +;;;; Security +(use-package keychain-environment + :init + (keychain-refresh-environment)) + +(use-package pass) +(use-package password-store) +(use-package password-store-otp) + +;;;; Evil Mode +(use-package evil + ;; :after evil-leader + :ensure t + :init + (setq evil-want-keybinding nil + evil-emacs-state-tag " 󰯸 " + evil-normal-state-tag " 󰰓 " + evil-visual-state-tag " 󰰬 " + evil-insert-state-tag " 󰰅 " + evil-motion-state-tag " 󰬔 " + evil-operator-state-tag " 󰰕 ") + :config + (evil-set-leader 'normal (kbd "")) + (evil-set-leader 'normal (kbd "z") t) + (evil-mode 1) + :bind + (:map evil-normal-state-map + ("f" . 'find-file) + ("k" . 'kill-buffer))) + +(use-package evil-collection + :after evil + :ensure t + :delight evil-collection-unimpaired-mode + :custom + (evil-collection-outline-bind-tab-p 1) + :commands evil-collection-init + :init + (evil-collection-init)) + +;;;; Search, Completion, Execution +;;;;; Preliminary Packages +(use-package savehist + :init + (savehist-mode)) + +(use-package orderless + :after consult + :config + (with-eval-after-load 'eglot + (setq completion-category-defaults nil)) + (setq completion-styles '(orderless basic) + completion-category-defaults nil + completion-category-overrides '((file (styles basic partial-completion))))) + +(use-package consult + :bind + (:map evil-normal-state-map + ("" . 'consult-find) + ("gs" . 'consult-eglot-symbols) + ("b" . 'consult-buffer) + ("gb" . 'consult-project-buffer) + ("g/" . 'consult-git-grep) + ("/" . 'consult-grep) + ("/" . 'consult-line))) + +(use-package embark + :bind + ("C-" . 'embark-act) + ("C-M-" . 'embark-bindings)) + +(use-package embark-consult + :after (embark consult) + :hook + (embark-collect-mode . consult-preview-at-point-mode)) + +(use-package wgrep + :config + (setq wgrep-auto-save-buffer t)) + +(use-package vertico + :commands + vertico-mode + :init + (vertico-mode)) + +(use-package marginalia + :commands + marginalia-mode + :init + (marginalia-mode)) + +(use-package nerd-icons-completion + :after marginalia + :commands + nerd-icons-completion-mode + :hook + (marginalia-mode-hook . nerd-icons-completion-marginalia-setup) + :init + (nerd-icons-completion-mode)) + +(use-package which-key + :commands + which-key-setup-minibuffer + :init + (which-key-setup-minibuffer)) + +;;;;; Code Completion +(use-package cape + :config + (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)) + +(defun my/corfu-combined-sort (candidates) + "Sort CANDIDATES using both display-sort-function and corfu-sort-function." + (let ((candidates + (let ((display-sort-func (corfu--metadata-get 'display-sort-function))) + (if display-sort-func + (funcall display-sort-func candidates) + candidates)))) + (if corfu-sort-function + (funcall corfu-sort-function candidates) + candidates))) + +(use-package corfu + :custom + (corfu-cycle t) + (corfu-preselect 'prompt) + (corfu-auto t) + (corfu-scroll-margin 5) + (corfu-quit-no-match 'separator) + (evil-collection-corfu-key-themes '(tab-n-go)) + :config + (setq corfu-sort-override-function #'my/corfu-combined-sort) + :commands + global-corfu-mode + :init + (global-corfu-mode)) + +(use-package corfu-history + :config + (add-to-list 'savehist-additional-variables 'corfu-history) + :hook + global-corfu-mode) + +(use-package corfu-popupinfo + :after corfu + :custom + (corfu-popupinfo-delay '(0.1 . 0.5)) + :hook + global-corfu-mode) + +(use-package nerd-icons-corfu + :after corfu + :init + (add-to-list 'corfu-margin-formatters 'nerd-icons-corfu-formatter)) + +(use-package corfu-terminal + :if (not (display-graphic-p)) + :after corfu + :hook + global-corfu-mode) + +(use-package tempel) + +(use-package xref-union + :hook + cider-connected) + +;;;; Basic Navigation +(use-package goto-chg + :bind + (:map evil-normal-state-map + ("g," . 'goto-last-change) + ("g;" . 'goto-last-change-reverse))) + +(use-package evil-snipe + :delight (evil-snipe-local-mode " 󰓾 ") + :custom + (evil-snipe-scope 'whole-visible) + (evil-snipe-repeat-scope 'whole-buffer) + (evil-snipe-spillover-scope 'whole-buffer) + (evil-snipe-tab-increment t) + :hook + evil-mode + (evil-mode . evil-snipe-override-mode) + (magit-mode . turn-off-evil-snipe-override-mode) + ;; See https://github.com/hlissner/evil-snipe/issues/95 + ;; :config + ;; (evilem-define "gs" 'evil-snipe-repeat + ;; :bind ((evil-snipe-scope 'buffer) + ;; (evil-snipe-enable-highlight) + ;; (evil-snipe-enable-incremental-highlight))) + ) + +(use-package evil-easymotion + :config + (evilem-default-keybindings "")) + +;;;; Lisp Navigation and Editing +;;;;; Helper Functions +(defun cc/move-sexp-backward () + "Move balanced expression (sexp) to the right of point backward one sexp. +Point must be at the beginning of balanced expression (sexp)." + (interactive) + (transpose-sexps 1) + (forward-sexp -2)) + +(defun cc/move-sexp-forward () + "Move balanced expression (sexp) to the right of point forward one sexp. +Point must be at the beginning of balanced expression (sexp)." + (interactive) + (forward-sexp 1) + (transpose-sexps 1) + (forward-sexp -1)) + +(defun looking-at-opening-paren () + (looking-at (rx (or "(" "{" "[")))) + +(defun being-past-closing-paren () + (looking-back (rx (or ")" "}" "]")))) + +;;;;; Basic +(use-package smartparens + :delight (smartparens-mode " 󰅲 ") + :hook + (smartparens-mode . show-smartparens-mode) + (smartparens-mode . smartparens-strict-mode) + clojure-ts-mode + emacs-lisp-mode + scheme-mode + :config + (add-to-list 'sp-clojure-modes 'clojure-ts-mode) + (add-to-list 'sp-clojure-modes 'clojurec-ts-mode) + (add-to-list 'sp-clojure-modes 'clojurescript-ts-mode) + (add-to-list 'sp-lisp-modes 'clojure-ts-mode) + (add-to-list 'sp-lisp-modes 'clojurec-ts-mode) + (add-to-list 'sp-lisp-modes 'clojurescript-ts-mode) + (evil-define-key 'insert smartparens-mode-map + (kbd "r") (conditional-keybind #'looking-at-opening-paren + #'sp-raise-sexp) + (kbd "w") (conditional-keybind #'looking-at-opening-paren + #'cc/move-sexp-backward) + (kbd "s") (conditional-keybind #'looking-at-opening-paren + #'cc/move-sexp-forward) + (kbd "c") (conditional-keybind #'looking-at-opening-paren + #'sp-clone-sexp) + (kbd "DEL") (conditional-keybind #'being-past-closing-paren + #'sp-backward-delete-sexp + #'evil-delete-backward-char-and-join) + (kbd ">") (conditional-keybind #'being-past-closing-paren + (lambda (prefix) + (interactive "P") + (call-interactively #'backward-char) + (call-interactively #'sp-forward-slurp-sexp) + (call-interactively #'sp-forward-sexp) + (call-interactively #'forward-char))) + (kbd "<") (conditional-keybind #'being-past-closing-paren + (lambda (prefix) + (interactive "P") + (call-interactively #'backward-char) + (call-interactively #'sp-forward-barf-sexp) + (call-interactively #'forward-char))))) + +(use-package evil-cleverparens + :after smartparens + :hook smartparens) + +;;;;; Visual Aid +;; (use-package rainbow-delimiters +;; :hook +;; emacs-lisp-mode +;; scheme-mode) + +;;;; Programming +(use-package editorconfig + :delight editorconfig-mode + :commands + editorconfig-mode + :init + (editorconfig-mode 1)) + +(use-package flymake + :delight '(:eval (cons "  " (flymake--mode-line-counters)))) + +(use-package consult-flymake + :after (consult flymake)) + +(defun my/eglot-capf () + (setq-local completion-at-point-functions + (list (cape-super-capf + #'eglot-completion-at-point + #'tempel-complete + #'cape-dabbrev + #'cape-file + #'cape-dict)))) + +(use-package eglot + :custom + (eglot-connect-timeout 90) + (eglot-autoshutdown t) + (eglot-report-progress t) + :config + (defun eglot-mode () + (eglot-inlay-hints-mode +1) + (my/eglot-capf)) + (setq-default eglot-workspace-configuration + '((clojure-lsp (maxCompletions . 300)))) + (add-to-list 'eglot-server-programs + '((clojure-ts-mode clojurec-ts-mode clojurescript-ts-mode) + "clojure-lsp" + :initializationOptions + (:preferences + (:includeInlayParameterNameHints + "all" + :includeInlayParameterNameHintsWhenArgumentMatchesName + t + :includeInlayFunctionParameterTypeHints + t + :includeInlayVariableTypeHints + t + :includeInlayVariableTypeHintsWhenTypeMatchesName + t + :includeInlayPRopertyDeclarationTypeHints + t + :includeInlayFunctionLikeReturnTypeHints + t + :includeInlayEnumMemberValueHints + t)))) + :hook + (eglot-managed-mode . (lambda () + (add-hook 'before-save-hook + (lambda () + (call-interactively #'eglot-format-buffer)) + nil 'local))) + (eglot-managed-mode . eglot-inlay-hints-mode) + (eglot-managed-mode . #'my/eglot-capf)) + +(use-package consult-eglot + :after (consult eglot)) + +(use-package tree-sitter + :ensure t) + +;;;;; Clojure +(use-package clojure-ts-mode + :delight "" + :after tree-sitter + :config + (require 'sesman) + (sesman-install-menu clojure-mode-map) + :hook + ((clojure-ts-mode . eglot-ensure) + (clojure-ts-mode . (lambda () + (setq-local sesman-system 'CIDER))) + (clojure-ts-mode . (lambda () + (sesman-install-menu clojure-mode-map))) + (clojurec-ts-mode . (lambda () + (sesman-install-menu clojurec-mode-map))) + (clojurescript-ts-mode . (lambda () + (sesman-install-menu clojurescript-mode-map)))) + :mode + ("\\.clj\\'" . #'clojure-ts-mode) + ("\\.cljc\\'" . #'clojurec-ts-mode) + ("\\.cljs\\'" . #'clojurescript-ts-mode) + :init + (add-to-list 'tree-sitter-major-mode-language-alist + '(clojure-ts-mode . clojure)) + (add-to-list 'tree-sitter-major-mode-language-alist + '(clojurec-ts-mode . clojure)) + (add-to-list 'tree-sitter-major-mode-language-alist + '(clojurescript-ts-mode . clojure))) + +(use-package cider + :delight (cider-mode '(:eval (concat "  [" (cider--modeline-info) "]"))) + :hook + (clojure-ts-mode . cider-mode) + :config + (evil-define-key 'insert 'cider-mode-map + "C-x C-e" #'cider-eval-last-sexp) + (evil-define-key 'normal 'cider-mode-map + (kbd "ce") #'cider-eval-sexp-at-point)) + +;;;;; Chicken Scheme +(use-package scheme + :config + (eval-after-load 'eglot + '(add-to-list 'eglot-server-programs + '(scheme-mode + . ("env" "CHICKEN_DOC_REPOSITORY=/home/zilti/.local/share/chicken-doc" "chicken-lsp-server")))) + :hook + (scheme-mode . eglot-ensure)) + +(defun flymake-chicken-init () + (add-hook 'flymake-diagnostic-functions + #'flymake-chicken-backend nil t) + (flymake-mode)) + +(use-package geiser + :custom + (geiser-chicken-match-limit 200) + :config + (defalias 'run-geiser 'geiser)) + +;; (use-package flymake-chicken +;; :hook +;; ((scheme-mode . flymake-chicken-init) +;; (scheme-mode . flymake-mode)) +;; :custom +;; (flycheck-global-modes '(not scheme-mode)) +;; :config +;; (add-hook 'flymake-diagnostic-functions #'flymake-chicken-backend nil t)) + +;;;; Other Languages + +(use-package zig-mode + :hook + (zig-mode . eglot-ensure) + :mode ("\\.zig\\'" . zig-mode)) + +(use-package nix-mode + :hook + (nix-mode . eglot-ensure) + :mode ("\\.nix\\'" . nix-mode)) + +;; (use-package lsp-tailwindcss +;; :init +;; (setq lsp-tailwindcss-add-on-mode t +;; lsp-tailwindcss-experimental-class-regex ["\"([^\"]*)\""]) +;; :config +;; (add-to-list 'lsp-tailwindcss-major-modes 'clojurescript-ts-mode) +;; (add-to-list 'lsp-tailwindcss-major-modes 'clojurec-ts-mode)) + +(use-package dhall-mode + :mode "\\.dhall\'" + :hook + ((dhall-mode . lsp))) + +;;;; Version Control + +;;;;; Git +(use-package magit + :autoload + magit) + +(use-package magit-todos + :after magit + :hook + (magit-mode . magit-todos-mode)) + +(use-package forge + :after magit + :config + (advice-add 'magit :after (lambda (&rest _args) + (call-interactively #'forge-pull)))) + +(use-package code-review + :after forge + :custom + (code-review-auth-login-marker 'forge)) + +(use-package git-gutter + :delight git-gutter-mode + :hook prog-mode) + +;;;; LaTeX +;; https://github.com/politza/pdf-tools/#known-problems +(add-hook 'TeX-after-compilation-finished-functions + #'TeX-revert-document-buffer) + +;;;; Communication +;;;;; IRC +(use-package rcirc + :ensure t + :custom + (rcirc-server-alist + `(("liberachat.irc.lyrion.ch" + :server-alias "irc.libera.chat" + :port 6697 + :nick "zilti" + :full-name "Daniel Ziltener" + :user-name "zilti/irc.libera.chat" + :password ,(password-store-get "Privat/Soju") + :encryption tls + :channels ("#chicken"))) + `(("oftc.irc.lyrion.ch" + :server-alias "irc.oftc.net" + :port 6697 + :nick "zilti" + :full-name "Daniel Ziltener" + :user-name "zilti/irc.oftc.net" + :password ,(password-store-get "Privat/Soju") + :encryption tls + :channels ())))) + +(provide 'init) +;;; init.el ends here diff --git a/home/emacs/init.org b/home/emacs/init.org new file mode 100644 index 0000000..40746e5 --- /dev/null +++ b/home/emacs/init.org @@ -0,0 +1,113 @@ +#+TITLE: Emacs Init File +#+AUTHOR: Daniel Ziltener + +* Initialization + +** Requirements + +Since I am using ~cl-defun~ in this init file, I need to import ~cl-macs~. + +#+begin_src emacs-lisp + (require 'cl-macs) +#+end_src + +** Personal Information + +#+NAME: pers-info-table +| Name | Mail | +|-----------------+---------------------| +| Daniel Ziltener | dziltener@lyrion.ch | + +#+begin_src emacs-lisp :var input=pers-info-table + (let ((row (car input))) + (setq user-full-name (cl-first row)) + (setq user-mail-address (cl-second row))) +#+end_src + +For storage of passwords, I use [[https://www.passwordstore.org/][pass]]: src_emacs-lisp[]{(auth-source-pass-enable)} + +** Customizations + +Since this init file is version controlled, and I set all customizations +myself in =use-package= blocks, I want Emacs to use a separate file +for authorized =.dir-local= variables and similar stuff. + +#+begin_src emacs-lisp + (setq custom-file "~/.emacs.d/custom.el") + (when (file-exists-p custom-file) + (load custom-file)) +#+end_src + +** Package Manager + +I use =straight.el= as package manager. + +#+NAME: straight-settings +| Setting | Value | +|-------------------------+-------| +| Use Straight as default | f | + +#+begin_src emacs-lisp :var tbl=straight-settings + (defvar bootstrap-version) + (let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 6)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) + + (let ((settings (car tbl))) + (setq straight-use-package-by-default + (string= "t" (cl-first settings)))) +#+end_src + +* Helper Functions + +Those are meant to reduce code duplication, and add some basic useful features. +The first one is a function to create conditional keybindings. + +#+BEGIN_SRC emacs-lisp + (cl-defun conditional-keybind + "Creates a keybinding that checks `filter-fn`. If it succeeds, + `target-fn` is run, otherwise `fail-fn`. If no fail-fn is given, + `self-insert-command` is run instead. + `target-fn` and `fail-fn` must both be interactive." + (lambda (_prefix) + (interactive "P") + (if (funcall filter-fn) + (call-interactively target-fn) + (call-interactively fail-fn)))) +#+end_src + +* Core Emacs Customization :important: + +#+begin_src emacs-lisp +(use-package emacs + :delight (eldoc-mode " 󰙎") + :custom + (completion-cycle-threshold 10) + (display-time-mode t) + (enable-recursive-minibuffers t) + (enable-remote-dir-locals t) + (global-hl-line-mode t) + (indent-tabs-mode nil) + (menu-bar-mode nil) + (minibuffer-prompt-properties (read-only t cursor-intangible t face minibuffer-prompt)) + (read-extended-command-predicate #'command-completion-default-include-p) + (recentf-mode t) + (scroll-bar-mode nil) + (tab-always-indent 'complete) + (tool-bar-mode nil) + :custom-face + (default ((t (:weight bold :height 113 :width normal :family "VictorMono Nerd Font")))) + :hook + (minibuffer-setup . cursor-intangible-mode) + :config + (advice-add 'risky-local-variable-p :override #'ignore)) +#+end_src + diff --git a/home/emacs/templates b/home/emacs/templates new file mode 100644 index 0000000..682abe5 --- /dev/null +++ b/home/emacs/templates @@ -0,0 +1,19 @@ +fundamental-mode + +(sign "-- DZ " (format-time-string "%Y-%m-%d")) + +prog-mode + +(vip-title (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) " " (make-string (length str) ?=) " " n + (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) " " (s str) " " n + (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) " " (make-string (length str) ?=) " " n) + +(fixme (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "FIXME ") +(todo (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "TODO ") +(bug (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "BUG ") +(hack (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "HACK ") + +;; Local Variables: +;; mode: lisp-data +;; outline-regexp: "[a-z]" +;; End: diff --git a/home/home-configuration.scm b/home/home-configuration.scm index 7e287d7..2532c1f 100644 --- a/home/home-configuration.scm +++ b/home/home-configuration.scm @@ -59,6 +59,14 @@ home-environment-variables-service-type `(("PASSWORD_STORE_DIR" . "$XDG_DATA_HOME/password-store") ("SSH_ASKPASS" . "ksshaskpass"))) + (simple-service 'ziltis-xdg-configuration-files-service + home-xdg-configuration-files-service-type + `(("sway/config" ,(local-file "./sway/sway")) + ("waybar/config" ,(local-file "./waybar/config")) + ("waybar/style.css" ,(local-file "./waybar/style.css")) + ("emacs/init.el" ,(local-file "./emacs/init.el")) + ("emacs/init.org" ,(local-file "./emacs/init.org")) + ("emacs/templates" ,(local-file "./emacs/templates")))) (service home-bash-service-type (home-bash-configuration (aliases @@ -69,12 +77,12 @@ (bashrc (list (local-file - "/home/zilti/guixconfig/home/.bashrc" + "./.bashrc" "bashrc"))) (bash-profile (list (local-file - "/home/zilti/guixconfig/home/.bash_profile" + "./.bash_profile" "bash_profile"))))) (service home-dicod-service-type) (service home-batsignal-service-type) diff --git a/home/sway/sway b/home/sway/sway new file mode 100644 index 0000000..07bbab4 --- /dev/null +++ b/home/sway/sway @@ -0,0 +1,273 @@ +# Default config for sway +# +# Copy this to ~/.config/sway/config and edit it to your liking. +# +# Read `man 5 sway` for a complete reference. + +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod4 +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l +# Your preferred terminal emulator +set $term kitty +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. +#set $menu fuzzel | xargs swaymsg exec -- + +### Appearance + +# borders +hide_edge_borders --i3 smart +default_border pixel 2 + +# window gaps +smart_gaps inverse_outer +gaps inner 15 +gaps left 700 +gaps right 700 + +bindsym $mod+g gaps outer all set 0 +bindsym $mod+i gaps left all set 700; gaps right all set 700 + +# window corner radius in px +corner_radius 10 + +# Window background blur +blur on +blur_xray off +blur_passes 2 +blur_radius 5 + +shadows on +shadows_on_csd on +shadow_blur_radius 20 +shadow_color #0000007F + +# inactive window fade amount. 0.0 = no dimming, 1.0 = fully dimmed +default_dim_inactive 0.0 +dim_inactive_colors.unfocused #000000FF +dim_inactive_colors.urgent #900000FF + +# Move minimized windows into Scratchpad (enable|disable) +scratchpad_minimize disable + +### Output configuration +# +# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) +#output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill +# +# Example configuration: +# +# output HDMI-A-1 resolution 1920x1080 position 1920,0 +# +# You can get the names of your outputs by running: swaymsg -t get_outputs + +### Idle configuration +# +# Example configuration: +# +# exec swayidle -w \ +# timeout 300 'swaylock -f -c 000000' \ +# timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ +# before-sleep 'swaylock -f -c 000000' +# +# This will lock your screen after 300 seconds of inactivity, then turn off +# your displays after another 300 seconds, and turn your screens back on when +# resumed. It will also lock your screen before your computer goes to sleep. + +### Input configuration +# +# Example configuration: +# +# input "2:14:SynPS/2_Synaptics_TouchPad" { +# dwt enabled +# tap enabled +# natural_scroll enabled +# middle_emulation enabled +# } +# +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Read `man 5 sway-input` for more information about this section. + +input * { + xkb_layout "de" + xkb_options "caps:swapescape" +} + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+q exec $term + + # Kill focused window + bindsym $mod+c kill + + # Start your launcher + bindsym $mod+r exec swaymsg "focus parent; split h; exec fuzzel" + bindsym $mod+Shift+r exec swaymsg "focus parent; split v; exec fuzzel" + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Shift+c reload + + # Exit sway (logs you out of your Wayland session) + #bindsym $mod+m exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' + bindsym $mod+m exec wlogout +# +# Moving around: +# +# Move your focus around +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus right +bindsym $mod+Tab focus next sibling +bindsym $mod+Shift+Tab focus prev sibling +# Or use $mod+[up|down|left|right] +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# Move the focused window with the same, but add Shift +bindsym $mod+Shift+$left move left +bindsym $mod+Shift+$down move down +bindsym $mod+Shift+$up move up +bindsym $mod+Shift+$right move right +# Ditto, with arrow keys +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# +# You can "split" the current object of your focus with +# $mod+b or $mod+v, for horizontal and vertical splits +# respectively. +bindsym $mod+b splith +bindsym $mod+v splitv + +# Switch the current container between different layout styles +bindsym $mod+s layout toggle stacking default +bindsym $mod+t layout toggle tabbed default +bindsym $mod+e layout toggle split + +# Untangle the mess +bindsym $mod+u split none + +# Make the current focus fullscreen +bindsym $mod+f fullscreen + +# Toggle the current focus between tiling and floating mode +bindsym $mod+Shift+space floating toggle + +# Swap focus between the tiling area and the floating area +bindsym $mod+space focus mode_toggle + +# Move focus to the parent container +bindsym $mod+a focus parent +# +# Scratchpad: +# +# Sway has a "scratchpad", which is a bag of holding for windows. +# You can send windows there and get them back later. + +# Move the currently focused window to the scratchpad +bindsym $mod+Shift+b move scratchpad + +# Show the next scratchpad window or hide the focused scratchpad window. +# If there are multiple scratchpad windows, this command cycles through them. +bindsym Alt+Shift+Return scratchpad show +# +# Resizing containers: +# +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +#bindsym $mod+r mode "resize" + +# Program-Specific Layouts + +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +#bar { +# position top +# +# # When the status_command prints a new line to stdout, swaybar updates. +# # The default just shows the current date and time. +# status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done +# +# colors { +# statusline #ffffff +# background #323232 +# inactive_workspace #32323200 #32323200 #5c5c5c +# } +#} + +# Autostarts +exec waybar +exec kitty && sleep 0.2s +exec swaymsg move scratchpad + +include @sysconfdir@/sway/config.d/* diff --git a/home/waybar/config b/home/waybar/config new file mode 100644 index 0000000..efda259 --- /dev/null +++ b/home/waybar/config @@ -0,0 +1,145 @@ +[ + { + "backlight": { + "format": "{percent}% {icon}", + "format-icons": [ + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "on-scroll-down": "/nix/store/30jb0hsd8smaqmn8dzjf898vwrhl1qyk-brightnessctl-0.5.1/bin/brightnessctl set 1%-", + "on-scroll-up": "/nix/store/30jb0hsd8smaqmn8dzjf898vwrhl1qyk-brightnessctl-0.5.1/bin/brightnessctl set +1%" + }, + "battery": { + "format": "{capacity}% {icon}", + "format-icons": [ + "", + "", + "", + "", + "" + ], + "states": { + "critical": 15, + "warning": 30 + } + }, + "battery#bat2": { + "bat": "BAT2" + }, + "clock": { + "format": "{:%H:%M}  ", + "format-alt": "{:%Y-%m-%d}  ", + "tooltip-format": "{:%Y %B}\n{calendar}" + }, + "cpu": { + "format": "{usage}% {icon0} {icon1} {icon2} {icon3} {icon4} {icon5} {icon6} {icon7}", + "format-icons": [ + "▁", + "▂", + "▃", + "▄", + "▅", + "▆", + "▇", + "█" + ], + "tooltip": false + }, + "hyprland/window": { + "format": "{}" + }, + "hyprland/workspaces": { + "format": "{id}: {icon}", + "on-click": "activate", + "on-scroll-down": "/nix/store/d25qnrva96v58dq10779sgfz9dachvlb-hyprland-0.32.3/bin/hyprctl dispatch workspace e-1", + "on-scroll-up": "/nix/store/d25qnrva96v58dq10779sgfz9dachvlb-hyprland-0.32.3/bin/hyprctl dispatch workspace e+1" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": [ + " ", + " " + ] + }, + "layer": "top", + "memory": { + "format": "{}% " + }, + "modules-center": [ + "hyprland/window" + ], + "modules-left": [ + "hyprland/workspaces", + "wlr/mode", + "wlr/scratchpad", + "user" + ], + "modules-right": [ + "idle_inhibitor", + "network", + "cpu", + "memory", + "temperature", + "backlight", + "battery", + "battery#bat2", + "clock", + "wireplumber", + "tray" + ], + "network": { + "format-alt": "{ifname}: {ipaddr}/{cidr}", + "format-disconnected": "Disconnected ⚠", + "format-ethernet": "{ipaddr}/{cidr} ", + "format-linked": "{ifname} (No IP) ", + "format-wifi": "{essid} ({signalStrength}%)  ", + "tooltip-format": "{ifname} via {gwaddr} " + }, + "spacing": 4, + "temperature": { + "critical-threshold": 80, + "format": "{temperatureC}°C", + "format-icons": [ + "" + ] + }, + "tray": { + "spacing": 10 + }, + "user": { + "format": "{user} (up {work_d} days ↑)", + "icon": true, + "interval": 60 + }, + "wireplumber": { + "format": "{volume}% {icon}", + "format-icons": [ + "", + "", + "" + ], + "format-muted": "🔇", + "on-click": "/nix/store/v35aidzfvgwzk6nvlnzx5z83vbfdj5av-pwvucontrol-0.2/bin/pwvucontrol" + }, + "wlr/mode": { + "format": "{}" + }, + "wlr/scratchpad": { + "format": "{icon} {count}", + "format-icons": [ + "", + "" + ], + "show-empty": true, + "tooltip": true, + "tooltip-format": "{app}: {title}" + } + } +] diff --git a/home/waybar/style.css b/home/waybar/style.css new file mode 100644 index 0000000..1b6610a --- /dev/null +++ b/home/waybar/style.css @@ -0,0 +1,280 @@ +* { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: 'MPlus Nerd Font', FontAwesome, Roboto, Helvetica, Arial, sans-serif; + font-size: 13px; +} + +window#waybar { + background-color: rgba(43, 48, 59, 0.5); + border-bottom: 3px solid rgba(100, 114, 125, 0.5); + color: #ffffff; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +/* +window#waybar.empty { + background-color: transparent; +} +window#waybar.solo { + background-color: #FFFFFF; +} +*/ + +window#waybar.termite { + background-color: #3F3F3F; +} + +window#waybar.chromium { + background-color: #000000; + border: none; +} + +button { + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; + /* Avoid rounded borders under each button name */ + border: none; + border-radius: 0; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +button:hover { + background: inherit; + box-shadow: inset 0 -3px #ffffff; +} + +#workspaces button { + padding: 0 5px; + background-color: transparent; + color: #ffffff; +} + +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); +} + +#workspaces button.focused { + background-color: #64727D; + box-shadow: inset 0 -3px #ffffff; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#mode { + background-color: #64727D; + border-bottom: 3px solid #ffffff; +} + +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#wireplumber, +#custom-media, +#tray, +#mode, +#idle_inhibitor, +#scratchpad, +#mpd { + padding: 0 10px; + color: #ffffff; +} + +#window, +#workspaces { + margin: 0 4px; +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left > widget:first-child > #workspaces { + margin-left: 0; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right > widget:last-child > #workspaces { + margin-right: 0; +} + +#clock { + background-color: #64727D; +} + +#battery { + background-color: #ffffff; + color: #000000; +} + +#battery.charging, #battery.plugged { + color: #ffffff; + background-color: #26A65B; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #000000; +} + +#cpu { + background-color: #2ecc71; + color: #000000; +} + +#memory { + background-color: #9b59b6; +} + +#disk { + background-color: #964B00; +} + +#backlight { + background-color: #90b1b1; +} + +#network { + background-color: #2980b9; +} + +#network.disconnected { + background-color: #f53c3c; +} + +#pulseaudio { + background-color: #f1c40f; + color: #000000; +} + +#pulseaudio.muted { + background-color: #90b1b1; + color: #2a5c45; +} + +#wireplumber { + background-color: #fff0f5; + color: #000000; +} + +#wireplumber.muted { + background-color: #f53c3c; +} + +#custom-media { + background-color: #66cc99; + color: #2a5c45; + min-width: 100px; +} + +#custom-media.custom-spotify { + background-color: #66cc99; +} + +#custom-media.custom-vlc { + background-color: #ffa000; +} + +#temperature { + background-color: #f0932b; +} + +#temperature.critical { + background-color: #eb4d4b; +} + +#tray { + background-color: #2980b9; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #eb4d4b; +} + +#idle_inhibitor { + background-color: #2d3436; +} + +#idle_inhibitor.activated { + background-color: #ecf0f1; + color: #2d3436; +} + +#mpd { + background-color: #66cc99; + color: #2a5c45; +} + +#mpd.disconnected { + background-color: #f53c3c; +} + +#mpd.stopped { + background-color: #90b1b1; +} + +#mpd.paused { + background-color: #51a37a; +} + +#language { + background: #00b093; + color: #740864; + padding: 0 5px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state { + background: #97e1ad; + color: #000000; + padding: 0 0px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state > label { + padding: 0 5px; +} + +#keyboard-state > label.locked { + background: rgba(0, 0, 0, 0.2); +} + +#scratchpad { + background: rgba(0, 0, 0, 0.2); +} + +#scratchpad.empty { + background-color: transparent; +}