mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2025-12-05 02:53:38 -08:00
Merge branch 'master' of github.com:ksyasuda/dotfiles
This commit is contained in:
5
.aliases
Normal file
5
.aliases
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
alias pissh='ssh -Y pi@192.168.1.118'
|
||||||
|
alias share='mount -t cifs //192.168.4.53/pishare /share -o username=pi,iocharset=utf8,uid=sudacode,gid=sudacode'
|
||||||
|
alias lconf='lvim ~/.config/lvim/config.lua'
|
||||||
|
alias dcre='dc up -d --force-recreate'
|
||||||
|
alias lofi="nohup mpv 'https://www.youtube.com/watch?v=jfKfPfyJRdk' >/dev/null 2>&1 &"
|
||||||
131
.bash_aliases
Normal file
131
.bash_aliases
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
alias sudo='sudo -v; sudo '
|
||||||
|
alias suda='sudo'
|
||||||
|
|
||||||
|
alias vi=nvim
|
||||||
|
alias vim=nvim
|
||||||
|
|
||||||
|
alias nvidia-settings='nvidia-settings --config=~/nvidia/settings'
|
||||||
|
|
||||||
|
alias qutebrowser="qutebrowser --qt-arg stylesheet ~/.local/share/qutebrowser/fix-tooltips.qss"
|
||||||
|
|
||||||
|
# Aniwrapper
|
||||||
|
alias aniwrapper='aniwrapper -D 144'
|
||||||
|
|
||||||
|
## Colorls
|
||||||
|
alias ls='eza -M --group-directories-first --icons --color=always --group --git'
|
||||||
|
alias ll='ls -l'
|
||||||
|
alias la='ls -la'
|
||||||
|
|
||||||
|
alias vimf='vim $(fzf --height=45% --layout=reverse --preview="bat --style=numbers --color=always --line-range :500 {}")'
|
||||||
|
|
||||||
|
# Kitty
|
||||||
|
alias kimg='kitty +kitten icat'
|
||||||
|
alias kdiff='kitty +kitten diff'
|
||||||
|
|
||||||
|
## Pacman/Yay
|
||||||
|
# update without noconfirm
|
||||||
|
alias spu='sudo pacman -Syu'
|
||||||
|
# cleanup orphaned packages
|
||||||
|
alias cleanup='suda pacman -Rns $(pacman -Qtdq)'
|
||||||
|
# update everything
|
||||||
|
alias upall="paru -Syu --noconfirm"
|
||||||
|
|
||||||
|
## Npm/Yarn
|
||||||
|
alias ns='npm start'
|
||||||
|
alias yb='yarn build'
|
||||||
|
alias ys='yarn start'
|
||||||
|
alias yi='yarn install'
|
||||||
|
|
||||||
|
## Git
|
||||||
|
alias gst='git status'
|
||||||
|
alias gcmt='git commit'
|
||||||
|
alias gpush='git push'
|
||||||
|
alias gpull='git pull'
|
||||||
|
|
||||||
|
## Helpful
|
||||||
|
alias count='ls -l | wc -l'
|
||||||
|
# use all cores
|
||||||
|
alias uac="sh ~/.bin/main/000*"
|
||||||
|
alias update-grub="sudo grub-mkconfig -o /boot/grub/grub.cfg"
|
||||||
|
alias update-fc="suda fc-cache -fv"
|
||||||
|
alias unlock-db='suda rm /var/lib/pacman/db.lck'
|
||||||
|
alias dn='deactivate_node'
|
||||||
|
alias logs='ksystemlog &'
|
||||||
|
|
||||||
|
## youtube-dl
|
||||||
|
alias yta-best="youtube-dl --extract-audio --audio-format best"
|
||||||
|
alias yta-mp3="youtube-dl --extract-audio --audio-format mp3 --config-location ~/.config/youtube-dl/config.audio"
|
||||||
|
alias ytv-best="youtube-dl -f bestvideo+bestaudio"
|
||||||
|
# get error message from journalctl
|
||||||
|
alias jctl='journalctl -p 3 -xb'
|
||||||
|
|
||||||
|
## This is specific to WSL 2. If the WSL 2 VM goes rogue and decides not to free
|
||||||
|
## up memory, this command will free your memory after about 20-30 seconds.
|
||||||
|
## Details: https://github.com/microsoft/WSL/issues/4166#issuecomment-628493643
|
||||||
|
alias drop_cache="sudo sh -c \"echo 3 >'/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'\""
|
||||||
|
|
||||||
|
# mkdir
|
||||||
|
alias mkdir='mkdir -p'
|
||||||
|
|
||||||
|
# wallpapers
|
||||||
|
alias mysan='feh --bg-scale ~/.wallpapers/MYSanGun-Inverted.png ~/.wallpapers/MYSanGun.png'
|
||||||
|
|
||||||
|
## I'm Lazy
|
||||||
|
alias scripts='cd /home/sudacode/scripts'
|
||||||
|
alias freud='cd /home/sudacode/'
|
||||||
|
alias c=clear
|
||||||
|
alias open='xdg-open'
|
||||||
|
alias glow='glow -p'
|
||||||
|
alias jn='jupyter-notebook'
|
||||||
|
alias blog='cd ~/projects/React/github/Sudacode-Blog-V3'
|
||||||
|
alias venv='source env/bin/activate'
|
||||||
|
alias eecs484='cd ~/projects/eecs484/project4'
|
||||||
|
alias n=ncmpcpp
|
||||||
|
alias reload='source ~/.zshrc'
|
||||||
|
alias golf='cd ~/projects/Python/SudacodeGolf/ && source env/bin/activate'
|
||||||
|
alias prolog=swipl
|
||||||
|
alias chess='cd ~/projects/React/github/sudacode-chess/'
|
||||||
|
alias temps='curl wttr.in'
|
||||||
|
alias whatsmyip='http ipinfo.io'
|
||||||
|
alias edit='sudoedit'
|
||||||
|
alias ports='sudo netstat -tupln'
|
||||||
|
alias ncdu='ncdu --color dark'
|
||||||
|
alias updates='~/SudacodeRice/scripts/package-updates'
|
||||||
|
alias aliases='cat ~/.bash_aliases'
|
||||||
|
alias sauce='~/Videos/sauce/'
|
||||||
|
alias wmedit='emc ~/.config/i3/config'
|
||||||
|
alias ani='cd $HOME/Projects/Scripts/aniwrapper'
|
||||||
|
alias archvm='VBoxManage startvm "arch-vm"'
|
||||||
|
alias chrome='google-chrome-beta --profile-directory="Profile 1" &>/dev/null &'
|
||||||
|
alias bar='~/SudacodeRice/scripts/launch_desktop.sh'
|
||||||
|
alias nord=nordvpn
|
||||||
|
alias lzd=lazydocker
|
||||||
|
alias lzg=lazygit
|
||||||
|
alias mounts='sudo ~/scripts/mounts.sh'
|
||||||
|
alias dc=docker-compose # sorry calculator
|
||||||
|
alias vimconf='cd ~/.config/nvim && vim -c ":NvimTreeOpen" && cd -'
|
||||||
|
alias sctl=systemctl
|
||||||
|
alias pyex='python -m'
|
||||||
|
alias get='aria2c'
|
||||||
|
alias links="vim ~/.links"
|
||||||
|
|
||||||
|
## Rice
|
||||||
|
alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME'
|
||||||
|
alias pushdots='config push senpai'
|
||||||
|
alias commitdots='config commit'
|
||||||
|
alias cs='config status'
|
||||||
|
alias f=floaterm
|
||||||
|
|
||||||
|
# wireguard
|
||||||
|
alias wgu='nmcli c up wg0'
|
||||||
|
alias wgd='nmcli c down wg0'
|
||||||
|
|
||||||
|
alias tmux='TERM=xterm-256color tmux'
|
||||||
|
alias mpv='FONTCONFIG_FILE=$HOME/.config/mpv/mpv-fonts.conf mpv'
|
||||||
|
alias hypr='cd ~/.config/hypr && vim ~/.config/hypr/hyprland.conf && cd -'
|
||||||
|
|
||||||
|
alias wlc='wl-copy'
|
||||||
|
alias wlp='wl-paste'
|
||||||
|
alias vn32='WINEPREFIX=/home/sudacode/S/lutris/wineprefix32 WINEARCH=win32'
|
||||||
|
alias impv='mpv --profile=immersion'
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"topics": [
|
|
||||||
"132262 - Mobuseka",
|
|
||||||
"konosuba",
|
|
||||||
"79222 - bunny girl senpai",
|
|
||||||
"oshi no ko",
|
|
||||||
"kill la kill",
|
|
||||||
"lofi",
|
|
||||||
"139520 - eminence in shadow",
|
|
||||||
"132 - Monogatari Series"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -16,3 +16,4 @@ copy-on-select = clipboard
|
|||||||
app-notifications = no-clipboard-copy
|
app-notifications = no-clipboard-copy
|
||||||
keybind = all:ctrl+enter=unbind
|
keybind = all:ctrl+enter=unbind
|
||||||
keybind = all:ctrl+grave_accent=toggle_quick_terminal
|
keybind = all:ctrl+grave_accent=toggle_quick_terminal
|
||||||
|
shell-integration = zsh
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ device {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render {
|
render {
|
||||||
explicit_sync = true
|
# explicit_sync = true
|
||||||
}
|
}
|
||||||
|
|
||||||
misc {
|
misc {
|
||||||
@@ -256,7 +256,9 @@ misc {
|
|||||||
# windowrulev2 = float, class:com.mitchellh.ghostty
|
# windowrulev2 = float, class:com.mitchellh.ghostty
|
||||||
windowrule = float, class:discord
|
windowrule = float, class:discord
|
||||||
windowrule = float, class:mpv
|
windowrule = float, class:mpv
|
||||||
|
windowrule = float, class:steam
|
||||||
windowrule = workspace 10 silent, class:discord
|
windowrule = workspace 10 silent, class:discord
|
||||||
|
windowrule = workspace 9 silent, class:steam
|
||||||
# windowruv2 = opacity 0.88, class:.* fullscreen:0
|
# windowruv2 = opacity 0.88, class:.* fullscreen:0
|
||||||
windowrule = opacity 0.88, class:.* fullscreen:0
|
windowrule = opacity 0.88, class:.* fullscreen:0
|
||||||
# windowruv2 = opacity 1, class:.* fullscreen:0
|
# windowruv2 = opacity 1, class:.* fullscreen:0
|
||||||
@@ -269,6 +271,8 @@ windowrule = opacity 1, class:com.obsproject.Studio
|
|||||||
windowrule = opacity 1, title:(.*)(- YouTube(.*))
|
windowrule = opacity 1, title:(.*)(- YouTube(.*))
|
||||||
windowrule = opacity 1, class:zen, title:(.*)YouTube TV(.*)
|
windowrule = opacity 1, class:zen, title:(.*)YouTube TV(.*)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Example windowrule v2
|
# Example windowrule v2
|
||||||
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Set programs that you use
|
# Set programs that you use
|
||||||
$terminal = FONTCONFIG_FILE=/home/sudacode/.config/ghostty/ghostty-fonts.conf uwsm app -sa -- ghostty
|
$terminal = FONTCONFIG_FILE=/home/sudacode/.config/ghostty/ghostty-fonts.conf uwsm app -sa -- ghostty
|
||||||
$fileManager = uwsm app -sa -- dolphin
|
$fileManager = uwsm app -sa -- thunar
|
||||||
# $menu = rofi -show drun
|
# $menu = rofi -show drun
|
||||||
# https://github.com/Vladimir-csp/uwsm#2-service-startup-notification-and-vars-set-by-compositor
|
# https://github.com/Vladimir-csp/uwsm#2-service-startup-notification-and-vars-set-by-compositor
|
||||||
# $menu = rofi -show drun -run-command "uwsm app -- {cmd}"
|
# $menu = rofi -show drun -run-command "uwsm app -- {cmd}"
|
||||||
@@ -106,9 +106,9 @@ bind = SUPER, m, exec, ~/.local/bin/mpv-add.sh
|
|||||||
bind = SUPER SHIFT, s, exec, slurp | grim -g - - | wl-copy
|
bind = SUPER SHIFT, s, exec, slurp | grim -g - - | wl-copy
|
||||||
bind = ,code:107, exec, ~/.local/bin/screenshot
|
bind = ,code:107, exec, ~/.local/bin/screenshot
|
||||||
bind = SUPER,code:107, exec, flameshot screen
|
bind = SUPER,code:107, exec, flameshot screen
|
||||||
bind = SUPER SHIFT, o, exec, ~/.local/bin/ocr.sh
|
bind = SUPER, o, exec, ~/.local/bin/ocr.sh
|
||||||
bind = $mainMod, o, exec, ~/.local/bin/ocr.sh
|
bind = $mainMod, o, exec, ~/.local/bin/rofi-open tab
|
||||||
bind = $mainMod SHIFT, o, exec, ~/.local/bin/rofi-open tab
|
bind = $mainMod SHIFT, o, exec, ~/.local/bin/rofi-open window
|
||||||
|
|
||||||
# change wallpaper
|
# change wallpaper
|
||||||
bind = $mainMod CTRL, n, exec, ~/.local/bin/change-wallpaper
|
bind = $mainMod CTRL, n, exec, ~/.local/bin/change-wallpaper
|
||||||
@@ -124,3 +124,5 @@ bind = CTRL ALT, F, exec, ~/.local/bin/favorite-wallpaper
|
|||||||
|
|
||||||
bind = $mainMod, z, exec, uwsm app -sb -- zen-browser
|
bind = $mainMod, z, exec, uwsm app -sb -- zen-browser
|
||||||
|
|
||||||
|
bind = $mainMod SHIFT, s, exec , rofi -show ssh -theme "$HOME/.config/rofi/launchers/type-2/style-2.rasi" -terminal -theme-str 'window{width: 25%;} listview {columns: 1; lines: 10;}' ghostty -ssh-command "ghostty --initial-command='TERM=kitty ssh {host}'"
|
||||||
|
|
||||||
|
|||||||
112
.config/oh-my-posh/catppuccin_macchiato.omp.json##default
Normal file
112
.config/oh-my-posh/catppuccin_macchiato.omp.json##default
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
|
||||||
|
"palette": {
|
||||||
|
"os": "#ACB0BE",
|
||||||
|
"closer": "p:os",
|
||||||
|
"pink": "#F5BDE6",
|
||||||
|
"lavender": "#B7BDF8",
|
||||||
|
"blue": "#8AADF4"
|
||||||
|
},
|
||||||
|
"blocks": [
|
||||||
|
{
|
||||||
|
"type": "rprompt",
|
||||||
|
"alignment": "right",
|
||||||
|
"segments": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"style": "plain",
|
||||||
|
"foreground": "p:os",
|
||||||
|
"properties": {
|
||||||
|
"shell": "bash",
|
||||||
|
"command": "ip -4 -o addr show dev tailscale0 up 2>/dev/null | awk '{print $4}' | cut -d/ -f1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alignment": "left",
|
||||||
|
"segments": [
|
||||||
|
{
|
||||||
|
"foreground": "p:os",
|
||||||
|
"style": "plain",
|
||||||
|
"template": " ",
|
||||||
|
"type": "os"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"foreground": "p:blue",
|
||||||
|
"style": "plain",
|
||||||
|
"template": "{{ .UserName }}@{{ .HostName }} ",
|
||||||
|
"type": "session"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"foreground": "p:pink",
|
||||||
|
"properties": {
|
||||||
|
"folder_icon": "..\ue5fe..",
|
||||||
|
"home_icon": "~",
|
||||||
|
"style": "agnoster_full"
|
||||||
|
},
|
||||||
|
"style": "plain",
|
||||||
|
"template": "{{ .Path }}",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"fetch_status": true,
|
||||||
|
"fetch_upstream_icon": true
|
||||||
|
},
|
||||||
|
"foreground_templates": [
|
||||||
|
"{{ if or (.Working.Changed) (.Staging.Changed) }}#EED49F{{ end }}",
|
||||||
|
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#EE99A0{{ end }}",
|
||||||
|
"{{ if gt .Ahead 0 }}#C6A0F6{{ end }}",
|
||||||
|
"{{ if gt .Behind 0 }}#C6A0F6{{ end }}"
|
||||||
|
],
|
||||||
|
"style": "powerline",
|
||||||
|
"type": "git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "python",
|
||||||
|
"style": "powerline",
|
||||||
|
"foreground": "#a6da95",
|
||||||
|
"display_default": false,
|
||||||
|
"display_mode": "environment",
|
||||||
|
"fetch_version": false,
|
||||||
|
"fetch_virtual_env": true,
|
||||||
|
"default_venv_names": ["venv", "env"],
|
||||||
|
"template": " {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ end }}{{ .Full }}{{ end }}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "status",
|
||||||
|
"style": "powerline",
|
||||||
|
"foreground": "p:pink",
|
||||||
|
"properties": {
|
||||||
|
"always_enabled": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "prompt"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tooltips": [
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"tips": ["git", "g"],
|
||||||
|
"style": "diamond",
|
||||||
|
"foreground": "#a6da95",
|
||||||
|
"background": "#363a4f",
|
||||||
|
"leading_diamond": "",
|
||||||
|
"trailing_diamond": "",
|
||||||
|
"template": "{{ .HEAD }}{{ if .Staging.Changed }} {{ .Staging.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Working.Changed }} {{ .Working.String }}{{ end }}",
|
||||||
|
"properties": {
|
||||||
|
"fetch_status": true,
|
||||||
|
"fetch_upstream_icon": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"final_space": true,
|
||||||
|
"version": 3,
|
||||||
|
"transient_prompt": {
|
||||||
|
"background": "transparent",
|
||||||
|
"foreground": "#ACB0BE",
|
||||||
|
"template": "{{ .Shell }}> "
|
||||||
|
}
|
||||||
|
}
|
||||||
111
.config/oh-my-posh/catppuccin_macchiato.omp.json##os.Darwin
Normal file
111
.config/oh-my-posh/catppuccin_macchiato.omp.json##os.Darwin
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
|
||||||
|
"palette": {
|
||||||
|
"os": "#ACB0BE",
|
||||||
|
"closer": "p:os",
|
||||||
|
"pink": "#F5BDE6",
|
||||||
|
"lavender": "#B7BDF8",
|
||||||
|
"blue": "#8AADF4"
|
||||||
|
},
|
||||||
|
"blocks": [
|
||||||
|
{
|
||||||
|
"type": "rprompt",
|
||||||
|
"alignment": "right",
|
||||||
|
"segments": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"style": "plain",
|
||||||
|
"foreground": "p:os",
|
||||||
|
"properties": {
|
||||||
|
"shell": "bash",
|
||||||
|
"command": "ip -4 -o addr show dev tailscale0 up 2>/dev/null | awk '{print $4}' | cut -d/ -f1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alignment": "left",
|
||||||
|
"segments": [
|
||||||
|
{
|
||||||
|
"foreground": "p:os",
|
||||||
|
"style": "plain",
|
||||||
|
"type": "os"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"foreground": "p:blue",
|
||||||
|
"style": "plain",
|
||||||
|
"template": "{{ .UserName }}@{{ .HostName }} ",
|
||||||
|
"type": "session"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"foreground": "p:pink",
|
||||||
|
"properties": {
|
||||||
|
"folder_icon": "..\ue5fe..",
|
||||||
|
"home_icon": "~",
|
||||||
|
"style": "agnoster_full"
|
||||||
|
},
|
||||||
|
"style": "plain",
|
||||||
|
"template": "{{ .Path }}",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"fetch_status": true,
|
||||||
|
"fetch_upstream_icon": true
|
||||||
|
},
|
||||||
|
"foreground_templates": [
|
||||||
|
"{{ if or (.Working.Changed) (.Staging.Changed) }}#EED49F{{ end }}",
|
||||||
|
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#EE99A0{{ end }}",
|
||||||
|
"{{ if gt .Ahead 0 }}#C6A0F6{{ end }}",
|
||||||
|
"{{ if gt .Behind 0 }}#C6A0F6{{ end }}"
|
||||||
|
],
|
||||||
|
"style": "powerline",
|
||||||
|
"type": "git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "python",
|
||||||
|
"style": "powerline",
|
||||||
|
"foreground": "#a6da95",
|
||||||
|
"display_default": false,
|
||||||
|
"display_mode": "environment",
|
||||||
|
"fetch_version": false,
|
||||||
|
"fetch_virtual_env": true,
|
||||||
|
"default_venv_names": ["venv", "env"],
|
||||||
|
"template": " {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ end }}{{ .Full }}{{ end }}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "status",
|
||||||
|
"style": "powerline",
|
||||||
|
"foreground": "p:pink",
|
||||||
|
"properties": {
|
||||||
|
"always_enabled": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "prompt"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tooltips": [
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"tips": ["git", "g"],
|
||||||
|
"style": "diamond",
|
||||||
|
"foreground": "#a6da95",
|
||||||
|
"background": "#363a4f",
|
||||||
|
"leading_diamond": "",
|
||||||
|
"trailing_diamond": "",
|
||||||
|
"template": "{{ .HEAD }}{{ if .Staging.Changed }} {{ .Staging.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Working.Changed }} {{ .Working.String }}{{ end }}",
|
||||||
|
"properties": {
|
||||||
|
"fetch_status": true,
|
||||||
|
"fetch_upstream_icon": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"final_space": true,
|
||||||
|
"version": 3,
|
||||||
|
"transient_prompt": {
|
||||||
|
"background": "transparent",
|
||||||
|
"foreground": "#ACB0BE",
|
||||||
|
"template": "{{ .Shell }}> "
|
||||||
|
}
|
||||||
|
}
|
||||||
235
.config/rmpc/config.ron
Normal file
235
.config/rmpc/config.ron
Normal file
@@ -0,0 +1,235 @@
|
|||||||
|
#![enable(implicit_some)]
|
||||||
|
#![enable(unwrap_newtypes)]
|
||||||
|
#![enable(unwrap_variant_newtypes)]
|
||||||
|
(
|
||||||
|
address: "127.0.0.1:6600",
|
||||||
|
password: None,
|
||||||
|
theme: None,
|
||||||
|
cache_dir: "/tmp/rmpc",
|
||||||
|
on_song_change: ["songinfo"],
|
||||||
|
volume_step: 5,
|
||||||
|
max_fps: 144,
|
||||||
|
scrolloff: 0,
|
||||||
|
wrap_navigation: false,
|
||||||
|
enable_mouse: true,
|
||||||
|
enable_config_hot_reload: true,
|
||||||
|
status_update_interval_ms: 1000,
|
||||||
|
rewind_to_start_sec: None,
|
||||||
|
reflect_changes_to_playlist: false,
|
||||||
|
select_current_song_on_change: false,
|
||||||
|
browser_song_sort: [Disc, Track, Artist, Title],
|
||||||
|
directories_sort: SortFormat(group_by_type: true, reverse: false),
|
||||||
|
keybinds: (
|
||||||
|
global: {
|
||||||
|
":": CommandMode,
|
||||||
|
",": VolumeDown,
|
||||||
|
"s": Stop,
|
||||||
|
".": VolumeUp,
|
||||||
|
"<Tab>": NextTab,
|
||||||
|
"<S-Tab>": PreviousTab,
|
||||||
|
"1": SwitchToTab("Queue"),
|
||||||
|
"2": SwitchToTab("Directories"),
|
||||||
|
"3": SwitchToTab("Artists"),
|
||||||
|
"4": SwitchToTab("Album Artists"),
|
||||||
|
"5": SwitchToTab("Albums"),
|
||||||
|
"6": SwitchToTab("Playlists"),
|
||||||
|
"7": SwitchToTab("Search"),
|
||||||
|
"q": Quit,
|
||||||
|
">": NextTrack,
|
||||||
|
"p": TogglePause,
|
||||||
|
"<": PreviousTrack,
|
||||||
|
"f": SeekForward,
|
||||||
|
"z": ToggleRepeat,
|
||||||
|
"x": ToggleRandom,
|
||||||
|
"c": ToggleConsume,
|
||||||
|
"v": ToggleSingle,
|
||||||
|
"b": SeekBack,
|
||||||
|
"?": ShowHelp,
|
||||||
|
"u": Update,
|
||||||
|
"U": Rescan,
|
||||||
|
"I": ShowCurrentSongInfo,
|
||||||
|
"O": ShowOutputs,
|
||||||
|
"P": ShowDecoders,
|
||||||
|
"R": AddRandom,
|
||||||
|
},
|
||||||
|
navigation: {
|
||||||
|
"k": Up,
|
||||||
|
"j": Down,
|
||||||
|
"h": Left,
|
||||||
|
"l": Right,
|
||||||
|
"<Up>": Up,
|
||||||
|
"<Down>": Down,
|
||||||
|
"<Left>": Left,
|
||||||
|
"<Right>": Right,
|
||||||
|
"<C-k>": PaneUp,
|
||||||
|
"<C-j>": PaneDown,
|
||||||
|
"<C-h>": PaneLeft,
|
||||||
|
"<C-l>": PaneRight,
|
||||||
|
"<C-u>": UpHalf,
|
||||||
|
"N": PreviousResult,
|
||||||
|
"a": Add,
|
||||||
|
"A": AddAll,
|
||||||
|
"r": Rename,
|
||||||
|
"n": NextResult,
|
||||||
|
"g": Top,
|
||||||
|
"<Space>": Select,
|
||||||
|
"<C-Space>": InvertSelection,
|
||||||
|
"G": Bottom,
|
||||||
|
"<CR>": Confirm,
|
||||||
|
"i": FocusInput,
|
||||||
|
"J": MoveDown,
|
||||||
|
"<C-d>": DownHalf,
|
||||||
|
"/": EnterSearch,
|
||||||
|
"<C-c>": Close,
|
||||||
|
"<Esc>": Close,
|
||||||
|
"K": MoveUp,
|
||||||
|
"D": Delete,
|
||||||
|
"B": ShowInfo,
|
||||||
|
},
|
||||||
|
queue: {
|
||||||
|
"D": DeleteAll,
|
||||||
|
"<CR>": Play,
|
||||||
|
"<C-s>": Save,
|
||||||
|
"a": AddToPlaylist,
|
||||||
|
"d": Delete,
|
||||||
|
"C": JumpToCurrent,
|
||||||
|
"X": Shuffle,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
search: (
|
||||||
|
case_sensitive: false,
|
||||||
|
mode: Contains,
|
||||||
|
tags: [
|
||||||
|
(value: "any", label: "Any Tag"),
|
||||||
|
(value: "artist", label: "Artist"),
|
||||||
|
(value: "album", label: "Album"),
|
||||||
|
(value: "albumartist", label: "Album Artist"),
|
||||||
|
(value: "title", label: "Title"),
|
||||||
|
(value: "filename", label: "Filename"),
|
||||||
|
(value: "genre", label: "Genre"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
artists: (
|
||||||
|
album_display_mode: SplitByDate,
|
||||||
|
album_sort_by: Date,
|
||||||
|
),
|
||||||
|
default_album_art_path: None,
|
||||||
|
draw_borders: false,
|
||||||
|
show_song_table_header: false,
|
||||||
|
symbols: (song: "🎵", dir: "📁", playlist: "🎼", marker: "\u{e0b0}"),
|
||||||
|
layout: Split(
|
||||||
|
direction: Vertical,
|
||||||
|
panes: [
|
||||||
|
(
|
||||||
|
pane: Pane(Header),
|
||||||
|
size: "1",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
pane: Pane(TabContent),
|
||||||
|
size: "100%",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
pane: Pane(ProgressBar),
|
||||||
|
size: "1",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
progress_bar: (
|
||||||
|
symbols: ["", "", "⭘", " ", " "],
|
||||||
|
track_style: (bg: "#1e2030"),
|
||||||
|
elapsed_style: (fg: "#c6a0f6", bg: "#1e2030"),
|
||||||
|
thumb_style: (fg: "#c6a0f6", bg: "#1e2030"),
|
||||||
|
),
|
||||||
|
scrollbar: (
|
||||||
|
symbols: ["│", "█", "▲", "▼"],
|
||||||
|
track_style: (),
|
||||||
|
ends_style: (),
|
||||||
|
thumb_style: (fg: "#b7bdf8"),
|
||||||
|
),
|
||||||
|
browser_column_widths: [20, 38, 42],
|
||||||
|
text_color: "#cad3f5",
|
||||||
|
background_color: "#24273a",
|
||||||
|
header_background_color: "#1e2030",
|
||||||
|
modal_background_color: None,
|
||||||
|
modal_backdrop: false,
|
||||||
|
tab_bar: (active_style: (fg: "black", bg: "#c6a0f6", modifiers: "Bold"), inactive_style: ()),
|
||||||
|
borders_style: (fg: "#6e738d"),
|
||||||
|
highlighted_item_style: (fg: "#c6a0f6", modifiers: "Bold"),
|
||||||
|
current_item_style: (fg: "black", bg: "#b7bdf8", modifiers: "Bold"),
|
||||||
|
highlight_border_style: (fg: "#b7bdf8"),
|
||||||
|
song_table_format: [
|
||||||
|
(
|
||||||
|
prop: (kind: Property(Artist), style: (fg: "#b7bdf8"), default: (kind: Text("Unknown"))),
|
||||||
|
width: "50%",
|
||||||
|
alignment: Right,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
prop: (kind: Text("-"), style: (fg: "#b7bdf8"), default: (kind: Text("Unknown"))),
|
||||||
|
width: "1",
|
||||||
|
alignment: Center,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
prop: (kind: Property(Title), style: (fg: "#7dc4e4"), default: (kind: Text("Unknown"))),
|
||||||
|
width: "50%",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
header: (
|
||||||
|
rows: [
|
||||||
|
(
|
||||||
|
left: [
|
||||||
|
(kind: Text("["), style: (fg: "#b7bdf8", modifiers: "Bold")),
|
||||||
|
(kind: Property(Status(State)), style: (fg: "#b7bdf8", modifiers: "Bold")),
|
||||||
|
(kind: Text("]"), style: (fg: "#b7bdf8", modifiers: "Bold"))
|
||||||
|
],
|
||||||
|
center: [
|
||||||
|
(kind: Property(Song(Artist)), style: (fg: "#eed49f", modifiers: "Bold"),
|
||||||
|
default: (kind: Text("Unknown"), style: (fg: "#eed49f", modifiers: "Bold"))
|
||||||
|
),
|
||||||
|
(kind: Text(" - ")),
|
||||||
|
(kind: Property(Song(Title)), style: (fg: "#7dc4e4", modifiers: "Bold"),
|
||||||
|
default: (kind: Text("No Song"), style: (fg: "#7dc4e4", modifiers: "Bold"))
|
||||||
|
)
|
||||||
|
],
|
||||||
|
right: [
|
||||||
|
(kind: Text("Vol: "), style: (fg: "#b7bdf8", modifiers: "Bold")),
|
||||||
|
(kind: Property(Status(Volume)), style: (fg: "#b7bdf8", modifiers: "Bold")),
|
||||||
|
(kind: Text("% "), style: (fg: "#b7bdf8", modifiers: "Bold"))
|
||||||
|
]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
tabs: [
|
||||||
|
(
|
||||||
|
name: "Queue",
|
||||||
|
pane: Split(
|
||||||
|
direction: Horizontal,
|
||||||
|
panes: [(size: "60%", pane: Pane(Queue)), (size: "40%", pane: Pane(AlbumArt))],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
name: "Directories",
|
||||||
|
pane: Pane(Directories),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
name: "Artists",
|
||||||
|
pane: Pane(Artists),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
name: "Album Artists",
|
||||||
|
pane: Pane(AlbumArtists),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
name: "Albums",
|
||||||
|
pane: Pane(Albums),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
name: "Playlists",
|
||||||
|
pane: Pane(Playlists),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
name: "Search",
|
||||||
|
pane: Pane(Search),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
@@ -21,6 +21,7 @@ export GBM_BACKEND=nvidia-drm
|
|||||||
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
||||||
export LIBVA_DRIVER_NAME=nvidia
|
export LIBVA_DRIVER_NAME=nvidia
|
||||||
export __GL_GSYNC_ALLOWED=1
|
export __GL_GSYNC_ALLOWED=1
|
||||||
|
export __GL_THREADED_OPTIMIZATIONS=0
|
||||||
|
|
||||||
export QT_IM_MODULE=fcitx
|
export QT_IM_MODULE=fcitx
|
||||||
export XMODIFIERS=@im=fcitx
|
export XMODIFIERS=@im=fcitx
|
||||||
|
|||||||
@@ -157,13 +157,13 @@
|
|||||||
"format-disconnected": "Disconnected ⚠",
|
"format-disconnected": "Disconnected ⚠",
|
||||||
"on-click": "$HOME/.config/rofi/scripts/rofi-wifi-menu.sh",
|
"on-click": "$HOME/.config/rofi/scripts/rofi-wifi-menu.sh",
|
||||||
},
|
},
|
||||||
"custom/weather": {
|
// "custom/weather": {
|
||||||
"interval": 600,
|
// "interval": 600,
|
||||||
"exec": "~/.config/waybar/scripts/wttr.sh Los_Angeles",
|
// "exec": "~/.config/waybar/scripts/wttr.sh Los_Angeles",
|
||||||
"return-type": "json",
|
// "return-type": "json",
|
||||||
"format": "{}",
|
// "format": "{}",
|
||||||
"tooltip": true,
|
// "tooltip": true,
|
||||||
},
|
// },
|
||||||
"custom/kernel": {
|
"custom/kernel": {
|
||||||
"exec": "uname -r | sed -E 's/^([0-9]+\\.[0-9]+\\.[0-9]+)-.*-([a-zA-Z0-9]+)/\\1-\\2/'",
|
"exec": "uname -r | sed -E 's/^([0-9]+\\.[0-9]+\\.[0-9]+)-.*-([a-zA-Z0-9]+)/\\1-\\2/'",
|
||||||
"format": "{} ",
|
"format": "{} ",
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ label:focus {
|
|||||||
/* background-color: @overlay0; */
|
/* background-color: @overlay0; */
|
||||||
background-color: @surface0;
|
background-color: @surface0;
|
||||||
color: @mantle;
|
color: @mantle;
|
||||||
|
margin: 5px 3px 5px 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tray > .passive {
|
#tray > .passive {
|
||||||
@@ -273,7 +274,7 @@ label:focus {
|
|||||||
color: @mantle;
|
color: @mantle;
|
||||||
background-color: @peach;
|
background-color: @peach;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
margin: 5px 1px;
|
margin: 5px 5px 5px 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#cava {
|
#cava {
|
||||||
@@ -310,7 +311,7 @@ label:focus {
|
|||||||
background-color: @flamingo;
|
background-color: @flamingo;
|
||||||
color: @base;
|
color: @base;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
margin: 5px 1px;
|
margin: 5px 5px 5px 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#custom-notification {
|
#custom-notification {
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ bindkey -M vicmd '^[[A' history-substring-search-up
|
|||||||
bindkey -M vicmd '^[[B' history-substring-search-down
|
bindkey -M vicmd '^[[B' history-substring-search-down
|
||||||
bindkey '^ ' autosuggest-accept
|
bindkey '^ ' autosuggest-accept
|
||||||
|
|
||||||
|
|
||||||
# The following lines were added by compinstall
|
# The following lines were added by compinstall
|
||||||
|
|
||||||
zstyle ':completion:*' completer _complete _ignored _match _approximate
|
zstyle ':completion:*' completer _complete _ignored _match _approximate
|
||||||
@@ -63,4 +62,13 @@ zstyle :compinstall filename /home/sudacode/.zsh/.zshrc
|
|||||||
|
|
||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
compinit
|
compinit
|
||||||
# End of lines added by compinstall
|
|
||||||
|
# load both the URL‐quoting and paste‐magic widgets
|
||||||
|
autoload -Uz url-quote-magic bracketed-paste-magic
|
||||||
|
|
||||||
|
# tell url-quote-magic which chars to escape
|
||||||
|
zstyle ':url-quote-magic:*' url-quotes ''
|
||||||
|
|
||||||
|
# bind it to both typing and pasting
|
||||||
|
zle -N self-insert url-quote-magic
|
||||||
|
zle -N bracketed-paste bracketed-paste-magic
|
||||||
|
|||||||
@@ -48,4 +48,13 @@ zstyle :compinstall filename '/Users/sudacode/.zshrc'
|
|||||||
|
|
||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
compinit
|
compinit
|
||||||
# End of lines added by compinstall
|
|
||||||
|
# load both the URL‐quoting and paste‐magic widgets
|
||||||
|
autoload -Uz url-quote-magic bracketed-paste-magic
|
||||||
|
|
||||||
|
# tell url-quote-magic which chars to escape
|
||||||
|
zstyle ':url-quote-magic:*' url-quotes ''
|
||||||
|
|
||||||
|
# bind it to both typing and pasting
|
||||||
|
zle -N self-insert url-quote-magic
|
||||||
|
zle -N bracketed-paste bracketed-paste-magic
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
- [hyprland.conf](.config/hypr/hyprland.conf)
|
- [hyprland.conf](.config/hypr/hyprland.conf)
|
||||||
- [keybindings.conf](.config/hypr/keybindings.conf)
|
- [keybindings.conf](.config/hypr/keybindings.conf)
|
||||||
- Shell: [zsh (oh-my-posh)](https://ohmyposh.dev/)
|
- Shell: [zsh (oh-my-posh)](https://ohmyposh.dev/)
|
||||||
- [.zshrc](.zsh/.zshrc)
|
- [.zshrc](.zsh/.zshrc##default)
|
||||||
- Notification Server: [SwayNotificationCenter](https://github.com/ErikReider/SwayNotificationCenter)
|
- Notification Server: [SwayNotificationCenter](https://github.com/ErikReider/SwayNotificationCenter)
|
||||||
- [config.json](.config/swaync/config.json)
|
- [config.json](.config/swaync/config.json)
|
||||||
- [style.css](.config/swaync/style.css)
|
- [style.css](.config/swaync/style.css)
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
- Text Editor: [neovim](https://neovim.io/)
|
- Text Editor: [neovim](https://neovim.io/)
|
||||||
- [config](.config/nvim)
|
- [config](.config/nvim)
|
||||||
- Audio Player: [mpd](https://www.musicpd.org/) with [ncmpcpp](https://github.com/ncmpcpp/ncmpcpp)
|
- Audio Player: [mpd](https://www.musicpd.org/) with [ncmpcpp](https://github.com/ncmpcpp/ncmpcpp)
|
||||||
- [mpd config](.config/mpd/mpd.conf)
|
- [mpd config](.config/mpd/mpd.conf##default)
|
||||||
- [ncmpcpp config](.config/ncmpcpp/config)
|
- [ncmpcpp config](.config/ncmpcpp/config##Default)
|
||||||
- Audio Visualizer: [cava](https://github.com/karlstav/cava)
|
- Audio Visualizer: [cava](https://github.com/karlstav/cava)
|
||||||
- [cava config](.config/cava/config)
|
- [cava config](.config/cava/config##default)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -22,28 +23,41 @@ const (
|
|||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Topics []string `json:"topics"`
|
Topics []string `json:"topics"`
|
||||||
|
Keep int `json:"keep"` // Number of wallpapers to keep (0 = never delete)
|
||||||
|
WallpaperDir string `json:"wallpaperDir"` // Directory to store wallpapers
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultTopics = []string{
|
var defaultTopics = []string{
|
||||||
"lofi",
|
"lofi",
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadConfig() []string {
|
const defaultKeep = 10
|
||||||
|
|
||||||
|
func loadConfig() (topics []string, keep int, wallpaperDir string) {
|
||||||
homeDir, err := os.UserHomeDir()
|
homeDir, err := os.UserHomeDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return defaultTopics
|
return defaultTopics, defaultKeep, wallpaperDir
|
||||||
}
|
}
|
||||||
configPath := filepath.Join(homeDir, ".config", "change-wallpaper", "config.json")
|
configPath := filepath.Join(homeDir, ".config", "change-wallpaper", "config.json")
|
||||||
file, err := os.Open(configPath)
|
file, err := os.Open(configPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return defaultTopics
|
return defaultTopics, defaultKeep, wallpaperDir
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
var cfg Config
|
var cfg Config
|
||||||
if err := json.NewDecoder(file).Decode(&cfg); err != nil || len(cfg.Topics) == 0 {
|
if err := json.NewDecoder(file).Decode(&cfg); err != nil {
|
||||||
return defaultTopics
|
return defaultTopics, defaultKeep, wallpaperDir
|
||||||
}
|
}
|
||||||
return cfg.Topics
|
if len(cfg.Topics) == 0 {
|
||||||
|
cfg.Topics = defaultTopics
|
||||||
|
}
|
||||||
|
if cfg.Keep < 0 {
|
||||||
|
cfg.Keep = defaultKeep
|
||||||
|
}
|
||||||
|
if cfg.WallpaperDir == "" {
|
||||||
|
cfg.WallpaperDir = wallpaperDir
|
||||||
|
}
|
||||||
|
return cfg.Topics, cfg.Keep, cfg.WallpaperDir
|
||||||
}
|
}
|
||||||
|
|
||||||
type WallhavenResponse struct {
|
type WallhavenResponse struct {
|
||||||
@@ -57,7 +71,7 @@ func main() {
|
|||||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
|
|
||||||
// Load topics from config or use defaults
|
// Load topics from config or use defaults
|
||||||
topics := loadConfig()
|
topics, keep, configWallpaperDir := loadConfig()
|
||||||
|
|
||||||
// Check if a file path was provided as argument
|
// Check if a file path was provided as argument
|
||||||
if len(os.Args) > 1 {
|
if len(os.Args) > 1 {
|
||||||
@@ -75,14 +89,26 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
wallpaperPath := filepath.Join(homeDir, wallpaperDir)
|
// Use config wallpaper directory if set, otherwise use default
|
||||||
|
var wallpaperPath string
|
||||||
|
if configWallpaperDir != "" {
|
||||||
|
if strings.HasPrefix(configWallpaperDir, "~/") {
|
||||||
|
wallpaperPath = filepath.Join(homeDir, configWallpaperDir[2:])
|
||||||
|
} else if configWallpaperDir == "~" {
|
||||||
|
wallpaperPath = homeDir
|
||||||
|
} else {
|
||||||
|
wallpaperPath = configWallpaperDir
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
wallpaperPath = filepath.Join(homeDir, wallpaperDir)
|
||||||
|
}
|
||||||
if err := os.MkdirAll(wallpaperPath, 0755); err != nil {
|
if err := os.MkdirAll(wallpaperPath, 0755); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Error creating wallpaper directory: %v\n", err)
|
fmt.Fprintf(os.Stderr, "Error creating wallpaper directory: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download and set new wallpaper
|
// Download and set new wallpaper
|
||||||
newWallpaper, topic := downloadRandomWallpaper(wallpaperPath, r, topics)
|
newWallpaper, topic := downloadRandomWallpaper(wallpaperPath, r, topics, keep)
|
||||||
if newWallpaper != "" {
|
if newWallpaper != "" {
|
||||||
changeWallpaper(newWallpaper, topic)
|
changeWallpaper(newWallpaper, topic)
|
||||||
} else {
|
} else {
|
||||||
@@ -91,7 +117,33 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func downloadRandomWallpaper(wallpaperPath string, r *rand.Rand, topics []string) (string, string) {
|
func downloadRandomWallpaper(wallpaperPath string, r *rand.Rand, topics []string, keep int) (string, string) {
|
||||||
|
// Clean up old wallpapers before downloading a new one, if keep > 0
|
||||||
|
if keep > 0 {
|
||||||
|
files, err := os.ReadDir(wallpaperPath)
|
||||||
|
if err == nil && len(files) > keep {
|
||||||
|
type fileInfo struct {
|
||||||
|
name string
|
||||||
|
mod int64
|
||||||
|
}
|
||||||
|
var fileInfos []fileInfo
|
||||||
|
for _, f := range files {
|
||||||
|
if !f.IsDir() {
|
||||||
|
info, err := f.Info()
|
||||||
|
if err == nil {
|
||||||
|
fileInfos = append(fileInfos, fileInfo{f.Name(), info.ModTime().Unix()})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Sort by mod time, newest first
|
||||||
|
sort.Slice(fileInfos, func(i, j int) bool { return fileInfos[i].mod > fileInfos[j].mod })
|
||||||
|
for _, f := range fileInfos[keep:] {
|
||||||
|
os.Remove(filepath.Join(wallpaperPath, f.name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If keep == 0, never delete
|
||||||
|
|
||||||
// Select random topic
|
// Select random topic
|
||||||
topic := topics[r.Intn(len(topics))]
|
topic := topics[r.Intn(len(topics))]
|
||||||
var query string
|
var query string
|
||||||
|
|||||||
Reference in New Issue
Block a user