aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emacs/.config/emacs/.local/eshell/alias1
-rw-r--r--Emacs/.config/emacs/config.org62
m---------Pictures/Pictures/Backgrounds0
-rw-r--r--SXHkD/.config/sxhkd/sxhkdrc20
-rwxr-xr-xScripts/.local/scripts/emacs_curl4
-rwxr-xr-xScripts/.local/scripts/status/music3
-rwxr-xr-xScripts/.local/scripts/status/volume10
-rwxr-xr-xScripts/.local/scripts/umpv88
-rw-r--r--Shell/.zprofile1
-rw-r--r--XServer/.xinitrc2
10 files changed, 167 insertions, 24 deletions
diff --git a/Emacs/.config/emacs/.local/eshell/alias b/Emacs/.config/emacs/.local/eshell/alias
index faaa53a..a39cea9 100644
--- a/Emacs/.config/emacs/.local/eshell/alias
+++ b/Emacs/.config/emacs/.local/eshell/alias
@@ -1,3 +1,2 @@
-alias clear clear;clear;
alias l ls -la
alias d dired-other-frame .
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org
index 86ff03b..80d5d86 100644
--- a/Emacs/.config/emacs/config.org
+++ b/Emacs/.config/emacs/config.org
@@ -316,8 +316,9 @@ Setup the evil package, with some opinionated keybindings:
"zC" #'hs-hide-level
"'" #'evil-goto-mark
"`" #'evil-goto-mark-line
- "gu" #'evil-upcase
- "gU" #'evil-downcase)
+ "C-w" #'evil-window-map
+ "gu" #'evil-upcase
+ "gU" #'evil-downcase)
(general-def
:states 'visual
:keymaps '(emacs-lisp-mode-map lisp-interaction-mode-map)
@@ -537,8 +538,12 @@ helpful counterparts.
counsel-describe-function-function #'helpful-callable
counsel-describe-variable-function #'helpful-variable
ivy-re-builders-alist '((swiper . ivy--regex-plus)
+ (counsel-grep-or-swiper . ivy--regex-plus)
(counsel-rg . ivy--regex-plus)
(t . orderless-ivy-re-builder)))
+ (with-eval-after-load "org-mode"
+ (general-def
+ [remap org-goto] #'counsel-org-goto))
(counsel-mode))
#+end_src
**** Ivy Core
@@ -1325,9 +1330,15 @@ integrate it into my workflow just a bit better.
"Sync mail via mbsync."
(interactive)
(start-process-shell-command "" nil "mbsync -a"))
+ (defun +mail/trash-junk ()
+ "Delete any mail in junk"
+ (interactive)
+ (start-process-shell-command "" nil "notmuch search --output=files --format=text0 tag:deleted tag:spam tag:trash tag:junk | xargs -r0 rm"))
:custom
(notmuch-show-logo nil)
+ (notmuch-search-oldest-first nil)
(notmuch-hello-sections '(notmuch-hello-insert-saved-searches notmuch-hello-insert-alltags))
+ (notmuch-archive-tags '("-inbox" "-unread" "+archive"))
(mail-signature +mail/signature)
(mail-default-directory +mail/local-dir)
(mail-source-directory +mail/local-dir)
@@ -1338,6 +1349,8 @@ integrate it into my workflow just a bit better.
;; sync mail after refresh
(advice-add #'notmuch-poll-and-refresh-this-buffer :before
#'+mail/sync-mail)
+ (advice-add #'notmuch-poll-and-refresh-this-buffer :after
+ #'+mail/trash-junk)
(with-eval-after-load "evil-collection"
(evil-collection-notmuch-setup)))
#+end_src
@@ -1716,6 +1729,7 @@ Along with that I setup the package =proced-narrow= which allows
further filtering of the process list.
#+begin_src emacs-lisp
(use-package proced-narrow
+ :straight t
:after proced
:general
(general-def
@@ -2009,6 +2023,13 @@ use the current buffer?) but it works out.
:keymaps 'pdf-view-mode-map
"M-g" #'pdfgrep))
#+end_src
+** SQL
+#+begin_src emacs-lisp
+(use-package sql
+ :straight nil
+ :init
+ (setq sql-display-sqli-buffer-function nil))
+#+end_src
** Ada
Check out [[file:ada-mode.el][ada-mode*]], my custom ada-mode that replaces the default one.
This mode just colourises stuff, and uses eglot to do the heavy
@@ -2124,14 +2145,7 @@ vanilla =org-goto=. Also records for auto insertion.
"#+latex: \clearpage\n"
"#+toc: headlines\n"
"#+latex: \clearpage\n\n"
- "* " _)))
- :config
- (with-eval-after-load "swiper"
- (defun +org/swiper-goto ()
- (interactive)
- (counsel-grep-or-swiper "^\\* "))
- (general-def
- [remap org-goto] #'+org/swiper-goto)))
+ "* " _))))
#+end_src
*** Org Core Bindings
Some bindings for org mode.
@@ -2202,13 +2216,6 @@ look is nice to have.
(use-package org-fragtog
:hook (org-mode-hook . org-fragtog-mode))
#+end_src
-*** Org pretty tables
-Make the default ASCII tables of org mode pretty with
-#+begin_src emacs-lisp
-(use-package org-pretty-table
- :straight (org-pretty-table-mode :type git :host github :repo "Fuco1/org-pretty-table")
- :hook (org-mode-hook . org-pretty-table-mode))
-#+end_src
*** Org pretty tags
#+begin_src emacs-lisp
(use-package org-pretty-tags
@@ -2381,6 +2388,25 @@ this.
(clang-format-region (region-beginning) (region-end))
(clang-format-buffer))))
#+end_src
+** Racket
+A scheme with lots of stuff inside it. Using it for a language design
+book so it's useful to have some Emacs binds for it.
+#+begin_src emacs-lisp
+(use-package racket-mode
+ :straight t
+ :hook (racket-mode-hook . racket-xp-mode)
+ :display
+ ("\\*Racket.*"
+ (display-buffer-at-bottom)
+ (window-height . 0.25))
+ :general
+ (local-leader
+ :keymaps 'racket-mode-map
+ "r" #'racket-run
+ "i" #'racket-repl
+ "sr" #'racket-send-region
+ "sd" #'racket-send-definition))
+#+end_src
** CSharp
#+begin_src emacs-lisp
(use-package csharp-mode
@@ -2488,7 +2514,7 @@ Here I configure the REPL for Haskell via the
(leader
"th" #'+shell/toggle-haskell-repl)
:display
- ("\\*haskell\\*"
+ ("\\*haskell.**\\*"
(display-buffer-at-bottom)
(window-height . 0.25))
:config
diff --git a/Pictures/Pictures/Backgrounds b/Pictures/Pictures/Backgrounds
-Subproject 27d509403451325d15d149a89568ea8ee9c0114
+Subproject 44ba53e708a1b790b1964da643349c76c55a88a
diff --git a/SXHkD/.config/sxhkd/sxhkdrc b/SXHkD/.config/sxhkd/sxhkdrc
index f5cc4f2..c8fe121 100644
--- a/SXHkD/.config/sxhkd/sxhkdrc
+++ b/SXHkD/.config/sxhkd/sxhkdrc
@@ -19,6 +19,9 @@ super + a
dmenu_run
super + e
+ $HOME/.local/scripts/emacs_curl;
+
+super + E
$HOME/.emacs_anywhere/bin/run
super + s
@@ -68,6 +71,23 @@ XF86AudioMute
kill -43 $(pidof dwmblocks); \
pactl set-sink-mute 41 toggle;
+Pause
+ playerctl --player=spotify play-pause
+
+Print
+ conn=$(nmcli | grep "connected to" | sed 's/.*connected to //g' | head -1); \
+ nmcli c down "$conn"; \
+ notify-send -u low "Turning off wifi"; \
+ nmcli c up "$conn"; \
+ notify-send -u low "Reset " $conn;
+
+Scroll_Lock
+ conn=$(nmcli | grep "connected to" | sed 's/.*connected to //g' | head -1); \
+ nmcli c down "$conn"; \
+ notify-send -u low "Turning off wifi"; \
+ nmcli c up "$conn"; \
+ notify-send -u low "Reset " $conn;
+
XF86MonBrightness{Down,Up}
light -{U,A} 15; \
notify-send -u low "Brightness: $(light)";
diff --git a/Scripts/.local/scripts/emacs_curl b/Scripts/.local/scripts/emacs_curl
new file mode 100755
index 0000000..f92835e
--- /dev/null
+++ b/Scripts/.local/scripts/emacs_curl
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+x=`xclip -o`
+emacsclient --socket-name=MAIN -c --alternate-editor=emacs --eval "(eww \"$x\")";
diff --git a/Scripts/.local/scripts/status/music b/Scripts/.local/scripts/status/music
index b7233d9..a1e734e 100755
--- a/Scripts/.local/scripts/status/music
+++ b/Scripts/.local/scripts/status/music
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
-echo  "$(playerctl --player=spotify metadata title)"
+title=$(playerctl --player=spotify metadata title)
+echo "${title::40}"
diff --git a/Scripts/.local/scripts/status/volume b/Scripts/.local/scripts/status/volume
index 87cb121..cbbafbe 100755
--- a/Scripts/.local/scripts/status/volume
+++ b/Scripts/.local/scripts/status/volume
@@ -1,5 +1,11 @@
#!/usr/bin/env bash
sinks="$(pactl list sinks)"
vol="$(echo "$sinks" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")"
-
-echo " $vol%"
+mute="$(echo "$sinks" | grep "Mute: " | sed "s/.*Mute: //g")"
+case "$mute" in
+ "no")
+ printf "";;
+ "yes")
+ printf "";;
+esac
+echo " $vol%"
diff --git a/Scripts/.local/scripts/umpv b/Scripts/.local/scripts/umpv
new file mode 100755
index 0000000..762e73a
--- /dev/null
+++ b/Scripts/.local/scripts/umpv
@@ -0,0 +1,88 @@
+#!/usr/bin/env python3
+
+"""
+This script emulates "unique application" functionality on Linux. When starting
+playback with this script, it will try to reuse an already running instance of
+mpv (but only if that was started with umpv). Other mpv instances (not started
+by umpv) are ignored, and the script doesn't know about them.
+
+This only takes filenames as arguments. Custom options can't be used; the script
+interprets them as filenames. If mpv is already running, the files passed to
+umpv are appended to mpv's internal playlist. If a file does not exist or is
+otherwise not playable, mpv will skip the playlist entry when attempting to
+play it (from the GUI perspective, it's silently ignored).
+
+If mpv isn't running yet, this script will start mpv and let it control the
+current terminal. It will not write output to stdout/stderr, because this
+will typically just fill ~/.xsession-errors with garbage.
+
+mpv will terminate if there are no more files to play, and running the umpv
+script after that will start a new mpv instance.
+
+Note: you can supply custom mpv path and options with the MPV environment
+ variable. The environment variable will be split on whitespace, and the
+ first item is used as path to mpv binary and the rest is passed as options
+ _if_ the script starts mpv. If mpv is not started by the script (i.e. mpv
+ is already running), this will be ignored.
+"""
+
+import sys
+import os
+import socket
+import errno
+import subprocess
+import fcntl
+import stat
+import string
+
+files = sys.argv[1:]
+
+# this is the same method mpv uses to decide this
+def is_url(filename):
+ parts = filename.split("://", 1)
+ if len(parts) < 2:
+ return False
+ # protocol prefix has no special characters => it's an URL
+ allowed_symbols = string.ascii_letters + string.digits + '_'
+ prefix = parts[0]
+ return all(map(lambda c: c in allowed_symbols, prefix))
+
+# make them absolute; also makes them safe against interpretation as options
+def make_abs(filename):
+ if not is_url(filename):
+ return os.path.abspath(filename)
+ return filename
+files = [make_abs(f) for f in files]
+
+SOCK = os.path.join(os.getenv("HOME"), ".umpv_socket")
+
+sock = None
+try:
+ sock = socket.socket(socket.AF_UNIX)
+ sock.connect(SOCK)
+except socket.error as e:
+ if e.errno == errno.ECONNREFUSED:
+ sock = None
+ pass # abandoned socket
+ elif e.errno == errno.ENOENT:
+ sock = None
+ pass # doesn't exist
+ else:
+ raise e
+
+if sock:
+ # Unhandled race condition: what if mpv is terminating right now?
+ for f in files:
+ # escape: \ \n "
+ f = f.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n")
+ f = "\"" + f + "\""
+ sock.send(("raw loadfile " + f + " append\n").encode("utf-8"))
+else:
+ # Let mpv recreate socket if it doesn't already exist.
+
+ opts = (os.getenv("MPV") or "mpv").split()
+ opts.extend(["--no-terminal", "--force-window", "--input-ipc-server=" + SOCK,
+ "--"])
+ opts.extend(files)
+
+ subprocess.check_call(opts)
diff --git a/Shell/.zprofile b/Shell/.zprofile
index 54ba227..58a56f8 100644
--- a/Shell/.zprofile
+++ b/Shell/.zprofile
@@ -21,4 +21,3 @@ export XDG_RUNTIME_DIR=/run/user/`id -u`
# Run some programs
/usr/bin/pfetch
eval `ssh-agent`;
-ssh-add ~/.ssh/id_rsa
diff --git a/XServer/.xinitrc b/XServer/.xinitrc
index bd2660f..c0d6493 100644
--- a/XServer/.xinitrc
+++ b/XServer/.xinitrc
@@ -9,7 +9,7 @@ xrandr --output HDMI1 --primary;
xrandr --output eDP1 --right-of HDMI1;
$(xss-lock --transfer-sleep-lock -- lock) &
-feh --randomize --bg-scale $HOME/Pictures/Backgrounds &
+$HOME/.local/scripts/background &
systemctl --user start emacs &
$HOME/.local/scripts/status/music_update_bar &