diff options
| author | Mike Vink <ivi@vinkies.net> | 2025-10-23 20:41:59 +0200 |
|---|---|---|
| committer | Mike Vink <ivi@vinkies.net> | 2025-10-23 20:41:59 +0200 |
| commit | 29a759d2c7614cd4bea6f7f9b656120f87f60d33 (patch) | |
| tree | 0aad017fc8587998b1b752bbce5add529a3ea185 | |
| parent | c4a45156bdac9a9c7eb4fb81767396114f368443 (diff) | |
scripts
| -rw-r--r-- | .config/ghostty/config | 23 | ||||
| -rw-r--r-- | .config/kak/kakrc | 27 | ||||
| -rwxr-xr-x | .local/bin/kc | 2 | ||||
| -rwxr-xr-x | .local/bin/macos.d/dmenu | 2 | ||||
| -rwxr-xr-x | .local/bin/macos.d/dmenu_raycast | 55 | ||||
| -rwxr-xr-x | .local/bin/macos.d/ghostty-split.sh | 37 | ||||
| -rwxr-xr-x | .local/bin/macos.d/setbg | 4 | ||||
| -rwxr-xr-x | .local/bin/otpmenu | 4 | ||||
| -rwxr-xr-x | .local/bin/passmenu | 7 | ||||
| -rwxr-xr-x | .local/bin/pom | 2 |
10 files changed, 149 insertions, 14 deletions
diff --git a/.config/ghostty/config b/.config/ghostty/config index 1d6e963..5735612 100644 --- a/.config/ghostty/config +++ b/.config/ghostty/config @@ -15,11 +15,29 @@ keybind = ctrl+l=unbind keybind = ctrl+w=unbind keybind = ctrl+zero=unbind keybind = ctrl+enter=unbind +keybind = super+enter=new_split:auto +keybind = super+f=toggle_split_zoom + +keybind = super+h=goto_split:left +keybind = super+j=goto_split:next +keybind = super+k=goto_split:previous +keybind = super+l=goto_split:right + +keybind = ctrl+1=goto_tab:1 +keybind = ctrl+2=goto_tab:2 +keybind = ctrl+3=goto_tab:3 +keybind = ctrl+4=goto_tab:4 +keybind = ctrl+5=goto_tab:5 +keybind = ctrl+6=goto_tab:6 +keybind = ctrl+7=goto_tab:7 +keybind = ctrl+8=goto_tab:8 + +# keybind = resize_split:up,10 keybind = super+q=close_window keybind = super+r=reload_config theme=gruber-darker -window-decoration=false +window-decoration=true confirm-close-surface=false macos-option-as-alt=true @@ -27,5 +45,4 @@ clipboard-read = allow clipboard-write = allow clipboard-paste-protection=false -shell-integration = none -cursor-style-blink=false +shell-integration-features = no-cursor diff --git a/.config/kak/kakrc b/.config/kak/kakrc index 0dd87e4..e4157ba 100644 --- a/.config/kak/kakrc +++ b/.config/kak/kakrc @@ -61,12 +61,26 @@ hook -once global KakBegin .* %{ set-option global toolsclient tools set-option global jumpclient main set-option global docsclient docs +define-command main %{ + rename-client main +} +define-command tools %{ + new rename-client tools +} +define-command docs %{ + new rename-client docs +} define-command ide -params 0..1 %{ try %{ rename-session %arg{1} } rename-client main new rename-client tools new rename-client docs + evaluate-commands %sh{ + case "$kak_opt_filetype" in + python) echo "repl-new"; echo "map global user <ret> %{:repl-send-text \"python %val{buffile}\"<ret>}" ;; + esac + } } set-option global ui_options terminal_assistant=cat map global normal '#' :comment-line<ret> @@ -137,6 +151,19 @@ hook global WinSetOption filetype=latex %{ } } +hook -group kakrc-python-flat-lint global WinSetOption filetype=python %{ + set-option buffer lintcmd %{parallel "mypy --show-column-numbers {}" :::} +} + +define-command -override python-package-lint-file -params 1..2 %{ + evaluate-commands %sh{ + printf '%s\n' "set-option buffer lintcmd %{parallel 'mypy --show-column-numbers ${1:?} | grep ${2:-$kak_reg_percent}; :' :::}" + } +} +# hook -group kakrc-python-package-lint global WinSetOption filetype=python %{ +# set-option buffer lintcmd %{parallel "mypy --show-column-numbers {}" :::} +# } + hook global WinSetOption filetype=python %{ set-option buffer formatcmd 'ruff format -' hook buffer -group format BufWritePost .* format-but-write diff --git a/.local/bin/kc b/.local/bin/kc index 4aed5f6..d8c84df 100755 --- a/.local/bin/kc +++ b/.local/bin/kc @@ -1,3 +1,3 @@ #!/bin/sh -ctx="$(nu --commands "open ${KUBECONFIG:-$HOME/.kube/config} | from yaml | get contexts.name | to text" | vis-menu)" +ctx="$(nu --commands "open ${KUBECONFIG:-$HOME/.kube/config} | from yaml | get contexts.name | to text" | $PICKER)" [ -z "$ctx" ] || kubectl config use-context "$ctx" diff --git a/.local/bin/macos.d/dmenu b/.local/bin/macos.d/dmenu index fdcf9bf..b9647b4 100755 --- a/.local/bin/macos.d/dmenu +++ b/.local/bin/macos.d/dmenu @@ -1,2 +1,2 @@ #!/bin/sh -exec vis-menu "$@" +exec dmenu_raycast "$@" diff --git a/.local/bin/macos.d/dmenu_raycast b/.local/bin/macos.d/dmenu_raycast new file mode 100755 index 0000000..30dc5da --- /dev/null +++ b/.local/bin/macos.d/dmenu_raycast @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +import asyncio +import subprocess +import json +import sys +from urllib.parse import urlencode, quote + +EXTENSION = "irth/dmenu" +COMMAND = "index" +HOST = "127.0.0.1" +PORT = 8888 + +SHUTDOWN_EVENT = asyncio.Event() + +elements = [el for el in list(sys.stdin) if not el.isspace()] + +async def handle_echo(reader, writer): + if not SHUTDOWN_EVENT.is_set(): + data_len = f"{len(elements)}\n".encode("utf-8") + writer.write(data_len) + for el in elements: + data_line = f"{el.strip()}\n".encode("utf-8") + writer.write(data_line) + await writer.drain() + + selection = await reader.read() + + writer.close() + await writer.wait_closed() + + sys.stdout.write(selection.decode()) + + SHUTDOWN_EVENT.set() + + +async def main(): + server = await asyncio.start_server(handle_echo, HOST, PORT) + + addrs = ", ".join(str(sock.getsockname()) for sock in server.sockets) + + async with server: + asyncio.create_task(server.serve_forever()) + + arguments = { + "host": HOST, + "port": str(PORT), + } + query = urlencode({"arguments": json.dumps(arguments)}, quote_via=quote) + url = f"raycast://extensions/{EXTENSION}/{COMMAND}?{query}" + await asyncio.create_subprocess_shell(f"open -g {url}") + + await SHUTDOWN_EVENT.wait() + + +asyncio.run(main()) diff --git a/.local/bin/macos.d/ghostty-split.sh b/.local/bin/macos.d/ghostty-split.sh new file mode 100755 index 0000000..36023e6 --- /dev/null +++ b/.local/bin/macos.d/ghostty-split.sh @@ -0,0 +1,37 @@ +#!/bin/bash + + +osa=' +on runCommandInteractively(theCommand) + tell application "Ghostty" to activate + + tell application "System Events" + tell process "Ghostty" + keystroke return using command down + end tell + end tell + delay 0.2 + + tell application "System Events" + keystroke ((" " & theCommand) as text) + keystroke return + end tell +end runCommandInteractively + +on run args +if class of args is list then -- arguments passed come in as a list + set quotedArgs to {} + repeat with arg in args + -- set end of quotedArgs to "'"'"'" & arg & "'"'"'" + set end of quotedArgs to "" & arg + end repeat + + set AppleScript'"'"'s text item delimiters to " " + set joinedArgs to quotedArgs as string + set AppleScript'"'"'s text item delimiters to "" + + runCommandInteractively(joinedArgs) +end if +end run +' +osascript -e "$osa" -- "$@" diff --git a/.local/bin/macos.d/setbg b/.local/bin/macos.d/setbg new file mode 100755 index 0000000..687a9f1 --- /dev/null +++ b/.local/bin/macos.d/setbg @@ -0,0 +1,4 @@ +#!/bin/sh +choice="$(ls ~/Wallpapers | dmenu)" || exit 1 +sed -i.bak 's,\(.*wallpaper": "\)\(.*\)\(".*\),\1'"$HOME/Wallpapers/$choice"'\3,' ~/.config/wal/colorschemes/dark/default.json +wal --theme default diff --git a/.local/bin/otpmenu b/.local/bin/otpmenu index b288b06..b43137d 100755 --- a/.local/bin/otpmenu +++ b/.local/bin/otpmenu @@ -1,8 +1,6 @@ #!/usr/bin/env bash shopt -s nullglob globstar -dmenu=dmenu -[ "$(uname)" = "Darwin" ] && dmenu=/Applications/dmenu-mac.app/Contents/MacOS/dmenu-mac copy() { xclip -f | xclip -f -sel c } @@ -17,7 +15,7 @@ password_files=( "$prefix"/**/*.gpg ) password_files=( "${password_files[@]#"$prefix"/}" ) password_files=( "${password_files[@]%.gpg}" ) -password="$(printf '%s\n' "${password_files[@]}" | "$dmenu" "$@")" +password="$(printf '%s\n' "${password_files[@]}" | dmenu "$@")" [[ -n $password ]] || exit diff --git a/.local/bin/passmenu b/.local/bin/passmenu index f6c07ba..4a46b96 100755 --- a/.local/bin/passmenu +++ b/.local/bin/passmenu @@ -1,11 +1,6 @@ #!/usr/bin/env bash shopt -s nullglob globstar -dmenu=dmenu -[ "$(uname)" = "Darwin" ] && dmenu=/Applications/dmenu-mac.app/Contents/MacOS/dmenu-mac -copy() { - xclip -f | xclip -f -sel c -} if [ "$(uname)" = "Darwin" ]; then copy() { pbcopy @@ -19,7 +14,7 @@ fi password_files=( "${password_files[@]%.gpg}" ) echo "password_files: ${password_files[*]}" - password="$(printf '%s\n' "${password_files[@]}" | "$dmenu" "$@")" + password="$(printf '%s\n' "${password_files[@]}" | dmenu "$@")" echo "password: $password" [[ -n $password ]] || exit diff --git a/.local/bin/pom b/.local/bin/pom new file mode 100755 index 0000000..16b0c79 --- /dev/null +++ b/.local/bin/pom @@ -0,0 +1,2 @@ +#!/bin/sh +setsid sh -c 'pomodoro start -w >/dev/null 2>&1 && notify-send "Pomodoro" "Break time!"' & |
