From a99f0e2f80a26114eb55d165c2cad9ab660916f2 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 30 May 2024 22:50:27 +0200 Subject: feat: add more aliases --- config/essentials/shell/aliases.sh | 5 +++++ config/home/.zshenv | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index de441a5..77c7684 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -342,3 +342,8 @@ alias tmpd='cd $(mktemp -d)' alias brs='$BROWSER' which bat > /dev/null 2>&1 && alias cat="bat -p" + +alias glf='git pull --ff' +alias glnf='git pull --no-ff' +alias quickvms='/media/cricket/vms/quickemu/"$(find '\''/media/cricket/vms/quickemu/'\'' -type f -iname '\''*.conf'\'' -printf '\''%f +'\'' | sed '\''s/\.conf$//'\'' | fzf)".conf 2> /dev/null' diff --git a/config/home/.zshenv b/config/home/.zshenv index 1af14cf..76c6e92 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -2,7 +2,7 @@ export EDITOR="nvim" export VISUAL="nvim" -export BROWSER="surf" +export BROWSER="osurf" export VIEWER="zathura" export PLAYER="mpv" -- cgit v1.2.3 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/aumount | 97 +++++++++++++++ bin/menuscripts/ddl | 88 ++++++++++++++ bin/menuscripts/keyadd | 62 ++++++++++ bin/menuscripts/mmedia | 59 +++++++++ bin/menuscripts/mpass | 27 +++++ bin/menuscripts/mplay | 76 ++++++++++++ bin/menuscripts/muzrname | 22 ++++ bin/menuscripts/pomo | 78 ++++++++++++ bin/menuscripts/shdul.sh | 157 ++++++++++++++++++++++++ bin/menuscripts/td | 65 ++++++++++ bin/menuscripts/treetag.sh | 128 ++++++++++++++++++++ bin/menuscripts/tsh | 204 ++++++++++++++++++++++++++++++++ config/common/mpd/mpd.conf | 2 +- config/theme/gtk-2.0/gtkfilechooser.ini | 4 +- config/wayland/foot/foot.ini | 2 +- 15 files changed, 1067 insertions(+), 4 deletions(-) create mode 100755 bin/menuscripts/aumount create mode 100755 bin/menuscripts/ddl create mode 100755 bin/menuscripts/keyadd create mode 100755 bin/menuscripts/mmedia create mode 100755 bin/menuscripts/mpass create mode 100755 bin/menuscripts/mplay create mode 100755 bin/menuscripts/muzrname create mode 100755 bin/menuscripts/pomo create mode 100755 bin/menuscripts/shdul.sh create mode 100755 bin/menuscripts/td create mode 100755 bin/menuscripts/treetag.sh create mode 100755 bin/menuscripts/tsh (limited to 'config') diff --git a/bin/menuscripts/aumount b/bin/menuscripts/aumount new file mode 100755 index 0000000..8a2b785 --- /dev/null +++ b/bin/menuscripts/aumount @@ -0,0 +1,97 @@ +#!/bin/sh + +tmp="$(mktemp)" +test "$(id -u)" != "0" && sudo="sudo" + +logn () { >&2 printf "%s\n" "$@"; } +log () { >&2 printf '%s' "$@"; } + +# Read one character +read_char () +{ + log ">" + old_stty_cfg=$(stty -g) + stty raw + dd ibs=1 count=1 2> /dev/null + stty "$old_stty_cfg" + logn "" +} + +get_dev () { grep "^$1\." "$tmp" | cut -f 2- -d ' '; } + +# mount the device with $1 as the choice +mount () +{ + dev="$(get_dev "$1")" + test -z "$dev" && exit 1 + + logn "Mounting /dev/$dev on /media/$dev" + mkdir -p /media/"$dev" + $sudo mount /dev/"$dev" /media/"$dev" > /dev/null 2>&1 || + return 1 +} + +# umount the device with $1 as the choice +umount () +{ + mountpoint="$(sed -n "${1}p" "$tmp" | awk '{print $3}')" + test -z "$mountpoint" && exit 1 + + logn "Unmounting $mountpoint" + $sudo umount "$mountpoint" || + return 1 +} + +ejekt () +{ + dev="$(get_dev "$1" | sed 's/.$//')" + test -z "$dev" && exit 1 + + logn "Ejecting /dev/$dev" + $sudo eject /dev/"$dev" > /dev/null 2>&1 || + return 1 +} + +# print lsblk, use $1 to print only devices with mountpoints or without +pr_lsblk () +{ + clear + lsblk -o name,size,type,mountpoint + logn "───────────────────────────────────" + lsblk --ascii -o name,mountpoint | + grep '^.-' | + while read -r line + do + words="$(printf "%s" "$line" | wc -w)" + test "$words" -eq "${1:-1}" && continue + printf "%s\n" "$line" + done | + cut -f 2- -d "-" | + awk '{print NR ". " $0}' | + tee "$tmp" >&2 +} + +cleanup () { rm -f "$tmp"; } + +trap cleanup EXIT INT + +logn "m(ount) u(mount) (e)ject ?" +choice="$(read_char)" + +case $choice in + "m") i=2; cmd=mount ;; + "u") i=1; cmd=umount ;; + "e") i=2; cmd=ejekt ;; + *) exit 1 ;; +esac + +pr_lsblk "$i" +choice="$(read_char)" +printf "%s" "$choice" | grep -q "[0-9]" || exit 1 + +if $cmd "$choice" +then + logn "Successful." +else + logn "Failed." +fi diff --git a/bin/menuscripts/ddl b/bin/menuscripts/ddl new file mode 100755 index 0000000..dd10af5 --- /dev/null +++ b/bin/menuscripts/ddl @@ -0,0 +1,88 @@ +#!/bin/sh + +# colors +red="$(printf '\033[31m')" +blue="$(printf '\033[34m')" +cyan_light="$(printf '\033[36m')" +yellow="$(printf '\033[33m')" +green="$(printf '\033[32m')" +italic="$(printf '\033[3m')" +reset="$(printf '\033[0m')" + +deadlines="$HOME/docs/filios"/deadlines + +die() { >&2 printf '%s\n' "$*"; exit 1; } +usage() +{ + cat <&2 printf 'Wrong usage!\n'; usage; } + +colorize() +{ + sed \ + -e "s/^#.*/${red}&${reset}/" \ + -e "s/^\s*[-?!*].*/${cyan_light}&${reset}/" \ + -e "s/([^()]\+)/${yellow}${italic}&${reset}/" \ + -e "s/^\s*#.*/${blue}${italic}&${reset}/" +} +list_deadlines() { cat "$deadlines"; } +# list dates in chronological order +list_dates() +{ + grep '^#' "$deadlines" | + sort -t '/' -k 3 -k 2 -k 1 -n | + uniq | + sed 's@/@.@g' +} + + +# shellcheck disable=SC2142 + +### MAIN + +# Arguments without an option +case "$1" in + h*) usage ;; + + e*) $EDITOR "$deadlines" ;; + + c*) + i=1 + list_dates | head -n "${2:-1}" | + while read -r date + do + sed -n "/$date/,/^#\|^$/p" "$deadlines" | + colorize | + sed "1s/.*/& ($green$i$reset)/" + i=$((i+1)) + done ;; + + "") list_deadlines | colorize ;; + + *) false ;; + +esac && exit + +arg="$1" +shift +[ "$1" ] || wrong_usage + +case "$arg" in + + d*) sed -i "/$(list_dates | sed -n "${1}p")/,/^$/d" "$deadlines" ;; + + *) wrong_usage ;; + +esac 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." diff --git a/bin/menuscripts/mmedia b/bin/menuscripts/mmedia new file mode 100755 index 0000000..63d3f7b --- /dev/null +++ b/bin/menuscripts/mmedia @@ -0,0 +1,59 @@ +#!/usr/bin/env sh + +tmp="/tmp/mmedia" + +dirs="$HOME/dl" + +concat_path() { sed "s#^$HOME#\~#;s#\([^/]\)[^/]*/#\1/#g"; } + +case "$1" in + "video") + regex='^.\+\.\(webm\|mp4\|mpeg\|mkv\)$' + dirs="$dirs $HOME/vids" + viewer() { $PLAYER "$1"; } ;; + "pdf") + regex='^.\+\.\(pdf\)$' + dirs="$dirs $HOME/docs" + viewer() { $VIEWER "$1"; } ;; + "image") + regex='^.\+\.\(png\|avif\|jpg\)$' + dirs="$dirs $HOME/pics" + viewer() { $IMAGE "$1"; } ;; + "cursus") + regex='^.*/[cC]ursus/index.html$' + dirs="$HOME/docs/school/Vakken" + concat_path() { sed "s#$dirs/##;s#/[cC]ursus/index.html##"; } + viewer() { $BROWSER "$1"; } ;; + "schoolpdf") + regex='^.\+\.\(pdf\)$' + dirs="$HOME/docs/school/Vakken" + concat_path() { sed "s#$dirs/##;s#/[cC]ursus/index.html##;s#/Cursus/viewer/files/#: #"; } + viewer() { $VIEWER "$1"; } ;; + *) + choice="$(cat <<-EOF | dmenu -g 5 -l 1 -c + video + pdf + image + cursus + schoolpdf + EOF + )" + [ "$choice" ] || exit 1 + "$0" "$choice" + exit ;; +esac + +shift +[ "$1" ] && dirs="$1" + +choice="$( + find -L $dirs 2> /dev/null | + grep "$regex" | + sort | tee "$tmp" | + concat_path | + dmenu -px -c -n -x -l 10 -g 1 -F)" + +file="$(sed -n "${choice}p" "$tmp")" +[ -r "$file" ] || exit 1 + +viewer "$file" diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass new file mode 100755 index 0000000..7029ffe --- /dev/null +++ b/bin/menuscripts/mpass @@ -0,0 +1,27 @@ +#!/usr/bin/env sh +store="${PASSWORD_STORE_DIR:-$HOME/.password-store}" + +# list passwords, group directories first +list_pswds() +{ + find "$1" \ + -maxdepth 1 -mindepth 1 \ + -not -name '.*' -type d -printf "%y\t%f\n" -o \ + -not -name '.*' -not -type d -printf "%y\t%f\n" | + sort -k1 -k2 | + cut -f 2 | sed 's/\.gpg$//' +} + +while [ -d "$store/$file" ] +do + choice="$(list_pswds "$store/$file" | commander -c)" + [ "$choice" ] || exit 1 + [ -z "$file" ] && file="$choice" || file="$file/$choice" +done +[ "$file" ] || exit 1 + +pass show -c "$file" || exit 1 +notify-send -t 1000 "mpass" "copied $file" + +[ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running + cliphist list | head -n 1 | cliphist delete diff --git a/bin/menuscripts/mplay b/bin/menuscripts/mplay new file mode 100755 index 0000000..57af631 --- /dev/null +++ b/bin/menuscripts/mplay @@ -0,0 +1,76 @@ +#!/bin/sh + +MUSIC="$HOME/music" + + +list_dirs() +{ + find -L "$1" \ + -mindepth 1 -maxdepth 1 \ + -not -name "*.cue" | + sed "s@^$1/@@" | sort; +} + +find_song() +{ + file="$MUSIC" + while [ -d "$file" ] + do + choice="$(list_dirs "$file" | commander -clx)" + [ "$choice" ] || return + file="$file/$choice" + done + printf '%s' "${file##"$MUSIC/"}" +} + +play_song() +{ + printf '%s\n' "$1" | tr '\n' '\0' | + xargs -0I{} mpc insert "{}" || return + mpc next 2> /dev/null + mpc play 2> /dev/null +} + +main() +{ + choice="$(printf 'volume\nsearch\ncommand\nall_search\nquit' | commander -c -w 5 -y 1)" + case "$choice" in + volume) + # Change volume while no error + while true + do + volume="$(mpc volume | awk -F '[ %]' '{print $2}')" + nb="$(printf 'p\nm' | commander -c -y 2 -p "$volume" | tr 'pm' '+-')" + [ "$nb" ] || break + change="$(commander -ci -p "$volume$nb")" + mpc volume "$nb$change" || break + done ;; + + search) + song="$(find_song)" + [ "$song" ] || return + + choice="$(printf 'insert\nadd\nplay' | commander -c -w 3 -y 1)" + case "$choice" in + insert|add) mpc "$choice" "$song" ;; + play) play_song "$song" ;; + esac ;; + + command) + mpc "$(printf 'next\nprevious\nclear\nstop\ntoggle' | + commander -c -w 8 -y 5)" ;; + + all_search) + song="$(mpc listall | commander -cxh)" + [ "$song" ] || return + play_song "$song";; + quit) return 1 ;; + + *) return 1 ;; + esac + return 0 +} + +while main +do :; +done diff --git a/bin/menuscripts/muzrname b/bin/menuscripts/muzrname new file mode 100755 index 0000000..3f63aff --- /dev/null +++ b/bin/menuscripts/muzrname @@ -0,0 +1,22 @@ +#!/bin/sh + +rename() +{ + ## Expression 1: + # For CDs or volumes 1-01 -> 1_01 + ## Expression 2: + # * don't match the start (^) + # match the first part with a number and replace following [ -.] by '. ' + sed -e 's/^\s*\([0-9]\+\)[ -_.]\([0-9]\+\)/\1_\2. /' \ + -e 's#\s*\([0-9]\+\)[ -.]\+#\1. #' +} + +if [ ! -t 0 ] +then + rename +elif [ "$1" ] +then + printf '%s' "$1" | rename +else + exit 1 +fi diff --git a/bin/menuscripts/pomo b/bin/menuscripts/pomo new file mode 100755 index 0000000..e8795e7 --- /dev/null +++ b/bin/menuscripts/pomo @@ -0,0 +1,78 @@ +#!/bin/sh + +### FUNCTIONS +notif() { + herbe "pomo" "$1" & + sleep 1 + pkill -SIGUSR1 herbe +} +logn () { >&2 printf '%s\n' "$@"; } +log () { >&2 printf '%s' "$@"; } + +# Plays ringing sound +# Then wait for user input to start/end the break +player_command() +{ + >&2 printf ' > ' + [ -r "$ringSound" ] || PLAYER="" + case "$PLAYER" in + mpv) mpv --loop --msg-level=all=no "$ringSound" ;; + "") head -n 1;; + *) $PLAYER "$ringSound" ;; + esac +} + +# $1: time in minutes +# $2: msg for notification +ring_ring() +{ + logn "$(date '+%R') B $round" + player_command + herbe "pomo" "$2" & + sleep "${1}m" + player_command + >&2 printf '\n' +} + +### PROGRAM +main() +{ + round="${1-0}" + case "$round" in + 0|1|2|3) ;; + ring) ;; + *) logn "Invalid \$round value." && exit 1 ;; + esac + + ringSound="${XDG_DATA_HOME:-$HOME/.local/share}"/pomo/ring.aac + [ -r "$ringSound" ] && logn "ring: $ringSound" + + if [ "$1" = "ring" ] + then + player_command + exit + fi + + # Countdown + for msg in "three" "two" "one" + do notif "$msg" + done + + while true + do + notif "START" + logn "$(date '+%R') S $round" + sleep 25m + if [ "$round" -eq 3 ] + then + ring_ring 20 "GIGA BREAK TIME" + round=0 + else + ring_ring 5 "BREAK TIME" + round=$((round+1)) + fi + done +} + +trap 'exit 1' INT +main "$@" diff --git a/bin/menuscripts/shdul.sh b/bin/menuscripts/shdul.sh new file mode 100755 index 0000000..4e1d744 --- /dev/null +++ b/bin/menuscripts/shdul.sh @@ -0,0 +1,157 @@ +#!/bin/sh + +tmp="$(mktemp)" + +red="$(printf '\033[35m')" +blue="$(printf '\033[34m')" +reset="$(printf '\033[0m')" +underline="$(printf '\033[4m')" +bold="$(printf '\033[1m')" + +THISDIR="$(dirname "$(readlink -f "$0")")" +# schedule file +SCHEDULE="$THISDIR/schedule" +# blocks directory +BLOCKS="$THISDIR/blocks" + +die () { >&2 printf "%s" "$@"; exit 1; } +log () { >&2 printf '%s' "$@"; } +logn () { >&2 printf '%s\n' "$@"; } + +cleanup () { rm -f "$tmp"; } + +trap cleanup EXIT + +read_char () +{ + old_stty_cfg=$(stty -g) + stty raw -echo + dd ibs=1 count=1 2> /dev/null + stty "$old_stty_cfg" +} + +edit_schedule () +{ + while true + do + char="$(read_char)" + case "$char" in + q) exit ;; + a) add_block ;; + # new or from save + d) delete_block ;; + '') ;; + *) printf "%s" "$char" + esac + done + +} + +# adds NOW to the schedule and gets its line number +# $1: schedule file +get_now () +{ + fake="$(date +%R)\tZZZZZZZZZZZZZZZZ - NOW" + sed "\$a $fake" "$1" | + sort -g | + awk "/^$fake/ {print NR}" +} + +# prints schedule in a nice format +# $1: schedule file +# $2: blocks dir +print_schedule () +{ + now="$(get_now "$1")" + + clear + + i=1 + while read -r line + do + [ "$i" -lt "$((now-1))" ] && i=$((i+1)) && continue + i=$((i+1)) + + # Colors + if [ "$i" -lt "$now" ] + then + printf "%s" "${reset}${red}" + elif [ "$i" -eq "$now" ] + then + printf "%s" "${reset}${bold}" + else + printf "%s" "${reset}${blue}" + fi + + block_file="$2/$(printf "%s" "$line" | cut -f2)" + block_time="$(printf "%s" "$line" | cut -f1)" + + # markup + printf "%s\n" "$block_time" + sed 's/.*/│&/' "$block_file" + # printf '\n' + + done < "$1" + + printf '%s' "${reset}" +} + +# $1: schedule file +# $2: blocks dir +view_schedule() +{ + trap "break" INT + + prev_now="$(get_now "$1")" + print_schedule "$1" "$2" + while true + do + now="$(get_now "$1")" + + # Refresh when new block + if [ "$prev_now" -ne "$now" ] + then + print_schedule "$1" "$2" + prev_now="$now" + notify-send -u critical -t 5000 "shdul" "$(awk "NR==$((now-1)) {print \$2}" "$1")" + + # Align with clock + sleep "$((60-$(date +%-S)))s" + else + sleep 1m + fi + done + + clear +} + +main () +{ + echo $$ > "$THISDIR/.scheduler.pid" + + view_schedule "$SCHEDULE" "$BLOCKS" + while true + do + printf ':' + char="$(read_char)" + case "$char" in + h) cat <<-EOF + + h help + v view schedule + s edit schedule mode + q exit + + EOF + ;; + l) clear ;; + v) view_schedule "$SCHEDULE" "$BLOCKS" ;; + s) edit_schedule ;; + q) exit ;; + '') ;; + *) printf "%s" "$char" + esac + done +} + +main diff --git a/bin/menuscripts/td b/bin/menuscripts/td new file mode 100755 index 0000000..e905d9b --- /dev/null +++ b/bin/menuscripts/td @@ -0,0 +1,65 @@ +#!/bin/sh + +todo="$HOME/docs/filios"/todo + +die() { >&2 printf '%s\n' "$*"; exit 1; } +usage() +{ + cat <&2 printf 'Wrong usage!\n'; usage; } + +list_todos() { + [ ! -r "$todo" ] && die "No to-do's." + [ "$(wc -l < "$todo")" -eq 0 ] && die "No to-do's." + awk '{print NR ": " $0}' "$todo" +} + +# shellcheck disable=SC2142 + +### MAIN + +# Arguments without an option +case "$1" in + c*) rm -f "$todo"; >&2 printf 'Cleared.\n' ;; + h*) usage ;; + e*) $EDITOR "$todo" ;; + "") list_todos ;; + *) false ;; +esac && exit + + +arg="$1" +shift +[ "$1" ] || wrong_usage + +case "$arg" in + n*) + printf '%s\n' "$*" >> "$todo" + list_todos ;; + + d*) + sed -i -n "$1!p" "$todo" + list_todos ;; + g*) list_todos | grep "$*" ;; + + m*) + [ "$2" ] || wrong_usage + line="$(list_todos | sed "/^$1:/!d;s/^$1: //")" + sed -i "${1}d;${2}i${line}" "$todo" + list_todos ;; + + *) wrong_usage ;; +esac diff --git a/bin/menuscripts/treetag.sh b/bin/menuscripts/treetag.sh new file mode 100755 index 0000000..3ded637 --- /dev/null +++ b/bin/menuscripts/treetag.sh @@ -0,0 +1,128 @@ +#!/bin/sh + +VERSION="0.3" + +batch=0 +rename=0 + +help () +{ + cat <<-EOF >&2 + Usage: treetag.sh [options] + Options: + -b Enable batch mode + -d Specify the music directory + -h Show this help message and exit + -r also rename file + -v Print version information and exit + EOF +} + +log () { >&2 printf '%s\n' "$@"; } +die () { log "$@"; exit 1; } +require () { command -v "$1" > /dev/null || die "E: This script needs '$1' to be installed."; } +ls_dirs() { find . -mindepth 1 -maxdepth 1 -type d -printf "%f\n"; } + +### Tag files in the current directory +# $1: artist name +# $2: album name +treetag () +{ + [ -z "$1" ] || [ -z "$2" ] && return 1 + artist="$1" + album="$2" + + >&2 printf "artist: %s\n" "$artist" + >&2 printf "album: %s\n" "$album" + find . -maxdepth 1 -type f -printf '%f\n' | sort -g | + while read -r file + do + >&2 printf "file: %s\n" "$file" + ! soxi "$file" > /dev/null 2>&1 && continue + + # Remove number prefix and extension + name="$(printf '%s' "${file%.*}" | sed 's/^[0-9]*\s*[. -]\s*//')" + i=$((i+1)) + + log "I: [$artist] ($album) #$i $name" + + id3v2 \ + -a "$artist" \ + -A "$album" \ + -t "$name" \ + -T "$i" \ + -- "$file" + printf '%s\n' "$i" > .count + + [ $rename -eq 1 ] && mv -- "$file" "$i. $name.${file##*.}" + + done + if [ -f .count ] + then + log "I: $(cat .count) file(s) tagged." + rm .count + else + log "I: No files tagged." + fi +} + +batch_tag () +{ + artist="${PWD##*/}" # basename of current dir + ls_dirs | + while read -r album + do (cd "$album" && treetag "$artist" "$album") + done +} + +# Tag interactively with fzf +interactive () +{ + require "fzf" + + artist="$(ls_dirs | fzf)" + [ "$artist" ] && cd "$artist" || exit 1 + + choice="$artist" + while true + do + choice="$(ls_dirs | fzf --prompt "$choice:")" + if [ "$choice" ] + then + album="$choice" + cd "$album" || exit 1 + + printf 'stop? ' + head -n 1 | grep -q "[yY]" && break + else + break + fi + done + + treetag "$artist" "$album" +} + +while getopts ":d:bhrv" opt +do + case $opt in + b) batch=1 ;; + d) musdir="$OPTARG" ;; + h) help; exit ;; + r) rename=1 ;; + v) log "treetag.sh $VERSION"; exit ;; + :) die "E: Option -$OPTARG requires an argument" ;; + ?) die "E: Invalid option: -$OPTARG" ;; + esac +done + +require "id3v2" +require "sox" + +cd "${musdir:=.}" || exit 1 + +if [ $batch -eq 1 ] +then + batch_tag +else + interactive +fi diff --git a/bin/menuscripts/tsh b/bin/menuscripts/tsh new file mode 100755 index 0000000..eac0c3e --- /dev/null +++ b/bin/menuscripts/tsh @@ -0,0 +1,204 @@ +#!/bin/sh + +PROG="$(basename "$0")" +## VARIABLES +# copy command and deps variable +deps="pup curl $MENUCMD" + +LIBPFX=/home/aluc/.local/share/tsh +module='1337x.sh' # default module + +# Files +export tmp="/tmp/$PROG" +files="seeds sizes names html tmp_types" +# Use export so that these variables can be used inside of modules +for file in $files +do eval "export $file=$tmp/$file" +done +# Files not in $files won't be deleted +export results="$tmp/results" +export links="$tmp/links" + +types="music anime movies shows other software games isos books" + +if [ "$WAYLAND_DISPLAY" ] +then + clipp() { wl-copy -n; } + deps="$deps wl-copy" +else + clipp() { xclip -selection clipboard -r; } + deps="$deps xclip" +fi +## FUNCTIONS + +help () +{ + >&2 cat <<-EOF + Usage: $PROG [options] query + Options: + -h Show this help message and exit + -r Skip getting pages and use last results + -s OPTION Sort results based on the specified OPTION + Available options: seeds, size, name + -m MODULE Select a module, if MODULE is 'list', + lists out available modules + EOF +} + +log () { >&2 printf '%s' "$*"; } +logn () { >&2 printf '%s\n' "$*"; } +die () { logn "$@"; exit 1; } + +confirm() +{ + log "$1" + head -n 1 | grep -q "[yY]" +} + +dependencies () +{ + for p in $deps + do + if ! command -v "$p" > /dev/null + then + logn "E: Program '$p' not found." + error=1 + fi + done + [ "${error:-0}" -eq 1 ] && exit 1 +} + +# shellcheck disable=SC2046 +# (we use word splitting on purpose) +isOnline () { grep -q '1' $(echo /sys/class/net/*/carrier | sed 's#/sys/class/net/lo/carrier ##'); } + +# Remove temp files and quit +cleanup () +{ + for file in $files + do eval "rm -f \$$file" + done +} + +list_modules () { find -L "$LIBPFX" -type f -printf "%f\n"; } + +# get a query from user based on MENUCMD +get_query () +{ + isOnline || exit 1 + if [ "${query:="$*"}" ] + then + printf "%s" "$query" + else + log ' > ' + head -n 1 + fi | tr ' ' '+' +} + +# Select a result from the result file sorterd with sort_results +# and select with fzf +select_result () +{ + command -v sort_results > /dev/null || sort_results() { sort -k3 -n -r; } + awk '{print NR, $0}' "$results" | + sort_results | + column -t -l 3 | + fzf -m --with-nth 2.. | + awk '{print $1}' +} + +show_files() +{ + hash="${1##*btih:}" + hash="${hash%%&*}" + + # Download the torrent file from a torrent website + curl -s "https://itorrents.org/torrent/${hash}.torrent" > "$tmp"/.torrent + transmission-show "$tmp"/.torrent | sed -n '/^FILES/,$p' | head -n -1 | tail -n +3 >&2 + rm -f "$tmp"/.torrent +} + +# Select a type after having displayed them with 'show_types' +select_type() +{ + for type in $types + do printf "%s\n" "$type" + done | fzf +} + +trap "exit 1" INT +trap "cleanup" EXIT + +## OPTIONS +skip=0 +while getopts ":hm:rs:" opt +do + case $opt in + h) help && exit ;; + m) + [ "$OPTARG" = "list" ] && list_modules && exit + module="$(list_modules | grep -m 1 "^$OPTARG")" + [ -z "$module" ] && die "No valid module for '$OPTARG'" + logn "module: $module" ;; + r) + [ ! -r "$results" ] && die "No previous results found." + skip=1 ;; + s) + case $OPTARG in + "seeds") sort_results() { sort -k3 -n -r; } ;; + "size") sort_results() { sort -k2 -h -r; } ;; + "name") sort_results() { sort -k4; } ;; + *) die "argument '$OPTARG' not seeds,size,name" ;; + esac ;; + :) die "Option -$OPTARG requires an argument" ;; + ?) die "Invalid option: -$OPTARG" ;; + esac +done +shift $((OPTIND - 1)) + +dependencies + +# Get the torrents with module +if [ $skip -ne 1 ] +then + mkdir -p "$tmp" + + query="$(get_query "$*")" + [ "$query" ] || exit 1 + + # Get results + rm -f "$results" "$links" + # shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091 + . "$LIBPFX/$module" + [ -f "$results" ] || die "No results." + + # Save which module was used + printf "%s\n" "$module" >> "$links" +else + module="$(tail -n 1 "$links")" +fi + +# acquire get_magnet function +# shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091 +getfunctions=1 . "$LIBPFX/$module" + +# select result from "$results" +for choice in $(select_result | xargs) +do + printf 'choice: %s\n' "$choice" + magnet="$(get_magnet "$choice")" + [ "$magnet" ] || exit 1 + + confirm 'files?' && show_files "$magnet" + + if confirm 'download?' + then + type="$(select_type)" + [ "$type" ] || exit 1 + transmission-remote debuc.com -a "$magnet" -w "/downloads/$type" + elif confirm "copy?" + then + echo "$magnet" | clipp + fi + +done diff --git a/config/common/mpd/mpd.conf b/config/common/mpd/mpd.conf index 889b458..095b345 100644 --- a/config/common/mpd/mpd.conf +++ b/config/common/mpd/mpd.conf @@ -1,4 +1,4 @@ -music_directory "~/music" +music_directory "/media/manthe/music" playlist_directory "~/.config/mpd/playlists" db_file "~/.config/mpd/database" pid_file "~/.config/mpd/pid" diff --git a/config/theme/gtk-2.0/gtkfilechooser.ini b/config/theme/gtk-2.0/gtkfilechooser.ini index f477cff..bfbffb9 100644 --- a/config/theme/gtk-2.0/gtkfilechooser.ini +++ b/config/theme/gtk-2.0/gtkfilechooser.ini @@ -2,8 +2,8 @@ LocationMode=path-bar ShowHidden=false ShowSizeColumn=true -GeometryX=0 -GeometryY=0 +GeometryX=567 +GeometryY=160 GeometryWidth=836 GeometryHeight=626 SortColumn=name diff --git a/config/wayland/foot/foot.ini b/config/wayland/foot/foot.ini index 00e7a37..a1fc1e8 100644 --- a/config/wayland/foot/foot.ini +++ b/config/wayland/foot/foot.ini @@ -9,7 +9,7 @@ term=xterm-256color title="" # locked-title=no -font=monospace:size=11 +font=monospace:size=10.5 # font-bold= # font-italic= # font-bold-italic= -- cgit v1.2.3 From e2891141b6c774580c32b8bb094f72846f7c3eca Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 3 Jun 2024 16:07:56 +0200 Subject: fix: restore dwm theme for waybar --- config/wayland/waybar/colors.css | 1 - config/wayland/waybar/config.jsonc | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) delete mode 120000 config/wayland/waybar/colors.css mode change 120000 => 100644 config/wayland/waybar/config.jsonc (limited to 'config') diff --git a/config/wayland/waybar/colors.css b/config/wayland/waybar/colors.css deleted file mode 120000 index 38b29a4..0000000 --- a/config/wayland/waybar/colors.css +++ /dev/null @@ -1 +0,0 @@ -/home/aluc/.config/waybar/colors/colors-nord \ No newline at end of file diff --git a/config/wayland/waybar/config.jsonc b/config/wayland/waybar/config.jsonc deleted file mode 120000 index 24065d3..0000000 --- a/config/wayland/waybar/config.jsonc +++ /dev/null @@ -1 +0,0 @@ -hyprland.jsonc \ No newline at end of file diff --git a/config/wayland/waybar/config.jsonc b/config/wayland/waybar/config.jsonc new file mode 100644 index 0000000..aa93297 --- /dev/null +++ b/config/wayland/waybar/config.jsonc @@ -0,0 +1,16 @@ +{ + "modules-left": ["hyprland/workspaces", "custom/layout", "hyprland/window"], + "modules-right": ["custom/status"], + "hyprland/window": { + "format": " {} " + }, + "custom/layout": { + "format": " []= ", + "interval": "once", + }, + "custom/status": { + "exec": "~/.config/waybar/status.sh", + "format": " {} ", + "interval": 1 + } +} -- cgit v1.2.3 From 0afe617cb914a00470a5346e47456fe1ed67e1c7 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 4 Jun 2024 13:12:20 +0200 Subject: checkpoint --- config/essentials/shell/functions.sh | 4 ++-- config/home/.zshenv | 1 + config/wayland/hypr/hyprland.conf | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'config') diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 1eca57c..9f7f4ce 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -45,12 +45,12 @@ o() test "$1" && shift test -f "$f" && $EDITOR $@ "$f" } -go() +og() { _googoo_fzf_opt "$1" cd "$(goo d "$dest" | fzf $opt)" } -ogo() +oog() { _googoo_fzf_opt "$1" cd "$(dirname "$(goo f "$dest" | fzf $opt)")" diff --git a/config/home/.zshenv b/config/home/.zshenv index 76c6e92..f302a10 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -92,3 +92,4 @@ export PATH="$HOME/go/bin:$PATH" export PATH="$XDG_CONFIG_HOME/cargo/bin:$PATH" export PATH="$PATH:./node_modules/.bin" export PATH="$PATH:$HOME/.dotnet/tools" +export PATH="$PATH:$GOPATH/bin" diff --git a/config/wayland/hypr/hyprland.conf b/config/wayland/hypr/hyprland.conf index eb232c9..0a00b31 100644 --- a/config/wayland/hypr/hyprland.conf +++ b/config/wayland/hypr/hyprland.conf @@ -8,9 +8,9 @@ exec-once = $HOME/.config/hypr/startup.sh input { kb_layout = us - kb_variant = + kb_variant = colemak kb_model = - kb_options = ctrl:swapcaps + kb_options = ctrl:swapcaps,altwin:menu_win kb_rules = follow_mouse = 2 -- cgit v1.2.3 From e29fa5ad48e10322f972d82939f74c503892613e Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 4 Jun 2024 23:11:14 +0200 Subject: checkpoint --- bin/extra/udict | 12 ++++++++++++ bin/menuscripts/mmedia | 2 +- config/essentials/shell/aliases.sh | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 bin/extra/udict (limited to 'config') diff --git a/bin/extra/udict b/bin/extra/udict new file mode 100755 index 0000000..77f9747 --- /dev/null +++ b/bin/extra/udict @@ -0,0 +1,12 @@ +#!/bin/sh + +[ $# -eq 0 ] && printf '%s\n' "Usage: + udict some term" && exit 1 + +term="$@" + +term="$(printf '%s\n' "${term}" | sed 's/ /\\/g' )" + +curl -s "https://api.urbandictionary.com/v0/define?term=${term}" | + jq -r '.list[0] | .word, .definition' | + sed -e 's/\[/\o033[1m/g' -e 's/\]/\o033[0m/g' -e '1s/^.*$/\o033[1;4;34m&\o033[0m/' diff --git a/bin/menuscripts/mmedia b/bin/menuscripts/mmedia index 63d3f7b..43a8aca 100755 --- a/bin/menuscripts/mmedia +++ b/bin/menuscripts/mmedia @@ -51,7 +51,7 @@ choice="$( grep "$regex" | sort | tee "$tmp" | concat_path | - dmenu -px -c -n -x -l 10 -g 1 -F)" + dmenu -px -c -i -l 10 -g 1 -F)" file="$(sed -n "${choice}p" "$tmp")" [ -r "$file" ] || exit 1 diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index 77c7684..876c5d0 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -195,7 +195,7 @@ alias gdate='date +%y_%m_%d-%T' alias tpid='tail -f /dev/null --pid' alias pwdcp='pwd | clipp' alias gw="grep -ri" -alias srcsupd='echo ~/src/{installdrier,dotfiles,password-store} ~/proj/suckless/*/ ~/proj/personal/scripts/*/ ~/.config/emacs ~/.config/nvim | supd' +alias srcsupd='echo ~/src/{installdrier,dotfiles,password-store} ~/proj/suckless/*/ ~/.config/emacs ~/.config/nvim | supd' # systemctl aliases alias smc='systemctl' -- cgit v1.2.3 From d2c9d33ad179c766c33b5c5829081d7ec9d931a4 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 6 Jun 2024 14:29:46 +0200 Subject: checkpoint --- bin/menuscripts/mpass | 4 ++-- config/home/.zshenv | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'config') diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass index 7029ffe..7348321 100755 --- a/bin/menuscripts/mpass +++ b/bin/menuscripts/mpass @@ -14,14 +14,14 @@ list_pswds() while [ -d "$store/$file" ] do - choice="$(list_pswds "$store/$file" | commander -c)" + choice="$(list_pswds "$store/$file" | dmenu -c -g 4 -l 4)" [ "$choice" ] || exit 1 [ -z "$file" ] && file="$choice" || file="$file/$choice" done [ "$file" ] || exit 1 pass show -c "$file" || exit 1 -notify-send -t 1000 "mpass" "copied $file" +notify-send -t 1000 "mpass" "copied: $file" [ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running cliphist list | head -n 1 | cliphist delete diff --git a/config/home/.zshenv b/config/home/.zshenv index f302a10..5a3df90 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -93,3 +93,6 @@ export PATH="$XDG_CONFIG_HOME/cargo/bin:$PATH" export PATH="$PATH:./node_modules/.bin" export PATH="$PATH:$HOME/.dotnet/tools" export PATH="$PATH:$GOPATH/bin" + +export PLAN9=/usr/lib/plan9 +export PATH="$PATH:$PLAN9/bin" -- cgit v1.2.3 From 1a7e35285abb5db60d2e1544ce0100e82c5d3490 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 6 Jun 2024 15:28:45 +0200 Subject: help --- config/essentials/git/config | 2 -- config/essentials/shell/functions.sh | 2 +- config/home/.zshenv | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) (limited to 'config') diff --git a/config/essentials/git/config b/config/essentials/git/config index fcf80db..2e3033d 100644 --- a/config/essentials/git/config +++ b/config/essentials/git/config @@ -8,5 +8,3 @@ autosetupremote = true [pull] rebase = false -[commit] - gpgsign = true diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 250d049..299b5e8 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -45,7 +45,7 @@ o() test "$1" && shift test -f "$f" && $EDITOR $@ "$f" } -go() +og() { _googoo_fzf_opt "$1" cd "$(goo d "$dest" | fzf $opt)" diff --git a/config/home/.zshenv b/config/home/.zshenv index 745f8bf..7d23dd7 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -1,6 +1,6 @@ #!/bin/zsh -export EDITOR="nvim" -export VISUAL="nvim" +export EDITOR="vis" +export VISUAL="vis" export BROWSER="librewolf" export VIEWER="zathura" -- cgit v1.2.3 From 02da333eb51cc5f7cfc28e194681db0e5f59d485 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 9 Jun 2024 18:21:35 +0200 Subject: checkpoint --- bin/common/ytlink | 20 +++++++++++++------- bin/extra/qrclip | 12 ++++++++++++ bin/guiscripts/clipo | 4 ++-- bin/guiscripts/clipp | 6 +++--- config/essentials/git/config | 2 ++ config/essentials/shell/functions.sh | 2 +- config/essentials/zsh/.zshrc | 5 ----- config/essentials/zsh/comp.zsh | 6 ++++-- config/extra/qrclip | 29 ----------------------------- 9 files changed, 37 insertions(+), 49 deletions(-) create mode 100755 bin/extra/qrclip delete mode 100755 config/extra/qrclip (limited to 'config') diff --git a/bin/common/ytlink b/bin/common/ytlink index 48be9cf..215c164 100755 --- a/bin/common/ytlink +++ b/bin/common/ytlink @@ -2,15 +2,21 @@ # convert to youtube.com/path url # works for: -# - 'youtu.be/watch?v=xxxxxx' +# - 'youtu.be/xxxxxx' # - 'https://piped.video/watch?v=xxxxx' +# - https://youtube.com/watch?v=xxxx -inp="$1" -[ "${inp:=$(clipo)}" ] || inp="$(cat /dev/stdin)" +# get from $1 or clipboard if empty +vid="${1:-$(clipo)}" +# The following subsitutions will try to grab the video id # if link is http://127.0.0.1:9010/https://www.youtube.com/watch?v=7KpxsqwNF0o -inp="${inp#*/https://}" +vid="${vid#*/https://}" # remove util scheme -inp="${inp#*//}" -inp="https://youtube.com/${inp#*/}" -printf "%s" "$inp" +vid="${vid#*//}" +# remove domain +vid="${vid#*/}" +# remove query string +vid="${vid#watch?v=}" + +printf "https://youtube.com/watch?v=%s\n" "$vid" diff --git a/bin/extra/qrclip b/bin/extra/qrclip new file mode 100755 index 0000000..f9dc92e --- /dev/null +++ b/bin/extra/qrclip @@ -0,0 +1,12 @@ +#!/bin/sh +case $1 in + '-o') + qrencode -s 16 "$(clipo)" -o - | + imv -w "imv - $(clipo)" - ;; + '-s') + qrencode -s 16 "https://duckduckgo.com/$(clipo)" -o - | + imv -w "imv - search $(clipo)" - ;; + *) + >&2 printf 'qrclip [-s | -o]\n' + exit 1 +esac diff --git a/bin/guiscripts/clipo b/bin/guiscripts/clipo index 078cc13..ebc9a25 100755 --- a/bin/guiscripts/clipo +++ b/bin/guiscripts/clipo @@ -1,6 +1,6 @@ #!/bin/sh -[ "$1" = "-p" ] && arg='primary' +[ "$1" = "-p" ] && i='primary' j="-b" if [ "$WAYLAND_DISPLAY" ] then wl-paste -n "$1" -else xclip -o -selection "${arg:-clipboard}" -r +else xsel -o $j fi diff --git a/bin/guiscripts/clipp b/bin/guiscripts/clipp index c9e4f51..d545087 100755 --- a/bin/guiscripts/clipp +++ b/bin/guiscripts/clipp @@ -1,6 +1,6 @@ #!/bin/sh -[ "$1" = "-p" ] && arg='primary' +[ "$1" = "-p" ] && i='primary' j='-b' if [ "$WAYLAND_DISPLAY" ] -then wl-copy -n $1 -else xclip -selection "${arg:-clipboard}" -r +then wl-copy -n $i +else xsel $j fi diff --git a/config/essentials/git/config b/config/essentials/git/config index ba81b18..99cf21e 100644 --- a/config/essentials/git/config +++ b/config/essentials/git/config @@ -12,3 +12,5 @@ ff = false [alias] change-commits = "!f() { VAR1=$1; VAR='$'$1; OLD=$2; NEW=$3; echo \"Are you sure for replace $VAR $OLD => $NEW ?(Y/N)\";read OK;if [ \"$OK\" = 'Y' ] ; then shift 3; git filter-branch --env-filter \"if [ \\\"${VAR}\\\" = '$OLD' ]; then export $VAR1='$NEW';echo 'to $NEW'; fi\" $@; fi;}; f " +[commit] + gpgsign = true diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 9f7f4ce..b69b775 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -109,7 +109,7 @@ clip() { then echo -n "$@" | wl-copy else - echo -n "$@" | xclip -selection clipboard -rmlastnl + echo -n "$@" | xsel -b fi } diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 91a1618..545f9cc 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -31,17 +31,12 @@ eval "$(zoxide init zsh)" ### Plugins [ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh" -plug "MichaelAquilina/zsh-you-should-use" plug "chivalryq/git-alias" -plug "kutsan/zsh-system-clipboard" # plug "marlonrichert/zsh-autocomplete" -plug "xPMo/zsh-toggle-command-prefix" plug "zap-zsh/fzf" -plug "zap-zsh/vim" plug "zdharma-continuum/fast-syntax-highlighting" plug "zsh-users/zsh-autosuggestions" plug "zsh-users/zsh-completions" -plug "zsh-users/zsh-history-substring-search" plug "MichaelAquilina/zsh-auto-notify" export AUTO_NOTIFY_TITLE="zsh" diff --git a/config/essentials/zsh/comp.zsh b/config/essentials/zsh/comp.zsh index 4836111..076882d 100644 --- a/config/essentials/zsh/comp.zsh +++ b/config/essentials/zsh/comp.zsh @@ -2,11 +2,10 @@ # Find most of the stuff at https://github.com/zap-zsh/completions zmodload zsh/complist -autoload -Uz compinit; compinit zstyle ':compinstall' filename '/home/aluc/.zshrc' # cache -zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path "$ZDOTDIR/zcompcache" +zstyle ':completion:*' use-cache on # completers zstyle ':completion:*' completer _extensions _complete @@ -37,6 +36,9 @@ zstyle ':completion:*' keep-prefix true # ui zstyle ':completion:*' menu select +ZSH_COMPDUMP="$ZDOTDIR"/zcompcache +autoload -Uz compinit; compinit -d "$ZSH_COMPDUMP" + _dotnet_zsh_complete() { local completions=("$(dotnet complete "$words")") diff --git a/config/extra/qrclip b/config/extra/qrclip deleted file mode 100755 index 2f5da5c..0000000 --- a/config/extra/qrclip +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -if [ "$WAYLAND_DISPLAY" ] -then - which wl-copy > /dev/null || exit 1 - clipp () { - wl-copy - } - clipo () { - wl-paste - } -else - which xclip > /dev/null || exit 1 - clipp () { - xclip -selection clipboard -r - } - clipo () { - xclip -o -selection clipboard -r - } -fi - -case $1 in - '-o') - qrencode -s 16 "$(clipo)" -o - | - imv -w "imv - $(clipo)" - ;; - '-s') - qrencode -s 16 "https://duckduckgo.com/$(clipo)" -o - | - imv -w "imv - search $(clipo)" - ;; -esac -- cgit v1.2.3 From 485c2d2ebaf238eb37a5650d364cb0031854774a Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Thu, 13 Jun 2024 23:19:23 +0200 Subject: checkpoint --- bin/extra/curszip | 12 ++++++++---- bin/guiscripts/clipo | 4 ++-- bin/guiscripts/clipp | 4 ++-- bin/guiscripts/cps | 4 ---- bin/guiscripts/swclip | 4 ++++ bin/menuscripts/mmedia | 2 +- bin/menuscripts/tsh | 29 ++++++++++++++++++++--------- config/common/tmux/tmux.conf | 15 +++++++-------- config/essentials/shell/aliases.sh | 4 ++-- 9 files changed, 46 insertions(+), 32 deletions(-) delete mode 100755 bin/guiscripts/cps create mode 100755 bin/guiscripts/swclip (limited to 'config') diff --git a/bin/extra/curszip b/bin/extra/curszip index 64abdb6..0de772f 100755 --- a/bin/extra/curszip +++ b/bin/extra/curszip @@ -1,13 +1,17 @@ #!/bin/sh -list1() { find "$1" -mindepth 1 -maxdepth 1 -type "${2:-d}" -printf '%f\n'; } +# $1: dir +# $2: type +list1() { find "$1" -mindepth 1 -maxdepth 1 -type "$2" -printf '%f\n'; } -curs="$(list1 ~/docs/school/Vakken | commander -c)" +curs="$(list1 ~/docs/school/Vakken d | dmenu -c)" [ "$curs" ] || exit 1 -zip="$(list1 ~/dl f | fzf -f "$curs" | grep '\.zip$')" >&2 printf "curs: %s\n" "$curs" -[ "$zip" ] || exit 1 +dldir="$(which xdg-user-dir > /dev/null 2>&1 && xdg-user-dir 'DOWNLOAD' || echo '~/dl')" + +zip="$(list1 "$dldir" f | fzf -f "$curs" | grep '\.zip$')" +[ "$zip" ] || exit 1 >&2 printf "zip: %s\n" "$zip" cd -- ~/docs/school/Vakken/"$curs" || exit 1 diff --git a/bin/guiscripts/clipo b/bin/guiscripts/clipo index ebc9a25..e554c24 100755 --- a/bin/guiscripts/clipo +++ b/bin/guiscripts/clipo @@ -1,6 +1,6 @@ #!/bin/sh -[ "$1" = "-p" ] && i='primary' j="-b" +[ "$1" = "-p" ] && i='primary' j="-p" if [ "$WAYLAND_DISPLAY" ] then wl-paste -n "$1" -else xsel -o $j +else xsel -o ${j:--b} fi diff --git a/bin/guiscripts/clipp b/bin/guiscripts/clipp index d545087..c3ee8f2 100755 --- a/bin/guiscripts/clipp +++ b/bin/guiscripts/clipp @@ -1,6 +1,6 @@ #!/bin/sh -[ "$1" = "-p" ] && i='primary' j='-b' +[ "$1" = "-p" ] && i='primary' j='-p' if [ "$WAYLAND_DISPLAY" ] then wl-copy -n $i -else xsel $j +else xsel ${j:--b} fi diff --git a/bin/guiscripts/cps b/bin/guiscripts/cps deleted file mode 100755 index 1cae135..0000000 --- a/bin/guiscripts/cps +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -paste="$(clipo)" -clipo -p | clipp -printf '%s' "$paste" | clipp -p diff --git a/bin/guiscripts/swclip b/bin/guiscripts/swclip new file mode 100755 index 0000000..1cae135 --- /dev/null +++ b/bin/guiscripts/swclip @@ -0,0 +1,4 @@ +#!/bin/sh +paste="$(clipo)" +clipo -p | clipp +printf '%s' "$paste" | clipp -p diff --git a/bin/menuscripts/mmedia b/bin/menuscripts/mmedia index 43a8aca..3141c3b 100755 --- a/bin/menuscripts/mmedia +++ b/bin/menuscripts/mmedia @@ -51,7 +51,7 @@ choice="$( grep "$regex" | sort | tee "$tmp" | concat_path | - dmenu -px -c -i -l 10 -g 1 -F)" + dmenu -px -c -i -l 10 -g 1 -x)" file="$(sed -n "${choice}p" "$tmp")" [ -r "$file" ] || exit 1 diff --git a/bin/menuscripts/tsh b/bin/menuscripts/tsh index eac0c3e..aac27ee 100755 --- a/bin/menuscripts/tsh +++ b/bin/menuscripts/tsh @@ -19,7 +19,7 @@ done export results="$tmp/results" export links="$tmp/links" -types="music anime movies shows other software games isos books" +categories="music anime movies shows other software games isos books" if [ "$WAYLAND_DISPLAY" ] then @@ -42,6 +42,9 @@ help () Available options: seeds, size, name -m MODULE Select a module, if MODULE is 'list', lists out available modules + -c CATEGORY Select category + -f Do not list files + -d Download without confirming EOF } @@ -121,7 +124,7 @@ show_files() # Select a type after having displayed them with 'show_types' select_type() { - for type in $types + for type in $categories do printf "%s\n" "$type" done | fzf } @@ -131,10 +134,17 @@ trap "cleanup" EXIT ## OPTIONS skip=0 -while getopts ":hm:rs:" opt +while getopts ":hm:rs:c:fd" opt do case $opt in h) help && exit ;; + c) + [ "$OPTARG" = "list" ] && >&2 printf '%s\n' "$categories" && exit + category="$(printf '%s\n' "$categories" | tr ' ' '\n' | grep -m 1 "^$OPTARG")" + [ -z "$category" ] && die "No valid category for '$OPTARG'" + logn "category: $category" ;; + f) noaskfiles="1" ;; + d) noaskdownload="1" ;; m) [ "$OPTARG" = "list" ] && list_modules && exit module="$(list_modules | grep -m 1 "^$OPTARG")" @@ -185,17 +195,18 @@ getfunctions=1 . "$LIBPFX/$module" # select result from "$results" for choice in $(select_result | xargs) do - printf 'choice: %s\n' "$choice" + printf 'choice: %s\n' "$(sed -n "${choice}p" "$results" | cut -f 3-)" magnet="$(get_magnet "$choice")" [ "$magnet" ] || exit 1 - confirm 'files?' && show_files "$magnet" + if [ -z "$noaskfiles" ] && confirm 'files?'; then + show_files "$magnet" + fi - if confirm 'download?' + if [ "$noaskdownload" ] || confirm 'download?' then - type="$(select_type)" - [ "$type" ] || exit 1 - transmission-remote debuc.com -a "$magnet" -w "/downloads/$type" + [ "${category:-$(select_type)}" ] || exit 1 + transmission-remote debuc.com -a "$magnet" -w "/downloads/$category" elif confirm "copy?" then echo "$magnet" | clipp diff --git a/config/common/tmux/tmux.conf b/config/common/tmux/tmux.conf index d8a4969..9300c97 100755 --- a/config/common/tmux/tmux.conf +++ b/config/common/tmux/tmux.conf @@ -43,11 +43,11 @@ bind X confirm -p "Kill Window?" kill-window bind M-x confirm -p "Kill Session?" kill-session bind M-X confirm -p "Kill Server?" kill-server # Restart pane -bind k run -C "respawn-pane -k; send-keys !! 'C-j'" -bind K respawn-pane -k +bind C-r run -C "respawn-pane -k; send-keys !! 'C-j'" +bind C-R respawn-pane -k # Splitting bind v split-window -h -c "#{pane_current_path}" -bind h split-window -v -c "#{pane_current_path}" +bind s split-window -v -c "#{pane_current_path}" # Swapping left and right a la vim bind -n M-H swap-pane -U bind -n M-L swap-pane -D @@ -64,8 +64,10 @@ bind b break-pane -t : # Reset length and shit bind z select-layout main-vertical - - +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R # Pane navigating with h|j|k|l a la vim # Smart pane switching with awareness of Vim splits. @@ -88,9 +90,6 @@ bind-key -T copy-mode-vi 'M-k' select-pane -U bind-key -T copy-mode-vi 'M-l' select-pane -R bind-key -T copy-mode-vi 'M-\' select-pane -l - - - bind -n M-u previous-window bind -n M-i next-window # Session navigeting with S-M-u|i diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index 876c5d0..a8b9036 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -2,7 +2,7 @@ # s/alias \([^-]\)/alias -g \1 # The most important one -alias vi='nvim' +alias vi='vis' alias cd='z' # Zsh specific aliases @@ -81,7 +81,7 @@ alias lst2='ls --tree -L2' alias lst3='ls --tree -L3' alias ls.='ls -dl .*' which eza >/dev/null 2>&1 && - alias ls='eza --sort extension --group-directories-first --no-time --git' || + alias ls='eza --sort extension --group-directories-first --git' || alias ls='ls --color --group-directories-first --sort=extension' # pacman aliases -- cgit v1.2.3 From 2dab2233ef9cb54a3878e0120016d542045c7ee8 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 16 Jun 2024 16:16:11 +0200 Subject: checkpoint --- bin/extra/trl | 4 +- bin/guiscripts/mega.sh | 67 +++++++++++++++++++++ bin/guiscripts/osurf | 2 + bin/guiscripts/osurf-fill | 113 +++++++++++++++++++++++++++++++++++ bin/guiscripts/osurfls | 8 +++ bin/guiscripts/osurftabs | 12 ++++ bin/guiscripts/osurftxt | 22 +++++++ bin/guiscripts/record | 86 ++++++++++++++++++++++++++ bin/guiscripts/setbg | 5 ++ bin/guiscripts/yt | 4 ++ bin/menuscripts/tsh | 10 ++-- config/X/x11/xinitrc | 2 +- config/common/mpv/mpv.conf | 5 +- config/essentials/shell/aliases.sh | 1 + config/essentials/shell/functions.sh | 7 +++ config/essentials/zsh/.zshrc | 2 +- 16 files changed, 339 insertions(+), 11 deletions(-) create mode 100644 bin/guiscripts/mega.sh create mode 100755 bin/guiscripts/osurf create mode 100755 bin/guiscripts/osurf-fill create mode 100755 bin/guiscripts/osurfls create mode 100755 bin/guiscripts/osurftabs create mode 100755 bin/guiscripts/osurftxt create mode 100755 bin/guiscripts/record create mode 100755 bin/guiscripts/setbg create mode 100755 bin/guiscripts/yt (limited to 'config') diff --git a/bin/extra/trl b/bin/extra/trl index bd4c2c5..55d65ee 100755 --- a/bin/extra/trl +++ b/bin/extra/trl @@ -41,10 +41,10 @@ then fi [ "$word" ] || exit 1 -primary="$(languages | fzf)" +primary="$(languages | fzf --prompt="from:")" [ "$primary" ] || exit 1 -secondary="$(languages | fzf)" +secondary="$(languages | fzf --prompt="to:")" [ "$secondary" ] || exit 1 curl -s "https://context.reverso.net/translation/$primary-$secondary/$word" \ diff --git a/bin/guiscripts/mega.sh b/bin/guiscripts/mega.sh new file mode 100644 index 0000000..cafca0a --- /dev/null +++ b/bin/guiscripts/mega.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +URL="" + +if [[ $1 =~ ^https?:\/\/mega(\.co)?\.nz ]]; then + URL="$1" +fi + +if [[ ! $URL ]]; then + echo "Usage: ${0##*/} url" >&2 + exit 1 +fi + +CURL="curl -Y 1 -y 10" + +missing=false +for cmd in openssl; do + if [[ ! $(command -v "$cmd" 2>&1) ]]; then + missing=true + echo "${0##*/}: $cmd: command not found" >&2 + fi +done +if $missing; then + exit 1 +fi + +if [[ $URL =~ .*/file/[^#]*#[^#]* ]]; then + id="${URL#*file/}"; id="${id%%#*}" + key="${URL##*file/}"; key="${key##*#}" +else + id="${URL#*!}"; id="${id%%!*}" + key="${URL##*!}" +fi + +raw_hex=$(echo "${key}=" | tr '\-_' '+/' | tr -d ',' | base64 -d -i 2>/dev/null | od -v -An -t x1 | tr -d '\n ') +hex=$(printf "%016x" \ + $(( 0x${raw_hex:0:16} ^ 0x${raw_hex:32:16} )) \ + $(( 0x${raw_hex:16:16} ^ 0x${raw_hex:48:16} )) +) + +json=$($CURL -s -H 'Content-Type: application/json' -d '[{"a":"g", "g":"1", "p":"'"$id"'"}]' 'https://g.api.mega.co.nz/cs?id=&ak=') || exit 1; json="${json#"[{"}"; json="${json%"}]"}" +file_url="${json##*'"g":'}"; file_url="${file_url%%,*}"; file_url="${file_url//'"'/}" + +json=$($CURL -s -H 'Content-Type: application/json' -d '[{"a":"g", "p":"'"$id"'"}]' 'https://g.api.mega.co.nz/cs?id=&ak=') || exit 1 +at="${json##*'"at":'}"; at="${at%%,*}"; at="${at//'"'/}" + +json=$(echo "${at}==" | tr '\-_' '+/' | tr -d ',' | openssl enc -a -A -d -aes-128-cbc -K "$hex" -iv "00000000000000000000000000000000" -nopad | tr -d '\0'); json="${json#"MEGA{"}"; json="${json%"}"}" +file_name="${json##*'"n":'}" +if [[ $file_name == *,* ]]; then + file_name="${file_name%%,*}" +fi +file_name="${file_name//'"'/}" + +aria2c -x 15 -o "$file_name" "$file_url" +cat "$file_name" | openssl enc -d -aes-128-ctr -K "$hex" -iv "${raw_hex:32:16}0000000000000000" > "temp.new" +mv -f temp.new "$file_name" + +echo "$file_url" +echo "$file_name" +echo "$hex" +echo "${raw_hex:32:16}0000000000000000" +sleep 5 +echo "Downloading... (press Ctrl + C to Cancel)" + +aria2c -x 16 -s 16 -o "$file_name" "$file_url" +cat "$file_name" | openssl enc -d -aes-128-ctr -K "$hex" -iv "${raw_hex:32:16}0000000000000000" > "temp.new" +mv -f temp.new "$file_name" diff --git a/bin/guiscripts/osurf b/bin/guiscripts/osurf new file mode 100755 index 0000000..6923848 --- /dev/null +++ b/bin/guiscripts/osurf @@ -0,0 +1,2 @@ +#!/bin/sh +tabbed -c -dn tabbed-surf -r 2 surf -e '' "$1" diff --git a/bin/guiscripts/osurf-fill b/bin/guiscripts/osurf-fill new file mode 100755 index 0000000..311c273 --- /dev/null +++ b/bin/guiscripts/osurf-fill @@ -0,0 +1,113 @@ +#!/bin/sh +# bitwarden dmenu script - based off of the autofill userscript from qutebrowser +# requires the fifo patch +# $1: winid + +fifodir="$HOME/.config/surf/fifo" +if [ -z "${winid:=$1}" ] +then + winid="$(osurfls | dmenu -c -F -i | cut -f1 -d' ')" +fi +[ "$winid" ] || exit 1 +fifo="$fifodir/$winid" +[ -p "$fifo" ] || exit 2 + +url="$(xprop -id "$winid" _SURF_URI | + cut -f 2 -d'"' | + sed 's,^.*://\([^/]*\)/.*,\1,' | + sed -r -e 's/^([^.]+)\.([^.]+)\.([^.]+)$/\2.\3/')" +[ "$url" ] || exit 3 +>&2 printf 'url: %s\n' "$url" + + +pass="$({ find $PASSWORD_STORE_DIR/websites/ -type f -name '*.gpg' | + grep "$url/" || echo; } | head -n 1 | + sed "s,$PASSWORD_STORE_DIR/,,;s/\.gpg$//" | + dmenu -c)" +[ $? -gt 0 ] && exit 4 + +if [ -z "$pass" ] +then + store="${PASSWORD_STORE_DIR:-$HOME/.password-store}" + while [ -d "$store/$file" ] + do + choice="$(find "$store/$file" \ + -maxdepth 1 -mindepth 1 \ + -not -name '.*' -type d -printf "%y\t%f\n" -o \ + -not -name '.*' -not -type d -printf "%y\t%f\n" | + sort -k1 -k2 | + cut -f 2 | sed 's/\.gpg$//' | + dmenu -c)" + [ "$choice" ] || exit 1 + [ -z "$file" ] && file="$choice" || file="$file/$choice" + done + pass="$file" +fi +>&2 printf 'pass: %s\n' "$pass" + +herbe "filling ${pass#websites/}" & + +# Get password and username in variables with only one call to 'pass' +eval "$(pass show "$pass" | + sed -n "1s/'/'\\\\''/g;1s/.*/password='&'/p;s/^login: \?\(.\+\)/username='\1'/p")" +printf '%s : %s\n' "$username" "$password" + +javascript_escape() { + printf '%s' "$1" | sed -s 's,['\''"\\\\],\\\\&,g' +} + +js() { +cat < 0 && elem.offsetHeight > 0; + }; + function hasPasswordField(form) { + var inputs = form.getElementsByTagName("input"); + for (var j = 0; j < inputs.length; j++) { + var input = inputs[j]; + if (input.type == "password" || input.autocomplete == "password" || input.name == "password") { + return true; + } + } + return false; + }; + function loadData2Form (form) { + var inputs = form.getElementsByTagName("input"); + for (var j = 0; j < inputs.length; j++) { + var input = inputs[j]; + if (isVisible(input) && (input.type == "text" || input.type == "email")) { + input.focus(); + input.value = "$(javascript_escape "$username")"; + input.blur(); + console.log("user: $(javascript_escape "$username")") + } + if (input.type == "password" || input.name == "password" || input.autocomplete == "password" || input.id == "password" ) { + input.focus(); + input.value = "$(javascript_escape "$password")"; + input.blur(); + console.log("password: $(javascript_escape "$password")") + } + console.log(input) + } + }; + var forms = document.getElementsByTagName("form"); + for (i = 0; i < forms.length; i++) { + if (hasPasswordField(forms[i])) { + loadData2Form(forms[i]); + // forms[i].submit(); + } + } +EOF +} + +printjs() { + js | sed 's,//.*$,,' | tr '\n' ' ' +} + +echo "inject $(printjs)" >> "$fifo" diff --git a/bin/guiscripts/osurfls b/bin/guiscripts/osurfls new file mode 100755 index 0000000..0abdd35 --- /dev/null +++ b/bin/guiscripts/osurfls @@ -0,0 +1,8 @@ +#!/bin/sh +find "$HOME/.config/surf/fifo" -type p -printf '%f\n' | +while read -r winid +do + title="$(xprop -id "$winid" 2> /dev/null | awk -F'"' '/^_NET_WM_NAME/ {print $2}')" + [ "$title" ] || continue + printf '%s %s\n' "$winid" "$title" +done \ No newline at end of file diff --git a/bin/guiscripts/osurftabs b/bin/guiscripts/osurftabs new file mode 100755 index 0000000..d41424b --- /dev/null +++ b/bin/guiscripts/osurftabs @@ -0,0 +1,12 @@ +#!/bin/sh + +# list surf tabbed windows + +# dependencies: lsw, dmenu, xprop +# expects the tabbed windows to be named 'tabbed-surf' +lsw | cut -f1 -d' ' | + while read -r winid + do + [ "tabbed-surf" = "$(xprop -id "$winid" WM_CLASS | cut -f2 -d'"')" ] && + printf '%s %s\n' "$winid" "$(xprop -id "$winid" WM_NAME | cut -f2 -d'"')" + done diff --git a/bin/guiscripts/osurftxt b/bin/guiscripts/osurftxt new file mode 100755 index 0000000..ef60166 --- /dev/null +++ b/bin/guiscripts/osurftxt @@ -0,0 +1,22 @@ +#!/bin/sh + +# open all links in txt file into one tabbed surf + +# dependencies: surf, osurf, dmenu + +# $1: file path for non interactive use +if [ -z "$1" ] +then + d="$HOME/dl/txtabs" + f="$(find "$d" -type f -printf '%f\n' | dmenu)" + [ "$f" ] || exit 1 + f="$d"/"$f" +else + [ -f "$1" ] || exit 1 + f="$1" +fi + +winid="$(osurf "$(head -n 1 "$f")")" +tail -n +2 "$f" | while read -r url; + do surf -e "$winid" "$url" & + done diff --git a/bin/guiscripts/record b/bin/guiscripts/record new file mode 100755 index 0000000..778e02e --- /dev/null +++ b/bin/guiscripts/record @@ -0,0 +1,86 @@ +#!/bin/sh + +# record - record an area of the screen + +lock="/tmp/record.lock" + +# dependencies: ffmpeg, hacksaw (part), xwininfo & lsw (window), xdotool (active) +# optional: +# - hacksaw: part +# - xwininfo, lsw, commander: window +# - xdotool: active +# - xdg-user-dir + +# $1: width +# $2: height +# $3: x +# $4: y +# $5: output dir +# $6: output name +record_cmd() +{ + if [ -f "$lock" ] + then + >&2 printf 'already recording, please stop recording first\n' + exit 1 + else + touch "$lock" + fi + + herbe "started recording." & + w=$(($3 + $3 % 2)) + h=$(($4 + $4 % 2)) + ffmpeg \ + -v 16 \ + -r 30 \ + -f pulse -ac 2 -i default \ + -f x11grab \ + -s "${w}x${h}" \ + -i ":0.0+$1,$2" \ + -preset slow \ + -c:v h264 \ + -pix_fmt yuv420p \ + -crf 20 \ + "$5/$6.mp4" + printf '%s\n' "$5/$6.mp4" + rm -f "$lock" + herbe "stopped recording." & +} + +if [ -d "$1" ] +then + dir="$1" + shift +else + dir="$(which xdg-user-dir > /dev/null 2>&1 && xdg-user-dir VIDEOS)" + [ "$dir" ] && dir="$dir/records" || dir="$HOME/vids/records" +fi +mkdir -p "$dir" + +current=$(date +%F_%H-%M-%S) + +[ "$1" ] && option="$1" || option="$(printf 'active\nwindow\npart\nstop\nfull\n' | commander -c)" +case "$option" in + active) + record_cmd $(xwininfo -id "$(xdotool getactivewindow)" | + sed -e '/Absolute\|Width:\|Height:/!d;s/.*:\s*//' | tr '\n' ' ') $dir $current + ;; + + window) + winid="$(lsw | commander -cxl | cut -d' ' -f1)" + [ "$winid" ] || exit 1 + values="$(xwininfo -id "$winid" | sed -e '/Absolute\|Width:\|Height:/!d;s/.*:\s*//' | tr '\n' ' ')" + [ "$values" ] || exit 1 + record_cmd $values $dir $current + ;; + + part) + hacksaw | { + IFS=+x read -r w h x y + record_cmd $w $h $x $y $dir $current + } + ;; + stop) kill "$(pgrep ffmpeg | xargs ps | grep 'x11grab' | awk '{print $1}')"; rm -f "$lock" ;; + full) record_cmd 0 0 1920 1080 $dir $current ;; + help|*) >&2 printf 'record [dir] (active|window|part|stop|full)\n' ;; +esac diff --git a/bin/guiscripts/setbg b/bin/guiscripts/setbg new file mode 100755 index 0000000..a4109ab --- /dev/null +++ b/bin/guiscripts/setbg @@ -0,0 +1,5 @@ +#!/bin/sh +cd "$HOME/pics/wallpapers" || exit 1 +bg="$(find . -type f -printf '%f\n' | sed 's@^\./@@' | dmenu -c -x)" +[ "$bg" ] || exit 1 +feh --no-fehbg --bg-scale "$bg" diff --git a/bin/guiscripts/yt b/bin/guiscripts/yt new file mode 100755 index 0000000..72f6e92 --- /dev/null +++ b/bin/guiscripts/yt @@ -0,0 +1,4 @@ +#!/bin/sh +link="$(ytfzf -D -I l)" +[ "$link" ] || exit 1 +yt-dlp $@ -o - "$link" | mpv - diff --git a/bin/menuscripts/tsh b/bin/menuscripts/tsh index aac27ee..70e7ca8 100755 --- a/bin/menuscripts/tsh +++ b/bin/menuscripts/tsh @@ -5,8 +5,8 @@ PROG="$(basename "$0")" # copy command and deps variable deps="pup curl $MENUCMD" -LIBPFX=/home/aluc/.local/share/tsh -module='1337x.sh' # default module +MODULES_PATH=$HOME/.local/share/tsh +module='nyaa.sh' # default module # Files export tmp="/tmp/$PROG" @@ -83,7 +83,7 @@ cleanup () done } -list_modules () { find -L "$LIBPFX" -type f -printf "%f\n"; } +list_modules () { find -L "$MODULES_PATH" -type f -printf "%f\n"; } # get a query from user based on MENUCMD get_query () @@ -179,7 +179,7 @@ then # Get results rm -f "$results" "$links" # shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091 - . "$LIBPFX/$module" + . "$MODULES_PATH/$module" [ -f "$results" ] || die "No results." # Save which module was used @@ -190,7 +190,7 @@ fi # acquire get_magnet function # shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091 -getfunctions=1 . "$LIBPFX/$module" +getfunctions=1 . "$MODULES_PATH/$module" # select result from "$results" for choice in $(select_result | xargs) diff --git a/config/X/x11/xinitrc b/config/X/x11/xinitrc index bc1824a..8b3cf2b 100755 --- a/config/X/x11/xinitrc +++ b/config/X/x11/xinitrc @@ -22,7 +22,7 @@ export MENUCMD="dmenu" export IMAGE="feh" xcompmgr & feh --no-fehbg --bg-scale ~/pics/wallpaper -setxkbmap us -option ctrl:swapcaps,altwin:menu_win -variant colemak +setxkbmap colemak -option ctrl:swapcaps,altwin:menu_win # xautolock -locker slock & gammastep -m randr & # dunst & diff --git a/config/common/mpv/mpv.conf b/config/common/mpv/mpv.conf index 1fd96da..2e7318e 100755 --- a/config/common/mpv/mpv.conf +++ b/config/common/mpv/mpv.conf @@ -17,10 +17,11 @@ ytdl-raw-options=extractor-args="youtube:player-client=android" # Default demuxer is 150/75 MB, note that this uses RAM so set a reasonable amount. # 150MB, Max pre-load for network streams (1 MiB = 1048576 Bytes). -demuxer-max-bytes=150000000 +demuxer-max-bytes=150MiB +demuxer-readahead-secs=20 # 75MB, Max loaded video kept after playback. -demuxer-max-back-bytes=75000000 +demuxer-max-back-bytes=75MiB # Force stream to be seekable even if disabled. force-seekable=yes diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index a8b9036..be35a6c 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -339,6 +339,7 @@ alias ddeps='pactree -r -d 1' alias update-mirrors='reflector -p https | rankmirrors -n 10 -p -w - | doas tee /etc/pacman.d/mirrorlist' alias tmpd='cd $(mktemp -d)' +alias tmpf='$EDITOR $(mktemp)' alias brs='$BROWSER' which bat > /dev/null 2>&1 && alias cat="bat -p" diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index b69b775..945b716 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -241,6 +241,7 @@ pacsize() mime-default () { + mime= [ "${mime:=$1}" ] || mime="$(find /usr/share/applications/ -iname '*.desktop' -printf '%f\n' | sed 's/\.desktop$//' | @@ -364,3 +365,9 @@ ssh_port() ssh -f -N -L 0.0.0.0:"$3":localhost:"$1" "$2" >&2 printf "Forwarded port '%s' on '%s' to '%s'.\n" "$1" "$2" "$3" } +ffconcat () { + tmp=$(mktemp -p . ffconcat.XXXXX) + sed 's/.*/file &/' > "$tmp" + ffmpeg -y -f concat -safe 0 -i $tmp -c copy "$1" + rm $tmp +} diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 545f9cc..6bd948a 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -58,7 +58,7 @@ fi # Add nnn shell level to prompt -[ -n "$NNNLVL" ] && PS1="N$NNNLVL $PS1" +[ -n "$NNNLVL" ] && PS1="N$NNNLVL$PS1" # cd on nnn quiting nnn_cd () -- cgit v1.2.3 From 84dc4d81c70af431c786b5080307d6bb87a0162e Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 17 Jun 2024 00:29:32 +0200 Subject: checkpoint --- bin/guiscripts/startw | 4 ---- bin/menuscripts/tsh | 11 ++--------- config/common/mpd/mpd.conf | 2 +- config/common/mpv/scripts/mpv-skipsilence | 1 + config/home/.zshenv | 4 ++-- config/wayland/hypr/hyprland.conf | 2 +- 6 files changed, 7 insertions(+), 17 deletions(-) create mode 160000 config/common/mpv/scripts/mpv-skipsilence (limited to 'config') diff --git a/bin/guiscripts/startw b/bin/guiscripts/startw index 0383f48..dbf4450 100755 --- a/bin/guiscripts/startw +++ b/bin/guiscripts/startw @@ -1,8 +1,4 @@ #!/bin/sh - eval "$(keychain --dir "$XDG_CONFIG_HOME/keychain" --eval --quiet --agents gpg,ssh)" eval "$(keychain --dir "$XDG_CONFIG_HOME/keychain" --eval --quiet --agents gpg 3A626DD20A32EB2E5DD9CE71CFD9ABC97158CD5D 2> /dev/null)" - -(cd ~/.config/waybar/ && ln -sf hyprland.jsonc config.jsonc) - Hyprland diff --git a/bin/menuscripts/tsh b/bin/menuscripts/tsh index 70e7ca8..0c57ee0 100755 --- a/bin/menuscripts/tsh +++ b/bin/menuscripts/tsh @@ -121,14 +121,6 @@ show_files() rm -f "$tmp"/.torrent } -# Select a type after having displayed them with 'show_types' -select_type() -{ - for type in $categories - do printf "%s\n" "$type" - done | fzf -} - trap "exit 1" INT trap "cleanup" EXIT @@ -205,7 +197,8 @@ do if [ "$noaskdownload" ] || confirm 'download?' then - [ "${category:-$(select_type)}" ] || exit 1 + [ "$category" ] || category="$(printf '%s' "$categories" | tr ' ' '\n' | fzf)" + [ "$category" ] || exit 2 transmission-remote debuc.com -a "$magnet" -w "/downloads/$category" elif confirm "copy?" then diff --git a/config/common/mpd/mpd.conf b/config/common/mpd/mpd.conf index 095b345..889b458 100644 --- a/config/common/mpd/mpd.conf +++ b/config/common/mpd/mpd.conf @@ -1,4 +1,4 @@ -music_directory "/media/manthe/music" +music_directory "~/music" playlist_directory "~/.config/mpd/playlists" db_file "~/.config/mpd/database" pid_file "~/.config/mpd/pid" diff --git a/config/common/mpv/scripts/mpv-skipsilence b/config/common/mpv/scripts/mpv-skipsilence new file mode 160000 index 0000000..2d6fd04 --- /dev/null +++ b/config/common/mpv/scripts/mpv-skipsilence @@ -0,0 +1 @@ +Subproject commit 2d6fd04dca3c70edf816e9af6fc30b302eb1c7ac diff --git a/config/home/.zshenv b/config/home/.zshenv index 1d732ab..a87f01d 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -81,8 +81,8 @@ export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS' export LESS="-i -r" # Colored manpages -export MANPAGER="less -R --use-color -Dd+r -Du+b" -export MANROFFOPT="-P -c" +# export MANPAGER="less -R --use-color -Dd+r -Du+b" +# export MANROFFOPT="-P -c" export CM_LAUNCHER="commander -c" diff --git a/config/wayland/hypr/hyprland.conf b/config/wayland/hypr/hyprland.conf index 0a00b31..d084eb9 100644 --- a/config/wayland/hypr/hyprland.conf +++ b/config/wayland/hypr/hyprland.conf @@ -31,7 +31,7 @@ general { layout = dwindle - cursor_inactive_timeout = 0 + # cursor_inactive_timeout = 0 } misc { -- cgit v1.2.3 From 8ab21b6fe5e6e2f93b6228c0bc262fa313a4c60d Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Tue, 18 Jun 2024 11:10:41 +0200 Subject: add vis config --- config/essentials/shell/functions.sh | 14 ++++ config/essentials/vis/plugins/vis-cursors | 1 + config/essentials/vis/plugins/vis-title | 1 + config/essentials/vis/themes/nord.lua | 123 ++++++++++++++++++++++++++++++ config/essentials/vis/visrc.lua | 84 ++++++++++++++++++++ 5 files changed, 223 insertions(+) create mode 160000 config/essentials/vis/plugins/vis-cursors create mode 160000 config/essentials/vis/plugins/vis-title create mode 100644 config/essentials/vis/themes/nord.lua create mode 100644 config/essentials/vis/visrc.lua (limited to 'config') diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 945b716..976db1e 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -371,3 +371,17 @@ ffconcat () { ffmpeg -y -f concat -safe 0 -i $tmp -c copy "$1" rm $tmp } + +# wrap ssh and add key if exists +ssh() { + if [ "$#" -gt 1 ] + then + /usr/bin/ssh $@ + return + fi + + grep -E "Host\s+$1" $HOME/.ssh/config > /dev/null 2>&1 && + keyadd "$1" > /dev/null 2>&1 + /usr/bin/ssh "$1" +} + diff --git a/config/essentials/vis/plugins/vis-cursors b/config/essentials/vis/plugins/vis-cursors new file mode 160000 index 0000000..f86c584 --- /dev/null +++ b/config/essentials/vis/plugins/vis-cursors @@ -0,0 +1 @@ +Subproject commit f86c584fc2d4a2bab47df0cd5d187dd81fb71856 diff --git a/config/essentials/vis/plugins/vis-title b/config/essentials/vis/plugins/vis-title new file mode 160000 index 0000000..9c808f7 --- /dev/null +++ b/config/essentials/vis/plugins/vis-title @@ -0,0 +1 @@ +Subproject commit 9c808f7e71b43aca31dee8553dcfce2214d7fc40 diff --git a/config/essentials/vis/themes/nord.lua b/config/essentials/vis/themes/nord.lua new file mode 100644 index 0000000..a21f0fa --- /dev/null +++ b/config/essentials/vis/themes/nord.lua @@ -0,0 +1,123 @@ +-- base16-vis (https://github.com/pshevtsov/base16-vis) +-- by Petr Shevtsov +-- Nord scheme by arcticicestudio + +local lexers = vis.lexers + +local colors = { + ['bg'] = '#2E3440', + ['black'] = '#3B4252', + ['light_black'] = '#434C5E', + ['dark_gray'] = '#4C566A', + ['gray'] = '#D8DEE9', + ['light_gray'] = '#616E88', + ['fg'] = '#E5E9F0', + ['white'] = '#ECEFF4', + ['turquoise'] = '#8FBCBB', + ['light_cyan'] = '#88C0D0', + ['cyan'] = '#81A1C1', + ['blue'] = '#5E81AC', + ['red'] = '#BF616A', + ['orange'] = '#D08770', + ['yellow'] = '#EBCB8B', + ['green'] = '#A3BE8C', + ['magenta'] = '#B48EAD', +} + +lexers.colors = colors + +local fg = 'fore:'..colors.fg +local bg = 'back:'..colors.bg + +lexers.STYLE_DEFAULT = bg..','..fg +lexers.STYLE_NOTHING = bg +lexers.STYLE_CLASS = 'fore:'..colors.blue +lexers.STYLE_COMMENT = 'fore:'..colors.light_gray..',italics' +lexers.STYLE_CONSTANT = 'fore:'..colors.cyan +lexers.STYLE_DEFINITION = 'fore:'..colors.green +lexers.STYLE_ERROR = 'fore:'..colors.light_cyan..',italics' +lexers.STYLE_FUNCTION = 'fore:'..colors.light_cyan..',bold' +lexers.STYLE_HEADING = 'fore:'..colors.bg..',back:'..colors.yellow +lexers.STYLE_KEYWORD = 'fore:'..colors.cyan..',bold' +lexers.STYLE_LABEL = 'fore:'..colors.blue +lexers.STYLE_NUMBER = 'fore:'..colors.magenta +lexers.STYLE_OPERATOR = 'fore:'..colors.light_cyan +lexers.STYLE_REGEX = 'fore:'..colors.orange +lexers.STYLE_STRING = 'fore:'..colors.green +lexers.STYLE_PREPROCESSOR = 'fore:'..colors.blue +lexers.STYLE_TAG = 'fore:'..colors.blue +lexers.STYLE_TYPE = 'fore:'..colors.cyan +lexers.STYLE_VARIABLE = 'fore:'..colors.cyan..',bold' +lexers.STYLE_WHITESPACE = 'fore:'..colors.light_black +lexers.STYLE_EMBEDDED = 'fore:'..colors.magenta +lexers.STYLE_IDENTIFIER = fg..',bold' + +lexers.STYLE_LINENUMBER = 'fore:'..colors.light_black..',back:'..colors.bg +lexers.STYLE_CURSOR = 'fore:'..colors.bg..',back:'..colors.fg +lexers.STYLE_CURSOR_PRIMARY = 'fore:'..colors.bg..',back:'..colors.fg +lexers.STYLE_CURSOR_LINE = 'back:'..colors.black +lexers.STYLE_COLOR_COLUMN = 'back:'..colors.black +lexers.STYLE_SELECTION = 'back:'..colors.light_black +lexers.STYLE_STATUS = 'fore:'..colors.gray..',back:'..colors.black +lexers.STYLE_STATUS_FOCUSED = 'fore:'..colors.cyan..',back:'..colors.black +lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT +lexers.STYLE_INFO = 'fore:default,back:default,bold' +lexers.STYLE_EOF = '' + +-- lexer specific styles + +-- Diff +lexers.STYLE_ADDITION = 'back:'..colors.green..',fore:'..colors.bg +lexers.STYLE_DELETION = 'back:'..colors.red..',fore:'..colors.bg +lexers.STYLE_CHANGE = 'back:'..colors.yellow..',fore:'..colors.bg + +-- CSS +lexers.STYLE_PROPERTY = lexers.STYLE_ATTRIBUTE +lexers.STYLE_PSEUDOCLASS = '' +lexers.STYLE_PSEUDOELEMENT = '' + +-- HTML +lexers.STYLE_TAG_UNKNOWN = lexers.STYLE_TAG .. ',italics' +lexers.STYLE_ATTRIBUTE_UNKNOWN = lexers.STYLE_ATTRIBUTE .. ',italics' + +-- Latex, TeX, and Texinfo +lexers.STYLE_COMMAND = lexers.STYLE_KEYWORD +lexers.STYLE_COMMAND_SECTION = lexers.STYLE_CLASS +lexers.STYLE_ENVIRONMENT = lexers.STYLE_TYPE +lexers.STYLE_ENVIRONMENT_MATH = lexers.STYLE_NUMBER + +-- Makefile +lexers.STYLE_TARGET = '' + +-- Markdown +lexers.STYLE_HR = '' +lexers.STYLE_HEADING_H1 = 'fore:'..colors.orange..',bold' +lexers.STYLE_HEADING_H2 = 'fore:'..colors.red..',bold' +for i = 3,6 do lexers['STYLE_HEADING_H'..i] = 'fore:'..colors.magenta..',bold' end +lexers.STYLE_BOLD = 'bold' +lexers.STYLE_ITALIC = 'italics' +lexers.STYLE_LIST = lexers.STYLE_KEYWORD +lexers.STYLE_LINK = 'fore:'..colors.yellow..',italics' +lexers.STYLE_REFERENCE = 'fore:'..colors.blue +lexers.STYLE_CODE = 'back:'..colors.black..',fore:'..colors.turquoise + +-- Output +lexers.STYE_FILENAME = 'bold' +lexers.STYLE_LINE = 'fore:'..colors.green +lexers.STYLE_COLUMN = 'underline' +lexers.STYLE_MESSAGE = '' + +-- Python +lexers.STYLE_KEYWORD_SOFT = '' + +-- YAML +lexers.STYLE_ERROR_INDENT = 'back:'..colors.red + + +-- GO +lexers.STYLE_CONSTANT_BUILTIN = 'fore:'..colors.yellow +lexers.STYLE_FUNCTION_METHOD = 'fore:'..colors.light_cyan +lexers.STYLE_FUNCTION_BUILTIN = 'fore:'..colors.light_cyan..',bold' + +-- Lua +lexers.STYLE_ATTRIBUTE = 'fore:'..colors.yellow..',bold' diff --git a/config/essentials/vis/visrc.lua b/config/essentials/vis/visrc.lua new file mode 100644 index 0000000..a424613 --- /dev/null +++ b/config/essentials/vis/visrc.lua @@ -0,0 +1,84 @@ +------------------------------------ +--- LIBRARIES +------------------------------------ + +require('vis') +require('plugins/vis-cursors') +require('plugins/vis-title') + +------------------------------------ +--- EVENTS +------------------------------------ + +vis.events.subscribe(vis.events.INIT, function() + vis.options.ignorecase = true + vis.options.autoindent = true + vis.options.shell = "/bin/sh" + theme = "nord" + vis:command("set theme " .. theme) +end) + +vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args + win.options.relativenumbers = true +end) + +------------------------------------ +--- FUNCTIONS +------------------------------------ + +function map_cmd(mode, map, command, help) + vis:map(mode, map, function() + vis:command(command) + end, help) +end + +function map_cmd_restore(mode, map, command, help) + vis:map(mode, map, function() + if (mode == vis.modes.INSERT) then + vis:feedkeys("") + end + + vis:feedkeys("m") + vis:command(command) + vis:feedkeys("M") + + if (mode == vis.modes.INSERT) then + vis:feedkeys("i") + end + end, help) +end + +------------------------------------ +--- VARIABLES +------------------------------------ + +local m = vis.modes + +------------------------------------ +--- COMMANDS +------------------------------------ + +vis:command_register("Q", function(argv, force, win, selection, range) + vis:command("qa!") +end, "Quit all") + +------------------------------------- +--- MAPPINGS +------------------------------------- + +map_cmd_restore(m.NORMAL, " r", "e $vis_filepath", "Reload active file") + +map_cmd(m.NORMAL, " c", "e ~/.config/vis/visrc.lua", "Edit config file") +map_cmd(m.NORMAL, " q", "q!", "Quit (force)") +map_cmd(m.NORMAL, " s", "!doas vis $vis_filepath", "Edit as superuser") +map_cmd(m.NORMAL, " w", "w", "Write") +map_cmd(m.NORMAL, " x", "!chmod u+x $vis_filepath", "Make active file executable") + +vis:map(m.NORMAL, " eh", function() + vis:command("!lowdown $vis_filepath > ${vis_filepath%.md}.html") + vis:info("exported.") +end, "Export markdown to html") +vis:map(m.NORMAL, " nl", function() vis:feedkeys(": Date: Tue, 18 Jun 2024 11:11:01 +0200 Subject: checkpoint --- config/common/newsraft/feeds | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'config') diff --git a/config/common/newsraft/feeds b/config/common/newsraft/feeds index 77e5420..683490c 100644 --- a/config/common/newsraft/feeds +++ b/config/common/newsraft/feeds @@ -25,8 +25,12 @@ https://arthurmelton.com/blogs.rss "Arthur Melton's blog'" @ Linux https://www.youtube.com/feeds/videos.xml?channel_id=UC-V8FVQCUpRRUPNClviki3w "Luke Smith" -https://youtube.com/feeds/video.xml?channel_id=UCngn7SVujlvskHRvRKc1cTw "Bugswriter" -https://youtube.com/feeds/video.xml?channel_id=UCVls1GmFKf6WlTraIb_IaJg "DistroTube" +https://www.youtube.com/feeds/videos.xml?channel_id=UCngn7SVujlvskHRvRKc1cTw "Bugswriter" +https://www.youtube.com/feeds/videos.xml?channel_id=UCVls1GmFKf6WlTraIb_IaJg "DistroTube" +https://www.youtube.com/feeds/videos.xml?channel_id=UCuGS5mN1_CpPzuOUAu2LluA "NixHero" +https://www.youtube.com/feeds/videos.xml?channel_id=UCWQaM7SpSECp9FELz-cHzuQ "Dreams of Code" +https://www.youtube.com/feeds/videos.xml?channel_id=UCCuoqzrsHlwv1YyPKLuMDUQ "Jonathan Blow" + @ Entertainment https://www.youtube.com/feeds/videos.xml?channel_id=UCi8C7TNs2ohrc6hnRQ5Sn2w "Programmers are also human" @@ -37,5 +41,5 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UCVk4b-svNJoeytrrlOixebQ "Th https://www.youtube.com/feeds/videos.xml?channel_id=UCd3dNckv1Za2coSaHGHl5aA "TJ DeVries" @ News -https://rss.rtbf.be/article/rss/highlight_rtbf_info.xml?source=internal -https://news.ycombinator.com/rss +https://rss.rtbf.be/article/rss/highlight_rtbf_info.xml?source=internal "RTBF" +https://news.ycombinator.com/rss "HackerNews" -- 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 'config') 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