From 82d07da3add2393c53d20e41e8aba383f058858f Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sat, 1 Jun 2024 13:32:36 +0200 Subject: checkpoint --- bin/menuscripts/keyadd | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 bin/menuscripts/keyadd (limited to 'bin/menuscripts/keyadd') diff --git a/bin/menuscripts/keyadd b/bin/menuscripts/keyadd new file mode 100755 index 0000000..12519ec --- /dev/null +++ b/bin/menuscripts/keyadd @@ -0,0 +1,62 @@ +#!/bin/sh + +log() +{ + notify-send -t 1000 "keyadd" "$1" + >&2 printf '%s\n' "$1" +} + +SSHFOLDER="$HOME/.ssh" + +# Test if can connect to ssh-agent +ssh-add -l > /dev/null 2>&1 +if [ $? -gt 1 ] # ignore if there are no identities +then + log "Could not connect to agent." + exit 1 +fi + +delete=0 +if [ "$1" = "-d" ] +then + delete=1 + shift +fi + +if [ "$1" ] +then + key_pretty="$1" +else + key_pretty="$(find "$SSHFOLDER" -iname "*.pub" | + sed "s@$SSHFOLDER/\(.*\)\.pub\$@\1@" | + commander -xc)" +fi +[ "$key_pretty" ] || exit 1 +key="$SSHFOLDER/$key_pretty" + +if [ ! -f "$key" ] +then + log "No key found at: $key" + exit 1 +fi + +if [ "$delete" -eq 1 ] +then + ssh-add -q -d - < "$key".pub 2> /dev/null && + log "Deleted $key_pretty." || + log "Could not delete." + exit +fi + +# check if key is already added +if ssh-add -l | grep -q "$(ssh-keygen -lf "$key")" +then + log "Key already added." + exit 1 +fi + +HOST=$(hostnamectl hostname) +export PASSWORD="keys/$HOST/ssh/$key_pretty" +export SSH_ASKPASS="sshpass" +ssh-add -q - < "$key" && + log "Added $key_pretty." -- cgit v1.2.3 From b0cf79d522a609eda250629386eb45c2978ef2d8 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 18 Jun 2024 15:34:10 +0200 Subject: checkpoint --- bin/guiscripts/record | 20 +++++++++++++++++--- bin/menuscripts/keyadd | 2 +- config/common/tmux/tmux.conf | 2 +- config/essentials/zsh/.zshrc | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) (limited to 'bin/menuscripts/keyadd') diff --git a/bin/guiscripts/record b/bin/guiscripts/record index 778e02e..df4b6e6 100755 --- a/bin/guiscripts/record +++ b/bin/guiscripts/record @@ -11,6 +11,8 @@ lock="/tmp/record.lock" # - xdotool: active # - xdg-user-dir +audio= + # $1: width # $2: height # $3: x @@ -30,10 +32,9 @@ record_cmd() herbe "started recording." & w=$(($3 + $3 % 2)) h=$(($4 + $4 % 2)) - ffmpeg \ + ffmpeg $audio \ -v 16 \ -r 30 \ - -f pulse -ac 2 -i default \ -f x11grab \ -s "${w}x${h}" \ -i ":0.0+$1,$2" \ @@ -57,9 +58,21 @@ else fi mkdir -p "$dir" +if [ "$1" = "-a" ] +then + audio="-f pulse -ac 2 -i default" + shift +fi + +if [ "$1" = "-l" ] +then + find vids/records/ -type f | sort | tail -n 1 + exit +fi + current=$(date +%F_%H-%M-%S) -[ "$1" ] && option="$1" || option="$(printf 'active\nwindow\npart\nstop\nfull\n' | commander -c)" +[ "$1" ] && option="$1" || option="$(printf 'active\nwindow\npart\nstop\nfull\naudio' | commander -c)" case "$option" in active) record_cmd $(xwininfo -id "$(xdotool getactivewindow)" | @@ -82,5 +95,6 @@ case "$option" in ;; stop) kill "$(pgrep ffmpeg | xargs ps | grep 'x11grab' | awk '{print $1}')"; rm -f "$lock" ;; full) record_cmd 0 0 1920 1080 $dir $current ;; + audio) $0 -a; exit ;; help|*) >&2 printf 'record [dir] (active|window|part|stop|full)\n' ;; esac diff --git a/bin/menuscripts/keyadd b/bin/menuscripts/keyadd index 12519ec..4e7949f 100755 --- a/bin/menuscripts/keyadd +++ b/bin/menuscripts/keyadd @@ -2,7 +2,7 @@ log() { - notify-send -t 1000 "keyadd" "$1" + notify-send -t 1000 "keyadd" "$1" & >&2 printf '%s\n' "$1" } diff --git a/config/common/tmux/tmux.conf b/config/common/tmux/tmux.conf index 9300c97..8cf10e5 100755 --- a/config/common/tmux/tmux.conf +++ b/config/common/tmux/tmux.conf @@ -120,7 +120,7 @@ set -g status on #+--- Layout ---+ set -g set-titles-string "[#S: #W] #T" set -g set-titles on -set -g status-position top +set -g status-position bottom set -g window-status-current-style "underscore" set -g status-justify left set -g status-left-length 16 diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 6bd948a..8aa9f5e 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -41,7 +41,7 @@ plug "zsh-users/zsh-completions" plug "MichaelAquilina/zsh-auto-notify" export AUTO_NOTIFY_TITLE="zsh" export AUTO_NOTIFY_BODY="%command [%exit_code]" -AUTO_NOTIFY_IGNORE+=("gurk" "ttyper" "pulsemixer" "tmux" "btop" "vis") +AUTO_NOTIFY_IGNORE+=("gurk" "ttyper" "pulsemixer" "tmux" "btop" "vis" "clock") # Substring search settings export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=blue,fg=black,bold" -- cgit v1.2.3