PHP mode, aggietimed (holy fuck that is a hack)!

This commit is contained in:
Lizzy Hunt 2023-02-16 13:56:23 -07:00
parent 1d53dbee53
commit 87983a830b
No known key found for this signature in database
GPG Key ID: 8AC6A4B840C0EC49
6 changed files with 43 additions and 4 deletions

View File

@ -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

View File

@ -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"))

View File

@ -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")

@ -1 +1 @@
Subproject commit 6d4584f01dec0143a169186df1608860d1aa1ef0
Subproject commit 19c231b2518efe71cb6dade3ad4cf573377902c3

View File

@ -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)

4
.zshrc
View File

@ -51,4 +51,8 @@ setopt appendhistory
eval $(thefuck --alias)
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