From fc983b39a6fc1d9478cce8ef1b673f3ea71dce9d Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Wed, 12 Apr 2023 19:24:13 -0700 Subject: [PATCH] adding various bits. --- Makefile | 3 +- roles/desktop/tasks/main.yml | 1 + roles/development/tasks/main.yml | 39 ++++++ roles/dotfiles/files/.stumpwmrc | 228 +++++++++++++++++++++++++++++++ roles/dotfiles/tasks/main.yml | 21 ++- 5 files changed, 289 insertions(+), 3 deletions(-) create mode 100644 roles/dotfiles/files/.stumpwmrc diff --git a/Makefile b/Makefile index 6f89426..669ba48 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ K := -K # prompt for sudo password O := # additional options P := site.yml # playbook T := # if y, time the process -V := -vvv # verbosity +V := # verbosity +# V := -vvv # verbosity ifeq ($T,y) diff --git a/roles/desktop/tasks/main.yml b/roles/desktop/tasks/main.yml index 9ed0ad0..7c839b3 100644 --- a/roles/desktop/tasks/main.yml +++ b/roles/desktop/tasks/main.yml @@ -31,6 +31,7 @@ with_items: - i3 - i3lock + - stumpwm - name: set up xprogs become: true diff --git a/roles/development/tasks/main.yml b/roles/development/tasks/main.yml index f1f0795..6b33117 100644 --- a/roles/development/tasks/main.yml +++ b/roles/development/tasks/main.yml @@ -242,6 +242,8 @@ become: true ansible.builtin.apt: name=code state=present + + ## rust - name: check if cargo is installed @@ -287,3 +289,40 @@ - scipy - tensorflow - torch + +- name: install balena etcher repo key + become: true + when: (dev_full or dev_embedded) and not headless + ansible.builtin.apt_key: + url: https://dl.cloudsmith.io/public/balena/etcher/gpg.70528471AFF9A051.key + state: present + +- name: setup balena etcher repo + become: true + when: (dev_full or dev_embedded) and not headless + ansible.builtin.apt_repository: + repo: 'deb https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu jammy main' + state: present + +- name: setup balena etcher source repo + become: true + when: (dev_full or dev_embedded) and not headless + ansible.builtin.apt_repository: + repo: 'deb-src https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu jammy main' + state: present + +- name: install balena etcher + become: true + when: (dev_full or dev_embedded) and not headless + ansible.builtin.apt: name=balena-etcher-electron state=present + +- name: link etcher to /usr/bin + become: true + when: (dev_full or dev_embedded) and not headless + ansible.builtin.file: + src: /opt/balenaEtcher/balena-etcher-electron + dest: /usr/local/bin/etcher + owner: root + group: root + mode: 0755 + state: link diff --git a/roles/dotfiles/files/.stumpwmrc b/roles/dotfiles/files/.stumpwmrc new file mode 100644 index 0000000..4db4307 --- /dev/null +++ b/roles/dotfiles/files/.stumpwmrc @@ -0,0 +1,228 @@ +Content-Type: text/enriched +Text-Width: 70 + +;; #565766-*-lisp-*- +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 +;;; #565766INDEX ;;; +;;; #565766- DEPRECATED - MANIFEST ;;; +;;; #565766- SWANK INTERACTION ;;; +;;; #565766- GENERAL CONFIG ;;; +;;; #565766- UTILITY FUNCTIONS ;;; +;;; #565766- KEY BINDING ;;; +;;; #565766- EXECUTION ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 +;;; #565766DEPRECATED - MANIFEST ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 +;; #565766without the ability to select localhost-only, we can't use +;; #565766manifest at this time. +;; #565766(defvar *manifest-url* +;; #565766(manifest:start)) +;; #565766(defun browse-manifest () +;; #565766(format nil "exec ~A ~A" *default-browser* *manifest-url*)) +;; #565766(define-key *root-map* (kbd "C-d") (browse-manifest)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 +;;; #565766SWANK INTERACTION ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 +;; #565766swank interaction allows us to connect to the StumpWM +;; #565766process from emacs while it's running. + +(ql:quickload #a3646f:swank) + +(#93e57clet ((server-running nil)) + (defcommand swank () () + #627e95"Toggle the swank server on/off" + (#93e57cif server-running + (#93e57cprogn + (swank:stop-server 4005) + (echo-string + (current-screen) + #627e95"Stopping swank.") + (setf server-running nil)) + (#93e57cprogn + (swank:create-server #a3646f:port 4005 + #a3646f:style swank:*communication-style* + #a3646f:dont-close t) + (echo-string + (current-screen) + #627e95"Starting swank. M-x slime-connect RET RET, then (in-packqage stumpwm).") + (setf server-running t))))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 +;;; #565766GENERAL CONFIG ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 +;; #565766this is where configuration parameters, the frame numbering +;; #565766and switching, and other general configuration is set up. + +(#93e57cdefparameter #9e79b3*default-browser* #627e95"firefox") +(#93e57cdefparameter #9e79b3*default-terminal* #627e95"mate-terminal") + +;; #565766make frames 1-numbered (i.e. for getting with ALT-FN) +(setf *frame-number-map* #627e95"1234567890") + +(run-commands + #627e95"gnewbg G2" ;; #565766F2 + #627e95"gnewbg G3" ;; #565766F3 + #627e95"gnewbg G4" ;; #565766F4 + #627e95"gnewbg G5" ;; #565766F5 + #627e95"gnewbg G6" ;; #565766F6 + #627e95"gnewbg G7" ;; #565766F7 + #627e95"gnewbg G8" ;; #565766F8 + #627e95"gnewbg G9" ;; #565766F9 + #627e95"gnewbg G10" ;; #565766F10 + #627e95"gnewbg G11" ;; #565766F11 + #627e95"gnewbg G12" + #627e95"gnewbg G13" + #627e95"gnewbg G14" + #627e95"gnewbg G15" + + + #627e95"gnewbg G16" + #627e95"gnewbg G17" + #627e95"gnewbg G18" + #627e95"gnewbg G19") + + +;; #565766Fluxbox-style Alt-F# virtual desktop (group in StumpWM-speak) +;; #565766switching. Modified from: +;; #565766http://hcl-club.lu/svn/development/lisp/.stumpwmrc +(#93e57cloop for i from 1 to 9 + do + (#93e57cprogn + (format t #627e95"Key: ~A~%" i) + (define-key *top-map* + (kbd (format nil #627e95"M-~a" i)) + (format nil #627e95"gselect ~a" i)))) + +(define-key *top-map* (kbd #627e95"M-!") #627e95"gselect 10") +(define-key *top-map* (kbd #627e95"M-@") #627e95"gselect 11") +(define-key *top-map* (kbd #627e95"M-#") #627e95"gselect 12") +(define-key *top-map* (kbd #627e95"M-$") #627e95"gselect 13") +(define-key *top-map* (kbd #627e95"M-%") #627e95"gselect 14") +(define-key *top-map* (kbd #627e95"M-^") #627e95"gselect 15") +(define-key *top-map* (kbd #627e95"M-&") #627e95"gselect 16") +(define-key *top-map* (kbd #627e95"M-*") #627e95"gselect 17") +(define-key *top-map* (kbd #627e95"M-\(") #627e95"gselect 18") +(define-key *top-map* (kbd #627e95"M-\)") #627e95"gselect 19") + +;; #565766set FFM +(setf *mouse-focus-policy* #a3646f:sloppy) + +;; #565766show input bar in centre of screen +(setf *input-window-gravity* #a3646f:center) + + +;; #565766enable the mode-line (and preferably the system tray) + +(setf *mode-line-position* #a3646f:bottom) + +(load-module #627e95"stumptray") + + +(#93e57cdolist + + (head (screen-heads (current-screen))) + + (toggle-mode-line (current-screen) head)) + + +(stumptray::stumptray) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 +;;; #565766UTILITY FUNCTIONS ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 + +(defcommand acpi-status () () + #627e95"Print ACPI status in the StumpWM message box." + (stumpwm:echo-string (current-screen) + (#93e57cwith-output-to-string (stream) + (sb-ext:run-program + #627e95"/usr/bin/acpitool" + nil + #a3646f:output stream)))) + +(defcommand lock () () + #627e95"Lock the screen by invoking i3lock." + (stumpwm:echo-string (current-screen) #627e95"Locking screen...") + (sb-ext:run-program #627e95"/usr/bin/i3lock" nil)) + +(#93e57cdefun #beb7f7exec-for-status (path #5992c2&rest args) + #565766"Run the path with args and return the status code." + (sb-ext:process-exit-code + (sb-ext:run-program path args #a3646f:wait t))) + +(#93e57cdefun #beb7f7exec-ok (path #5992c2&rest args) + #565766"Returns true if path with args ran without error." + (zerop (exec-for-status path args))) + +(#93e57cdefun #beb7f7daemon-is-running (daemon) + (zerop (exec-for-status #627e95"/usr/bin/pgrep" daemon))) + +(#93e57cdefun #beb7f7start-daemon-if-not-running (path #5992c2&rest args) + #565766"If the program specified at path isn't running, start it." + (#93e57cwhen (not (daemon-is-running (pathname-name path))) + (run-shell-command (#93e57cif (null args) + path + (format nil #627e95"~A~{ ~A~}" path args))))) + +(#93e57cdefun #beb7f7start-program-if-not-running (program #5992c2&rest args) + (format t #627e95"WOULD RUN: nohup ~A~{ ~A~}" program args) + (#93e57cwhen (not (exec-ok #627e95"/usr/bin/pgrep" program)) + (run-shell-command (format nil #627e95"nohup ~A~{ ~A~}" + program args)))) + +(#93e57cdefun #beb7f7with-terminal (#5992c2&key (run #627e95"" run-p) (term *default-terminal*)) + (concat #627e95"exec " term (#93e57cif run-p #627e95" -e " #627e95"") run)) + +(#93e57cdefun #beb7f7with-homedir (path) + (merge-pathnames path (user-homedir-pathname))) + +(#93e57cdefun #beb7f7in-homedir-p (path) + (probe-file (#93e57cwith-homedir path))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 +;;; #565766DEMON^WKEY BINDING ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#565766 + +(define-key stumpwm:*root-map* (kbd #627e95"B") #627e95"exec firefox") +(define-key stumpwm:*root-map* (kbd #627e95"c") (#93e57cwith-terminal)) +(define-key *root-map* (kbd #627e95"b") #627e95"acpi-status") +(define-key *root-map* (kbd #627e95"RET") (#93e57cwith-terminal)) +(define-key *root-map* (kbd #627e95"d") #627e95"exec dmenu_run") +(define-key *root-map* (kbd #627e95"D") #627e95"exec i3-dmenu-desktop") +(define-key *root-map* (kbd #627e95"e") #627e95"exec emacsclient -c -a \"\"") +(define-key *root-map* (kbd #627e95"E") (#93e57cwith-terminal #a3646f:run #627e95"'emacsclient -c -nw -a \"\"'")) +(define-key *root-map* (kbd #627e95"g") (#93e57cwith-terminal #a3646f:run #627e95"ghci")) +(define-key *root-map* (kbd #627e95"C-i") (#93e57cwith-terminal #a3646f:run #627e95"ipython")) +(define-key *root-map* (kbd #627e95"l") #627e95"lock") +(define-key *root-map* (kbd #627e95"C-l") (#93e57cwith-terminal #a3646f:run #627e95"rlwrap sbcl")) +(Purpledefine-key *root-map* (kbd VioletRed4"M") (Purplewith-terminal dark slate blue:run VioletRed4"htop")) +(Purpledefine-key *root-map* (kbd VioletRed4"C-s") VioletRed4"swank") +(Purpledefine-key *root-map* (kbd VioletRed4"C-v") VioletRed4"exec pavucontrol") +(Purpledefine-key *root-map* (kbd VioletRed4"w") (Purplewith-terminal dark slate blue:run VioletRed4"nmtui-connect")) +(Purpledefine-key *root-map* (kbd VioletRed4"`") VioletRed4"scratch-pad") +(Purpledefine-key *root-map* (kbd VioletRed4"~") VioletRed4"scratch-pad-float") + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Firebrick +;;; FirebrickEXECUTION ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Firebrick + +(run-shell-command VioletRed4"ssh-add") + +(Purplewhen (in-homedir-p VioletRed4".fehbg") + (sb-ext:run-program VioletRed4"/bin/sh" (Purplewith-homedir VioletRed4".fehbg"))) +(Purplewhen (in-homedir-p VioletRed4".screenlayouts/norminal.sh") + (run-shell-command (Purplewith-homedir VioletRed4".screenlayouts/norminal.sh"))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Firebrick +;;; FirebrickTHIS BATTLESTATION IS FULLY OPERATIONAL ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Firebrick +(message VioletRed4"Ready.") + +;;FirebrickLISP=sbcl + \ No newline at end of file diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml index 4926ebf..471fd33 100644 --- a/roles/dotfiles/tasks/main.yml +++ b/roles/dotfiles/tasks/main.yml @@ -5,6 +5,15 @@ directory_mode: 0755 force: false +# changes are made often enough right now that this +# should be copied every run. +- name: copy the shell profile over + ansible.builtin.copy: + src: "{{ role_path }}/files/.profile" + dest: "/home/{{ laptop_user }}/.profile" + mode: 0644 + force: true + - name: create binary directory ansible.builtin.file: path: "/home/{{ laptop_user }}/.local/bin" @@ -27,9 +36,7 @@ - .gitignore_global - .hgrc - .mg - - .profile - .vimrc - - .XCompose - name: copy vim directory ansible.builtin.copy: @@ -37,3 +44,13 @@ dest: "/home/{{ laptop_user }}/" directory_mode: 0755 force: false + +- name: copy various dotfiles for non-headless systems + when: not headless + ansible.builtin.copy: + src: "{{ role_path }}/files/{{ item }}" + dest: "/home/{{ laptop_user }}/{{ item }}" + mode: 0644 + with_items: + - .stumpwmrc + - .XCompose