20240721
This commit is contained in:
parent
17b03778ac
commit
5f1b118ff3
@ -3,12 +3,11 @@ export XDG_CONFIG_HOME="$HOME/.config"
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
export XDG_STATE_HOME="$HOME/.local/state"
|
||||
export XDG_CONFIG_DIRS=/etc/xdg
|
||||
export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share"
|
||||
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
|
||||
|
||||
export HISTFILE="$XDG_STATE_HOME/bash_history"
|
||||
export HISTCONTROL=ignorespace:erasedups
|
||||
export HISTSIZE=65536
|
||||
export SAVEHIST=8192
|
||||
export HISTSIZE=1024
|
||||
|
||||
export LESSHISTFILE='-'
|
||||
|
||||
@ -18,12 +17,14 @@ export KUBECACHEDIR="$XDG_CACHE_HOME/kube"
|
||||
export PYTHON_HISTORY="$XDG_STATE_HOME/python_history"
|
||||
export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python"
|
||||
|
||||
export SQLITE_HISTORY=$XDG_STATE_HOME/sqlite_history
|
||||
|
||||
export GOPATH="$XDG_DATA_HOME/go"
|
||||
export GOTELEMETRY=off
|
||||
|
||||
export W3M_DIR="$XDG_STATE_HOME/w3m"
|
||||
|
||||
export PATH="$HOME/.local/bin:$XDG_DATA_HOME/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH"
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
export BROWSER=firefox
|
||||
export EDITOR=nvim
|
||||
@ -38,9 +39,6 @@ export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock"
|
||||
|
||||
export SSH_AUTH_SOCK; SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
systemctl --user import-environment PATH
|
||||
|
||||
[ -z "$DISPLAY" ] && [ "$XDG_VTNR" = 1 ] && {
|
||||
GUILOG="$HOME/.local/state/gui.log"
|
||||
|
||||
|
@ -5,4 +5,4 @@ background = "#101010"
|
||||
size = 9
|
||||
|
||||
[window]
|
||||
opacity = 0.90
|
||||
opacity = 0.9
|
||||
|
@ -1,5 +1,5 @@
|
||||
_compalias() {
|
||||
local name val valarr fn
|
||||
local name val valarr
|
||||
name="${COMP_WORDS[0]}"
|
||||
val="${BASH_ALIASES[$name]}"
|
||||
|
||||
@ -11,8 +11,8 @@ _compalias() {
|
||||
COMP_LINE="${COMP_LINE//$name/$val}"
|
||||
COMP_CWORD=$((${#COMP_WORDS[@]} - 1))
|
||||
COMP_POINT="${#COMP_LINE}"
|
||||
fn="$(complete -p "${COMP_WORDS[0]}" | grep -Po -- '-F\s+\K\w+')"
|
||||
"$fn" "${COMP_WORDS[0]}" "${COMP_WORDS[-1]}" "${COMP_WORDS[-2]}"
|
||||
$(complete -p "${COMP_WORDS[0]}" | grep -Po -- '-F\s+\K\w+') \
|
||||
"${COMP_WORDS[0]}" "${COMP_WORDS[-1]}" "${COMP_WORDS[-2]}"
|
||||
}
|
||||
|
||||
compalias() {
|
||||
|
@ -14,7 +14,9 @@ am() {
|
||||
if mount | grep -q "$name"; then
|
||||
umount "$name"
|
||||
else
|
||||
cd -- "$(udisksctl mount -b "$name" | awk '{print $NF}')"
|
||||
(cd -- "$(udisksctl mount -b "$name" | awk '{print $NF}')"
|
||||
bash
|
||||
)
|
||||
return
|
||||
fi
|
||||
break
|
||||
@ -47,7 +49,7 @@ md2html() {
|
||||
|
||||
update() {
|
||||
$TERM --hold -e "$SHELL" -xc "sudo pacman -Syu && echo $'\e[32mDONE'" &
|
||||
$TERM --hold -e "$SHELL" -xc "git --git-dir='$HOME/.dotfiles/' --work-tree='$HOME' submodule update --remote --recursive && echo $'\e[32mDONE'" &
|
||||
$TERM --hold -e "$SHELL" -xc "git --git-dir='$HOME/.dotfiles/' --work-tree='$HOME' submodule update --remote && echo $'\e[32mDONE'" &
|
||||
}
|
||||
|
||||
tmp() {
|
||||
@ -82,6 +84,7 @@ alias -- \
|
||||
...='../..' \
|
||||
c='git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"' \
|
||||
cp='cp -vi' \
|
||||
df='df -x efivarfs -x tmpfs' \
|
||||
diff='diff --color' \
|
||||
feh='feh --auto-zoom --scale-down' \
|
||||
g=git \
|
||||
@ -93,13 +96,12 @@ alias -- \
|
||||
ls='ls --color' \
|
||||
mail=aerc \
|
||||
mkdir='mkdir -v' \
|
||||
mkisofs='xorriso -as mkisofs -iso-level 3 -full-iso9660-filenames -joliet -joliet-long -rational-rock -output' \
|
||||
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' \
|
||||
|
@ -1,9 +1,11 @@
|
||||
# vim: tabstop=8 nowrap
|
||||
|
||||
# TODO
|
||||
https://www.themoviedb.org/person/86543-david-attenborough
|
||||
https://www.service-public.fr/particuliers/vosdroits/R65687
|
||||
https://wiki.archlinux.org/title/Systemd#systemd.mount_-_mounting
|
||||
https://anubis.techaro.lol/docs/admin/installation
|
||||
https://tech.yahoo.com/articles/mozilla-vpns-per-controls-too-182238290.html
|
||||
https://help.gnome.org/users/zenity/stable/notification.html.en
|
||||
https://www.grepular.com/Automatically_Encrypting_all_Incoming_Email
|
||||
https://www.grepular.com/Protecting_a_Laptop_from_Simple_and_Sophisticated_Attacks
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
[general]
|
||||
temp-day=5000
|
||||
temp-night=3500
|
||||
location-provider=manual
|
||||
|
||||
[manual]
|
||||
lat=-8.65
|
||||
lon=115
|
@ -1,2 +0,0 @@
|
||||
[Settings]
|
||||
gtk-theme-name = Materia-dark
|
@ -1 +0,0 @@
|
||||
map D delete
|
@ -67,5 +67,8 @@ video/ogg=mpv.desktop
|
||||
video/quicktime=mpv.desktop
|
||||
video/webm=mpv.desktop
|
||||
|
||||
# nvim
|
||||
inode/directory=nvim.desktop
|
||||
|
||||
# zathura
|
||||
application/pdf=org.pwmt.zathura-pdf-poppler.desktop
|
||||
|
@ -7,22 +7,15 @@ https://suckless.org/atom.xml "su
|
||||
https://tails.net/news/index.en.rss "Tails"
|
||||
|
||||
@ Updates
|
||||
https://gitea.com/gitea/act_runner/releases.rss "Act runner"
|
||||
https://github.com/arkenfox/user.js/releases.atom "arkenfox"
|
||||
https://github.com/vector-im/element-web/releases.atom "Element" < item-rule "title NOT LIKE '%-rc._'"
|
||||
https://github.com/go-gitea/gitea/releases.atom "Gitea" < item-rule "title NOT LIKE '%-rc_' AND title NOT LIKE '%-dev%'"
|
||||
https://github.com/jellyfin/jellyfin/releases.atom "Jellyfin"
|
||||
https://www.getmonero.org/feed.xml "Monero" < item-rule "title NOT LIKE 'Monero GUI%released'"
|
||||
https://github.com/nextcloud/server/releases.atom "Nextcloud" < item-rule "title NOT LIKE '%rc_' AND title NOT LIKE '%beta_'"
|
||||
https://github.com/qbittorrent/qBittorrent/tags.atom "qBittorrent" < item-rule "title NOT LIKE '%rc_' AND title NOT LIKE '%beta_'"
|
||||
https://github.com/searxng/searxng/commits/master.atom "SearXNG"
|
||||
https://github.com/element-hq/synapse/releases.atom "Synapse" < item-rule "title NOT LIKE '%rc%'"
|
||||
https://github.com/ventoy/Ventoy/releases.atom "Ventoy"
|
||||
@ K8S
|
||||
https://github.com/kubernetes/kubernetes/releases.atom "Kubernetes" < item-rule "title NOT LIKE '%-rc._' AND title NOT LIKE '%-alpha._' AND title NOT LIKE '%-beta._'"
|
||||
https://gitea.com/gitea/act_runner/releases.rss "Act runner"
|
||||
https://github.com/arkenfox/user.js/releases.atom "arkenfox"
|
||||
https://github.com/cert-manager/cert-manager/releases.atom "cert-manager" < item-rule "title NOT LIKE 'cmd/ctl/%' AND title NOT LIKE '%-alpha._' AND title NOT LIKE '%-beta._'"
|
||||
https://github.com/cloudnative-pg/cloudnative-pg/releases.atom "CloudNativePG" < item-rule "title NOT LIKE '%-rc_'"
|
||||
https://github.com/flannel-io/flannel/releases.atom "flannel"
|
||||
https://github.com/go-gitea/gitea/releases.atom "Gitea" < item-rule "title NOT LIKE '%-rc_' AND title NOT LIKE '%-dev%'"
|
||||
https://github.com/jellyfin/jellyfin/releases.atom "Jellyfin"
|
||||
https://github.com/kubernetes/ingress-nginx/releases.atom "Ingress-NGINX" < item-rule "title LIKE 'controller-%' AND title NOT LIKE '%-beta._'"
|
||||
https://github.com/metallb/metallb/releases.atom "MetalLB" < item-rule "title NOT LIKE 'metallb-chart-%'"
|
||||
https://github.com/kubernetes-csi/csi-driver-nfs/releases.atom "NFS"
|
||||
https://github.com/nextcloud/server/releases.atom "Nextcloud" < item-rule "title NOT LIKE '%rc_' AND title NOT LIKE '%beta_'"
|
||||
https://github.com/qbittorrent/qBittorrent/tags.atom "qBittorrent" < item-rule "title NOT LIKE '%rc_' AND title NOT LIKE '%beta_'"
|
||||
https://github.com/searxng/searxng/commits/master.atom "SearXNG"
|
||||
https://github.com/ventoy/Ventoy/releases.atom "Ventoy"
|
||||
https://www.getmonero.org/feed.xml "Monero" < item-rule "title NOT LIKE 'Monero GUI%released'"
|
||||
|
@ -1,3 +1,3 @@
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.listchars = vim.o.listchars .. ",leadmultispace:│ "
|
||||
vim.opt_local.listchars = vim.o.listchars .. ",leadmultispace:│ "
|
||||
|
@ -1 +1,3 @@
|
||||
vim.opt_local.spell = true
|
||||
vim.opt_local.spell = true
|
||||
vim.opt_local.textwidth = 79
|
||||
vim.opt_local.linebreak = true
|
||||
|
@ -1,6 +1,6 @@
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.listchars = vim.o.listchars .. ",leadmultispace:│ "
|
||||
vim.opt_local.listchars = vim.o.listchars .. ",leadmultispace:│ "
|
||||
|
||||
vim.opt_local.spell = true
|
||||
|
||||
|
@ -3,7 +3,7 @@ vim.opt.expandtab = true
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.shiftwidth = 0
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.cino = "(s"
|
||||
vim.opt.cinoptions = "(s"
|
||||
vim.g.python_indent = { open_paren = "shiftwidth()" }
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = {
|
||||
@ -26,7 +26,6 @@ vim.g.netrw_banner = 0
|
||||
vim.opt.lazyredraw = true
|
||||
vim.opt.complete = vim.o.complete .. ",i"
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.linebreak = true
|
||||
|
||||
vim.g.go_recommended_style = 0
|
||||
|
||||
@ -37,6 +36,15 @@ require"pack-treesitter"
|
||||
|
||||
vim.keymap.set("n", "<Leader>e", "<cmd>.w !$SHELL<CR>")
|
||||
vim.keymap.set("n", "<Leader>s", "<cmd>%s/\\s\\+$//e<CR>")
|
||||
vim.keymap.set("n", "<Leader>h", function()
|
||||
vim.opt.cmdheight = 0
|
||||
vim.opt.colorcolumn = ""
|
||||
vim.opt.laststatus = 0
|
||||
vim.opt.listchars = {}
|
||||
vim.opt.number = false
|
||||
vim.opt.relativenumber = false
|
||||
vim.lsp.stop_client(vim.lsp.get_clients())
|
||||
end)
|
||||
|
||||
vim.keymap.set("v", "<Leader>t", function()
|
||||
local sep = string.char(vim.fn.getchar())
|
||||
|
@ -55,36 +55,35 @@ static const Layout layouts[] = {
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
|
||||
#define CMD(...) {__VA_ARGS__, NULL}
|
||||
|
||||
/* commands */
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-i", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "alacritty", NULL };
|
||||
static const char *lockcmd[] = { "lock", NULL };
|
||||
static const char *wwwcmd[] = { "bookmarks", NULL };
|
||||
static const char *pwwwcmd[] = { "bookmarks", "-p", NULL };
|
||||
static const char *calccmd[] = { "alacritty", "-epython", NULL };
|
||||
static const char *fmcmd[] = { "pcmanfm", NULL };
|
||||
static const char *prtsccmd[] = { "sh", "-c", "magick import png:- | xclip -sel c -t image/png && xclip -sel c -o | feh -", NULL };
|
||||
static const char *spkdefcmd[] = { "wpdef", "s", NULL };
|
||||
static const char *spklcmd[] = { "vol", "s", "-5", NULL };
|
||||
static const char *spkrcmd[] = { "vol", "s", "+5", NULL };
|
||||
static const char *spkmutecmd[] = { "vol", "s", "m", NULL };
|
||||
static const char *micdefcmd[] = { "wpdef", "m", NULL };
|
||||
static const char *miclcmd[] = { "vol", "m", "-5", NULL };
|
||||
static const char *micrcmd[] = { "vol", "m", "+5", NULL };
|
||||
static const char *micmutecmd[] = { "vol", "m", "m", NULL };
|
||||
static const char *pausecmd[] = { "playerctl", "play-pause", NULL };
|
||||
static const char *prevcmd[] = { "playerctl", "previous", NULL };
|
||||
static const char *nextcmd[] = { "playerctl", "next", NULL };
|
||||
static const char *stopcmd[] = { "playerctl", "stop", NULL };
|
||||
static const char *lbrtcmd[] = { "light", "-1", NULL };
|
||||
static const char *rbrtcmd[] = { "light", "+1", NULL };
|
||||
static const char *passselectcmd[] = { "nohup", "pass", "select", NULL };
|
||||
static const char *passopencmd[] = { "nohup", "pass", "openurl", NULL };
|
||||
static const char *passusercmd[] = { "nohup", "pass", "printuser", NULL };
|
||||
static const char *passpasscmd[] = { "nohup", "pass", "printpass", NULL };
|
||||
static const char *passotpcmd[] = { "nohup", "pass", "printotp", NULL };
|
||||
static const char *reloadbarcmd[] = { "sh", "-c", "kill -34 \"$(cat \"$HOME/.cache/pidofbar\")\"", NULL};
|
||||
static const char *dmenucmd[] = CMD("dmenu_run", "-i", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4);
|
||||
static const char *termcmd[] = CMD("alacritty");
|
||||
static const char *lockcmd[] = CMD("lock");
|
||||
static const char *wwwcmd[] = CMD("bookmarks");
|
||||
static const char *pwwwcmd[] = CMD("bookmarks", "-p");
|
||||
static const char *calccmd[] = CMD("alacritty", "-epython");
|
||||
static const char *prtsccmd[] = CMD("sh", "-c", "magick import png:- | xclip -sel c -t image/png && xclip -sel c -o | feh -");
|
||||
static const char *spkdefcmd[] = CMD("wpdef", "s");
|
||||
static const char *spklcmd[] = CMD("vol", "s", "-5");
|
||||
static const char *spkrcmd[] = CMD("vol", "s", "+5");
|
||||
static const char *spkmutecmd[] = CMD("vol", "s", "m");
|
||||
static const char *micdefcmd[] = CMD("wpdef", "m");
|
||||
static const char *miclcmd[] = CMD("vol", "m", "-5");
|
||||
static const char *micrcmd[] = CMD("vol", "m", "+5");
|
||||
static const char *micmutecmd[] = CMD("vol", "m", "m");
|
||||
static const char *pausecmd[] = CMD("playerctl", "play-pause");
|
||||
static const char *prevcmd[] = CMD("playerctl", "previous");
|
||||
static const char *nextcmd[] = CMD("playerctl", "next");
|
||||
static const char *stopcmd[] = CMD("playerctl", "stop");
|
||||
static const char *lbrtcmd[] = CMD("light", "-1");
|
||||
static const char *rbrtcmd[] = CMD("light", "+1");
|
||||
static const char *passselectcmd[] = CMD("nohup", "pass", "select");
|
||||
static const char *passopencmd[] = CMD("pass", "openurl");
|
||||
static const char *passusercmd[] = CMD("pass", "printuser");
|
||||
static const char *passpasscmd[] = CMD("pass", "printpass");
|
||||
static const char *passotpcmd[] = CMD("pass", "printotp");
|
||||
|
||||
static const Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
@ -94,7 +93,6 @@ static const Key keys[] = {
|
||||
{ MODKEY, XK_b, spawn, {.v = wwwcmd } },
|
||||
{ MODKEY|ShiftMask, XK_b, spawn, {.v = pwwwcmd } },
|
||||
{ 0, XF86XK_Calculator, spawn, {.v = calccmd } },
|
||||
{ MODKEY, XK_e, spawn, {.v = fmcmd } },
|
||||
{ 0, XK_Print, spawn, {.v = prtsccmd } },
|
||||
{ MODKEY, XK_v, spawn, {.v = spkdefcmd } },
|
||||
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = spklcmd } },
|
||||
@ -150,5 +148,4 @@ static const Button buttons[] = {
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
{ ClkStatusText, 0, Button1, spawn, {.v = reloadbarcmd } },
|
||||
};
|
||||
|
@ -1649,8 +1649,6 @@ spawn(const Arg *arg)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
if (arg->v == dmenucmd)
|
||||
dmenumon[0] = '0' + selmon->num;
|
||||
if (fork() == 0) {
|
||||
if (dpy)
|
||||
close(ConnectionNumber(dpy));
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit c819ff1192867d5d1c9927d2995fb65c4e5c4a58
|
||||
Subproject commit c45589c02c50d8be0539653769e96e80ca28c0af
|
@ -1,10 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
sites=(
|
||||
'https://chat.mistral.ai'
|
||||
'https://discord.com'
|
||||
'https://gmoker.com'
|
||||
'https://login.microsoftonline.com'
|
||||
'https://maby.dev'
|
||||
'https://web.whatsapp.com'
|
||||
)
|
||||
|
@ -1,10 +1,10 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
STEPS=16
|
||||
DIR="$(find /sys/class/backlight/* -print -quit)"
|
||||
FILE=/sys/class/backlight/amdgpu_bl1/brightness
|
||||
STEPS=7196
|
||||
MAX=64764
|
||||
|
||||
CUR="$(cat "$DIR/brightness")"
|
||||
MAX=$(cat "$DIR/max_brightness")
|
||||
CUR="$(< "$FILE")"
|
||||
|
||||
case "$1" in
|
||||
+*|-*) CUR=$(((++CUR / STEPS + $1) * STEPS)) ;;
|
||||
@ -18,4 +18,4 @@ elif [ "$CUR" -gt "$MAX" ]; then
|
||||
CUR="$MAX"
|
||||
fi
|
||||
|
||||
echo "$CUR" > "$DIR/brightness"
|
||||
echo "$CUR" > "$FILE"
|
||||
|
25
.local/bin/mullvad_update
Executable file
25
.local/bin/mullvad_update
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
{ read -r AN; read -r PRV; } < <(pass mullvad | sed -n '1p; s/^Privkey:\s*//p')
|
||||
|
||||
ADDRESS="$(curl 'https://api.mullvad.net/wg/' \
|
||||
-d "account=$AN" --data-urlencode "pubkey=$(wg pubkey <<< "$PRV")")"
|
||||
|
||||
j="$(curl 'https://api.mullvad.net/app/v1/relays/')"
|
||||
q='.wireguard.relays[] | "\(.hostname) \(.ipv4_addr_in) \(.public_key)"'
|
||||
|
||||
DNS="$(jq -r '.wireguard.ipv4_gateway' <<< "$j")"
|
||||
|
||||
while read -r file endpoint pubkey; do
|
||||
cat <<EOF > "$file.conf"
|
||||
[Interface]
|
||||
PrivateKey = $PRV
|
||||
Address = $ADDRESS
|
||||
DNS = $DNS
|
||||
|
||||
[Peer]
|
||||
PublicKey = $pubkey
|
||||
AllowedIPs = 0.0.0.0/0,::0/0
|
||||
Endpoint = $endpoint:51820
|
||||
EOF
|
||||
done < <(jq -r "$q" <<< "$j")
|
@ -7,15 +7,15 @@ scrypto() {
|
||||
}
|
||||
|
||||
scpu() {
|
||||
echo " $(awk '{print $1}' /proc/loadavg)" > cpu
|
||||
awk '{print " "$1}' /proc/loadavg > cpu
|
||||
}
|
||||
|
||||
smemory() {
|
||||
echo " $(free -h | awk '/^Mem:/{print $3}')" > memory
|
||||
free -h | awk '/^Mem:/{print " "$3}' > memory
|
||||
}
|
||||
|
||||
sbat() {
|
||||
local cap; cap="$(cat /sys/class/power_supply/BAT0/capacity)"
|
||||
local cap; cap="$(< /sys/class/power_supply/BAT0/capacity)"
|
||||
|
||||
if grep -qv Discharging /sys/class/power_supply/BAT0/status; then
|
||||
echo " $cap%"
|
||||
@ -25,7 +25,7 @@ sbat() {
|
||||
}
|
||||
|
||||
svol() {
|
||||
local st v m vol=('' ' ')
|
||||
local st i v m vol=('' ' ')
|
||||
|
||||
mapfile -t st <<< "$(wpctl status | sed -n 's/.*\*.*\[vol: \(.*\)]/\1/p')"
|
||||
for i in "${!vol[@]}"; do
|
||||
@ -34,32 +34,27 @@ svol() {
|
||||
break
|
||||
fi
|
||||
v="${vol[$i]} $((10#${v/./}))"
|
||||
if [ -n "$m" ]; then
|
||||
echo -n "${v//?/&$'\U0336'}"
|
||||
else
|
||||
echo -n "$v"
|
||||
fi
|
||||
echo -n "${v//?/&${m:+$'\U0336'}}"
|
||||
done > vol
|
||||
}
|
||||
|
||||
snet() {
|
||||
local dev j ssid sig
|
||||
local if sig
|
||||
|
||||
dev="$(ip route | grep -oP 'default.*dev\s+\K[^\s]+')"
|
||||
j="$(networkctl status "$dev" --json=short)"
|
||||
case "$(jq -r .Type <<< "$j")" in
|
||||
mapfile -t if < <(networkctl --json=short | jq -r '.Interfaces[] | select(.Routes) | select(.Routes[].Gateway) | .Type, .Name, .SSID')
|
||||
case "${if[0]}" in
|
||||
ether)
|
||||
echo "🌐 $dev"
|
||||
echo "🌐 ${if[1]}"
|
||||
;;
|
||||
wlan)
|
||||
ssid="$(jq -r .SSID <<< "$j")"
|
||||
sig="$(awk "/$dev/{printf \"%.0f\", \$3}" /proc/net/wireless)"
|
||||
if [ "$sig" -gt 56 ]; then echo "▂▄▆█ $ssid"
|
||||
elif [ "$sig" -gt 38 ]; then echo "▂▄▆_ $ssid"
|
||||
elif [ "$sig" -gt 21 ]; then echo "▂▄__ $ssid"
|
||||
elif [ "$sig" -gt 3 ]; then echo "▂___ $ssid"
|
||||
else echo "____ $ssid"
|
||||
sig="$(awk "/${if[1]}/{printf \"%.0f\", \$3}" /proc/net/wireless)"
|
||||
if [ "$sig" -gt 56 ]; then sig='▂▄▆█'
|
||||
elif [ "$sig" -gt 38 ]; then sig='▂▄▆_'
|
||||
elif [ "$sig" -gt 21 ]; then sig='▂▄__'
|
||||
elif [ "$sig" -gt 3 ]; then sig='▂___'
|
||||
else sig='____'
|
||||
fi
|
||||
echo "$sig ${if[2]}"
|
||||
;;
|
||||
*)
|
||||
echo '⚠'
|
||||
@ -68,33 +63,33 @@ snet() {
|
||||
}
|
||||
|
||||
svpn() {
|
||||
local v; v="$(ip -br link show type wireguard | awk '{print $1}')"
|
||||
|
||||
if [ -n "$v" ]; then
|
||||
echo " 🔒 $v"
|
||||
fi > vpn
|
||||
ip -br link show type wireguard | awk '{print " 🔒 "$1}' > vpn
|
||||
}
|
||||
|
||||
stz() {
|
||||
local tmp ip; ip="$(ip route | grep -oP '^default.*src\s+\K[^\s]+')"
|
||||
_tz() {
|
||||
local j if f="$XDG_CACHE_HOME/tz"
|
||||
|
||||
if ! [ -s tz ] || [ "$ip" != "$(cat ip)" ]; then
|
||||
tmp="$(curl -s --interface wlan0 'https://ipapi.co/timezone')" \
|
||||
&& echo "$tmp" > tz
|
||||
echo "$ip" > ip
|
||||
mapfile -t if < <(ip -j route show default | jq -r '.[] | .prefsrc, .dev')
|
||||
if ! [ -s "$f" ] || [ "${if[0]}" != "$(< ip)" ]; then
|
||||
echo "${if[0]}" > ip
|
||||
if j="$(curl -s 'https://ipapi.co/json')"; then
|
||||
jq -r '.timezone, "\(.latitude):\(.longitude)"' <<< "$j" > "$f"
|
||||
head -1 "$f"
|
||||
fi
|
||||
else
|
||||
head -1 "$f"
|
||||
fi
|
||||
}
|
||||
|
||||
stime() {
|
||||
TZ="$(cat tz)" date '+%a %m-%d %R%:::z' > 'time'
|
||||
TZ="$(_tz)" date '+%a %m-%d %R%:::z' > 'time'
|
||||
}
|
||||
|
||||
display() {
|
||||
declare -A v
|
||||
for f in *; do
|
||||
local - "$f"="$(cat "$f")"
|
||||
v[$f]=$(< "$f")
|
||||
done
|
||||
# shellcheck disable=SC2154
|
||||
xsetroot -name "$crypto | $cpu | $memory | $vol | $net$vpn | $bat | $time"
|
||||
xsetroot -name "${v[crypto]} | ${v[cpu]} | ${v[memory]} | ${v[vol]} | ${v[net]}${v[vpn]} | ${v[bat]} | ${v[time]}"
|
||||
}
|
||||
|
||||
trap "kill 0" INT
|
||||
@ -102,13 +97,13 @@ trap "kill 0" INT
|
||||
mkdir -p "$XDG_RUNTIME_DIR/sbar"
|
||||
cd "$XDG_RUNTIME_DIR/sbar" || exit 1
|
||||
|
||||
(while :; do
|
||||
while :; do
|
||||
scrypto
|
||||
stz
|
||||
sleep 300
|
||||
done &)
|
||||
done &
|
||||
|
||||
(while :; do
|
||||
touch ip
|
||||
while :; do
|
||||
scpu
|
||||
smemory
|
||||
sbat
|
||||
@ -117,8 +112,8 @@ done &)
|
||||
svpn
|
||||
stime
|
||||
display
|
||||
sleep $((5 - $(date '+%S') % 5))
|
||||
done &)
|
||||
sleep $((5 - 10#$(date '+%S') % 5))
|
||||
done &
|
||||
|
||||
while read -r _ _ f; do
|
||||
"s$f"
|
||||
|
@ -1,16 +1,13 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
getmaxram() {
|
||||
local ram; ram="$(free -g | awk '/^Mem:/{print $2 - 2}')"
|
||||
|
||||
if [ "$ram" -le 2 ]; then ram=2
|
||||
elif [ "$ram" -gt 32 ]; then ram=32; fi
|
||||
echo "${ram}G"
|
||||
}
|
||||
|
||||
ISO="$1"; shift
|
||||
DISK="$HOME/${ISO%.*}.qcow2"
|
||||
MAXMEM="$(getmaxram)"
|
||||
RAM="$(free -g | awk '/^Mem:/{t=$2 / 2; print(t < 2 ? 2 : t)"G"}')"
|
||||
|
||||
if ! [ -f "$ISO" ]; then
|
||||
echo "$ISO does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ -f "$DISK" ]; then (set -x
|
||||
qemu-img create -f qcow2 "$DISK" 64G
|
||||
@ -21,13 +18,13 @@ qemu-system-x86_64 \
|
||||
-M q35 \
|
||||
-bios /usr/share/edk2/x64/OVMF.4m.fd \
|
||||
-monitor stdio \
|
||||
-cpu host \
|
||||
-m "2G,maxmem=$MAXMEM" \
|
||||
-smp "$(nproc --ignore 4)" \
|
||||
-m "$RAM" \
|
||||
-vga virtio \
|
||||
-audio pipewire,model=hda \
|
||||
-nic model=virtio-net-pci,type=user \
|
||||
-device qemu-xhci \
|
||||
-object "memory-backend-ram,id=mem,size=2G,share=on" \
|
||||
-object "memory-backend-ram,id=mem,size=$RAM,share=on" \
|
||||
-numa node,memdev=mem \
|
||||
-drive "if=virtio,file=$DISK" \
|
||||
-drive "file=$ISO,media=cdrom,readonly=on" \
|
||||
|
@ -21,8 +21,10 @@ if [ "$1" != off ]; then
|
||||
CMD=(
|
||||
"basename -s.conf '/etc/wireguard/$1'*.conf > '$d/1'"
|
||||
"inotifywait -e close_write '$d/2'"
|
||||
"up=\"\$(cat '$d/2')\""
|
||||
"[ -z \"\$up\" ] && exit"
|
||||
"${CMD[@]}"
|
||||
"wg-quick up \"\$(cat '$d/2')\""
|
||||
"wg-quick up \"\$up\""
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -24,13 +24,8 @@ case "$1" in
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
|
||||
dev="$(getdev "${CLASS,,}")"
|
||||
if [ -n "$dev" ]; then
|
||||
devs="$(getdevs "$CLASS" | grep -v "$dev")"$'\n'"* $dev"
|
||||
else
|
||||
devs="$(getdevs "$CLASS")"
|
||||
read -r id <<< "$(getdevs "$CLASS" | sed "s/^\($(getdev "${CLASS,,}")\)$/* \1/" | dmenu -l 16 | sed 's/* //')"
|
||||
if [ -n "$id" ]; then
|
||||
wpctl set-default "$id"
|
||||
touch "$XDG_RUNTIME_DIR/sbar/vol"
|
||||
fi
|
||||
|
||||
read -r id <<< "$(dmenu -l 16 <<< "$devs" | sed 's/*//')"
|
||||
wpctl set-default "$id"
|
||||
touch "$XDG_RUNTIME_DIR/sbar/vol"
|
||||
|
@ -1255,7 +1255,7 @@ user_pref("browser.startup.page", 3);
|
||||
user_pref("browser.tabs.hoverPreview.showThumbnails", false);
|
||||
user_pref("browser.tabs.inTitlebar", 0);
|
||||
user_pref("browser.toolbars.bookmarks.visibility", "never");
|
||||
user_pref("browser.uiCustomization.state", "{\"placements\":{\"nav-bar\":[\"back-button\",\"forward-button\",\"stop-reload-button\",\"urlbar-container\",\"downloads-button\",\"unified-extensions-button\"],\"toolbar-menubar\":[\"menubar-items\"],\"TabsToolbar\":[\"tabbrowser-tabs\"]},\"currentVersion\":21}");
|
||||
user_pref("browser.uiCustomization.state", "{\"placements\":{\"nav-bar\":[\"back-button\",\"forward-button\",\"stop-reload-button\",\"urlbar-container\",\"downloads-button\",\"unified-extensions-button\"],\"toolbar-menubar\":[\"menubar-items\"],\"TabsToolbar\":[\"tabbrowser-tabs\"]},\"currentVersion\":22}");
|
||||
user_pref("browser.urlbar.suggest.openpage", false);
|
||||
user_pref("browser.urlbar.suggest.topsites", false);
|
||||
user_pref("browser.zoom.siteSpecific", false);
|
||||
@ -1275,7 +1275,7 @@ user_pref("privacy.clearHistory.historyFormDataAndDownloads", true);
|
||||
user_pref("privacy.clearOnShutdown_v2.browsingHistoryAndDownloads", false);
|
||||
user_pref("privacy.clearOnShutdown_v2.cache", false);
|
||||
user_pref("privacy.clearOnShutdown_v2.cookiesAndStorage", true);
|
||||
user_pref("privacy.clearOnShutdown_v2.downloads", false);
|
||||
user_pref("privacy.clearOnShutdown_v2.downloads", true);
|
||||
user_pref("privacy.clearOnShutdown_v2.formdata", true);
|
||||
user_pref("privacy.clearOnShutdown_v2.historyFormDataAndDownloads", false);
|
||||
user_pref("privacy.clearOnShutdown_v2.siteSettings", true);
|
||||
|
8
.xinitrc
8
.xinitrc
@ -3,16 +3,16 @@
|
||||
dbus-update-activation-environment --systemd DISPLAY XAUTHORITY
|
||||
|
||||
# startup
|
||||
xss-lock -n "feh --fullscreen '$XDG_CONFIG_HOME/wallpapers/lock.png'" -- lock &
|
||||
xss-lock -l lock &
|
||||
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 || # arch
|
||||
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 || # debian
|
||||
/usr/libexec/polkit-gnome-authentication-agent-1 & # fedora
|
||||
picom &
|
||||
gammastep &
|
||||
sbar &
|
||||
gammastep -t 5000:3500 \
|
||||
-l "$(tail -1 "$XDG_CACHE_HOME/tz" 2> /dev/null || echo 0:0)" &
|
||||
|
||||
xset s 600 15
|
||||
xset dpms 616 616 616
|
||||
xset dpms 600 600 600
|
||||
|
||||
wallpaper
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user