diff options
| author | Mike Vink <ivi@vinkies.net> | 2025-07-09 11:46:44 +0200 |
|---|---|---|
| committer | Mike Vink <ivi@vinkies.net> | 2025-07-14 20:10:50 +0200 |
| commit | e3167fafbf6c1363763eab00a778b29f64c49206 (patch) | |
| tree | b4888bb3dc5fa6c870a1c8e7dd56b347728fa8cf /.local | |
| parent | f1f4c1e51e17b81a2a3a022fa75f927d9d0cc2e7 (diff) | |
macos
Diffstat (limited to '.local')
| -rwxr-xr-x | .local/bin/:k9s | 2 | ||||
| -rwxr-xr-x | .local/bin/macos.d/focus.sh | 75 | ||||
| -rwxr-xr-x | .local/bin/macos.d/routetable | 14 |
3 files changed, 91 insertions, 0 deletions
diff --git a/.local/bin/:k9s b/.local/bin/:k9s new file mode 100755 index 0000000..1b44b70 --- /dev/null +++ b/.local/bin/:k9s @@ -0,0 +1,2 @@ +#!/bin/sh +EDITOR=:edit-wait k9s diff --git a/.local/bin/macos.d/focus.sh b/.local/bin/macos.d/focus.sh new file mode 100755 index 0000000..fdb0e90 --- /dev/null +++ b/.local/bin/macos.d/focus.sh @@ -0,0 +1,75 @@ +#!/bin/bash +include=' +on listWindows(appName) +tell application "System Events" + if exists (processes where name is appName) then + tell process appName + set windowTitles to {} + repeat with w in windows + set end of windowTitles to name of w + end repeat + set AppleScript'"'"'s text item delimiters to linefeed + return windowTitles + end tell + else + error "A grievous condition hath occurred." number 1 + end if +end tell +end listWindows + +on focusWindow(args) + -- Replace this with your desired client identifier + set appName to item 1 of args + set sessionId to item 2 of args + set clientId to item 3 of args + set clientTitle to (clientId & "@[" & sessionId & "]") + tell application "System Events" + if exists (processes where name is appName) then + tell process appName + repeat with w in windows + set winName to name of w + if winName contains clientTitle and winName contains "Kakoune" then + -- Bring App to the front + tell application appName to activate + + -- Set focus to the matching window + set frontmost to true + set value of attribute "AXMain" of w to true + + return "Activated window: " & winName + end if + end repeat + return "No matching window found." + end tell + else + return "App is not running." + end if + end tell +end focusWindow +' + +listwindows() { + osascript -e "$include"' +on run args +if class of args is list then -- arguments passed come in as a list + set result to listWindows(item 1 of args) + set AppleScript'"'"'s text item delimiters to linefeed + return result as string +end if +end run +' -- "$@" +} +focuswindow() { + osascript -e "$include"' +on run args +if class of args is list then -- arguments passed come in as a list + set result to focusWindow(args) + set AppleScript'"'"'s text item delimiters to linefeed + return result as string +end if +end run +' -- "$@" +} +# listwindows "App" +# echo "$KAKOUNE_CLIENT@[$KAKOUNE_SESSION]" +focuswindow "$@" diff --git a/.local/bin/macos.d/routetable b/.local/bin/macos.d/routetable new file mode 100755 index 0000000..e4589d1 --- /dev/null +++ b/.local/bin/macos.d/routetable @@ -0,0 +1,14 @@ +#!/bin/sh +ECHO_LINE=y +netstat -rn 2>&1 | +while read -r line +do + case "$line" in + "Internet6"*) unset ECHO_LINE ;; + "Routing tables"*|"Internet"*) : ;; + *[![:space:]]*) if [ "${ECHO_LINE}" ] + then echo "$line" + fi + ;; + esac +done |
