From 8eddca15ff2c283c0eec6f6bb26644fb0c1b0a1f Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 12 Jan 2022 05:38:19 +0000 Subject: (General)+better systemd gitignore handling --- .gitignore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6a2e2e0..63a2021 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ TAGS *.elc +*.socket +*.targets.wants.* /mpd/* /ncmpcpp/* /Emacs/.config/emacs/transient/* @@ -11,5 +13,4 @@ TAGS /Emacs/.config/emacs/.mail/ /Doom/.config/doom/bookmarks /Emacs/.config/emacs/config.el -/Emacs/.config/emacs/eglot-eclipse-jdt-cache/ -/SystemD/.config/systemd/user/ +/Emacs/.config/emacs/eglot-eclipse-jdt-cache/ \ No newline at end of file -- cgit v1.2.3-13-gbd6f From 248a3145c472258acb8d9a7d3496a9a12346d86b Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 12 Jan 2022 05:39:22 +0000 Subject: (SystemD)+ssh-agent service Integrates into .zshrc to create a consistent ssh experience without the stupid passwords. --- SystemD/.config/systemd/user/ssh-agent.service | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 SystemD/.config/systemd/user/ssh-agent.service diff --git a/SystemD/.config/systemd/user/ssh-agent.service b/SystemD/.config/systemd/user/ssh-agent.service new file mode 100644 index 0000000..33aaa63 --- /dev/null +++ b/SystemD/.config/systemd/user/ssh-agent.service @@ -0,0 +1,10 @@ +[Unit] +Description=SSH agent + +[Service] +Type=simple +Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket +ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK + +[Install] +WantedBy=default.target \ No newline at end of file -- cgit v1.2.3-13-gbd6f From 05b8480c5f1d5844a4f4f9b7e2a1ca092aa6db06 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 12 Jan 2022 05:40:14 +0000 Subject: (Shell)+ssh_agent integration Use the same socket file for any zsh shell I create (default shell for user and hence from tty) so ssh-agent works consistently. --- Shell/.zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/Shell/.zshrc b/Shell/.zshrc index 6a62c2c..66a33f2 100644 --- a/Shell/.zshrc +++ b/Shell/.zshrc @@ -1,6 +1,7 @@ # zshrc -*- mode: sh; lexical-binding: t; -*- export DOTNET_ROOT=~/.local/src/dotnet +export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket" ## Variables TERM=xterm-256color ## Aliases -- cgit v1.2.3-13-gbd6f From 056dc5dcc7ef12270556a07b8415e8db74f612fe Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 12 Jan 2022 05:44:36 +0000 Subject: (XServer)~rotation for right monitor to normal --- XServer/.xinitrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XServer/.xinitrc b/XServer/.xinitrc index f44c934..a7578ce 100644 --- a/XServer/.xinitrc +++ b/XServer/.xinitrc @@ -9,7 +9,7 @@ xset s 1800; xrandr --auto --output HDMI1 --primary; xrandr --auto --output eDP1 --right-of HDMI1; xrandr --auto --output VGA1 --primary --left-of DP2; -xrandr --auto --output DP2 --rotate left; +xrandr --auto --output DP2 left; $(xss-lock --transfer-sleep-lock -- $HOME/.local/scripts/lock) & $HOME/.local/scripts/background & -- cgit v1.2.3-13-gbd6f From f2efbcc1731b413c6bc4b092dc54214bae394a0b Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 12 Jan 2022 06:24:28 +0000 Subject: (Emacs)~path -> environment variables, -+dx/newline, +sys-env-cond sys-env-cond allows for a cond like structure for system name checking. This allows for transferable configurations. --- Emacs/.config/emacs/config.org | 110 ++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 61 deletions(-) diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 27c77e8..7892171 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -57,17 +57,23 @@ setup the custom-file to exist in the var-directory :config (global-auto-revert-mode 1)) #+end_src -** Path -Setting the path variable cos it can get annoying sometimes +** Environment variables +- Setting the path variable cos it can get annoying sometimes. +- Setting the ssh agent #+begin_src emacs-lisp (use-package env :defer 1 :straight nil :config - (setenv "PATH" - (concat - (expand-file-name "~/.local/bin:") - (getenv "PATH")))) + (setenv + "PATH" ; + (concat + (expand-file-name "~/.local/bin:") + (getenv "PATH"))) + + (setenv + "SSH_AGENT_SOCK" + (shell-command-to-string "echo -n \"${XDG_RUNTIME_DIR}/ssh-agent.socket\""))) #+end_src * Custom Functions These are general custom functions I have defined for various @@ -75,59 +81,27 @@ purposes. These encapsulate functionality that could apply to multiple packages/situations, otherwise I would've defined it in the place it's required. ** Toggle buffer -There are many cases where 'toggling' a buffer is very useful. For -example, toggling a shell to access it quickly and hide it away with -little annoyance. - -This is negligible with a bit of Emacs lisp. However, as stated -earlier, there are /many/ cases where this is useful. Following the -DRY principle means a more abstract function would be better to use -here. - -One may use higher order functions to create an abstract form that -handles toggling, and then the caller can wrap this call in a new -function if they wish to use it in a keybinding. This format or -construct is kinda common (using a higher order function and wrapping -it in an interactive function for use in a binding), so I created a -macro that further wraps this functionality, creating a custom -function for you. - -The macro asks for a function name, a buffer name and the function -necessary to create a buffer with that name. It then generates a -function with the given name that holds the necessary logic to -'toggle' buffers. -#+begin_src emacs-lisp -(defmacro +dx/create-toggle-function (func-name buf-name buf-create) - "Generate a function named func-name that toggles +Like VSCode's toggling feature for just the terminal, but now for +anything I want. +#+begin_src emacs-lisp +(with-eval-after-load "window" + (defmacro +dx/create-toggle-function (func-name buf-name buf-create) + "Generate a function named func-name that toggles the buffer with name buf-name and creation function buf-create." - `(defun ,func-name () - (interactive) - (let* ((buffer (or (get-buffer ,buf-name) (,buf-create))) - (displayed (get-buffer-window buffer))) - (cond (displayed - (select-window displayed) - (delete-window)) - (t - (display-buffer buffer) - (select-window (get-buffer-window buffer))))))) + `(defun ,func-name () + (interactive) + (let* ((buffer (or (get-buffer ,buf-name) (,buf-create))) + (displayed (get-buffer-window buffer))) + (cond (displayed + (select-window displayed) + (delete-window)) + (t + (display-buffer buffer) + (select-window (get-buffer-window buffer)))))))) #+end_src ** Auto-run command after-save-hook -Macro that defines functionality that runs after a buffer save. -Requires a list of conditions (so it doesn't happen FOR ALL saved -buffers) and a function to run if the buffer satisfies the condition. -Then automatically adds it to the ~after-save-hook~. - -On a Luke Smith video on YouTube, I saw a vim feature which I really -liked. He uses it in his DWM videos, but it's essentially an -"autocmd" call that, upon saving a certain file with vim, will run -a shell command (such as =make= or =pdflatex=). - -It's arbitrary to program this functionality in Emacs. This macro -essentially performs the same task. In particular if you use -=start-process-shell-command= in the =to-run= function then you also -get a generated buffer of output from the command, useful for checking -errors and general messages. Better than vim, eh? - +Define a macro that can run a body of functionality on a given set of +files on after-save-hook. #+begin_src emacs-lisp (use-package simple :straight nil @@ -151,6 +125,21 @@ common use of this macro. "For a given list of forms CDR, return a quoted non-argument lambda." `(quote (lambda () ,@CDR))) #+end_src +** sys-name-cond +#+begin_src emacs-lisp +(defmacro +dx/sys-name-cond (&rest pairs) + (let ((current-lisp)) + (while pairs + (let* ((pair (car pairs)) + (name (car pair)) + (body (cdr pair))) + (add-to-list + 'current-lisp + `((string= ,name (system-name)) ,@body)) + (setq pairs (cdr pairs)))) + `(cond + ,@current-lisp))) +#+end_src * Aesthetics Load my custom "personal-theme" theme which is stored in the Emacs lisp folder (look at [[file:elisp/personal-theme.el][this file]]). @@ -169,8 +158,9 @@ Set font size to 125. (use-package faces :straight nil :config - (+dx/env-cond "spiderboy" (set-face-attribute 'default nil :height 150)) - (+dx/env-cond "oldboy" (set-face-attribute 'default nil :height 115))) + (+dx/sys-name-cond + ("spiderboy" (set-face-attribute 'default nil :height 150)) + ("oldboy" (set-face-attribute 'default nil :height 115)))) #+end_src Turn off the startup buffer because I prefer [[Dashboard]], and write into @@ -220,9 +210,7 @@ instead just picking stuff I think is useful. :config (general-def :states '(normal motion) - "SPC" nil - "M-V" #'+dx/newline - "M-v" (proc (interactive) (+dx/newline 1))) + "SPC" nil) (general-create-definer leader :states '(normal motion) -- cgit v1.2.3-13-gbd6f From 94ff68f889b367c6459e55ec2ce2d015f7a94790 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 12 Jan 2022 07:14:15 +0000 Subject: (Scripts|General)~programs->root of repo Just makes more sense. --- Scripts/.local/src/programs | 9 --------- programs | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) delete mode 100644 Scripts/.local/src/programs create mode 100644 programs diff --git a/Scripts/.local/src/programs b/Scripts/.local/src/programs deleted file mode 100644 index 390b836..0000000 --- a/Scripts/.local/src/programs +++ /dev/null @@ -1,9 +0,0 @@ -dmenu -dwm -dwmblocks -emacs -light -pfetch -programs -spotify -xboxdrv diff --git a/programs b/programs new file mode 100644 index 0000000..ddb8bd0 --- /dev/null +++ b/programs @@ -0,0 +1,14 @@ +dmenu +dwm +dwmblocks +emacs +komorebi +light +minecraft-launcher +omnisharp +pfetch +snapd +spotify +teams +xboxdrv +yay-bin -- cgit v1.2.3-13-gbd6f