This commit is contained in:
2026-06-29 21:25:36 +07:00
parent 7df6d6bd99
commit 0d6d830c6d
2 changed files with 42 additions and 39 deletions
-37
View File
@@ -1,37 +0,0 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
HISTFILE=~/.histfile
HISTSIZE=2000
SAVEHIST=2000
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
bindkey "\e[3~" delete-char
autoload -Uz compinit && compinit
zstyle ':completion:*' menu select
# End of lines added by compinstall
source /home/nnduc/git/powerlevel10k/powerlevel10k.zsh-theme
source /home/nnduc/git/zsh-autosuggestions/zsh-autosuggestions.zsh
zshaddhistory() {
whence ${${(z)1}[1]} >/dev/null || return 2
}
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
export EDITOR=nvim
export TERM='xterm-256color'
export PATH="$HOME/.local/bin:$PATH"
alias ls='ls --color=auto'
alias doc='docker-compose'
+42 -2
View File
@@ -1,4 +1,44 @@
#!/bin/bash
wall_dir="${1:?wallpaper directory required}"
img=$(find "$wall_dir" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | shuf -n1)
[ -n "$img" ] && feh --bg-fill "$img"
interval="${2:-1800}"
pick_wall() {
find "$wall_dir" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | shuf -n1
}
set_wall() { [ -n "$1" ] && xwallpaper --zoom "$1"; }
has_fullscreen() {
python3 - <<'EOF'
import json, subprocess, sys
def is_fullscreen(node):
if node.get('fullscreen_mode', 0) > 0: return True
return any(is_fullscreen(c) for c in node.get('nodes', []) + node.get('floating_nodes', []))
def find_ws(node, name):
if node.get('type') == 'workspace' and node.get('name') == name: return node
for c in node.get('nodes', []) + node.get('floating_nodes', []):
r = find_ws(c, name)
if r: return r
try:
wss = json.loads(subprocess.check_output(['i3-msg', '-t', 'get_workspaces'], stderr=subprocess.DEVNULL))
tree = json.loads(subprocess.check_output(['i3-msg', '-t', 'get_tree'], stderr=subprocess.DEVNULL))
for ws in wss:
if ws.get('visible'):
node = find_ws(tree, ws['name'])
if node and is_fullscreen(node):
sys.exit(0)
except Exception:
pass
sys.exit(1)
EOF
}
# Initial wallpaper
set_wall "$(pick_wall)"
while sleep "$interval"; do
has_fullscreen || set_wall "$(pick_wall)"
done