This commit is contained in:
ange 2025-01-30 13:55:36 +00:00
parent ddbc24a33f
commit ddd00d7844
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
16 changed files with 121 additions and 91 deletions

View File

@ -12,8 +12,8 @@ function gi() {
}
function update() {
$TERM --hold -e "$SHELL" -ic "pac -Syu && echo $'\e[32mDONE'" &
$TERM --hold -e "$SHELL" -ic "flatpak update && echo -e $'\e[32mDONE'" &
$TERM --hold -e "$SHELL" -c "sudo pacman -Syu && echo $'\e[32mDONE'" &
$TERM --hold -e "$SHELL" -c "flatpak update && echo -e $'\e[32mDONE'" &
$TERM --hold -e "$SHELL" -ic "cd && c submodule update --remote --recursive && echo $'\e[32mDONE'" &
}
@ -21,37 +21,39 @@ function tmp() {
cd "$(mktemp -d --tmpdir "$1"XXX)" || return
}
alias ...='../..' \
....='../../..' \
.....='../../../..' \
......='../../../../..' \
c='git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"' \
cp='cp -vi' \
diff='diff --color' \
feh='feh --auto-zoom --scale-down' \
g=git \
grep='grep --color --exclude-dir={.cache,.git,.idea,.venv,.vscode,node_modules}' \
ip='ip -c=auto' \
l='ll -a' \
la='ll -A' \
ll='ls -lh' \
ls='ls --color' \
mail=aerc \
mkdir='mkdir -v' \
mv='mv -vi' \
neofetch=fastfetch \
pac='sudo pacman' \
qcp='qcp -o tabsize=4' \
qmv='qmv -o tabsize=4' \
rm='rm -vI' \
rss=newsraft \
rsync='rsync -P' \
ssh='TERM=xterm-256color ssh' \
sudo='sudo ' \
vi='$EDITOR' \
watch='watch -c ' \
xargs='xargs ' \
xmr='monero-wallet-cli --daemon-address monero.maby.dev:18081 --trusted-daemon --log-file=/tmp/monero-wallet-cli.log --wallet-file /home/ange/.config/monero/ange'
alias -- \
-='cd -' \
......='../../../../..' \
.....='../../../..' \
....='../../..' \
...='../..' \
c='git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"' \
cp='cp -vi' \
diff='diff --color' \
feh='feh --auto-zoom --scale-down' \
g=git \
grep='grep --color --exclude-dir={.cache,.git,.idea,.venv,.vscode,node_modules}' \
ip='ip -c=auto' \
l='ll -a' \
la='ll -A' \
ll='ls -lh' \
ls='ls --color' \
mail=aerc \
mkdir='mkdir -v' \
mv='mv -vi' \
neofetch=fastfetch \
qcp='qcp -o tabsize=4' \
qmv='qmv -o tabsize=4' \
rm='rm -vI' \
rss=newsraft \
rsync='rsync -P' \
ssh='TERM=xterm-256color ssh' \
sudo='sudo ' \
vi='$EDITOR' \
watch='watch -c ' \
waydroid='cage -- waydroid' \
xargs='xargs ' \
xmr='monero-wallet-cli --daemon-address monero.maby.dev:18081 --trusted-daemon --log-file=/tmp/monero-wallet-cli.log --wallet-file $XDG_CONFIG_HOME/.config/monero/ange'
. /usr/share/git/completion/git-completion.bash
$(complete -p git) p c

View File

@ -0,0 +1,2 @@
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2

@ -1 +1 @@
Subproject commit a67a312e7b08cbf2895d8f29a4b1f38f18d9a8e8
Subproject commit 0c94de7e9792cf89c14a865ab819ad5c6e6a7f77

3
.gitmodules vendored
View File

@ -19,3 +19,6 @@
[submodule ".local/aur/sparrow"]
path = .local/aur/sparrow
url = https://aur.archlinux.org/sparrow-wallet.git
[submodule ".local/aur/waydroid"]
path = .local/aur/waydroid
url = https://aur.archlinux.org/waydroid.git

1
.local/aur/waydroid Submodule

@ -0,0 +1 @@
Subproject commit d19d5823400fc065a3b0ea9bb1eb8b7cc9cb5e12

View File

@ -12,7 +12,10 @@ case "${1:0:1}" in
*) CUR="$1" ;;
esac
[ "$CUR" -lt 0 ] && CUR=0
[ "$CUR" -gt "$MAX" ] && CUR="$MAX"
if [ "$CUR" -lt 0 ]; then
CUR=0
elif [ "$CUR" -gt "$MAX" ]; then
CUR="$MAX"
fi
echo "$CUR" > "$DIR/brightness"

View File

@ -19,43 +19,42 @@ function update_bat() {
dir='/sys/class/power_supply/BAT0'
cap="$(cat "$dir/capacity")"
{ grep -qv Discharging "$dir/status" && bat=" $cap%"; } ||
{ [ "$cap" -gt 80 ] && bat=" $cap%"; } ||
{ [ "$cap" -gt 60 ] && bat=" $cap%"; } ||
{ [ "$cap" -gt 40 ] && bat=" $cap%"; } ||
{ [ "$cap" -gt 20 ] && bat=" $cap%"; } ||
{ bat=" $cap%"; }
if grep -qv Discharging "$dir/status"; then
bat=" $cap%"
elif [ "$cap" -gt 80 ]; then bat=" $cap%"
elif [ "$cap" -gt 60 ]; then bat=" $cap%"
elif [ "$cap" -gt 40 ]; then bat=" $cap%"
elif [ "$cap" -gt 20 ]; then bat=" $cap%"
else bat=" $cap%"
fi
}
function update_sink_vol() {
local sink vol
local vol mute
sink="$(wpctl get-volume '@DEFAULT_AUDIO_SINK@')"
if grep -q MUTED <<< "$sink"; then
sink_vol='🔇'
return
read -r vol mute < <(wpctl get-volume '@DEFAULT_AUDIO_SINK@')
vol="$((10#${vol/./}))"
if [ -n "$mute" ]; then sink_vol='🔇'
elif [ "$vol" -gt 67 ]; then sink_vol=" $vol"
elif [ "$vol" -gt 33 ]; then sink_vol=" $vol"
else sink_vol=" $vol"
fi
vol="$(awk '{printf "%.0f", $2 * 100}' <<< "$sink")"
{ [ "$vol" -gt 67 ] && sink_vol=" $vol"; } ||
{ [ "$vol" -gt 33 ] && sink_vol=" $vol"; } ||
{ sink_vol=" $vol"; }
}
function update_source_vol() {
local source vol
local vol mute
source="$(wpctl get-volume '@DEFAULT_AUDIO_SOURCE@')"
if grep -q MUTED <<< "$source"; then
source_vol=''
return
read -r vol mute < <(wpctl get-volume '@DEFAULT_AUDIO_SOURCE@')
vol="$((10#${vol/./}))"
if [ -n "$mute" ]; then source_vol='🔇'
else source_vol=" $vol"
fi
source_vol=" $(awk '{printf "%.0f", $2 * 100}' <<< "$source")"
}
function update_net() {
local dev j ssid sig
dev="$(ip route show default | sed -n 's/.*dev\s\+\(\w\+\).*/\1/p;q')"
dev="$(ip route | grep -oP 'default.*dev\s+\K[^\s]+')"
j="$(networkctl status "$dev" --json=short)"
case "$(jq -r .Type <<< "$j")" in
ether)
@ -64,11 +63,12 @@ function update_net() {
wlan)
ssid="$(jq -r .SSID <<< "$j")"
sig="$(awk "/$dev/{printf \"%.0f\", \$3}" /proc/net/wireless)"
{ [ "$sig" -gt 56 ] && net="▂▄▆█ $ssid"; } ||
{ [ "$sig" -gt 38 ] && net="▂▄▆_ $ssid"; } ||
{ [ "$sig" -gt 21 ] && net="▂▄__ $ssid"; } ||
{ [ "$sig" -gt 3 ] && net="▂___ $ssid"; } ||
{ net="____ $ssid"; }
if [ "$sig" -gt 56 ]; then net="▂▄▆█ $ssid"
elif [ "$sig" -gt 38 ]; then net="▂▄▆_ $ssid"
elif [ "$sig" -gt 21 ]; then net="▂▄__ $ssid"
elif [ "$sig" -gt 3 ]; then net="▂___ $ssid"
else net="____ $ssid"
fi
;;
*)
net='⚠'

View File

@ -7,8 +7,12 @@ OVMF_CODE=/usr/share/edk2/x64/OVMF_CODE.4m.fd
OVMF_VARS=/tmp/OVMF_VARS.4m.fd
set -x
[ -f "$OVMF_VARS" ] || cp -f /usr/share/edk2/x64/OVMF_VARS.4m.fd "$OVMF_VARS"
[ -f "$DISK" ] || qemu-img create -f qcow2 "$DISK" 20G
if [ -f "$OVMF_VARS" ]; then
cp -f /usr/share/edk2/x64/OVMF_VARS.4m.fd "$OVMF_VARS"
fi
if [ -f "$DISK" ]; then
qemu-img create -f qcow2 "$DISK" 20G
fi
qemu-system-x86_64 \
-accel kvm \
-M q35 \

View File

@ -19,8 +19,11 @@ function update_vol() {
case "$1" in
+*|-*)
CUR="$(($CUR + $1 - $CUR % $1 + $CUR % $1 * 10 / $1 / 5 * $1))"
[ "$CUR" -lt 0 ] && CUR=0
[ "$CUR" -gt 150 ] && CUR=150
if [ "$CUR" -lt 0 ]; then
CUR=0
elif [ "$CUR" -gt 300 ]; then
CUR=150
fi
;;
*)
CUR="$1"
@ -40,7 +43,9 @@ else
if [[ "$1" =~ [0-9] ]]; then
update_vol "$1"
fi
[ -n "$MUTE" ] && wpctl set-mute "$DEV" 0
if [ -n "$MUTE" ]; then
wpctl set-mute "$DEV" 0
fi
fi
kill "-$SIG" "$(cat "$HOME/.cache/pidofbar")"

View File

@ -1,24 +1,26 @@
#!/bin/bash -e
function off() {
local ifs
read -ra ifs < <(wg show interfaces) || true
for i in "${ifs[@]}"; do
wg-quick down "$i"
done
}
[ "$EUID" != 0 ] && { pkexec bash -c "DISPLAY='$DISPLAY' XAUTHORITY='$XAUTHORITY' $0 $*"; exit; }
[ "$1" == off ] && { off; exit; }
if [ -n "$DISPLAY" ]; then
if="$(basename -s.conf /etc/wireguard/*.conf | /usr/local/bin/dmenu)"
if tty -s; then
DMENU=fzf
SUDO=sudo
else
select if in $(basename -s.conf /etc/wireguard/*.conf); do
break
done
DMENU=/usr/local/bin/dmenu
SUDO=pkexec
fi
if [ "$EUID" != 0 ]; then
exec "$SUDO" env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" \
"$BASH" -- "${BASH_SOURCE[0]}" "$@"
fi
if [ -z "$1" ]; then
set -- "$(basename -s.conf /etc/wireguard/*.conf | "$DMENU")"
fi
while read -r i; do
wg-quick down "$i"
done < <(wg show interfaces)
if [ "$1" != off ]; then
wg-quick up "$1"
fi
off
wg-quick up "$if"

View File

@ -3,7 +3,9 @@
iwctl=(iwctl station "$(basename /sys/class/net/wlan*)")
rfkill unblock wlan
"${iwctl[@]}" show | grep -q 'Scanning\s\+yes' || "${iwctl[@]}" scan
if ! "${iwctl[@]}" show | grep -q 'Scanning\s\+yes'; then
"${iwctl[@]}" scan
fi
for _ in {0..29}; do
if "${iwctl[@]}" show | grep -q '\s*State\s\+connected\s*$'; then

View File

@ -1,3 +1,5 @@
# vim: ft=bash
function _ddev() {
cache="/tmp/${FUNCNAME[0]}"

View File

@ -1,3 +1,5 @@
# vim: ft=bash
function _gi() {
cache="/tmp/${FUNCNAME[0]}"

View File

@ -1,3 +1,5 @@
# vim: ft=bash
function _kctx() {
[ "$COMP_CWORD" -ne 1 ] && return
mapfile -t COMPREPLY < <(compgen -W \

View File

@ -1,3 +1,5 @@
# vim: ft=bash
function _kns() {
[ "$COMP_CWORD" -ne 1 ] && return
mapfile -t COMPREPLY < <(compgen -W \

View File

@ -1,2 +0,0 @@
. /usr/share/bash-completion/completions/pacman
complete -F _pacman pac