From 87983a830b5fe50f08e7a0da7e45018dd6779cec Mon Sep 17 00:00:00 2001 From: Lizzy Hunt Date: Thu, 16 Feb 2023 13:56:23 -0700 Subject: [PATCH] PHP mode, aggietimed (holy fuck that is a hack)! --- .emacs.d/settings.org | 9 +++++++++ .stumpwm.d/keyboard.lisp | 4 ++++ .stumpwm.d/modeline.lisp | 18 +++++++++++++++++- .stumpwm.d/modules | 2 +- .stumpwm.d/utils.lisp | 8 +++++++- .zshrc | 6 +++++- 6 files changed, 43 insertions(+), 4 deletions(-) diff --git a/.emacs.d/settings.org b/.emacs.d/settings.org index 5ef74d4..0dbad8f 100644 --- a/.emacs.d/settings.org +++ b/.emacs.d/settings.org @@ -216,6 +216,7 @@ (elixir-mode . lsp) (rust-mode . lsp) (java-mode . lsp) + (php-mode . lsp) (typescript-mode . lsp) ;; npm install -g typescript typescript-language-server (lsp-mode . lsp-enable-which-key-integration)) :config (lsp-register-custom-settings @@ -335,6 +336,14 @@ After installing the ~rust-analyzer~ program, the following can be used: #+RESULTS: : t +*** PHP +#+BEGIN_SRC emacs-lisp + (use-package php-mode + :ensure t) +#+END_SRC + +#+RESULTS: + ** Format All The Buffers #+BEGIN_SRC emacs-lisp (use-package format-all diff --git a/.stumpwm.d/keyboard.lisp b/.stumpwm.d/keyboard.lisp index 53d423f..101dd10 100644 --- a/.stumpwm.d/keyboard.lisp +++ b/.stumpwm.d/keyboard.lisp @@ -20,3 +20,7 @@ (define-key *root-map* (kbd "C-t") "exec alacritty") (define-key *root-map* (kbd "b") "exec firefox") + +(when (is-work-machine) + (define-key *root-map* (kbd "C-i") "exec aggietimed --action clock-in") + (define-key *root-map* (kbd "C-o") "exec aggietimed --action clock-out")) diff --git a/.stumpwm.d/modeline.lisp b/.stumpwm.d/modeline.lisp index 391110b..7222f15 100644 --- a/.stumpwm.d/modeline.lisp +++ b/.stumpwm.d/modeline.lisp @@ -13,7 +13,20 @@ (defun get-ip () ;; Return the current ip of the default network interface - (run-shell-command "printf $(ifconfig $(route | grep '^default' | grep -o '[^ ]*$') | grep -Po '\\d+\\.\\d+\\.\\d+\\.\\d+' | head -n1)" t)) + (run-shell-command "printf $(ifconfig $(route | grep '^default' | grep -o '[^ ]*$' | head -n1) | grep -Po '\\d+\\.\\d+\\.\\d+\\.\\d+' | head -n1)" t)) + +;; UGLY AF BUT I DONT GIVE A SINGLE SHITE :3 +(defparameter *seconds-between-shift-poll* 4) +(defvar *last-shift* 0) +(defvar *last-shift-line* "") +(defun get-shift () + (let ((line (run-shell-command "cat /tmp/aggietime_status" t))) + (if (= *last-shift* 0) + (run-shell-command "aggietimed --action status-line | jq -r .status | head -n1 > /tmp/aggietime_status" nil)) + (if (> (length line) 0) (setf *last-line* line)) + (setf *last-shift* (rem (incf *last-shift*) *seconds-between-shift-poll*) + *last-shift-line* line) + (string-trim '(#\Space #\Tab #\Newline) *last-line*))) (defun get-cpu-temp () ;; Return current temperature of the first cpu package (core) @@ -31,6 +44,9 @@ (:eval (get-ip)))) (if (is-laptop) (push '(:eval (make-bar "BAT" #'get-battery)) (cdr (last *mode-line*)))) +(if (is-work-machine) + (push '(:eval (get-shift)) (cdr (last *mode-line*)))) + (setf *screen-mode-line-format* (insert-seperators *mode-line* *status-seperator*)) (setf *window-format* "%n%s%c") diff --git a/.stumpwm.d/modules b/.stumpwm.d/modules index 6d4584f..19c231b 160000 --- a/.stumpwm.d/modules +++ b/.stumpwm.d/modules @@ -1 +1 @@ -Subproject commit 6d4584f01dec0143a169186df1608860d1aa1ef0 +Subproject commit 19c231b2518efe71cb6dade3ad4cf573377902c3 diff --git a/.stumpwm.d/utils.lisp b/.stumpwm.d/utils.lisp index ce34d50..8210576 100644 --- a/.stumpwm.d/utils.lisp +++ b/.stumpwm.d/utils.lisp @@ -9,8 +9,14 @@ (t (sub (subseq s 1)))))) (sub (string string2)))))) +(defun env-exists (name) + (loop for item in (sb-ext:posix-environ) thereis (string-include name item))) + (defun is-laptop () - (loop for item in (sb-ext:posix-environ) thereis (string-include "LAPTOP" item))) + (env-exists "LAPTOP")) + +(defun is-work-machine () + (env-exists "WORK_MACHINE")) (defun insert-seperators (l &optional (seperator " | ") (seperated-list (list seperator))) (if (car l) diff --git a/.zshrc b/.zshrc index 94dc1a8..ac0c5cd 100644 --- a/.zshrc +++ b/.zshrc @@ -51,4 +51,8 @@ setopt appendhistory eval $(thefuck --alias) -[ -f "/home/logan/.ghcup/env" ] && source "/home/logan/.ghcup/env" # ghcup-env \ No newline at end of file +export PYENV_ROOT="$HOME/.pyenv" +command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init -)" + +[ -f "/home/logan/.ghcup/env" ] && source "/home/logan/.ghcup/env" # ghcup-env