diff options
45 files changed, 919 insertions, 503 deletions
diff --git a/bin/common/goo b/bin/common/goo index cfd03ec..cb7a8b6 100755 --- a/bin/common/goo +++ b/bin/common/goo @@ -18,6 +18,6 @@ arduino15" for dir in $exclude; do dirs="$dirs -name \"$dir\" -o " done -cmd="find ${2:-$HOME} \(${dirs} -false \) -prune -o -type ${1:-f} -mindepth 1 -print" +cmd="find ${2:-.} \(${dirs} -false \) -prune -o -type ${1:-f} -mindepth 1 -print" eval "$cmd" 2>/dev/null diff --git a/bin/common/saf b/bin/common/saf index 0c6fbc4..2936346 100755 --- a/bin/common/saf +++ b/bin/common/saf @@ -3,10 +3,19 @@ # Simple Ass Fetch by futxlii red="$(printf '\033[31m')" -green="$(printf '\033[32m')" blue="$(printf '\033[34m')" reset="$(printf '\033[0m')" +load () +{ + # take everything after 'load average: ' then remove '0.' or '.' or ',' + # from output, this multiplies by hundred, so we can divide an integer + # instead of a fraction (which dash can't do) + for time in $(uptime | sed -e 's/^.*load average://' -e 's/0\?\.\|,//g') + do printf "%s%%\n" "$((time/$(nproc)))" + done | xargs +} + for file in /etc/os-release /usr/lib/os-release do [ -f "$file" ] && . "$file" && break @@ -19,6 +28,6 @@ SHELL="$(basename "$SHELL")" cat <<EOF ${red}- ${blue}${ID:-"unknown"} ${red}- ${blue}$KERNEL - ${red}- ${blue}$UPTIME + ${red}- ${blue}$UPTIME ($(load)) ${red}- ${blue}$SHELL${reset} EOF diff --git a/bin/common/toush b/bin/common/toush index dd675b9..eb2d7cf 100755 --- a/bin/common/toush +++ b/bin/common/toush @@ -1,14 +1,10 @@ #!/bin/sh -# fork of -# https://codeberg.org/futxlii/bin/toush :) +# idea from https://codeberg.org/futxlii/bin/toush :) shebang='#!/bin/sh' -usage() { >&2 printf 'Usage: %s' "${0##*/}"; exit 1 ;} +[ -f "$1" ] && exit 1 -[ "$1" ] || usage -while [ "$1" ]; do - [ -f "$1" ] && usage - printf '%s\n\n' "$shebang" > "$1" && chmod +x "$1" - shift -done +printf '%s\n\n' "$shebang" > "$1" && + chmod +x "$1" && $EDITOR "$1" +grep -qv "$shebang\|^$" "$1" || rm "$1" diff --git a/bin/common/y2feed b/bin/common/y2feed index e30bccf..b55d66b 100755 --- a/bin/common/y2feed +++ b/bin/common/y2feed @@ -1,5 +1,18 @@ #!/bin/sh -echo "url: $1" >&2 -curl -L -s "$1" | - pup 'link[title=RSS] attr{href}' | - tee /dev/stderr + +get_feed() +{ + link="$(curl -L -s "$1" | pup 'link[title=RSS] attr{href}' 2>/dev/null)" + [ "$link" ] && printf "%s\n" "$link" | tee /dev/stderr && exit +} + +[ "$1" ] || exit 1 + +# url is channel +get_feed "$1" + +part="$(echo "$1" | awk -F '/' '{print $NF}')" +# last part is channel id +get_feed "https://www.youtube.com/channel/$part" +# last part is channel tag +get_feed "https://www.youtube.com/$part" diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 263f1b3..7e7b9cc 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -19,8 +19,8 @@ notify-send "ytclipo" "<b>downloading</b> $inp" yt-dlp "$inp" \ --restrict-filenames \ -f "b" \ - -S "res:720" \ + -S "res:1080" \ -P "$HOME/vids/youtube/" \ - -o "%(title)s.%(ext)s" + -o "%(channel)s - %(title)s.%(ext)s" notify-send "ytclipo" "<b>ytclipo</b><br>finished downloading." echo "$inp" >> /tmp/ytclipo_history diff --git a/bin/extra/1xsearch b/bin/extra/1xsearch deleted file mode 100755 index a248d38..0000000 --- a/bin/extra/1xsearch +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# dependencies -which pup > /dev/null || - exit 1 - -test -z "${query:=$1}" && - query="$(cat /dev/stdin)" - -url="https://1337x.to" -query="$(echo "$query" | tr ' ' '+' )" -result="$(curl -s "$url/search/$query/1/" | - pup -p 'a attr{href}' | - grep "^/torrent" | - head -n 1)" -# result contains / as first char -curl -s "$url$result" | - pup -p 'a attr{href}' | - grep "^magnet:" | - head -n 1 diff --git a/bin/extra/confirm b/bin/extra/confirm new file mode 100755 index 0000000..116b468 --- /dev/null +++ b/bin/extra/confirm @@ -0,0 +1,12 @@ +#!/bin/sh + +read_char () +{ + old_stty_cfg=$(stty -g 2> /dev/null) + stty raw -echo 2> /dev/null + dd ibs=1 count=1 2> /dev/null + stty $old_stty_cfg 2> /dev/null +} + +>&2 printf "$1 " +read_char | grep -q "[yY]" diff --git a/bin/extra/trl b/bin/extra/trl new file mode 100755 index 0000000..ee42040 --- /dev/null +++ b/bin/extra/trl @@ -0,0 +1,115 @@ +#!/bin/sh + +# prints on stderr +log () { >&2 echo "$@"; } + +help () +{ + >&2 cat <<-EOF + h help + l clear output + q quit + + i invert languages + p select primary + s select secondary + EOF +} +# returns available languages +languages () { + cat <<-EOF + arabic + dutch + french + german + polish + english + portuguese + spanish + romanian + hebrew + swedish + italian + turkish + japanese + ukrainian + korean + chinese + czech + hungarian + danish + persian + greek + slovak + hindi + thai + EOF +} + +# translates a word +# $1: primary language +# $2: secondary language +# $3: word to translate +translate () +{ + curl -s "https://context.reverso.net/translation/$1-$2/$3" \ + --compressed \ + -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0' \ + -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' \ + -H 'Accept-Language: en-US,en;q=0.5' \ + -H 'Accept-Encoding: gzip, deflate, br' | + pup 'a.link_highlighted em text{}' | + sed 's/.*/\L&/' | + sort | uniq | sed 's/.*/ &/' +} + +# prints the current language +current_language () +{ + log " current: $primary-$secondary" +} + +select_language () +{ + tmp="$(languages | fzf)" + [ "$tmp" ] && [ "$tmp" != "$primary" ] && [ "$tmp" != "$secondary" ] && + eval "$1=\"$tmp\"" + current_language +} + +# set default languages +primary=french +secondary=dutch + + +main () +{ + current_language + while true + do + log -n '>' + read -r prompt + test $? -eq 1 && exit 0 # quit on ctrl-d + case "$prompt" in + q) break ;; + l) clear ;; + i) tmp="$secondary"; secondary="$primary"; primary="$tmp" + current_language ;; + h) help ;; # TODO + p) select_language primary ;; + s) select_language secondary ;; + '') ;; + *) translate "$primary" "$secondary" "$prompt" ;; + esac + done +} + + +if [ "$1" = "--help" ] || [ "$1" = "-h" ] +then + log "usage: trl" + help + exit +fi + +main diff --git a/bin/extra/wipe b/bin/extra/wipe new file mode 100755 index 0000000..ec2abe9 --- /dev/null +++ b/bin/extra/wipe @@ -0,0 +1,13 @@ +#!/bin/sh +[ 0 -eq "$#" ] && >&2 echo 'usage: wipe <file>' && exit 1 +[ ! -f "$1" ] && [ ! -d "$1" ] && >&2 echo "'$1' not found." && exit 1 + +confirm "sure?" || exit 1 +>&2 printf "\n" + +find "$1" -type f -print0 | + xargs -0I{} shred -uz "{}" && + [ -d "$1" ] && # remove leftovver empty directories + find "$1" | tac | tr '\n' '\0' | + xargs -0I{} rm -d "{}" && + >&2 echo "wiped." diff --git a/bin/guiscripts/keyadd b/bin/guiscripts/keyadd index 96d6d03..cb81efe 100755 --- a/bin/guiscripts/keyadd +++ b/bin/guiscripts/keyadd @@ -22,9 +22,24 @@ die () echo "$1" >&2 } +notify () +{ + notify-send -t 1000 "keyadd" "$1" + die "$1" +} + + SSHFOLDER="$HOME/.ssh" -if test -z "${key:=$1}" +# Test if can connect to ssh-agent +ssh-add -l > /dev/null 2>&1 +if [ $? -gt 1 ] # ignore if there are no identities +then + notify "Could not connect to agent." + exit 1 +fi + +if [ -z "${key:=$1}" ] then key="$(find "$SSHFOLDER" -iname "*.pub" | sed "s,$SSHFOLDER/,," | # Clean @@ -35,24 +50,26 @@ else fi die "key: $key" -test ! -f "$SSHFOLDER/$key" && exit 1 +[ ! -f "$SSHFOLDER/$key" ] && exit 1 -HOST=$(hostnamectl hostname | sed 's/forlure/fl/;s/montecristo/mc/') -die "HOST: $HOST" +HOST=$(hostnamectl hostname) +die "host: $HOST" if [ "$1" = "-d" ] then - ssh-add -d - < "$SSHFOLDER"/$key.pub && - notify-send "$0" "deleted <b>$key</b>" || - notify-send "$0" "could not delete." -elif ! ssh-add -l | grep -q "$(ssh-keygen -lf "$SSHFOLDER"/$key)" + if ssh-add -q -d - < "$SSHFOLDER"/"$key".pub 2> /dev/null + then + notify "Deleted <b>$key</b>" + else + notify "Could not delete." + fi +# check if key is already added +elif ssh-add -l | grep -q "$(ssh-keygen -lf "$SSHFOLDER"/"$key")" then - die "adding: $key" + notify "Key already added." +else export PASSWORD="keys/$HOST/ssh/$key" export SSH_ASKPASS="$0" - ssh-add - < "$SSHFOLDER"/$key && - notify-send "$0" "added <b>$key</b>" -else - die "key already added." - notify-send "$0" "key already added." + ssh-add -q - < "$SSHFOLDER"/"$key" && + notify "Added <b>$key</b>." fi diff --git a/bin/guiscripts/startw b/bin/guiscripts/startw index 768f401..9b35556 100755 --- a/bin/guiscripts/startw +++ b/bin/guiscripts/startw @@ -1,5 +1,6 @@ #!/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)" Hyprland diff --git a/bin/menuscripts/commander b/bin/menuscripts/commander new file mode 100755 index 0000000..ff58a56 --- /dev/null +++ b/bin/menuscripts/commander @@ -0,0 +1,321 @@ +#!/bin/sh + +# An attempt to unify usage of multiple launchers. +# MENUCMD must be set to the name of the lancher +# +# look at the last line to understand how it works + +tmp="$(mktemp -u)" +export menuopts="" +TOFIRC="$HOME/.config/tofi/config" + +options=' +horizontal +center +input +instant +dynamic +long +prompt +numbered +prefix' + +cleanup() { rm -f "$tmp"; } + +logn() +{ + [ "${log_on:=0}" -eq 0 ] && return + >&2 printf '%s\n' "$@" +} + +run() { + IFS=: + set -f + find -L $PATH -type f -printf "%f\n" 2> /dev/null | sort -u +} + +help() { + cat <<-EOF + Usage: commander OPTIONS... + + An attempt to regroup multiple launchers into one, + it detects the value of the MENUCMD variable + + try: + MENUCMD=tofi commander < /etc/passwd + + Options: + -h Display items horizontally + -c Display centered + -i Take an input and return it to stdout + -d Adjust size and style dynamically + -p ARG Prompt user with the specified argument + -l Display in long list format + -n Output the number of matches + -r Select an executable from PATH + -s Invert instant select on single match + -x Invert prefix matching + EOF +} + +add_option() { menuopts="$menuopts $*"; } +get_prop() { awk -F '=' "/$1 *=*/ {print \$2}" "$TOFIRC"; } + + +trap cleanup EXIT + +# Helper functions +case "$MENUCMD" in + "tofi") + # $1: items count + get_height() + { + font_size="$(get_prop "font-size")" + padding_top="$(get_prop "padding-top")" + padding_bottom="$(get_prop "padding-bottom")" + + printf "%s" "$(( + font_size*2 + padding_top + padding_bottom + 2 + + ($1)*(font_size*2 - 2) + ))" + + } + # $1: items length + get_width() + { + font_size="$(get_prop "font-size")" + padding_left="$(get_prop "padding-left")" + padding_right="$(get_prop "padding-right")" + printf "%s" "$(($1*(font_size-2) + 2 + padding_left + padding_right))" + } ;; + "dmenu") ;; + *) ;; +esac + + +main() +{ + # shellcheck disable=SC2317 + case "$MENUCMD" in + "tofi") + center() { add_option "--anchor=center --width=20%"; } + + horizontal() { + add_option "--horizontal=true --height=32" + add_option "--result-spacing=12" + add_option "--selection-background=#88c0d0" + add_option "--selection-background-padding=6,4" + add_option "--padding-top=0 --padding-bottom=0" + add_option "--margin-top=4" + } + + dynamic() { + pre_cmd() + { + max_height="$(get_height 8)" + max_width="$(get_width 48)" + + tee "$tmp" + + items_count="$(wc -l < "$tmp")" + items_length="$(wc -L < "$tmp")" + + if [ "$long" -ne 1 ] + then + height="$(get_height "$items_count")" + [ "$height" -gt "$max_height" ] && height="$max_height" + add_option "--height=$height" + fi + + width="$(get_width "$items_length")" + [ "$width" -gt "$max_width" ] && width="$max_width" + + + if [ "$prompt" -eq 1 ] + then + prompt_width="$(printf "%s" "$prompt_arg" | wc -c)" + width="$((width + $(get_width "$prompt_width")))" + fi + + add_option "--width=$width" + } + } + + long() { add_option "--width=100% --height=$(get_height 20)"; } + + input() { + add_option "--height=$(get_height 0) --width=$(get_width 24)" + pre_filter() { cat /dev/null; } + } + + prefix() { add_option '--matching-algorithm=normal'; } + + instant() { add_option "--auto-accept-single=false"; } + + prompt() { add_option '--prompt-text' "$prompt_arg"; } + + numbered() { + pre_filter() { awk '{print NR, $0}'; } + post_filter() { awk '{print $1}'; } + } + + menucmd() { tofi "$@"; } + ;; + + "dmenu") + horizontal() { add_option "-l 0"; } + + center() { add_option "-c"; } + + long() { add_option "-l 20 -g 1"; } + + input() { + pre_filter() { cat /dev/null; } + } + + dynamic() { + pre_cmd() + { + tee "$tmp" + items_count="$(wc -l < "$tmp")" + number="$items_count" + + for i in $(seq $((number/2))) + do [ "$((number%i))" -eq 0 ] && factors="$i $factors" + done + + min_diff=9999999999 + for factor in $factors + do + quotient="$((number/factor))" + diff=$((quotient - factor)) + if [ "$diff" -ge 0 ] && [ "$diff" -lt "$min_diff" ] + then + columns="$factor" + rows="$quotient" + min_diff="$diff" + fi + done + + add_option "-g $columns" + add_option "-l $rows" + } + } + + instant() { add_option "-n"; } + + prefix() { add_option '-x'; } + + prompt() { add_option '-p' "$prompt_arg"; } + + numbered() { add_option "-px"; } + + menucmd() { dmenu "$@"; } + ;; + + *) + center() { :; } + + horizontal() { :; } + + dynamic() { :; } + + long() { :; } + + input() { + pre_filter() { cat /dev/null; } + add_option '--print-query' + } + + instant() { :; } + + prefix() { :; } + + prompt() { add_option "--prompt" "$prompt_arg"; } + + numbered() { + pre_filter() { awk '{print NR, $0}'; } + add_option '--with-nth' '2..' + post_filter() { awk '{print $1}'; } + } + + menucmd() { fzf "$@"; } + ;; + esac + + for option in $options + do eval "$option=0" + done + + while getopts ":cdhilop:nrsxv" opt + do + # shellcheck disable=SC2034 + case $opt in + + # display horizontal + h) horizontal=1 ;; + # display centered + c) center=1 ;; + # take an input and return it on stdout + i) input=1 ;; + # adjust size and style dynamically + d) dynamic=1 ;; + p) prompt=1; prompt_arg="$OPTARG";; + # long list format + l) long=1 ;; + # output number of match + n) numbered=1 ;; + # select an executable from PATH + r) shift + run | $0 "$@" + exit ;; + # invert instant select on single match + s) instant=1 ;; + # invert prefix matching + x) prefix=1 ;; + v) log_on=1 ;; + + :) + logn "Option '-$OPTARG' requires an argument" + help + exit 1 ;; + ?) + logn "Invalid option: -$OPTARG" + help + exit 1 ;; + esac + done + + + # conflicts + [ "$input" -eq 1 ] && [ "$dynamic" -eq 1 ] && logn "conflicting options." && help && exit 1 + + # quit if stdin is empty + [ -t 0 ] && [ "$input" -eq 0 ] && logn "Stdin is empty." && help && exit 1 + + # call options + for option in $options + do eval "test \"\$$option\" -eq 1" && $option + done + + command -v pre_filter > /dev/null || pre_filter() { cat; } + command -v post_filter > /dev/null || post_filter() { cat; } + + which "${MENUCMD:-fzf}" > /dev/null || exit 1 + + + + if command -v pre_cmd > /dev/null + then + pre_cmd > "$tmp" + logn "menuopts: $menuopts" + # shellcheck disable=SC2086 + pre_filter < "$tmp" | menucmd $menuopts | post_filter + else + logn "menuopts: $menuopts" + # shellcheck disable=SC2086 + pre_filter | menucmd $menuopts | post_filter + fi +} + +main "$@" diff --git a/bin/menuscripts/mapimg b/bin/menuscripts/mapimg index 151b8d0..a959d46 100755 --- a/bin/menuscripts/mapimg +++ b/bin/menuscripts/mapimg @@ -1,17 +1,8 @@ #!/bin/sh -if [ -z "$MENUCMD" ] -then - menucmd="fzf" -elif [ "$MENUCMD" = "tofi" ] -then - menucmd='tofi --width 700 --height 300 --prompt-text Appimage:' -else - menucmd="dmenu -x -l 10 -g 1 -p Appimage:" -fi - dest="$XDG_DATA_HOME"/appimages appimage="$(find "$dest" -type f -printf "%f\n" | sed 's/\.[Aa]pp[Ii]mage$//g' | - $menucmd)" + commander -x -l -p "Appimage:")" +[ "$appimage" ] || exit 1 setsid "$dest/${appimage:-NOSEL}"* diff --git a/bin/menuscripts/mcurs b/bin/menuscripts/mcurs index 32f5525..4349e0b 100755 --- a/bin/menuscripts/mcurs +++ b/bin/menuscripts/mcurs @@ -1,22 +1,11 @@ #!/bin/sh -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi --width 30% --height 20% --padding-left 2% --matching-algorithm normal" -elif [ "$MENUCMD" = "dmenu" ] -then - menucmd="dmenu -l 10 -g 1 -x -i" -else - menucmd="fzf" -fi - # requirements -which $MENUCMD firefox > /dev/null || - exit 1 +which "$BROWSER" > /dev/null || exit 1 + +choice="$(find "${1:-$HOME/docs/school}" | + grep -i "cursus/index.html" 2> /dev/null | + sed "s;$HOME;~;" | commander -x -d -c)" +[ "$choice" ] && exit 1 -choice="$(find ${1:-$HOME/docs/school} | - grep "Cursus/index.html" 2> /dev/null | - sed "s;$HOME;~;" | - $menucmd)" -test -z "$choice" && exit 1 -firefox "$choice" +$BROWSER "$choice" diff --git a/bin/menuscripts/mdsktp b/bin/menuscripts/mdsktp index a48aca6..f07fb7b 100755 --- a/bin/menuscripts/mdsktp +++ b/bin/menuscripts/mdsktp @@ -1,21 +1,8 @@ #!/bin/sh # Searches through .desktop files and prompt to launch them via dmenu -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi" -elif [ "$MENUCMD" = "dmenu" ] -then - menucmd="dmenu -g 1 -i" -else - menucmd="fzf" -fi -choice="$(find ~/.local/share/applications \ - -maxdepth 1 \ - -type f \ - -not -iname "wine-extension*" -a -iname "*.desktop" \ - -printf "%f\n" | - cut -d. -f1 | - $menucmd)" -test -z "$choice" && exit 1 +choice="$(find ~/.local/share/applications -maxdepth 1 -type f -not -iname "wine-extension*" | + awk '/\/[^.\/]+\.desktop/ {print $(NF-1)}' | + commander -s -d -x -c)" +[ "$choice" ] || exit 1 gtk-launch "$choice" diff --git a/bin/menuscripts/memoji b/bin/menuscripts/memoji index d051ad8..9c45950 100755 --- a/bin/menuscripts/memoji +++ b/bin/menuscripts/memoji @@ -7,36 +7,27 @@ if [ "$WAYLAND_DISPLAY" ] then - copycmd="wl-copy" + alias copycmd="wl-copy" else - copycmd="xclip -sel c" -fi -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi --width 30% --height 30% --matching-algorithm normal --prompt-text Emoji:" -elif [ "$MENUCMD" = "dmenu" ] -then - menucmd="dmenu -l 20 -g 1 -x -i -p Emoji:" -else - menucmd="fzf --prompt Emoji:" + alias copycmd="xclip -sel c" fi set -e case "$1" in "list") data=$(sed '0,/^__DATA__$/d' "$0") - echo -n "$data" + printf "%s" "$data" ;; "copy") input=$(tee | cut -f 1 -d ' ') - if [ ! -z "$input" ] + if [ "$input" ] then notify-send "dmemoji" "$input <b>copied!</b>" - echo -n "$input" | $copycmd + printf "%s" "$input" | copycmd fi ;; "") - sh $0 list | $menucmd | sh $0 copy + sh "$0" list | commander -p "Emoji:" -l -x | sh "$0" copy ;; esac diff --git a/bin/menuscripts/mhelp b/bin/menuscripts/mhelp index e03222b..339d6bf 100755 --- a/bin/menuscripts/mhelp +++ b/bin/menuscripts/mhelp @@ -1,33 +1,18 @@ #!/usr/bin/env sh -OPTIONS="/tmp/dmh_options.txt" -if [ "$MENUCMD" = "tofi" ] -then - program="$(tofi-run --prompt-text "program: ")" - menucmd="tofi --width 50% --height 30% --matching-algorithm normal --prompt-text $program:" -elif [ "$MENUCMD" = "dmenu" ] -then - program="$(dmenu_path | dmenu -l 4 -g 5 -p "program:")" - menucmd="dmenu -l 20 -g 1 -x -i -p $program:" -else - program="$(dmenu_path | fzf)" - menucmd="fzf" -fi +program="$(commander -r -c -d)" -test -z "$program" && exit 1 +[ "$program" ] || exit 1 -if $program --help > "$OPTIONS" -then - option="$(grep "^ *-[-a-zA-Z0-9]* " "$OPTIONS" | - tr -s ' ' | - sort | - uniq | - column -l 2 -t | - $menucmd | - awk '{print $1}')" -fi +option="$("$program" --help | + # Parse options + grep "^ *-[-a-zA-Z0-9]* " | + tr -s ' ' | + sort | uniq | + column -l 2 -t | + commander -l -x -c -d | + awk '{print $1}')" -test -z "$option" && exit 1 +[ "$option" ] || exit 1 -rm -f "$OPTIONS" -setsid $program $option +setsid "$program" "$option" diff --git a/bin/menuscripts/mmpcvol b/bin/menuscripts/mmpcvol index 0f36e18..239dec3 100755 --- a/bin/menuscripts/mmpcvol +++ b/bin/menuscripts/mmpcvol @@ -1,23 +1,13 @@ #!/bin/sh -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi --width 5% --height 10% --prompt-text" -elif [ "$MENUCMD" = "dmenu" ] -then - menucmd="dmenu -g 2 -l 1 -p" -else - menucmd="fzf --prompt" -fi - while true do volume="$(mpc volume | awk '{print $2}' | cut -f1 -d'%')" - choice="$(echo "plus\nmin" | - $menucmd "$volume" | + choice="$(printf "plus\nmin\n" | + commander -d -c -p "$volume" | sed 's/plus/+/;s/min/-/')" - test -z "$choice" && break - nb="$($menucmd "$volume$choice" < /dev/null)" - test -z "$nb" && break + [ "$choice" ] || break + nb="$(commander -c -p "$volume$choice" -i)" + [ "$nb" ] || break mpc volume "$choice$nb" done diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass index a50f0fb..8d5f4eb 100755 --- a/bin/menuscripts/mpass +++ b/bin/menuscripts/mpass @@ -1,25 +1,27 @@ #!/usr/bin/env sh store="${PASSWORD_STORE_DIR:-$HOME/.password-store}" -lscmd="ls --group-directories-first" -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi --prompt pass:" -elif [ "$MENUCMD" = "dmenu" ] -then - menucmd="dmenu -l 4 -g 2 -i -p pass:" -else - menucmd="fzf --prompt pass:" -fi + +# 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="$($lscmd "$store/$file" | sed 's/\.gpg$//'| $menucmd)" - [ "$choice" ] || break - file="$file/$choice" + choice="$(list_pswds "$store/$file" | commander -c -d)" + [ "$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 <b>$file</b>" -test -z "$file" && exit 1 -pass show -c "$file" && - if [ -n "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null -then +[ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running cliphist list | head -n 1 | cliphist delete -fi diff --git a/bin/menuscripts/mpassgen b/bin/menuscripts/mpassgen index 8384542..51b9bc4 100755 --- a/bin/menuscripts/mpassgen +++ b/bin/menuscripts/mpassgen @@ -1,46 +1,21 @@ #!/usr/bin/env sh -input () -{ - # menu prompt for output - if [ "$MENUCMD" = "tofi" ] - then - inp="$(tofi --prompt-text "$1 " </dev/null)" - elif [ "$MENUCMD" = "dmenu" ] - then - inp="$(dmenu -p "$1" < /dev/null)" - else - echo -n "$1" >&2 - read inp - fi - echo $inp -} -# menu select long -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi --prompt login:" -elif [ "$MENUCMD" = "dmenu" ] -then - menucmd="dmenu -l 10 -g 1 -x -i -p login:" -else - menucmd="fzf" -fi +input () { commander -c -i -p "$1"; } -choice="$(echo "multiline\nsingle" | $MENUCMD)" -test -z "${choice}" && exit 1 +choice="$(printf "multiline\nsingle\n" | commander -c -d)" +[ "$choice" ] || exit 1 password="$(input "name:")" -test -z "${password}" && exit 1 +[ "$password" ] || exit 1 -if [ "${choice}" = "multiline" ] +if [ "$choice" = "multiline" ] then - login="$(ls -1 ${PASSWORD_STORE_DIR:=$HOME/.password-store}/e-mails | - sed 's/\.gpg$//' | - $menucmd)" - test -z "${login}" && exit 1 + login="$(find "${PASSWORD_STORE_DIR:=$HOME/.password-store}"/e-mails -type f -maxdepth 1 -iname "*.gpg" -printf "%f\n" | + sed 's/\.gpg$//' | commander -c -d -p 'login:')" + [ "$login" ] || exit 1 url="$(input "url:")" - test -z "${url}" && exit 1 - echo "${password}\nlogin: ${login}\nurl: ${url}" | + [ "$url" ] || exit 1 + printf "%s\nlogin: %s\nurl: %s\n" "${password}" "${login}" "${url}" | pass insert -mf "${password}" pass generate -ci "${password}" else diff --git a/bin/menuscripts/mpdf b/bin/menuscripts/mpdf index d67fdae..85debfb 100755 --- a/bin/menuscripts/mpdf +++ b/bin/menuscripts/mpdf @@ -1,22 +1,10 @@ #!/bin/sh -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi --width 30% --height 30% --matching-algorithm normal --prompt-text pdf:" -elif [ "$MENUCMD" = "dmenu" ] -then - menucmd="dmenu -l 10 -g 1 -x -i -p pdf:" -else - menucmd="fzf" -fi - -tmp="/tmp/dmpdf" -find ${1:-$HOME/docs $HOME/dl} 2> /dev/null | grep -E ".+\.pdf" | sort > "$tmp" -choice="$(sed "s|^$HOME|\~| ; s|\([^/]\)[^/]*/|\1/|g" "$tmp" | - awk '{printf "%s %s\n", NR ":", $0}' | - $menucmd | - grep -o "^[0-9]\+:" | - cut -f 1 -d :)" -test -z "$choice" && exit 1 +tmp="/tmp/mpdf" +choice="$(find ${1:-$HOME/docs $HOME/dl} -iname "*.pdf" 2> /dev/null | sort | + tee "$tmp" | + sed "s|^$HOME|\~| ; s|\([^/]\)[^/]*/|\1/|g" | + commander -x -n)" file="$(sed -n "${choice}p" "$tmp")" +[ -r "$file" ] || exit 1 zathura "$file" & diff --git a/bin/menuscripts/mplay b/bin/menuscripts/mplay index 08fcc46..e4fca54 100755 --- a/bin/menuscripts/mplay +++ b/bin/menuscripts/mplay @@ -1,16 +1,6 @@ #!/bin/sh -# menu select long -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi --width 50% --height 30% --matching-algorithm normal" -elif [ "$MENUCMD" = "dmenu" ] -then - menucmd="dmenu -l 10 -g 1 -x -i" -else - menucmd="fzf" -fi -choice="$(mpc listall | $menucmd)" -test -z "$choice" && - exit 1 -mpc insert "$choice" && - mpc next +choice="$(mpc listall | commander -c -l -d -x)" +[ "$choice" ] || exit 1 +mpc insert "$choice" || exit 1 +mpc next 2> /dev/null +mpc play 2> /dev/null diff --git a/bin/menuscripts/mpower b/bin/menuscripts/mpower index 443ed54..3b66824 100755 --- a/bin/menuscripts/mpower +++ b/bin/menuscripts/mpower @@ -1,14 +1,8 @@ #!/bin/sh -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi --width 10% --height 13% --padding-left 2%" -elif [ "$MENUCMD" = "dmenu" ] -then - menucmd="dmenu -g 2 -l 2" -else - menucmd="fzf" -fi +choice="$(printf 'poweroff +suspend +hibernate +reboot +' | commander -c -d)" -choices="poweroff\nreboot\nhibernate\nsuspend" -choice="$(printf "$choices" | $menucmd)" -test -z "$choice" || systemctl "$choice" +[ "$choice" ] && systemctl "$choice" diff --git a/bin/menuscripts/mvid b/bin/menuscripts/mvid index ca309fb..85187cb 100755 --- a/bin/menuscripts/mvid +++ b/bin/menuscripts/mvid @@ -1,27 +1,16 @@ #!/usr/bin/env sh -tmpfile="/tmp/dmvids" +tmp="/tmp/dmvids" dirs="${1:-$HOME/vids $HOME/dl}" -find -L $dirs 2> /dev/null | - grep ".\+\.\(webm\|mp4\|mpeg\|mkv\)$" | - sort > "$tmpfile" -if [ "$MENUCMD" = "tofi" ] -then - menucmd="tofi --width 30% --height 30% --matching-algorithm normal" -elif [ "$MENUCMD" = "dmenu" ] -then - menucmd="dmenu -l 10 -g 1 -x -i" -else - menucmd="fzf" -fi +choice="$(find -L $dirs 2> /dev/null | + grep '^.\+\.\(webm\|mp4\|mpeg\|mkv\)$' | + sort | tee "$tmp" | + sed "s#^$HOME#\~#;s#\([^/]\)[^/]*/#\1/#g" | + commander -d -n -x)" -choice="$(sed "s|^$HOME|\~| ; s|\([^/]\)[^/]*/|\1/|g" "$tmpfile" | - awk '{printf "%s %s\n", NR ":", $0}' | - $menucmd | - cut -f 1 -d ':')" -test -z "$choice" && - exit 1 +file="$(sed -n "${choice}p" "$tmp")" +[ -r "$file" ] || exit 1 -mpv "$(sed -n "${choice}p" "$tmpfile")" +mpv "$file" diff --git a/config/X/dunst/dunstrc b/config/X/dunst/dunstrc index 71998b9..0c4eebc 100644 --- a/config/X/dunst/dunstrc +++ b/config/X/dunst/dunstrc @@ -30,10 +30,10 @@ height = 80 # Position the notification in the top right corner - origin = top-center + origin = right # Offset from the origin - offset = 0x10 + offset = 10x10 # Scale factor. It is auto-detected if value is 0. scale = 0 @@ -87,7 +87,7 @@ # Defines width in pixels of frame around the notification window. # Set to 0 to disable. - frame_width = 1 + frame_width = 0 # Defines color of the frame around the notification window. frame_color = "#969B95" @@ -96,7 +96,7 @@ # If value is greater than 0, separator_height will be ignored and a border # of size frame_width will be drawn around each notification instead. # Click events on gaps do not currently propagate to applications below. - gap_size = 2 + gap_size = 4 # Define a color for the separator. # possible values are: @@ -118,11 +118,11 @@ ### Text ### - font = mononoki nerd font mono 10 + font = mononoki nerd font mono 11 # The spacing between lines. If the height is smaller than the # font height, it will get raised to the font height. - line_height = 11 + line_height = 7 # Possible values are: # full: Allow a small subset of html markup in notifications: @@ -158,7 +158,7 @@ # %n progress value if set without any extra characters # %% Literal % # Markup is allowed - format = "%b" + format = "[<u>%s</u>]\n%b" # Alignment of message text. # Possible values are "left", "center" and "right". @@ -181,7 +181,7 @@ ignore_newline = no # Stack together notifications with the same content - stack_duplicates = false + stack_duplicates = true # Hide the count of stacked notifications with the same content hide_duplicate_count = false @@ -310,13 +310,13 @@ # Otherwise the "#" and following would be interpreted as a comment. # Icon for notifications with low urgency, uncomment to enable #default_icon = /path/to/icon - background = "#d08770" - foreground = "#2E3541" + background = "#b48ead" + foreground = "#2e3440" frame_color = "#81a1c1" timeout = 6 [urgency_normal] - background = "#b48ead" + background = "#81a1c1" foreground = "#2e3440" frame_color = "#2e3440" timeout = 5 @@ -324,9 +324,10 @@ #default_icon = /path/to/icon [urgency_critical] - background = "#b48ead" - foreground = "#d8dee9" + background = "#d08770" + foreground = "#2e3440" frame_color = "#81a1c1" + format = "[<u>%s</u>]\n<b>%b</b>" timeout = 0 # Icon for notifications with critical urgency, uncomment to enable #default_icon = /path/to/icon diff --git a/config/common/alacritty/alacritty.yml b/config/common/alacritty/alacritty.yml index e5664f1..32fc95b 100644 --- a/config/common/alacritty/alacritty.yml +++ b/config/common/alacritty/alacritty.yml @@ -761,7 +761,7 @@ hints: # # If the same trigger is assigned to multiple actions, all of them are executed # in the order they were defined in. -# key_bindings: +key_bindings: #- { key: Paste, action: Paste } #- { key: Copy, action: Copy } #- { key: L, mods: Control, action: ClearLogNotice } @@ -871,6 +871,7 @@ hints: #- { key: F, mods: Command|Control, action: ToggleFullscreen } #- { key: F, mods: Command, mode: ~Search, action: SearchForward } #- { key: B, mods: Command, mode: ~Search, action: SearchBackward } + - {key: F11, action: ToggleFullscreen} #debug: # Display the time it takes to redraw each frame. diff --git a/config/common/mpv/mpv.conf b/config/common/mpv/mpv.conf index 4f5e251..7d9d1fe 100755 --- a/config/common/mpv/mpv.conf +++ b/config/common/mpv/mpv.conf @@ -26,3 +26,5 @@ force-seekable=yes slang=eng, en, english alang=jpn + +screenshot-directory=~/pics/screenshots diff --git a/config/common/ncmpcpp/bindings b/config/common/ncmpcpp/bindings index d2a5eb6..b7921e7 100644 --- a/config/common/ncmpcpp/bindings +++ b/config/common/ncmpcpp/bindings @@ -194,9 +194,9 @@ def_key "p" def_key "P" play -def_key "H" +def_key "g" move_home -def_key "L" +def_key "G" move_end def_key "ctrl-u" diff --git a/config/common/tmux/tmux.conf b/config/common/tmux/tmux.conf index 409ad66..80ab9ca 100755 --- a/config/common/tmux/tmux.conf +++ b/config/common/tmux/tmux.conf @@ -1,9 +1,5 @@ -# By Nicholas Marriott. Public domain. -# but -now- me. +# Special thanks to Nicholas Marriott. -# Some tweaks to the status line -set -g status-right "%H:%M" -set -g window-status-current-style "underscore" # Enable RGB color if running in xterm set-option -sa terminal-overrides ",xterm*:Tc" # Change the default $TERM to xterm-256color @@ -26,7 +22,7 @@ set -g focus-events on # KEYBINDINGS # Reload config file -bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf" +bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded ~/.tmux.conf" # Clipboard bind -T copy-mode-vi v send-keys -X begin-selection bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -r -selection clipboard" @@ -82,9 +78,55 @@ bind -n M-I switch-client -n bind n command-prompt "rename-window '%%'" bind N command-prompt "rename-session '%%'" # Starting new windows -bind w new-window -c "#{pane_current_path}" +bind w new-window -c "$HOME" bind W new-session -c "$HOME" # Show tree bind S choose-tree -Z # Menu for mounting and ejecting devices. bind E display-menu -T "#[align=centre]#I:#W" -x W -y W '' Mount 0 "display-popup -E 'amount'" + +# Theme + +#+---------+ +#+ Options + +#+---------+ +set -g status-interval 1 +set -g status on + +#+--------+ +#+ Status + +#+--------+ +#+--- Layout ---+ +set -g set-titles-string "[#S:#I] #T" +set -g set-titles on +set -g status-position top +set -g window-status-current-style "underscore" +set -g status-justify left +set -g status-left "#[fg=black,bg=blue,bold] #S #[fg=blue,bg=black,nobold,noitalics,nounderscore]" +set -g status-right "#[fg=brightblack,bg=black,nobold,noitalics,nounderscore]#[fg=white,bg=brightblack] %H:%M #[fg=white,bg=brightblack,nobold,noitalics,nounderscore]#[fg=white,bg=brightblack] #{client_user} #[fg=cyan,bg=brightblack,nobold,noitalics,nounderscore]#[fg=black,bg=cyan,bold] #H " +#+--- Colors ---+ +set -g status-style bg=black,fg=white + +#+-------+ +#+ Panes + +#+-------+ +set -g pane-border-style bg=default,fg=brightblack +set -g pane-active-border-style bg=default,fg=blue +set -g display-panes-colour black +set -g display-panes-active-colour brightblack + +#+------------+ +#+ Clock Mode + +#+------------+ +setw -g clock-mode-colour cyan + +#+----------+ +#+ Messages + +#+---------+ +set -g message-style bg=brightblack,fg=cyan +set -g message-command-style bg=brightblack,fg=cyan + +#+--- Windows ---+ +set -g window-status-format "#[fg=black,bg=brightblack,nobold,noitalics,nounderscore] #[fg=white,bg=brightblack]#I #[fg=white,bg=brightblack,nobold,noitalics,nounderscore] #[fg=white,bg=brightblack]#W #F #[fg=brightblack,bg=black,nobold,noitalics,nounderscore]" +set -g window-status-current-format "#[fg=black,bg=cyan,nobold,noitalics,nounderscore] #[fg=black,bg=cyan]#I #[fg=black,bg=cyan,nobold,noitalics,nounderscore] #[fg=black,bg=cyan]#W #F #[fg=cyan,bg=black,nobold,noitalics,nounderscore]" +set -g window-status-separator "" diff --git a/config/essentials/nvim/after/plugin/luasnip.lua b/config/essentials/nvim/after/plugin/luasnip.lua index 7ee274f..5657560 100644 --- a/config/essentials/nvim/after/plugin/luasnip.lua +++ b/config/essentials/nvim/after/plugin/luasnip.lua @@ -155,18 +155,14 @@ ls.add_snippets("sh", { stty \$old_stty_cfg } ]], {}), - parse("fdie", + parse("flogn", [[ - die () - { - echo "\$@" >&2 - } + logn () { >&2 printf '%s\n' "\$@"; } ]], {}), - s("die", fmt( + parse("flog", [[ - die "{}: {}"{} - ]], - { c(1, {t "I", t "E", t "W"}), i(2), i(0) })), + log () { >&2 printf '%s' "\$@"; } + ]], {}), s("inp", fmt( [[ test -z "${{{}:=$1}}" && diff --git a/config/essentials/nvim/ftplugin/sh.lua b/config/essentials/nvim/ftplugin/sh.lua index 01b20d6..e18170a 100644 --- a/config/essentials/nvim/ftplugin/sh.lua +++ b/config/essentials/nvim/ftplugin/sh.lua @@ -1,6 +1,6 @@ -vim.keymap.set("n", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1echo \"\\2\"<cr>") -vim.keymap.set("n", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1echo \"\\2: $\\2\"<cr>") -vim.keymap.set("i", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1echo \"\\2\"<cr><esc>A") -vim.keymap.set("i", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1echo \"\\2: $\\2\"<cr><esc>A") +vim.keymap.set("n", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1>\\&2 printf \"\\2\"<cr>") +vim.keymap.set("n", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1>\\&2 printf \"\\2: %s\\\\n\" \"$\\2\"<cr>") +vim.keymap.set("i", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1>\\&2 printf \"\\2\"<cr><esc>A") +vim.keymap.set("i", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1>\\&2 printf \"\\2: %s\\\\n\" \"$\\2\"<cr><esc>A") vim.keymap.set({"i", "n"}, "<LocalLeader>v", "<esc>A)\"<esc>I\"$(<esc>I") vim.opt.formatoptions = "cqrnj" diff --git a/config/essentials/nvim/lua/user/packer.lua b/config/essentials/nvim/lua/user/packer.lua index c9e27a2..9351460 100644 --- a/config/essentials/nvim/lua/user/packer.lua +++ b/config/essentials/nvim/lua/user/packer.lua @@ -3,7 +3,7 @@ return require('packer').startup(function(use) -- files use { - 'nvim-telescope/telescope.nvim', tag = '0.1.1', + 'nvim-telescope/telescope.nvim', tag = '0.1.2', requires = { {'nvim-lua/plenary.nvim'} } } use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } diff --git a/config/essentials/nvim/lua/user/remap.lua b/config/essentials/nvim/lua/user/remap.lua index 0fe4164..c50d346 100644 --- a/config/essentials/nvim/lua/user/remap.lua +++ b/config/essentials/nvim/lua/user/remap.lua @@ -15,13 +15,9 @@ vim.keymap.set("i", "\\\\", "\\", { noremap = true }) vim.keymap.set("n", "gb", "<cmd>buffers<cr>:buffer<Space>", { noremap = true }) vim.keymap.set("n", "<Leader>q", "<cmd>q!<cr>", { noremap = true }) vim.keymap.set("n", "<Leader>Q", "<cmd>qa!<cr>", { noremap = true }) +-- close all except focused buffer +vim.keymap.set("n", "<leader>1", "<cmd>%bd|e#<cr>", { noremap = true }) --- Windows -vim.keymap.set("n", "<A-h>", "<C-W>h", { noremap = true }) -vim.keymap.set("n", "<A-j>", "<C-W>j", { noremap = true }) -vim.keymap.set("n", "<A-k>", "<C-W>k", { noremap = true }) -vim.keymap.set("n", "<A-l>", "<C-W>l", { noremap = true }) -vim.keymap.set("n", "<A-o>", "<C-W>o", { noremap = true }) -- command line vim.keymap.set("c", "<M-b>", "<C-Left>", { noremap = true }) vim.keymap.set("c", "<M-f>", "<C-Right>", { noremap = true }) @@ -34,6 +30,8 @@ vim.keymap.set("c", "<C-a>", "<Home>", { noremap = true }) vim.keymap.set("v", "J", "<cmd>m '>+1<cr>gv=gv<cr>", { noremap = true }) vim.keymap.set("v", "K", "<cmd>m '<-2<cr>gv=gv<cr>", { noremap = true }) +vim.keymap.set("n", "+", "<cmd>tabe .<cr>", { noremap = true }) + -- clipboard vim.keymap.set("n", "<Leader>y", "\"+y", { noremap = true }) diff --git a/config/essentials/nvim/lua/user/zk.lua b/config/essentials/nvim/lua/user/zk.lua index 613c8e5..8004238 100644 --- a/config/essentials/nvim/lua/user/zk.lua +++ b/config/essentials/nvim/lua/user/zk.lua @@ -50,6 +50,11 @@ require('telekasten').setup({ template_new_note = home .. "/" .. "templates/new_note.md", new_note_filename = "title", }, + NetworkEssentials = { + home = home .. "/" .. "NetworkEssentials", + template_new_note = home .. "/" .. "templates/new_note.md", + new_note_filename = "title", + }, C = { home = home .. "/" .. "C", template_new_note = home .. "/" .. "templates/new_note.md", diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index d8675d4..eeb4439 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -5,9 +5,9 @@ then clear if [ "/dev/tty1" = "$TTY" ] then - startw > /dev/null 2>&1 + exec startw > /dev/null 2>&1 else - startx > /dev/null 2>&1 + exec startx > /dev/null 2>&1 fi exit fi @@ -89,7 +89,7 @@ rehash_precmd() { # window title hooks add-zsh-hook -Uz precmd rehash_precmd set_wt_action () { - print -Pn '\e]0;$1\a' + print -Pn "\e]0;$1\a\033[0m" } add-zsh-hook -Uz preexec set_wt_action set_wt () { @@ -121,13 +121,13 @@ RPROMPT='%F{blue}$(parse_git_remote)%f%F{red}$(parse_git_status)%f%F{green}$(par setopt prompt_subst parse_git_remote() { - b="$(git branch -v 2> /dev/null | grep "^*" | sed 's/.\+\[\([^ ]\+\).*$/\1/')" + b="$(git branch -v 2>/dev/null | grep "^*" | cut -f2 -d'[' | cut -f1 -d' ')" if [ "$b" = "behind" ] then - echo -n "↓ " + printf "↓ " elif [ "$b" = "ahead" ] then - echo -n "↑ " + printf "↑ " fi } parse_git_branch() { diff --git a/config/essentials/zsh/aliases.sh b/config/essentials/zsh/aliases.sh index 6df28e3..6ac39d5 100644 --- a/config/essentials/zsh/aliases.sh +++ b/config/essentials/zsh/aliases.sh @@ -5,9 +5,6 @@ if [ $SHELL = "/bin/zsh" ] then # googoo aliases - alias o.='o .' - alias go.='go .' - alias ogo.='ogo .' alias o/='o /' alias o/s='o /srv' alias go/='go /' @@ -15,6 +12,8 @@ then alias ogo/='ogo /' alias ogo/s='ogo /srv' + alias calc='bc <<<' + if [ "$WAYLAND_DISPLAY" ] then alias -g clipp='wl-copy -n' @@ -40,6 +39,7 @@ fi if grep -qi "debian\|ubuntu" /etc/os-release 2> /dev/null then alias aptup='apt update && apt upgrade -y' + alias ufwd='echo y | ufw delete "$(ufw status numbered | tail -n +5 | fzf | cut -f2 -d'\''['\'' | cut -f1 -d'\'']'\'')" > /dev/null 2>&1 && >&2 echo "deleted."' fi # Programs @@ -128,12 +128,9 @@ alias xrandr-default='xrandr --auto --output VGA-1 --mode 1920x1080 --left-of HD alias d='du -d 0 -h' alias dud='du .* * -d 0 -h 2>/dev/null | sort -h' alias df='df -h' +alias diff='diff -u --color' alias shred='shred -uz' alias lsblk='lsblk -o name,type,fsused,fsavail,size,fstype,label,mountpoint' -alias floc='doas find / -type "f" 2> /dev/null | grep' -alias dloc='doas find / -type "d" 2> /dev/null | grep' -alias fif='find . -type "f" | grep' -alias fid='find . -type "d" | grep' alias sxt='sxiv -t' alias wgsh='wget --quiet --show-progress' alias wgc='wgsh "$(clipo)"' @@ -144,7 +141,6 @@ alias mdbwa='mariadb -h 10.3.50.5 -u padmin -pbulbizarre padmindb' # ssh alias sha='ssh-add' alias sshs='eval "$(ssh-agent)" && ssh-add' - alias vidlen='ffprobe -show_entries format=duration -v quiet -of csv="p=0" -i' alias whatsmyip='curl -s "ifconfig.co"' alias icognito='unset HISTFILE' @@ -173,16 +169,17 @@ alias kll='killall' alias pi='ping archlinux.org -c4' alias sba='source env/bin/activate || source bin/activate' alias smc='systemctl' -alias ssc='doas systemctl' +alias dsmc='doas systemctl' alias smcu='smc --user' -alias zsr='source ${ZDOTDIR:-$HOME}/.zshrc && rehash' +alias zsr='source ${ZDOTDIR:-~}/.zshrc && rehash' alias rh='rehash' alias wf='doas wipefs -a' alias dmci="doas make clean install" alias rmd='rm -f *.{orig,rej}' alias cdzot='mkdir -p /tmp/zottesite && cd /tmp/zottesite' -alias gdate="date +%y%m%d_%H%M%S" +alias gdate='date +%y_%m_%d-%T' alias tpid='tail -f /dev/null --pid' +alias pwdcp='pwd | clipp' alias vbm='vboxmanage' alias vbls='vbm list vms' @@ -190,7 +187,7 @@ alias vblsr='vbm list runningvms' alias vb='vbm startvm' # quick config -alias ez='$EDITOR ${ZDOTDIR:-$HOME}/.zshrc' +alias ez='$EDITOR ${ZDOTDIR:-~}/.zshrc' alias eza='$EDITOR ${ZDOTDIR}/aliases.sh' alias ezf='$EDITOR ${ZDOTDIR}/functions.zsh' alias eto='$EDITOR ~/sync/TODO' @@ -202,43 +199,48 @@ alias est='$EDITOR ~/proj/suckless/st/config.def.h' alias esl='$EDITOR ~/proj/suckless/slock/config.def.h' alias esls='$EDITOR ~/proj/suckless/slstatus/config.def.h' alias ehy='$EDITOR ~/.config/hypr/hyprland.conf' +alias ewbj='$EDITOR ~/src/dotfiles/config/hyprland/waybar/config.jsonc' +alias ewbs='$EDITOR ~/src/dotfiles/config/hyprland/waybar/style.css' alias cfd='$EDITOR config.def.h' # /# quick cd
jV}k:!sort -t "'" -k 2
-alias cdl='cd $HOME/dl' -alias cdoc='cd $HOME/docs' -alias cda='cd $HOME/docs/android/projects' -alias cdm='cd $HOME/music' -alias cdp='cd $HOME/pics' -alias cdpa='cd $HOME/pics/ai-outputs/' -alias cdpp='cd $HOME/proj/personal/' -alias chom='cd $HOME/proj/personal/homepage' -alias lov='cd $HOME/proj/personal/lola' -alias cdsw='cd $HOME/proj/personal/WheelAdvisor' -alias cddm='cd $HOME/proj/suckless/dmenu' -alias cdw='cd $HOME/proj/suckless/dwm' -alias cdslo='cd $HOME/proj/suckless/slock' -alias cdsl='cd $HOME/proj/suckless/slstatus' -alias cdst='cd $HOME/proj/suckless/st' -alias cdsta='cd $HOME/proj/suckless/stable-diffusion-webui' -alias cdsu='cd $HOME/proj/suckless/surf' -alias cds='cd $HOME/src/' -alias cdsb='cd $HOME/src/build' -alias cdsc='cd $HOME/src/comfyui/' -alias cdo='cd $HOME/src/dotfiles' -alias cdi='cd $HOME/src/installdrier' -alias cdia='cd $HOME/src/installdrier/arch' -alias cdib='cd $HOME/src/installdrier/deb' -alias czo='cd $HOME/zot/' -alias cdpw='cd ${PASSWORD_STORE_DIR:-$HOME/.password-store}' +alias cdl='cd ~/dl' +alias cdoc='cd ~/docs' +alias cda='cd ~/docs/android/projects' +alias cdm='cd ~/music' +alias cdp='cd ~/pics' +alias cdpa='cd ~/pics/ai-outputs/' +alias cdpp='cd ~/proj/personal/' +alias chom='cd ~/proj/personal/homepage' +alias lov='cd ~/proj/personal/lola' +alias cdsh='~/proj/personal/scheduler' +alias cdsw='cd ~/proj/personal/WheelAdvisor' +alias cddm='cd ~/proj/suckless/dmenu' +alias cdw='cd ~/proj/suckless/dwm' +alias cdslo='cd ~/proj/suckless/slock' +alias cdsl='cd ~/proj/suckless/slstatus' +alias cdst='cd ~/proj/suckless/st' +alias cdsta='cd ~/proj/suckless/stable-diffusion-webui' +alias cdsu='cd ~/proj/suckless/surf' +alias cds='cd ~/src/' +alias cdsb='cd ~/src/build' +alias cdsc='cd ~/src/comfyui/' +alias cdo='cd ~/src/dotfiles' +alias cdi='cd ~/src/installdrier' +alias cdia='cd ~/src/installdrier/arch' +alias cdib='cd ~/src/installdrier/deb' +alias czo='cd ~/zot/' +alias cdpw='cd ${PASSWORD_STORE_DIR:-~/.password-store}' alias cdng='cd /etc/nginx' alias cdrs='cd /srv/' # fzf aliases +alias ppj='cd ~/proj/personal/"$(find ~/proj/personal -mindepth 1 -maxdepth 1 -type d -printf "%f\n"| fzf)"' +alias cfg='find -L ~/src/dotfiles -type f | fzf | xargs -r $EDITOR' alias fzps='ps aux | tail +2 | fzf | tee /dev/stderr | awk '\''{print $2}'\'' | clipp' alias asf='alias | fzf' alias fzh="tac $HISTFILE | fzf | tee /dev/stderr | clipp" alias ffwin='hyprctl clients -j | jq '\''.[].pid'\'' | fzf --preview "hyprctl clients -j | jq '\''.[] | select(.pid == {}) | {class, title, workspace, xwayland}'\''"' -alias pff='find ${PASSWORD_STORE_DIR:=$HOME/src/password-store/} -name "*.gpg" | sed -e "s@$PASSWORD_STORE_DIR/@@" -e '\''s/\.gpg$//'\'' | fzf | xargs pass show -c' +alias pff='find ${PASSWORD_STORE_DIR:=~/src/password-store/} -name "*.gpg" | sed -e "s@$PASSWORD_STORE_DIR/@@" -e '\''s/\.gpg$//'\'' | fzf | xargs pass show -c' alias fzps='fzf --print0 | xargs -0I{}' alias dcb='docker build' @@ -254,7 +256,6 @@ alias dbinf='ssh db dlinfo' alias sshdb='ssh -t db tmux a' alias dbsmu='rsync -aPz db:/media/basilisk/music/ /media/kilimanjaro/music' -alias cfg='git --git-dir=$HOME/src/dotfiles/.git --work-tree=$HOME/src/dotfiles' # oh-my-zsh git aliases alias g='git' alias ga='git add' diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index 671e6fb..22a8fbe 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -1,28 +1,19 @@ #!/bin/zsh -die () -{ - echo "$@" >&2 -} - -awnk() { - awk "{print \$$1}" -} +log() { >&2 printf '%s' "$@"; } +logn() { >&2 printf '%s\n' "$@"; } vmp() { col -b | \ vim -MR \ -c 'set ft=man nolist nonu nornu' } -vimh() { - vim -c "help $1" -c 'call feedkeys("\<c-w>o")' -} nvf() { local cache="$HOME/.cache/nvf" local match="$(grep -m1 "$1$" "$cache" 2> /dev/null)" if test ! -f "$match" then - die "resetting cache..." + logn "resetting cache..." match="$(goo | tee "$cache" | grep -m 1 "$1$" 2> /dev/null)" # # Alternative: # match="$(goo | grep -m 1 "$1" 2> /dev/null | tee -a | "$cache")" @@ -31,7 +22,7 @@ nvf() { then $EDITOR "$match" && return else - die "no match." && return 1 + logn "no match." && return 1 fi } @@ -39,27 +30,43 @@ nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit } ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit } # googoo aliases -ff () { goo f "$1" | fzf } -fd () { goo d "$1" | fzf } -fdf () { goo f "$1" | fzf | xargs -I {} dirname "{}" } -o () +_googoo_fzf_opt() +{ + if [ "$1" ] + then + [ -d "$1" ] && dest="$1" || opt="-q $1" + fi +} +o() { - f="$(ff $1)" + _googoo_fzf_opt "$1" + f="$(goo f "$dest" | fzf $opt)" test "$1" && shift - test -n "$f" && $EDITOR $@ "$f" + test -f "$f" && $EDITOR $@ "$f" } -go () +go() { - d="$(fd $1)" - test -d "$d" && cd "$d" + _googoo_fzf_opt "$1" + cd "$(goo d "$dest" | fzf $opt)" } -ogo () +ogo() { - d="$(fdf $1)" - test -d "$d" && cd "$d" + _googoo_fzf_opt "$1" + cd "$(dirname "$(goo f "$dest" | fzf $opt)")" } -ipc () +# Onelineres +awnk() { awk "{print \$$1}"; } +vimh() { vi -c "help $1" -c 'call feedkeys("\<c-w>o")'; } +dgo() { cd "$(goo d ~ | fzf --filter "$@" | head -n 1)"; } +open() { $EDITOR "$(goo f ~ | fzf --filter "$@" | head -n 1)"; } +pkbs() { pkgfile -b "$1" | tee /dev/stderr | doas pacman -S -; } +oclip() { printf "\033]52;c;$(echo -n "$@" | base64)\a"; } +sms() { ssh phone sendmsg "$1" "'$2'"; } +trcp() { scp "$1" db:/media/basilisk/downloads/transmission/torrents/; } +rln() { ln -s "$(readlink -f "$1")" "$2"; } + +ipc() { if [[ "$(ip link show eno1 | awk -F, 'NR=1 {print $3}')" == "UP" ]] then @@ -69,16 +76,20 @@ ipc () fi } -calc () { echo "$@" | bc -l } +psgrep() +{ + [ $# -eq 0 ] && return 1 + pgrep "$@" | xargs ps +} -unique () { +unique() { local f f="$(mktemp)" awk '!x[$0]++' "$1" > "$f" mv "$f" "$1" } -clip () { +clip() { if [ "$WAYLAND_DISPLAY" ] then echo -n "$@" | wl-copy @@ -87,7 +98,7 @@ clip () { fi } -unzipp () { +unzipp() { file=$1 shift unzip $file $@ || exit 1 @@ -95,22 +106,23 @@ unzipp () { } # fix long waiting time -__git_files () { +__git_files() { _wanted files expl 'local files' _files } -esc () { +esc() { $EDITOR "$(which $1)" } -delfile () { +delfile() { curl "${2:-https://upfast.cronyakatsuki.xyz/delete/$1}" } -upfile () { +upfile() { curl -F "file=@\"$1\"" ${2:-https://upfast.cronyakatsuki.xyz} } -sgd () { +# git +sgd() { d="$PWD" find $HOME/src -maxdepth 1 -mindepth 1 -type d | while read -r dir @@ -129,16 +141,24 @@ sgd () { unset d } -# Git functions +ginit() +{ + [ "$1" ] || return 1 + ssh db /var/git/initdir.sh "$1" + git remote add origin git@db:"$1.git" + git push --set-upstream origin $(git_current_branch) +} + # Returns current branch -function git_current_branch() +git_current_branch() { command git rev-parse --git-dir &>/dev/null || return git branch --show-current } # Check if main exists and use instead of master -function git_main_branch() { +git_main_branch() +{ command git rev-parse --git-dir &>/dev/null || return local ref for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default}; do @@ -164,7 +184,7 @@ function git_develop_branch() { } # gpg backup -gpg_backup () +gpg_backup() { gpg --export-secret-keys --armor > private.asc gpg --export --armor > public.asc @@ -173,7 +193,7 @@ gpg_backup () shred -uz {public,private,trust}.asc } -gpg_import () +gpg_import() { tar xf $1 shred -uz $1 @@ -183,29 +203,29 @@ gpg_import () shred -uz {public,private,trust}.asc } -ngenable () +ngenable() { ln -sf /etc/nginx/sites-available/$1 /etc/nginx/sites-enabled/ } -vbsr () +vbsr() { vboxmanage snapshot "$1" restore "$2" && vboxmanage startvm "$1" || vboxmanage controlvm "$1" poweroff } -vbsrr () +vbsrr() { vbsr "$1" "$2" sleep 3 vbsr "$1" "$2" } -vbst () +vbst() { vboxmanage snapshot "$1" take "$2" } -pacsize () +pacsize() { if test -n "$1"; then packages="$@" @@ -219,22 +239,18 @@ pacsize () expac '%m %n' - | numfmt --to=iec-i --suffix=B --format="%.2f" } -pkbs () -{ - pkgfile -b "$1" | tee /dev/stderr | doas pacman -S - -} mime-default () { - die "Setting '$1' as default for its mimetypes" + logn "Setting '$1' as default for its mimetypes" grep "MimeType=" /usr/share/applications/"$1" | cut -d '=' -f 2- | tr ';' '\n' | xargs -I {} xdg-mime default "$1" "{}" - die "Done." + logn "Done." } -addedkeys () { +addedkeys() { find ~/.ssh -iname "*.pub" | while read key do local fingerprint="$(ssh-keygen -lf "$key" 2>/dev/null)" @@ -245,7 +261,7 @@ addedkeys () { done | sed "s,$HOME/.ssh/,," } -fpass () { +fpass() { find $HOME/.password-store -type f -not -path ".git" | grep "\.gpg$" | sed "s,$HOME/.password-store/,,;s,\.gpg$,," | @@ -253,33 +269,18 @@ fpass () { xargs pass show -c } -oclip () -{ - printf "\033]52;c;$(echo -n "$@" | base64)\a" -} - -sms () -{ - ssh phone sendmsg "$1" "'$2'" -} - -trcp () -{ - scp "$1" db:/media/basilisk/downloads/transmission/torrents/ -} - -muttmail () +muttmail() { - die -n "email set: " + log "email set: " ls $HOME/.config/mutt/configs | fzf | tee /dev/stderr | xargs -I {} ln -sf "$HOME/.config/mutt/configs/{}" $HOME/.config/mutt/muttrc - die -n 'Press [Enter to login]' + log 'Press [Enter to login]' read && mutt } -resize () +resize() { test $# -lt 2 && printf "usage: %s <format> <file> [out]\n" "$0" >&2 && diff --git a/config/extra/tridactyl/tridactylrc b/config/extra/tridactyl/tridactylrc index c48ffe1..f7e1935 100644 --- a/config/extra/tridactyl/tridactylrc +++ b/config/extra/tridactyl/tridactylrc @@ -8,7 +8,8 @@ set searchurls.aur https://aur.archlinux.org/packages?O=0&K=%s set searchurls.aw https://wiki.archlinux.org/title/%s set searchurls.cnrtl http://www.cnrtl.fr/lexicographie/ set searchurls.dhu https://hub.docker.com/search?q=%s -set searchurls.g https://www.google.com/search?q=%s +set searchurls.g https://www.qwant.com/?q=%s +set searchurls.google https://www.qwant.com/?q=%s set searchurls.gm https://www.google.com/maps?q=%s set searchurls.gwi https://wiki.gentoo.org/index.php?title=Special%3ASearch&profile=default&fulltext=Search&search= set searchurls.im https://www.imdb.com/find?q=%s @@ -59,3 +60,11 @@ bind gpdy tabopen http://debuc.com:9010 " For syntax highlighting see https://github.com/tridactyl/vim-tridactyl " vim: set filetype=tridactyl + +modeindicatormodes.normal true +set modeindicatormodes.insert true +set modeindicatormodes.input true +set modeindicatormodes.ignore false +set modeindicatormodes.ex true +set modeindicatormodes.hint true +set modeindicatormodes.visual true diff --git a/config/home/.zshenv b/config/home/.zshenv index d1cd73a..b83cad5 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -19,11 +19,16 @@ export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc export GNUPGHOME="$XDG_CONFIG_HOME"/gnupg export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc-2.0 export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc -export NVM_DIR="$XDG_DATA_HOME/nvm" +export NVM_DIR="$XDG_DATA_HOME"/nvm export W3M_DIR="$XDG_STATE_HOME"/w3m export GOPATH="$XDG_DATA_HOME"/go export GOMODCACHE="$XDG_CACHE_HOME"/go/mod export TNS_ADMIN=/opt/oracle/instantclient_21_9/network/admin +export WGETRC="$XDG_CONFIG_HOME"/wgetrc +export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages +export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel +export MYSQL_HISTFILE="$XDG_DATA_HOME"/mysql_history +export RANDFILE="$XDG_CACHE_HOME"/rnd export XINITRC="$XDG_CONFIG_HOME/x11"/xinitrc export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority @@ -50,3 +55,11 @@ export PASSWORD_STORE_CLIP_TIME=5 # export VIMINIT="source ~/.config/vim/vimrc" # export fpath=($XDG_CONFIG_HOME/zsh/completion/ $fpath) # export CUDA_CACHE_PATH="$XDG_CONFIG_HOME"/nv + +export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS' + --color=fg:#e5e9f0,hl:#88c0d0 + --color=pointer:blue + --color=gutter:#2e3440 + --color=fg+:#81a1c1,hl+:#ebcb8b + --color=info:#b48ead,prompt:#bf6069,pointer:#b48dac + --color=marker:#a3be8b,spinner:#ebcb8b,header:#a3be8b' diff --git a/config/hyprland/hypr/binds.conf b/config/hyprland/hypr/binds.conf index eb3d4a2..8100868 100644 --- a/config/hyprland/hypr/binds.conf +++ b/config/hyprland/hypr/binds.conf @@ -2,12 +2,10 @@ $mainMod = SUPER $term = foot -$menu = $(tofi-run) -$menu_opt = $(tofi-run --auto-accept-single=false) +$menu = $(commander -r -h) bind = $mainMod, Return, exec, $term bind = $mainMod SHIFT, Return, exec, $menu -bind = $mainMod CTRL, Return, exec, $menu_opt bind = $mainMod, C, killactive, bind = $mainMod SHIFT, C, exec, hyprctl kill bind = $mainMod SHIFT, Q, exit, diff --git a/config/hyprland/hypr/hyprland.conf b/config/hyprland/hypr/hyprland.conf index a8a99c2..17f0235 100644 --- a/config/hyprland/hypr/hyprland.conf +++ b/config/hyprland/hypr/hyprland.conf @@ -41,14 +41,17 @@ misc { } decoration { - rounding = 2 - blur = no - blur_size = 3 - blur_passes = 1 - blur_new_optimizations = on + rounding = 0 + blur { + enabled = 1 + size = 6 + } dim_inactive = true dim_strength = 0.08 + active_opacity = 0.98 + inactive_opacity = 0.92 + drop_shadow = yes shadow_range = 4 shadow_render_power = 3 diff --git a/config/hyprland/hypr/startup.sh b/config/hyprland/hypr/startup.sh index 83fefe4..6d5957f 100755 --- a/config/hyprland/hypr/startup.sh +++ b/config/hyprland/hypr/startup.sh @@ -5,3 +5,4 @@ gammastep & wl-paste --watch cliphist store & keyadd id_rsa & swayidle 300 locker & +$TERMINAL & diff --git a/config/hyprland/tofi/themes/nord b/config/hyprland/tofi/themes/nord index cf78b5c..c8a6192 100644 --- a/config/hyprland/tofi/themes/nord +++ b/config/hyprland/tofi/themes/nord @@ -1,7 +1,9 @@ ### Font font = monospace bold font-size = 12 +anchor=top +# colors text-color = #d8dee9 prompt-color = #81a1c1 placeholder-color = #4c566a @@ -9,25 +11,28 @@ input-color = #d8dee9 default-result-color = #88c0d0 selection-color = #5e81ac selection-match-color = #ffffff +background-color = #3b4252f2 +outline-color = #81a1c1 +border-color = #88c0d0 -prompt-text = "" -prompt-padding = 0 -placeholder-text = "..." - -width = 20% +# sizes +width = 100% height = 20% -background-color = #2e3440f0 -outline-width = 0 -outline-color = #81a1c1 + border-width = 2 -border-color = #88c0d0 -corner-radius = 26 +outline-width = 0 +prompt-padding = 0 -padding-top = 0 -padding-bottom = 0 -padding-left = 0 -# padding-left = 7% -padding-right = 0 +padding-top = 5 +padding-bottom = 5 +padding-left = 5 +padding-right = 5 + +corner-radius = 0 + +# general +prompt-text = "" +placeholder-text = "..." matching-algorithm = prefix require-match = false diff --git a/config/hyprland/waybar/config.jsonc b/config/hyprland/waybar/config.jsonc index aadc6d3..6866f62 100644 --- a/config/hyprland/waybar/config.jsonc +++ b/config/hyprland/waybar/config.jsonc @@ -1,21 +1,18 @@ { "layer": "top", - "modules-left": ["battery", "clock", "wlr/workspaces", "mpd"], - "modules-center": ["hyprland/window"], + "modules-left": ["battery", "hyprland/workspaces", "mpd", "hyprland/window"], + "modules-center": ["clock"], "modules-right": ["custom/wireguard", "network", "pulseaudio", "temperature", "cpu", "custom/memory", "tray"], - "wlr/workspaces": { - "on-click": "activate", - }, "mpd": { - "tooltip": false, "format": "{artist} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S})", "artist-len": 24, - "format-disconnected": "", + "format-disconnected": "s", "format-stopped": "", "state-icons": { "playing": "", "paused": "", }, + "tooltip-format": "{songPosition}/{queueLength} ({volume}%)", "on-click": "mpc toggle", "on-scroll-up": "mpc volume +5", "on-scroll-down": "mpc volume -5", @@ -29,7 +26,6 @@ "separate-outputs": true, }, "pulseaudio": { - "tooltip": false, "scroll-step": 5, "format": "{icon} {volume:3}%", "format-icons": { @@ -57,7 +53,6 @@ "format-disconnected": "", }, "cpu": { - "tooltip": false, "format": " {usage:2}%", "interval": 3, }, @@ -67,8 +62,8 @@ "restart-interval": 3, }, "clock": { - "format": "{:%H:%M}", - "format-alt": "{:(%R) %A %d %B}", + "format": "{:%R}", + "format-alt": "{:(%T) %A %d %B}", "interval": 1, }, "tray": { diff --git a/config/hyprland/waybar/schemes/base16.css b/config/hyprland/waybar/schemes/base16.css index 19bb703..76efbb3 100644 --- a/config/hyprland/waybar/schemes/base16.css +++ b/config/hyprland/waybar/schemes/base16.css @@ -29,6 +29,12 @@ window#waybar.hidden { opacity: 0.2; } +tooltip { + background: @background; + color: @foreground; + border: 2px solid @color0; +} + window#waybar.termite #window, window#waybar.Firefox #window, window#waybar.Navigator #window, @@ -37,19 +43,21 @@ window#waybar.PCSX2 #window { background: @color7; } -#mpd, #battery, -#window, -#custom-wireguard, #network, #pulseaudio, #temperature, #cpu, #custom-memory { - margin-left: 8px; - padding-left: 16px; - padding-right: 16px; - border-radius: 26px; +.modules-right * { + padding: 0 16px; +} + +.modules-right { + margin-right: 2px; +} +.modules-left { + margin-left: 2px; } #workspaces, #mpd, #battery, #clock, -#window, #custom-wireguard, #network, #pulseaudio, #temperature, #cpu, #custom-memory, #tray { - border: solid @background 2px; + border: solid @background; + border-width: 2px 2px 2px 0; margin-top: 4px; margin-bottom: 2px; transition: none; @@ -62,20 +70,18 @@ window#waybar.PCSX2 #window { } #workspaces { - margin-left: 12px; - border-radius: 26px; + border: solid @background 2px; background: @color3; } #workspaces button { transition: none; background: transparent; - font-size: 16px; color: @background; } #workspaces button.active { - text-shadow: 1px 0px 1px @background; + text-shadow: 0px 1px 0px @color1; } #workspaces button:hover { @@ -85,6 +91,7 @@ window#waybar.PCSX2 #window { #mpd { color: @background; + padding: 0 16px; background: @color6; } @@ -96,30 +103,27 @@ window#waybar.PCSX2 #window { } #clock { - margin-top: 4px; - margin-bottom: 2px; - margin-left: 8px; - padding-left: 16px; - padding-right: 16px; - border-radius: 26px; + border: solid @color4 2px; + padding: 0 16px; color: @color3; background: @background; - border-color: @color4; } #window { - color: @background; - background: @color4; + margin-left: 16px; + padding: 0; + color: @color5; } #custom-wireguard { color: @color5; - border-color: @color8; + border: 2px solid @color8; background: @background; } #network { color: @background; + border-left: 2px solid @background; background: @color5; } @@ -139,20 +143,13 @@ window#waybar.PCSX2 #window { } #custom-memory { - margin-left: 8px; - margin-right: 12px; - padding-left: 16px; - padding-right: 16px; - border-radius: 26px; + padding: 0 16px; color: @background; background: @color5; } -#tray { - border: none; - margin-right: 12px; - color: @foreground; - background: transparent; +#tray * { + padding: unset; } #tray > .needs-attention { |