This commit is contained in:
starr-dusT 2022-07-31 16:37:01 -07:00
parent 037a94c6d8
commit f43610ccb0
18 changed files with 841 additions and 92 deletions

View File

@ -0,0 +1,26 @@
;;; config.el -*- lexical-binding: t; -*-
;; Author: Tyler Starr
;; Commentary
;; Custom configuration for SystemCrafter's crafted-emacs
;;; Enable crafted modules
(require 'crafted-defaults) ; Sensible default settings for Emacs
(require 'crafted-updates) ; Tools to upgrade Crafted Emacs
(require 'crafted-completion) ; selection framework based on `vertico`
(require 'crafted-ui) ; Better UI experience (modeline etc.)
(require 'crafted-windows) ; Window management configuration
(require 'crafted-editing) ; Whitspace trimming, auto parens etc.
(require 'crafted-evil) ; An `evil-mode` configuration
(require 'crafted-org) ; org-appear, clickable hyperlinks etc.
(require 'crafted-project) ; built-in alternative to projectile
(require 'crafted-speedbar) ; built-in file-tree
;;; Enable local modules
(require 'theme) ; Colors and non-interactive UI elements
(require 'ux) ; Interactive UI elements and window management
(require 'custom-org) ; All the custom bits for org-mode and accesories!
;;; Further settings and customizations follow...

View File

@ -0,0 +1,131 @@
;;; org.el -*- lexical-binding: t; -*-
;; Author: Tyler Starr
;; Commentary
;; Custom configuration for org-mode stuff!
;;; Org file locations
;; Set default working directory for org files
(setq org-directory "~/documents/org")
;; Set default locations to store notes
(setq org-default-notes-file "~/documents/org/capture/refile.org")
;; Set agenda files
(setq org-agenda-files (quote ("~/documents/org/capture"
"~/documents/org/capture/agendas"
"~/documents/org/capture/bookmarks"
"~/documents/org/capture/notes")))
;;; Set Todo Options
;; Set keywords for todo items
(setq org-todo-keywords
(quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
(sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" ))))
;; Set colors for todo items
(setq org-todo-keyword-faces
(quote (("TODO" :foreground "red" :weight bold)
("NEXT" :foreground "blue" :weight bold)
("DONE" :foreground "forest green" :weight bold)
("WAITING" :foreground "orange" :weight bold)
("HOLD" :foreground "magenta" :weight bold)
("CANCELLED" :foreground "forest green" :weight bold))))
;; Set tags based on todo changes
(setq org-todo-state-tags-triggers
(quote (("CANCELLED" ("CANCELLED" . t))
("WAITING" ("WAITING" . t))
("HOLD" ("WAITING") ("HOLD" . t))
(done ("WAITING") ("HOLD"))
("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
("NEXT" ("WAITING") ("CANCELLED") ("HOLD")))))
;; open org-capture
(global-set-key (kbd "C-c c") 'org-capture)
(defvar ts-capture-prmt-history nil
"History of prompt answers for org capture.")
(defun ts/prmt (prompt variable)
"PROMPT for string, save it to VARIABLE and insert it."
(make-local-variable variable)
(set variable (read-string (concat prompt ": ") nil ts-capture-prmt-history)))
;; Capture templates for: TODO tasks, Notes, appointments, and meetings
(setq org-capture-templates
(quote (("t" "todo" entry (file "~/documents/org/capture/refile.org")
"* TODO %?\n%U\n%a\n")
("r" "respond" entry (file "~/documents/org/capture/refile.org")
"* TODO Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n")
("w" "workout" entry (file+datetree "~/documents/org/tracking/workout.org")
"* Test: %(ts/prmt \"Hey\" 'lel) - %(ts/prmt \"Hey1\" 'lel)")
("n" "note" entry (file "~/documents/org/capture/refile.org")
"* %? :NOTE:\n%U\n%a\n")
("m" "Meeting" entry (file "~/documents/org/capture/refile.org")
"* MEETING with %? :MEETING:\n%U")
("h" "Habit" entry (file "~/documents/org/capture/refile.org")
"* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"%<<%Y-%m-%d %a .+1d/3d>>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n"))))
;; Targets include this file and any file contributing to the agenda - up to 9 levels deep
(setq org-refile-targets (quote ((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9))))
;; Use full outline paths for refile targets - we file directly with IDO
(setq org-refile-use-outline-path t)
;; Targets complete directly with IDO
(setq org-outline-path-complete-in-steps nil)
;; Allow refile to create parent tasks with confirmation
(setq org-refile-allow-creating-parent-nodes (quote confirm))
;; Exclude DONE state tasks from refile targets
(defun bh/verify-refile-target ()
"Exclude todo keywords with a done state from refile targets"
(not (member (nth 2 (org-heading-components)) org-done-keywords)))
(setq org-refile-target-verify-function 'bh/verify-refile-target)
(crafted-package-install-package 'org-super-agenda)
(org-super-agenda-mode)
(setq org-super-agenda-header-map (make-sparse-keymap))
(setq org-agenda-custom-commands
'(("c" "Custom Agenda"
((agenda "" ((org-agenda-span 'day)
(org-super-agenda-groups
'((:name "--- LATE ---"
:face (:underline t)
:deadline past
:order 1)
(:name "--- DUE TODAY ---"
:time-grid t
:deadline today
:order 2)
(:name "--- SCHEDULED TODAY ---"
:time-grid t
:date today
:scheduled today
:order 3)
(:name ""
:discard (:anything)
:order 99))
)))))))
;; Configure common tags
(setq org-tag-alist
'((:startgroup)
; Put mutually exclusive tags here
(:endgroup)
("@errand" . ?E)
("@home" . ?H)
("@work" . ?W)
("agenda" . ?a)
("planning" . ?p)
("publish" . ?P)
("batch" . ?b)
("note" . ?n)
("idea" . ?i)
("thinking" . ?t)
("recurring" . ?r)))
;;; Provide the module
(provide 'custom-org)

View File

@ -0,0 +1,48 @@
;;; custom.el --- l -*- lexical-binding: t; -*-
;; Copyright (C) 2022
;; Author: <tstarr@kestrel>
;; Keywords:
;; 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:
(provide 'custom)
;;; custom.el ends here
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
'("eca44f32ae038d7a50ce9c00693b8986f4ab625d5f2b4485e20f22c47f2634ae" default))
'(package-selected-packages
'((burly :host github :repo "alphapapa/burly.el" :branch "main")
(burly :host github :repo "alphapapa/burly.el" :branch "master")
burly dirvish vertico use-package org-appear orderless marginalia helpful evil-nerd-commenter evil-collection embark-consult elisp-demos doom-themes doom-modeline corfu-doc cape all-the-icons))
'(warning-suppress-types '((frameset))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

View File

@ -0,0 +1,5 @@
(setq package-enable-at-startup t)
(defalias 'crafted-use-package 'straight-use-package)
(setq crafted-package-system 'straight)
(setq straight-base-dir "~/.emacs.d/straight")
(crafted-package-bootstrap crafted-package-system)

View File

@ -0,0 +1,19 @@
;;; theme.el -*- lexical-binding: t; -*-
;; Author: Tyler Starr
;; Commentary
;; Custom theming for emacs
;;; Colors
;; Provide nice premade themes
(crafted-package-install-package 'doom-themes)
;; Disable default theme and enable gruvbox
(disable-theme 'deeper-blue)
(load-theme 'doom-gruvbox t)
;;; Provide the module
(provide 'theme)

View File

@ -0,0 +1,31 @@
;;; ux.el -*- lexical-binding: t; -*-
;; Author: Tyler Starr
;; Commentary
;; Custom configuration of emacs ux elements
;;; File Management
(crafted-package-install-package 'dirvish)
(dirvish-override-dired-mode)
(crafted-package-install-package 'treemacs)
;;; Window Management
(crafted-package-install-package '(burly :host github
:repo "alphapapa/burly.el"
:branch "master"))
(tab-bar-mode)
(burly-tabs-mode)
;;; Keybinds
(crafted-package-install-package 'which-key)
(which-key-mode)
;;; Provide the module
(provide 'ux)

View File

@ -8,6 +8,6 @@ function cleanup {
export xeph_qtile=1
Xephyr -br -ac -noreset -screen 800x600 :1 &
export DISPLAY=:1
qtile start &
stumpwm &
trap cleanup EXIT

File diff suppressed because one or more lines are too long

View File

@ -30,7 +30,8 @@
- [[#file-warnings][File Warnings]]
- [[#hilight-matching-braces][Hilight Matching Braces]]
- [[#fix-annoying-buffers][Fix Annoying Buffers]]
- [[#theme][Theme]]
- [[#theme][
Theme]]
- [[#fonts][Fonts]]
- [[#mode-line][Mode Line]]
- [[#time-format][Time Format]]
@ -706,7 +707,7 @@ Setup package management. Some lines can be uncommented for fresh installs.
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize)
;(package-initialize)
; Uncomment for fresh install
(package-refresh-contents)
@ -728,18 +729,18 @@ Trying out straight.el for package management. So far so good!
; Uncomment for fresh install
; Bootstrap straight.el
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;(defvar bootstrap-version)
;(let ((bootstrap-file
; (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
; (bootstrap-version 5))
; (unless (file-exists-p bootstrap-file)
; (with-current-buffer
; (url-retrieve-synchronously
; "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
; 'silent 'inhibit-cookies)
; (goto-char (point-max))
; (eval-print-last-sexp)))
; (load bootstrap-file nil 'nomessage))
;; Always use straight to install on systems other than Linux
(setq straight-use-package-by-default (not (eq system-type 'gnu/linux)))
@ -844,7 +845,7 @@ I don't want a bunch of transient files showing up as untracked in the Git repo
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "~/.emacs.d/init.el" "no")
(server-start)
;(server-start)
#+end_src
@ -1640,6 +1641,30 @@ The [[https://github.com/myrjola/diminish.el][diminish]] package hides pesky min
(setq initial-major-mode 'emacs-lisp-mode)
#+END_SRC
** Scratch
Since the =*scratch*= buffer is pretty hard-wired into Emacs (see
=buffer.c=), the least we could do is getting rid of its initial
message. No, it's using its own mode instead of ~emacs-lisp-mode~ for
the questionable benefit of having a function inserting evaluation
values after a newline.
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "~/.emacs.d/init.el" "no")
(setq initial-scratch-message "")
(setq initial-major-mode 'emacs-lisp-mode)
#+END_SRC
** Scratch
#+begin_src emacs-lisp :tangle (if (member this-system system-category-1) "~/.emacs.d/init.el" "no")
(use-package evil-multiedit)
(evil-multiedit-default-keybinds)
#+END_SRC
* Window Management
** Frame Scaling
@ -3144,7 +3169,6 @@ Sets the background of HTML color strings in buffers to be the color mentioned.
js2-mode))
#+end_src
* Project Specific
** Recipes

View File

@ -1,13 +0,0 @@
(in-package :stumpwm)
(run-shell-command "export GDK_CORE_DEVICE_EVENTS=1")
(defvar *app-keymap*
(let ((m (make-sparse-keymap)))
(define-key m (kbd "b") "exec firefox")
(define-key m (kbd "t") "exec alacritty")
m))
(define-key *root-map* (kbd "a") '*app-keymap*)
(setf *mouse-focus-policy* :click)

293
.config/stumpwm/init.lisp Normal file
View File

@ -0,0 +1,293 @@
;;; init.lisp --- StumpWM demo configuration
;; Copyright © 2020-2021 James McCabe
;; Author: James McCabe <james.mccab3(at)gmail.com>
;; URL: https://github.com/jamesmccabe/stumpwm-demo-config
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This is a basic StumpWM configuration for my demo video.
;;; Code:
(in-package :stumpwm)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Basic settings ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; load Stump contrib modules
(mapc #'load-module
'("swm-gaps"))
;; set prefix key
(set-prefix-key (kbd "C-z"))
;; set desktop background color
(setf (xlib:window-background (screen-root (current-screen))) #x47456d)
;; set wallpaper
(run-shell-command "feh --bg-fill ~/Pictures/wallpaper.png")
;; font settings
;;(set-font (list
;; (make-instance 'xft:font
;; :family "DejaVu Sans Mono"
;; :subfamily "Bold"
;; :size 13)
;; (make-instance 'xft:font
;; :family "FontAwesome"
;; :subfamily "Regular"
;; :size 12)))
;; setup groups
(grename "Base")
(gnewbg "Extra")
(gnewbg-float "Float")
;(gnewbg ".scratchpad") ; hidden group / scratchpad
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Color settings ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; My own personal theme with random colors taken from
;; various Doom Emacs themes and also Dracula theme
;; You can set 10 colors in total (8 default plus 2 extra)
(setf *colors*
'("#ffffff" ; ^0 ; White
"#131220" ; ^1 ; Dark Blue
"#f72f33" ; ^2 ; Red
"#689d6a" ; ^3 ; Light Green
"#62bfef" ; ^4 ; Light Blue
"#fabd2f" ; ^5 ; Yellow / Help map keys
"#a644bf" ; ^6 ; Magenta
"#cc4a0e" ; ^7 ; Brown
"#56b6c2")) ; ^8 ; Cyan
(defparameter *mode-line-bg-color* (nth 1 *colors*))
(defparameter *mode-line-fg-color* (nth 0 *colors*))
(defparameter *msg-bg-color* (nth 1 *colors*))
(defparameter *msg-fg-color* (nth 0 *colors*))
(defparameter *msg-border-color* (nth 2 *colors*))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; General settings ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; mouse pointer
(run-shell-command "xsetroot -cursor_name left_ptr")
;; messages display time
(setf *timeout-wait* 7)
;; ignore window hints
(setf *ignore-wm-inc-hints* t)
;; window name format (truncate name after 20 letters)
(setf *window-format* "%m%n%s%20t")
;; input focus is transferred to the window you click on
(setf *mouse-focus-policy* :click)
;; message and input window location
(setf *message-window-gravity* :center)
(setf *input-window-gravity* :center)
;; message/input bar colors
(set-bg-color *msg-bg-color*)
(set-fg-color *msg-fg-color*)
(set-border-color *msg-border-color*)
;; message/input bar settings
(set-msg-border-width 3)
(setf *message-window-padding* 6)
;;; gaps settings
;; inner gaps run along all the 4 borders of a frame
(setf swm-gaps:*inner-gaps-size* 10)
;; outer gaps add more padding to the outermost borders
;; (touching the screen border)
(setf swm-gaps:*outer-gaps-size* 10)
;; startup message
(setf *startup-message* "^5 Stump Window Manager ^0has initialized!
Press ^2Ctrl+z ? ^0for Help. ^5Never Stop Hacking!^n
Powered with ^02 Common Lisp ")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Swank settings ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require :swank)
(swank-loader:init)
(defparameter *port-number* 4004
"My default port number for Swank")
(defvar *swank-server-p* nil
"Keep track of swank server, turned off by default on startup")
(defcommand start-swank () ()
"Start Swank if it is not already running"
(if *swank-server-p*
(message "Swank server is already active on Port^5 ~a^n" *port-number*)
(progn
(swank:create-server :port *port-number*
:style swank:*communication-style*
:dont-close t)
(setf *swank-server-p* t)
(message "Swank server is now active on Port^5 ~a^n.
Use^4 M-x slime-connect^n in Emacs.
Type^2 (in-package :stumpwm)^n in Slime REPL." *port-number*))))
(defcommand stop-swank () ()
"Stop Swank"
(swank:stop-server *port-number*)
(setf *swank-server-p* nil)
(message "Stopping Swank Server! Closing Port^5 ~a^n." *port-number*))
(defcommand toggle-swank () ()
(if *swank-server-p*
(run-commands "stop-swank")
(run-commands "start-swank")))
(define-key *top-map* (kbd "s-s") "toggle-swank")
;; modeline status
(defun get-swank-status ()
(if *swank-server-p*
(setf *swank-ml-status* (format nil "Swank ^3^f1^f0^n Port:^5 ~a^n " *port-number*))
(setf *swank-ml-status* "")))
(defun ml-fmt-swank-status (ml)
(declare (ignore ml))
(get-swank-status))
(add-screen-mode-line-formatter #\S #'ml-fmt-swank-status)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Keybindings ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; navigation
;; cycle forward and back through groups
(define-key *root-map* (kbd ".") "gnext")
(define-key *root-map* (kbd ",") "gprev")
(define-key *top-map* (kbd "s-Up") "gnext")
(define-key *top-map* (kbd "s-Down") "gprev")
;; cycle through windows using Super key + arrows
(define-key *top-map* (kbd "s-Right") "pull-hidden-next")
(define-key *top-map* (kbd "s-Left") "pull-hidden-previous")
;; send window to next/previous groups
(define-key *root-map* (kbd "s-Right") "gnext-with-window")
(define-key *root-map* (kbd "s-Left") "gprev-with-window")
(define-key *top-map* (kbd "s-SPC") "fnext")
;;others
;; run or raise firefox
(defcommand firefox () ()
"Start Forefox or switch to it, if it is already running"
(run-or-raise "firefox" '(:class "Firefox")))
(define-key *root-map* (kbd "b") "firefox")
;; open terminal
(define-key *root-map* (kbd "Return") "exec alacritty")
(define-key *root-map* (kbd "c") "exec alacritty")
(define-key *root-map* (kbd "C-c") "exec alacritty")
;; toggle useless gaps keybinding (Super + u)
(define-key *top-map* (kbd "s-u") "toggle-gaps")
;; hard restart keybinding (Super + r)
(define-key *top-map* (kbd "s-r") "restart-hard")
;; allows me to continously have control of Prefix key
;; by unmapping it from 'pull-hidden-other
(undefine-key *tile-group-root-map* (kbd "C-z"))
(define-key *root-map* (kbd "C-z") "abort")
;; take screenshot
(defcommand stump-screenshot () ()
(run-shell-command "exec scrot")
(sleep 0.5)
(message "Screenshot taken!"))
(define-key *top-map* (kbd "Print") "stump-screenshot")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Modeline settings ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setf *mode-line-timeout* 1)
(setf *mode-line-border-width* 0)
(setf *mode-line-background-color* *mode-line-bg-color*)
(setf *mode-line-border-color* *mode-line-bg-color*)
(setf *mode-line-foreground-color* *mode-line-fg-color*)
(setf *time-modeline-string* "^2 %H:%M")
;(defparameter *battery-percent* "")
;
;(defun get-battery-status ()
; (let* ((batgetcap (run-shell-command "cat /sys/class/power_supply/BAT0/capacity | tr -d '\\r\\n'" t)))
; (setf *battery-percent* (format nil "^4^f1^f0^n ~a% " batgetcap))))
;
;(defun battery-percentage (ml)
; (declare (ignore ml))
; *battery-percent*)
;
;(run-with-timer 0 10 #'get-battery-status)
;(add-screen-mode-line-formatter #\B #'battery-percentage)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setf *screen-mode-line-format*
(list "^5[%g]^n " ; groups
"%W" ; windows
"^>" ; right align
"%S" ; swank status
; ;"%B" ; battery percentage
"%d")) ; time/date
;; turn on the mode line
(if (not (head-mode-line (current-head)))
(toggle-mode-line (current-screen) (current-head)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Overrides ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This file when loaded overrides some Stump behavior
;; which are personal preferences I prefer to the defaults
(load "~/.config/stumpwm/overrides.lisp")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Debugging ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(redirect-all-output (data-dir-file "debug-output" "txt"))
;(setf stumpwm:*debug-level* 10)
;(load "~/.stumpwm.d/test.lisp")
;;; init.lisp ends here

View File

@ -0,0 +1,80 @@
;;; overrides.lisp --- preferred functionality for StumpWM
;; Copyright © 2020-2021 James McCabe
;; Author: James McCabe <james.mccab3(at)gmail.com>
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This file changes some default behavior of StumpWM.
;;; Code:
;;; Colors
;; overrides StumpWM default behavior of dimming normal colors
(defun update-color-map (screen)
"Read *colors* and cache their pixel colors for use when rendering colored text."
(labels ((map-colors (amt)
(loop for c in *colors*
as color = (lookup-color screen c)
do (adjust-color color amt)
collect (alloc-color screen color))))
(setf (screen-color-map-normal screen) (apply #'vector (map-colors 0.00)))))
(update-color-map (current-screen))
;; fix colors in quit message
(defcommand quit-confirm () ()
"Prompt the user to confirm quitting StumpWM."
(if (y-or-n-p (format nil "~@{~a~^~%~}"
"You are about to quit the window manager to TTY."
"Really ^2quit^n ^4StumpWM^n?"
"^5Confirm?^n "))
(quit)
(xlib:unmap-window (screen-message-window (current-screen)))))
;;; Splits
;; StumpWM by default treats horizontal and vertical splits as Emacs does.
;; Horizontal splits the current frame into 2 side-by-side frames and Vertical
;; splits the current frame into 2 frames, one on top of the other.
;; I reverse this behavior in my configuration.
(defcommand (vsplit tile-group) (&optional (ratio "1/2")) (:string)
"Split the current frame into 2 side-by-side frames."
(split-frame-in-dir (current-group) :column (read-from-string ratio)))
(defcommand (hsplit tile-group) (&optional (ratio "1/2")) (:string)
"Split the current frame into 2 frames, one on top of the other."
(split-frame-in-dir (current-group) :row (read-from-string ratio)))
(undefine-key *tile-group-root-map* (kbd "S"))
(undefine-key *tile-group-root-map* (kbd "s"))
(define-key *root-map* (kbd "S") "vsplit")
(define-key *root-map* (kbd "s") "hsplit")
(defcommand (vsplit-equally tile-group) (amt)
((:number "Enter the number of frames: "))
"Split current frame in n columns of equal size."
(split-frame-eql-parts (current-group) :column amt))
(defcommand (hsplit-equally tile-group) (amt)
((:number "Enter the number of frames: "))
"Split current frame in n rows of equal size."
(split-frame-eql-parts (current-group) :row amt))
;;; overrides.lisp ends here

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
export GDK_CORE_DEVICE_EVENTS=1
stumpwm

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true"
, bgColor = "#282828"
, fgColor = "#EBDBB2"
, position = Static {xpos = 2560, ypos = 0, width = 2560, height = 20}
, position = Static {xpos = 0, ypos = 0, width = 2560, height = 20}
, iconRoot = "X"
, allDesktops = True
, commands = [ Run Cpu ["-t", " <fc=#FB4934><total></fc>%","-H", "2"] 10

19
.config/xmobar/xmobarrc1 Executable file
View File

@ -0,0 +1,19 @@
Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true"
, bgColor = "#282828"
, fgColor = "#EBDBB2"
, position = Static {xpos = 2560, ypos = 0, width = 2560, height = 20}
, iconRoot = "X"
, allDesktops = True
, commands = [ Run Cpu ["-t", " <fc=#FB4934><total></fc>%","-H", "2"] 10
, Run Memory ["-t", "<fc=#FB4934><usedratio></fc>%"] 10
, Run Network "enp3s0" [ "-t", "<fc=#FB4934><tx></fc>kb/<fc=#FB4934><rx></fc>kb" ] 10
, Run Com "/home/tstarr/.config/xmobar/volume" [] "volume" 10
, Run Com "/home/tstarr/.config/xmobar/gamemode" [] "gamemode" 10
, Run Com "/home/tstarr/.config/xmobar/mouse" [] "mouse" 10
, Run Date " %a %d/%m/%y  %H:%M:%S" "date" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = " <fc=#FB4934>%StdinReader%</fc>}%date%{%enp3s0% | %mouse% | %volume% | 閭%cpu% |  %memory% |%gamemode%"

View File

@ -1,7 +1,13 @@
#!/bin/sh
if [ -d "$HOME/.local/bin" ] ; then
PATH="$PATH:$HOME/.local/bin"
fi
#xrdb -load ~/.Xresources
#exec dbus-launch xmonad
exec dbus-launch xmonad
#exec qtile start
#exec dbus-launch --exit-with-session emacs -mm --eval "(exwm-enable)"
#exec herbstluftwm --locked
export GDK_CORE_DEVICE_EVENTS=1
exec stumpwm
#export GDK_CORE_DEVICE_EVENTS=1
#exec stumpwm

View File

@ -42,18 +42,21 @@ import XMonad.Util.Loggers
--import XMonad.Util.XProp
-- Actions
import XMonad.Actions.DynamicProjects (Project (..), dynamicProjects, switchProjectPrompt, shiftToProjectPrompt, switchProject, shiftToProject)
import XMonad.Actions.DynamicWorkspaces
import XMonad.Actions.UpdatePointer
import XMonad.Actions.RotSlaves
import XMonad.Actions.RotateSome
import XMonad.Actions.GroupNavigation
import XMonad.Actions.Navigation2D
import XMonad.Actions.WindowBringer
-- Prompt
import XMonad.Prompt
import XMonad.Prompt.Window
import XMonad.Prompt.AppLauncher
import qualified XMonad.Util.ExtensibleState as XS
-- Font to use
myFont :: String
myFont = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true"
@ -84,12 +87,12 @@ windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace
myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
-- Width of window border
myBorderWidth = 0
myBorderWidth = 2
-- Border colors
myNormalBorderColor = "#282828"
myFocusedBorderColor = "#B16286"
-- Config for xmonad prompts
myXPConfig =
def { font = myFont
@ -128,36 +131,28 @@ myStartupHook = do
spawnOnce "imwheel -b 45 &"
spawnOnce "udiskie &"
spawnOnce "dunst -conf ~/.config/dunst/dunstrc"
-- Config dynamic projects
projects :: [Project]
projects =
[ Project { projectName = "dev"
, projectDirectory = "~/devel"
, projectStartHook = Just $ do spawn "emacs"
spawn myTerminal
}
]
spawnOnce "emacs --daemon"
-- Config layouts
myLayout = windowNavigation
$ renamed [CutWordsLeft 1]
$ spacing 0
-- $ smartBorders
$ spacing 3
$ smartBorders
(masterTab ||| (tabbed shrinkText myTabTheme) ||| tiled Tall ||| noBorders Full)
where
-- tiled = Tall nmaster delta ratio
tiled = HintedTile 1 0.03 0.5 TopLeft
-- master and tabbed tiling
masterTab = renamed [Replace "Master Tab"] $ mastered (1/100) (1/2) $ (focusTracking (tabbed shrinkText myTabTheme))
where
-- tiled = Tall nmaster delta ratio
tiled = HintedTile 1 0.03 0.5 TopLeft
-- master and tabbed tiling
masterTab = renamed [Replace "Master Tab"] $ mastered (1/100) (1/2) $ (focusTracking (tabbed shrinkText myTabTheme))
myScratchPads :: [NamedScratchpad]
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
, NS "discord" spawnDiscord findDiscord manageDiscord
, NS "keepassxc" spawnKeepass findKeepass manageKeepass
, NS "gsimplecal" spawnCal findCal manageCal
, NS "scratch-emacs" spawnEmacs findEmacs manageEmacs ]
, NS "qalculate-gtk" spawnCal findCal manageCal
, NS "scratch-emacs" spawnEmacs findEmacs manageEmacs]
where
-- Basic terminal
spawnTerm = myTerminal ++ " -t terminal"
findTerm = title =? "terminal"
manageTerm = customFloating $ W.RationalRect l t w h
@ -166,7 +161,7 @@ myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
w = 0.9
t = 0.95 -h
l = 0.95 -w
-- Discord
spawnDiscord = "discord"
findDiscord = appName =? "discord"
manageDiscord = customFloating $ W.RationalRect l t w h
@ -175,7 +170,7 @@ myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
w = 0.9
t = 0.95 -h
l = 0.95 -w
-- Keepass
spawnKeepass = "keepassxc"
findKeepass = appName =? "keepassxc"
manageKeepass = customFloating $ W.RationalRect l t w h
@ -184,16 +179,16 @@ myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
w = 0.9
t = 0.95 -h
l = 0.95 -w
spawnCal = "gsimplecal"
findCal = appName =? "gsimplecal"
-- Calculator
spawnCal = "qalculate-gtk"
findCal = appName =? "qalculate-gtk"
manageCal = customFloating $ W.RationalRect l t w h
where
h = 0.125
w = 0.1
t = 0.15 -h
l = 0.55 -w
-- Basic emacs
spawnEmacs = "emacsclient -c -n -e --eval '(set-frame-name \"scratch-emacs\")'"
findEmacs = title =? "scratch-emacs"
manageEmacs = customFloating $ W.RationalRect l t w h
@ -209,14 +204,7 @@ myManageHook = composeAll . concat $
[[className =? c --> doFloat | c <- myFloats],
[isDialog --> doCenterFloat,
isFullscreen --> doFullFloat,
className =? "latte-dock" --> hasBorder False,
className =? "lattedock" --> hasBorder False,
className =? "Plasma-desktop" --> hasBorder False,
className =? "plasmashell" --> hasBorder False,
className =? "krunner" --> hasBorder False,
className =? "Klipper" --> hasBorder False,
className =? "krunner" --> hasBorder False,
className =? "fusion360.exe" --> doFullFloat,
className =? "net-runelite-client-RuneLite" --> doFloat,
className =? "mpv" --> doRectFloat (W.RationalRect 0.55 0.05 0.4 0.4),
className =? "Steam" --> doFullFloat,
className =? "Superslicer" --> doFullFloat,
@ -283,6 +271,16 @@ myKeys home =
, ("M-,", sendMessage (IncMasterN (-1)))
-- Swap the focused window and the master window.
, ("M-b", nextMatch History (return True))
-- Bring a window to focus.
, ("M-z", bringMenu)
-- Remove workspace
, ("M-r", removeWorkspace)
-- Rename workspace
, ("M-S-r", renameWorkspace myXPConfig)
-- Add or select workspace
, ("M-a", selectWorkspace myXPConfig)
-- Toggle Struts
, ("M-i", sendMessage ToggleStruts)
--------------------------------------------------
-- Basic Utils
@ -304,25 +302,15 @@ myKeys home =
-- Spawn keepass scratchpad
, ("M-p", namedScratchpadAction myScratchPads "keepassxc")
-- Spawn calendar scratchpad
, ("M-c", namedScratchpadAction myScratchPads "gsimplecal")
, ("M-c", namedScratchpadAction myScratchPads "qalculate-gtk")
-- Spawn emacs scratchpad
, ("M-e", namedScratchpadAction myScratchPads "scratch-emacs")
--------------------------------------------------
-- Dynamic Projects
--------------------------------------------------
, ("M-s s", switchProjectPrompt myXPConfig)
, ("M-s S", shiftToProjectPrompt myXPConfig)
, ("M-s d", switchProject (projects !! 0))
, ("M-s S-d", shiftToProject (projects !! 0))
, ("M-s g", switchProject (projects !! 1))
, ("M-s S-g", shiftToProject (projects !! 1))
--------------------------------------------------
-- Open Applications
--------------------------------------------------
-- Spawn firefox
, ("M-o b" , spawn "brave")
, ("M-o b" , spawn "chromium")
-- Spawn lutris
, ("M-o l" , spawn "lutris")
-- Spawn steam
@ -352,6 +340,15 @@ myKeys home =
-- lower overall volume
, ("<XF86AudioLowerVolume>", spawn lowerVolumeCmd)
]
++
-- Switch to dynamically created workspace
zip (["M-<F1>","M-<F2>","M-<F3>","M-<F4>",
"M-<F5>","M-<F6>","M-<F7>","M-<F8>"]) (map (withNthWorkspace W.greedyView) [10..])
++
-- Shift windows to dynamically created workspace
zip (["M-S-<F1>","M-S-<F2>","M-S-<F3>","M-S-<F4>",
"M-S-<F5>","M-S-<F6>","M-S-<F7>","M-S-<F8>"]) (map (withNthWorkspace W.shift) [10..])
-- Remove the default binding for quit xmonad
rmKeys :: String -> [(KeyMask, KeySym)]
rmKeys keys =
@ -362,9 +359,9 @@ rmKeys keys =
main = do
home <- getHomeDirectory
xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc"
xmproc1 <- spawnPipe "xmobar -x 1 ~/.config/xmobar/xmobarrc1"
-- The monad
xmonad
$ dynamicProjects projects
$ docks
$ ewmh
$ ewmhFullscreen
@ -389,6 +386,7 @@ main = do
handleEventHook = myEventHook,
logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP
{ ppOutput = \x -> hPutStrLn xmproc0 x
>> hPutStrLn xmproc1 x
, ppCurrent = xmobarColor "#B8BB26" "" . wrap "[" "]" -- Current workspace in xmobar
, ppVisible = xmobarColor "#83A598" "" -- Visible but not current workspace
, ppHidden = xmobarColor "#83A598" "" . wrap "*" "" -- Hidden workspaces in xmobar