diff --git a/desktop/.config/river/init b/desktop/.config/river/init index 1f142af..21dd169 100755 --- a/desktop/.config/river/init +++ b/desktop/.config/river/init @@ -4,6 +4,12 @@ if [ -d "$TURNSTILE_ENV_DIR" ]; then echo "$DISPLAY" >"$TURNSTILE_ENV_DIR/DISPLAY" echo "$WAYLAND_DISPLAY" >"$TURNSTILE_ENV_DIR/WAYLAND_DISPLAY" + echo "ADDING KEYCHAIN TO ENV" + keychain --eval --quiet --agents ssh,gpg C414FF88A557F29AFEF76C7E73BA40D5AFAF49C9 + echo "$SSH_AUTH_SOCK">"$TURNSTILE_ENV_DIR/SSH_AUTH_SOCK" + echo "$SSH_AGENT_PID">"$TURNSTILE_ENV_DIR/SSH_AGENT_PID" + echo "$GPG_AGENT_INFO">"$TURNSTILE_ENV_DIR/GPG_AGENT_INFO" + echo "DONE ADDING KEYCHAIN TO ENV" fi mod="Mod4" diff --git a/desktop/.config/waybar/config b/desktop/.config/waybar/config index 0d72df1..8b3dcf2 100644 --- a/desktop/.config/waybar/config +++ b/desktop/.config/waybar/config @@ -64,6 +64,7 @@ "format": "{icon}{0}", // issue tracked here https://github.com/Alexays/Waybar/issues/3623 "format-icons": { "event": "", + "event-today": " ", "no-event": "", }, }, diff --git a/desktop/.config/waybar/modules/khal.py b/desktop/.config/waybar/modules/khal.py index 6dc3971..76f4280 100755 --- a/desktop/.config/waybar/modules/khal.py +++ b/desktop/.config/waybar/modules/khal.py @@ -27,13 +27,16 @@ for line in lines: if len(clean_line) and clean_line[0] not in ["0", "1", "2"]: clean_line = "\n" + clean_line + "" new_lines.append(clean_line) + output = "\n".join(new_lines).strip() -data["alt"] = "no-event" -data["tooltip"] = output - -if today in output: +if today in output: # an event today! + data["alt"] = "event-today" data["text"] = output.split("\n")[1] +elif output: # an event in the week! data["alt"] = "event" + data["tooltip"] = output +else: # no events + data["alt"] = "no-event" print(json.dumps(data)) diff --git a/nvim/.config/nvim/lua/core/commands.lua b/nvim/.config/nvim/lua/core/commands.lua index ef17d87..70f9365 100644 --- a/nvim/.config/nvim/lua/core/commands.lua +++ b/nvim/.config/nvim/lua/core/commands.lua @@ -5,18 +5,35 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, { group = vim.api.nvim_create_augroup("highlightyanks", { clear = true }), }) +local private_mode = function() + vim.o.shada = "" + vim.o.swapfile = false + vim.o.undofile = false + vim.o.backup = false + vim.o.writebackup = false + vim.o.shelltemp = false + vim.o.history = 0 + vim.o.modeline = false + vim.o.secure = true +end -- Special setting for editing gopass files - make sure nothing leaks outside the directories it -- is supposed to vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { + group = vim.api.nvim_create_augroup("passnoleak", { clear = true }), pattern = { "/dev/shm/gopass.*", "/dev/shm/pass.?*/?*.txt", "$TMPDIR/pass.?*/?*.txt", "/tmp/pass.?*/?*.txt", }, - command = "setlocal noswapfile nobackup noundofile nowritebackup viminfo=", desc = "Don't leak any information when editing potential password files", - group = vim.api.nvim_create_augroup("passnoleak", { clear = true }), + callback = private_mode, +}) +vim.api.nvim_create_autocmd({ "BufNewFile", "BufReadPre" }, { + group = vim.api.nvim_create_augroup("PrivateJrnl", {}), + pattern = "*.jrnl", + desc = "Don't leak information when editing jrnl files", + callback = private_mode, }) -- remove line numbers from terminal buffers diff --git a/nvim/.config/nvim/lua/plugins/pickers.lua b/nvim/.config/nvim/lua/plugins/pickers.lua index 8072d32..3682999 100644 --- a/nvim/.config/nvim/lua/plugins/pickers.lua +++ b/nvim/.config/nvim/lua/plugins/pickers.lua @@ -56,7 +56,6 @@ return { -- file/item pickers and managers end end, opts = { - fzf_opts = { ["--select-1"] = false }, keymap = { builtin = { true, @@ -78,7 +77,10 @@ return { -- file/item pickers and managers }, }, }, - }, -- FIXME: Does not seem to work with single result and still closes instantly? + defaults = { -- FIXME: Does not seem to work with single result and still closes instantly? + jump1 = false, + }, + }, config = function(_, opts) opts.actions = opts.actions or { true } opts.actions["ctrl-q"] = require("fzf-lua").actions.file_sel_to_qf diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index a38a2d6..04a0844 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -168,39 +168,49 @@ local prose_plugs = { -- bring zettelkasten commands { "zk-org/zk-nvim", - config = function() + opts = function() if require("core.util").is_available("which-key") then require("which-key").add({ { "n", group = "notes" }, { "n", group = "note" }, { "n", group = "note", mode = "v" }, }) + end - require("zk.commands").add("ZkOrphans", function(opts) - opts = vim.tbl_extend("force", { orphan = true }, opts or {}) - require("zk").edit(opts, { title = "Zk Orphans" }) - end) - require("zk.commands").add("ZkGrep", function(opts) - local collection = {} - local list_opts = { select = { "title", "path", "absPath" } } - require("zk.api").list(vim.env.ZK_NOTEBOOK_DIR, list_opts, function(_, notes) - for _, note in ipairs(notes) do - collection[note.absPath] = note.title or note.path - end - end) - local options = vim.tbl_deep_extend("force", { - prompt_title = "Notes", - search_dirs = { vim.env.ZK_NOTEBOOK_DIR }, - disable_coordinates = true, - path_display = function(_, path) - return collection[path] - end, - }, opts or {}) - require("telescope.builtin").live_grep(options) + require("zk.commands").add("ZkOrphans", function(opts) + opts = vim.tbl_extend("force", { orphan = true }, opts or {}) + require("zk").edit(opts, { title = "Zk Orphans" }) + end) + require("zk.commands").add("ZkGrep", function(opts) + local collection = {} + local list_opts = { select = { "title", "path", "absPath" } } + require("zk.api").list(vim.env.ZK_NOTEBOOK_DIR, list_opts, function(_, notes) + for _, note in ipairs(notes) do + collection[note.absPath] = note.title or note.path + end end) + local search_dir = vim.env.ZK_NOTEBOOK_DIR + local options = vim.tbl_deep_extend("force", { + prompt = "Note Grep❯ ", + -- cmd = "cd " .. search_dir .. "; rg --vimgrep", + cwd = search_dir, + disable_coordinates = true, + path_display = function(_, path) + return collection[path] + end, + }, opts or {}) + -- FIXME: Don't hard-code this so much? + -- require("telescope.builtin").live_grep(options) + require("fzf-lua").live_grep(options) + end) + local picker = "select" + if require("core.util").is_available("fzf-lua") then + picker = "fzf_lua" + elseif require("core.util").is_available("telescope") then + picker = "telescope" end require("zk").setup({ - picker = "telescope", + picker = picker, lsp = { auto_attach = { enabled = true, diff --git a/office/.local/share/task/hooks/DISABLED.on-exit.sync-to-server-silent.py b/office/.local/share/task/hooks/DISABLED.on-exit.sync-to-server-silent.py deleted file mode 100755 index f444c69..0000000 --- a/office/.local/share/task/hooks/DISABLED.on-exit.sync-to-server-silent.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 - -# From: https://gist.github.com/varunagrawal/2b93c5dc721520ff6876e940c420ab05 -# This hooks script syncs task warrior to the configured task server. -# The on-exit event is triggered once, after all processing is complete. - -# Make sure hooks are enabled and this hook script is executable. -# Run `task diag` for diagnostics on the hook. - -import sys -import json -import subprocess - -try: - tasks = json.loads(sys.stdin.readline()) -except: - # No input - sys.exit(0) - -# no tasks to work through, don't error -if len(tasks) <= 0: - sys.exit(0) - -# Call the `sync` command -# hooks=0 ensures that the sync command doesn't call the on-exit hook -# verbose=nothing sets the verbosity to print nothing at all -subprocess.Popen(["task", "rc.verbose=nothing", "rc.hooks=0", "sync"], close_fds=True) - -sys.exit(0) diff --git a/office/.local/share/task/hooks/on-exit.git-backup b/office/.local/share/task/hooks/on-exit.git-backup new file mode 100755 index 0000000..eb4d96b --- /dev/null +++ b/office/.local/share/task/hooks/on-exit.git-backup @@ -0,0 +1,65 @@ +#!/bin/sh +# Automatically git commits, pushes and pulls if doable in the taskwarrior data directory +# +# Much of this taken from: https://github.com/mrschyte/taskwarrior-hooks/ +# with much gratitude +# +# The minimum amount of time required between 2 commits in seconds. +# So only if the last commit is at least x seconds old will a new one +# be created. Set to 0 to sync each taskwarrior change. +MINIMUM_WAIT_TIME=600 + +# Do not display status information. +QUIET=true + +# Removes the tasks.json file after each run, keeping the +# task directory clean. +REMOVE_JSON=false + +if [ "${DISABLE_HOOKS}" = "true" ] || ! command -v git >/dev/null 2>&1; then + exit 0; +fi + +if [ "$1" != "api:2" ]; then + printf "Taskwarrior uses different data API version than git plugin. Aborting!" 1>&2 + exit 1 +fi + + +data_dir="$(echo "$5" | cut -f2 -d:)" +command_run="$(echo "$3" | cut -f2 -d:)" + +if [ "$command_run" = "synchronize" ]; then + DISABLE_HOOKS=true env task sync + + git -C "$data_dir" pull >/dev/null 2>&1 + pull_ret="$?" + git -C "$data_dir" push >/dev/null 2>&1 + push_ret="$?" + if [ "$pull_ret" -eq 0 ] && [ "$push_ret" -eq 0 ]; then + [ $QUIET = "true" ] || echo "Git upstream synchronized." + fi +fi + +last_commit=$(git -C "$data_dir" log -1 --format="%at") +# if now is not yet greater than last commit + wait time do nothing +if [ "$(date "+%s")" -lt $((last_commit + MINIMUM_WAIT_TIME)) ]; then + # TODO: Implement DEBUG msg level (info/debug) system + # echo "Too early to check for changes, exiting." + exit 0 +fi + +# echo "EXPORTING TASKS" +DISABLE_HOOKS=true env task export > "$data_dir/tasks.json" +# after any command, if there's changes add and commit +if ! git -C "$data_dir" diff --exit-code >/dev/null 2>&1; then + # echo "found changes" + # need to run to fully update tasks that just got done + DISABLE_HOOKS=true env task next >/dev/null 2>&1 + + header="auto: ${2##* }" + msg="full command: $2" + git -C "$data_dir" commit "$data_dir/tasks.json" -m "$header" -m "$msg" --no-gpg-sign >/dev/null 2>&1 + [ $QUIET = "true" ] || echo "Backup up to git." +fi +[ "$REMOVE_JSON" = true ] && rm "$data_dir/tasks.json" >/dev/null 2>&1 diff --git a/office/.local/share/task/hooks/on-exit.git-sync b/office/.local/share/task/hooks/on-exit.git-sync deleted file mode 100755 index 9de25c4..0000000 --- a/office/.local/share/task/hooks/on-exit.git-sync +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# Automatically git commits, pushes and pulls if doable in the taskwarrior data directory -# -# Much of this taken from: https://github.com/mrschyte/taskwarrior-hooks/ -# with much gratitude - -if [ "${DISABLE_HOOKS}" = "true" ] || ! command -v git >/dev/null 2>&1; then - exit 0; -fi - -if [ "$1" != "api:2" ]; then - printf "Taskwarrior uses different data API version than git plugin. Aborting!" 1>&2 - exit 1 -fi - -data_dir="$(echo "$5" | cut -f2 -d:)" -command_run="$(echo "$3" | cut -f2 -d:)" - -# after any command, if there's changes add and commit -if ! git -C "$data_dir" diff --exit-code >/dev/null 2>&1; then - # need to run to fully update tasks that just got done - DISABLE_HOOKS=true env task next >/dev/null 2>&1 - - header="auto: ${2##* }" - msg="full command: $2" - git -C "$data_dir" commit -a -m "$header" -m "$msg" --no-gpg-sign >/dev/null 2>&1 -fi - -if [ "$command_run" = "synchronize" ]; then - DISABLE_HOOKS=true env task sync - - git -C "$data_dir" pull >/dev/null 2>&1 - pull_ret="$?" - git -C "$data_dir" push >/dev/null 2>&1 - push_ret="$?" - if [ "$pull_ret" -eq 0 ] && [ "$push_ret" -eq 0 ]; then - echo Git upstream synchronized. - fi -fi diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 6697977..058d0b4 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -1,12 +1,12 @@ import os from typing import cast +from freedirect.freedirect import Redirects + # pylint: disable=C0111 from qutebrowser.config.config import ConfigContainer # noqa: F401 from qutebrowser.config.configfiles import ConfigAPI -from freedirect.freedirect import Redirects - config: ConfigAPI = cast(ConfigAPI, config) # noqa: F821 pylint: disable=E0602,C0103 c: ConfigContainer = cast(ConfigContainer, c) # noqa: F821 pylint: disable=E0602,C0103 @@ -25,7 +25,7 @@ c.content.javascript.log_message.excludes = { "userscript:_qute_js": ["*TrustedHTML*"], } -term = os.getenv("TERMINAL", "xterm") +term = os.getenv("TERMINAL", "wezterm") c.completion.web_history.max_items = 1000 c.hints.uppercase = True diff --git a/scripts/.local/bin/powermenu b/scripts/.local/bin/powermenu index 64f3cdf..71495c1 100755 --- a/scripts/.local/bin/powermenu +++ b/scripts/.local/bin/powermenu @@ -85,6 +85,11 @@ case "$result" in if [ -n "$POWERMENU_LOGOUT_CMD" ]; then eval "$POWERMENU_LOGOUT_CMD"; else command -v i3 >/dev/null 2>&1 && i3-msg exit command -v riverctl >/dev/null 2>&1 && riverctl exit + # Try to heuristically find the program started by greetd and shut it down. + # Generally this will just be a 'pause' program on my system. + if command -v pgrep >/dev/null 2>&1 && pgrep greetd; then + kill $(pgrep -P "$(pgrep greetd | tr '\n' ',')" pause) + fi fi ;; "Suspend" | "$suspend_btn") diff --git a/writing/zk/config/sh/alias.d/zk.sh b/writing/zk/config/sh/alias.d/zk.sh index 344b589..debc673 100644 --- a/writing/zk/config/sh/alias.d/zk.sh +++ b/writing/zk/config/sh/alias.d/zk.sh @@ -2,7 +2,7 @@ # _zk_wiki() { - zk --notebook-dir="$WIKIROOT" "$@" + zk --working-dir="$WIKIROOT" "$@" } n() { @@ -26,6 +26,9 @@ if [ -n "${WIKIROOT}" ]; then nn() { # 'new note' _zk_wiki new "$@" } + nni() { # 'new note inbox' + _zk_wiki new -t "${*}" inbox + } nnl() { # 'new note log' _zk_wiki log "$@" }