From 1022a09fc4d8ac7c28031d777097c22799507007 Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Sun, 11 Feb 2024 12:16:07 +0100 Subject: some random stuff --- mut/bin/notmuch-hook | 2 -- mut/bin/sb-volume | 39 +++++++++++++++++++++++++++++++++++++++ mut/dwmblocks | 2 +- mut/neovim/fnl/conf/init.fnl | 20 ++++++++++++++++++++ profiles/core/neovim.nix | 1 + profiles/email/gmail.nix | 1 - profiles/email/neomutt.nix | 1 + 7 files changed, 62 insertions(+), 4 deletions(-) create mode 100755 mut/bin/sb-volume diff --git a/mut/bin/notmuch-hook b/mut/bin/notmuch-hook index 147559e..8203558 100755 --- a/mut/bin/notmuch-hook +++ b/mut/bin/notmuch-hook @@ -1,7 +1,5 @@ -. <(pass show personal/notmuch) notmuch new --quiet notmuch tag -new +unread +jobs -- 'tag:new and (from:jobs-listings* or from:jobs-noreply*)' -notmuch tag -new +unread +houses -- 'tag:new and (from:"'$MAKELAAR'" or thread:{'$MAKELAAR'})' notmuch tag -new +unread +dev -- 'tag:new and (from:/.*github.com/ or thread:{from:/.*github.com/})' # New needs to be removed, otherwise it will re add inbox unread diff --git a/mut/bin/sb-volume b/mut/bin/sb-volume new file mode 100755 index 0000000..e66dea7 --- /dev/null +++ b/mut/bin/sb-volume @@ -0,0 +1,39 @@ +#!/bin/sh + +# Prints the current volume or 🔇 if muted. + +case $BLOCK_BUTTON in + 1) setsid -w -f "$TERMINAL" -e pulsemixer; pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ;; + 2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;; + 4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;; + 5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;; + 3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. +- Middle click to mute. +- Scroll to change." ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" + +# If muted, print 🔇 and exit. +[ "$vol" != "${vol%\[MUTED\]}" ] && echo 🔇 && exit + +vol="${vol#Volume: }" + +split() { + # For ommiting the . without calling and external program. + IFS=$2 + set -- $1 + printf '%s' "$@" +} + +vol="$(printf "%.0f" "$(split "$vol" ".")")" + +case 1 in + $((vol >= 70)) ) icon="🔊" ;; + $((vol >= 30)) ) icon="🔉" ;; + $((vol >= 1)) ) icon="🔈" ;; + * ) echo 🔇 && exit ;; +esac + +echo "$icon$vol%" diff --git a/mut/dwmblocks b/mut/dwmblocks index f8aaf48..4d79273 160000 --- a/mut/dwmblocks +++ b/mut/dwmblocks @@ -1 +1 @@ -Subproject commit f8aaf481e40c8ce60f4fe795368b9bca59fb09b1 +Subproject commit 4d792732191817ced096f6f89559e1bcfd204032 diff --git a/mut/neovim/fnl/conf/init.fnl b/mut/neovim/fnl/conf/init.fnl index aec028f..5a0826a 100644 --- a/mut/neovim/fnl/conf/init.fnl +++ b/mut/neovim/fnl/conf/init.fnl @@ -20,9 +20,29 @@ (local action (require :fzf-lua.actions)) (fzf.setup [:max-perf]) +(local + draw + (fn [toggle] + (if + toggle + (do + (vim.cmd "set virtualedit=all") + (vim.keymap.set "n" "J" "j:VBox") + (vim.keymap.set "n" "K" "k:VBox") + (vim.keymap.set "n" "L" "l:VBox") + (vim.keymap.set "n" "H" "h:VBox")) + (do + (vim.cmd "set virtualedit=") + (vim.keymap.del "n" "J") + (vim.keymap.del "n" "K") + (vim.keymap.del "n" "L") + (vim.keymap.del "n" "H"))))) + (local cope #(vim.cmd (.. ":copen " (math.floor (/ vim.o.lines 2.1))))) (local oil (require :oil.actions)) (let [map vim.keymap.set] + (map :n :d (fn [] (draw true))) + (map :n :d (fn [] (draw false))) (map :n :- ::Oil) (map :n :_ #(oil.open_cwd.callback)) (map :v :y "OSCYankVisual|gvy") diff --git a/profiles/core/neovim.nix b/profiles/core/neovim.nix index 3f9f5f7..c4f7a2e 100644 --- a/profiles/core/neovim.nix +++ b/profiles/core/neovim.nix @@ -45,6 +45,7 @@ bat nil shellcheck + vale ]; plugins = with pkgs.vimPlugins; [ # highlighting diff --git a/profiles/email/gmail.nix b/profiles/email/gmail.nix index 765f584..229738b 100644 --- a/profiles/email/gmail.nix +++ b/profiles/email/gmail.nix @@ -1,5 +1,4 @@ { - inputs, config, pkgs, ... diff --git a/profiles/email/neomutt.nix b/profiles/email/neomutt.nix index 7ee2346..7940fc6 100644 --- a/profiles/email/neomutt.nix +++ b/profiles/email/neomutt.nix @@ -184,6 +184,7 @@ macros = [ { map = ["index" "pager"]; key = ","; action = "khard add-email"; } { map = ["index"]; key = "X"; action = "=Spamy"; } + { map = ["index"]; key = "Ma"; action = "=Archivey"; } { map = ["index"]; key = "A"; action = "+archive -unread -inboxz^'z"; } { map = ["index"]; key = "D"; action = ""; } { map = ["index" "pager"]; key = "S"; action = "!notmuch-hookz^'z"; } -- cgit v1.2.3