diff --git a/.zshrc b/.zshrc deleted file mode 100644 index 502cc13..0000000 --- a/.zshrc +++ /dev/null @@ -1,141 +0,0 @@ -#user-defined functions -gtp(){ - [ -z "$*" ] && commit=$(curl -s "https://raw.githubusercontent.com/ngerakines/commitment/master/commit_messages.txt" | shuf -n1) || commit=$* - git add -p - git commit -m "$commit" - git push - unset commit -} - -megamind() { - len=$(printf '%s' "$*" | wc -c) - - printf "———————————%s——————————— -⠀⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝ -⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇ -⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀ -⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀ -⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀ -⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀ -⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -——————————————————————" "$*" - for i in $(seq $len); do - printf '—' - done - printf '\n' - unset len -} -gtb () { - [ -z "$*" ] && br=$(git branch -a | fzf --border=rounded --layout=reverse --height=10 | tr -d ' ') || br=$* - [ -z "$br" ] || git checkout $br - unset br -} - -holidays(){ - printf 'Day Date Holiday - -Tuesday 15th August Independence Day -Wednesday 30th August Rakshabandhan -Monday 2nd October Gandhi Jayanti -Tuesday 24th October Dussehra -Sunday-Tuesday 12-14 November Diwali & Bhai dooj\n' | bat -pp -l tsv -} - -b64 () { printf "%s" "$1" | base64 $2 $3; } - -url() { - [ -z "$2" ] && duration="1440" || duration=$2 - out=$(curl -k https://oshi.at -F shorturl=0 -F "f=@$1" -F "expire=$duration") #1440 means 1 day duration - [ -z "$out" ] && return 1 - printf "%s" "$out" | sed -nE 's|DL: (.*)|\1|p' | wl-copy && notify-send "Link copied to clipboard"; - wl-paste - #storing only long duration links - [ -z "$2" ] && printf "%s\n%s" "$out" "$(date '+%s')" | tr '\n' '>' | sed 's/>/ | /g' >> $HOME/.cache/oshi-urls - - #deleting file uploaded than 1 day ago - for i in $(cut -d'|' -f3 $HOME/.cache/oshi-urls | tr -d ' ');do - curr=$(date '+%s') - [ "$((curr - i))" -gt "86400" ] && sed -i "/$i/d" $HOME/.cache/oshi-urls & - done - echo >> $HOME/.cache/oshi-urls -} - -gtd () { - preview="git diff $@ --color=always -- {-1}" - file=$(git diff $@ --name-only --relative | fzf --ansi --preview $preview --preview-window right:65%:wrap -0) - [ -n "$file" ] && nvim $file - unset preview file -} - -gtc () { [ -z "$*" ] && [ -p "/dev/stdin" ] && read -r query &1 | bat --plain --language=help -} - -addpkg(){ - [ -z "$*" ] && printf "\033[1;31mPlease write the name of package (just some words)..\033[0m" && return 1 - paru -Ss "$*" | sed -nE 's|^[a-z]*/([^ ]*).*|\1|p' | fzf --preview 'paru -Si {} | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | paru -S - -} - -rmpkg(){ - paru -Qq | fzf --preview 'paru -Si {} | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | paru -Rcns - -} - -# Lines configured by zsh-newuser-install -export EDITOR="nvim" -export MANPAGER="sh -c 'col -bx | bat -l man -p'" -export VISUAL="nvim" -export TERMINAL="foot" -export OPENER="xdg-open" -export VIDEO="mpv" -export WM="hyprland" -export IMAGE="nsxiv" -alias cat="bat -pp --color=always" -alias open="xdg-open" -alias cp="cp -v" -alias art="php artisan" -alias rm="rm -v" -alias mv="mv -v" -alias pgrep="pgrep -a" -alias grep="grep --color=auto" -alias ncdu="ncdu --color dark" -alias ll="ls --color=auto -alh" -alias ls="ls --color=auto" -alias fetch='/bin/*fetch' -alias nchh="nvim ~/.config/hypr/hyprland.conf" -alias shfmt="shfmt -ci -d -w" - -clshist -HISTFILE=~/.histfile -HISTSIZE=200 -SAVEHIST=200 -PROMPT_EOL_MARK=' ⏎ ' -setopt autocd -bindkey -e -zstyle :compinstall filename "$HOME/.zshrc" -autoload -Uz compinit -compinit -zstyle ':completion:*' menu select -eval "$(starship init zsh)" -[ -f "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] && source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -source $HOME/.config/fzf-tab/fzf-tab.plugin.zsh diff --git a/eww/eww.scss b/eww/eww.scss index 6c663a8..30d6b6a 100644 --- a/eww/eww.scss +++ b/eww/eww.scss @@ -40,7 +40,7 @@ color: #8FBCBB; font-size : 24px; font-weight : bold; - margin : 20px 0px 0px 0px; + margin : 30px 0px 0px 0px; } .artist { color: #EBCB8B; @@ -50,7 +50,7 @@ } .btn_play { color: #A3BE8C; - font-family: IosevkaTerm Nerd Font Mono; + font-family: IosevkaTerm Nerd Font; font-size : 70px; } .btn_play:hover { @@ -59,7 +59,7 @@ .btn_controls { color: #EBCB8B; font-size : 32px; - font-family: IosevkaTerm Nerd Font Mono; + font-family: IosevkaTerm Nerd Font; } .btn_controls:hover { font-size : 50px; @@ -67,6 +67,8 @@ .lyrics { color: #EBCB8B; margin : -20px 0px 0px 0px; + font-family: IBM Plex Sans Text; + font-size : 18px; } .music_bar { color: #81A1C1; diff --git a/eww/script b/eww/script index 145e51b..616a72f 100755 --- a/eww/script +++ b/eww/script @@ -4,7 +4,7 @@ case $1 in songdata) out=$(printf '{ "command": ["get_property", "pause"]}\n' | socat - /tmp/yt-music/yt-music-mpvsocket 2>/dev/null) if [ -n "$out" ] && pgrep -f mpvsocket >/dev/null 2>&1;then - printf '{"name":"%s","artist":"%s","cover":"/tmp/yt-music/default.jpg","next":"%s","prev":"%s"}' "$(cut -d'>' -f1 < "/tmp/yt-music/current" | cut -d':' -f2 | sed 's|[^-]*$||;s|-$||;s| $||;s|^ ||')" "$(cut -d'>' -f1 < "/tmp/yt-music/current" | sed 's_.* - __;s| $||')" "$(sed -n "/$(cut -d'>' -f2 < /tmp/yt-music/current )/{n;p}" /tmp/yt-music/next | cut -f1)" "$(sed -n "$(cat /tmp/yt-music/counter)p" /tmp/yt-music/next | cut -f1)" + printf '{"name":"%s","artist":"%s","cover":"/tmp/yt-music/default.jpg","next":"%s","prev":"%s"}' "$(cut -d'>' -f1 < "/tmp/yt-music/current" | cut -d':' -f2- | sed 's|[^-]*$||;s|-$||;s| $||;s|^ ||')" "$(cut -d'>' -f1 < "/tmp/yt-music/current" | sed 's_.* - __;s| $||')" "$(sed -n "/$(cut -d'>' -f2 < /tmp/yt-music/current )/{n;p}" /tmp/yt-music/next | cut -f1)" "$(sed -n "$(cat /tmp/yt-music/counter)p" /tmp/yt-music/next | cut -f1)" else printf '{"name":"OFFLINE","artist":"offline","cover":"%s/.config/eww/music.png"}' "$HOME" fi @@ -21,7 +21,7 @@ case $1 in ;; lyrics) if [ -f "/tmp/yt-music/lyrics" ]; then - awk -F'\t' -v value="$(echo '{ "command": ["get_property", "time-pos"] }' | socat - /tmp/yt-music/yt-music-mpvsocket | sed -nE 's|.*data":([^,]*).*|\1|p')" '$1 > value*1002 {print $2;exit}' /tmp/yt-music/lyrics + awk -F'\t' -v value="$(echo '{ "command": ["get_property", "time-pos"] }' | socat - /tmp/yt-music/yt-music-mpvsocket | sed -nE 's|.*data":([^,]*).*|\1|p')" '$1 > value*1005 {print $2;exit}' /tmp/yt-music/lyrics else printf "Lyrics will show here" fi diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 49df662..4150e1d 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -167,7 +167,7 @@ windowrulev2=fullscreen,class:^(org.freedesktop.Xwayland)$ #startup applications exec-once=dbus-update-activation-environment --systemd --all exec-once=ssh-agent -exec-once=swaybg -i ~/wall/9.png +exec-once=swaybg -i $HOME/.config/wall/9.png exec-once=xrdb -merge $HOME/.config/.Xresource exec-once=$hypr_dir/workspace 'focus' exec-once=sleep 5 && $hypr_dir/workspace diff --git a/mpv/mpv.conf b/mpv/mpv.conf index 9cb18ec..a448fe0 100644 --- a/mpv/mpv.conf +++ b/mpv/mpv.conf @@ -1,3 +1,4 @@ #hwdec=auto profile=gpu-hq gpu-context=wayland +input-ipc-server=/tmp/mpvsocket diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 23b19b5..c3f7ebb 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,5 +1,5 @@ { - "LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" }, + "LuaSnip": { "branch": "master", "commit": "c5fb16a934892086d4ba01bac48b77c65435025e" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, @@ -9,17 +9,17 @@ "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "dfdd771b792fbb4bad8e057d72558255695aa1a7" }, - "mason.nvim": { "branch": "main", "commit": "ee6a7f179ebf8aa9da9d53b1cf1b57d292ea0182" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2451adb9bdb0fd32140bf3aa8dbc17ff60050db3" }, + "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, "monokai-pro.nvim": { "branch": "main", "commit": "826d028edbcc7a8aadc0f7a32b32747d97575615" }, - "nvim-autopairs": { "branch": "master", "commit": "35493556b895f54c129918aca43ae9a63af42a1f" }, + "nvim-autopairs": { "branch": "master", "commit": "7b3eb9b5813a22188c4dbb248475fcbaf9f4d195" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, - "nvim-dap": { "branch": "master", "commit": "0e6b7c47dd70e80793ed39271b2aa712d9366dbc" }, + "nvim-dap": { "branch": "master", "commit": "b3d4408e29d924fe130c9397a7c3b3630b3ea671" }, "nvim-dap-python": { "branch": "master", "commit": "37b4cba02e337a95cb62ad1609b3d1dccb2e5d42" }, - "nvim-lspconfig": { "branch": "master", "commit": "0517d8522dcec286b1dba47aa3ee1ed8f523aed6" }, + "nvim-lspconfig": { "branch": "master", "commit": "4266f9bb36b4fb09edd19b67d95043cf7ff88ddf" }, "nvim-parinfer": { "branch": "master", "commit": "5ca09287ab3f4144f78ff7977fabc27466f71044" }, - "nvim-treesitter": { "branch": "master", "commit": "80b4fa7970ee159e5c2c715bbcd386143c48dcb1" }, + "nvim-treesitter": { "branch": "master", "commit": "fc93fa5c07df7cd578a3ea82d7c075c0460a6884" }, "packer.nvim": { "branch": "master", "commit": "ea0cc3c59f67c440c5ff0bbe4fb9420f4350b9a3" }, - "telescope.nvim": { "branch": "master", "commit": "20a37e43bb43c74c6091f9fea6551af0964ad45a" } + "telescope.nvim": { "branch": "master", "commit": "40c8d2fc2b729dd442eda093cf8c9496d6e23732" } } \ No newline at end of file diff --git a/wall/1.png b/wall/1.png new file mode 100644 index 0000000..a0f1ee2 Binary files /dev/null and b/wall/1.png differ diff --git a/wall/10.png b/wall/10.png new file mode 100755 index 0000000..ee28d8c Binary files /dev/null and b/wall/10.png differ diff --git a/wall/11.jpg b/wall/11.jpg new file mode 100644 index 0000000..efd4ebe Binary files /dev/null and b/wall/11.jpg differ diff --git a/wall/12.jpg b/wall/12.jpg new file mode 100644 index 0000000..5c99cd5 Binary files /dev/null and b/wall/12.jpg differ diff --git a/wall/13.jpg b/wall/13.jpg new file mode 100644 index 0000000..93e4b63 Binary files /dev/null and b/wall/13.jpg differ diff --git a/wall/14.jpg b/wall/14.jpg new file mode 100644 index 0000000..e49280c Binary files /dev/null and b/wall/14.jpg differ diff --git a/wall/15.jpg b/wall/15.jpg new file mode 100644 index 0000000..28b0427 Binary files /dev/null and b/wall/15.jpg differ diff --git a/wall/16.jpg b/wall/16.jpg new file mode 100644 index 0000000..e9561b0 Binary files /dev/null and b/wall/16.jpg differ diff --git a/wall/17.jpg b/wall/17.jpg new file mode 100644 index 0000000..1e22b20 Binary files /dev/null and b/wall/17.jpg differ diff --git a/wall/2.jpg b/wall/2.jpg new file mode 100644 index 0000000..a9a5041 Binary files /dev/null and b/wall/2.jpg differ diff --git a/wall/3.jpg b/wall/3.jpg new file mode 100644 index 0000000..d8ef2aa Binary files /dev/null and b/wall/3.jpg differ diff --git a/wall/4.png b/wall/4.png new file mode 100644 index 0000000..cd5e812 Binary files /dev/null and b/wall/4.png differ diff --git a/wall/5.png b/wall/5.png new file mode 100644 index 0000000..33764a8 Binary files /dev/null and b/wall/5.png differ diff --git a/wall/6.png b/wall/6.png new file mode 100644 index 0000000..6aae25f Binary files /dev/null and b/wall/6.png differ diff --git a/wall/7.png b/wall/7.png new file mode 100644 index 0000000..d321411 Binary files /dev/null and b/wall/7.png differ diff --git a/wall/8.png b/wall/8.png new file mode 100755 index 0000000..69da7cf Binary files /dev/null and b/wall/8.png differ diff --git a/wall/9.png b/wall/9.png new file mode 100755 index 0000000..412036a Binary files /dev/null and b/wall/9.png differ diff --git a/zsh/completions/_url_oshi b/zsh/completions/_url_oshi new file mode 100644 index 0000000..5db6c2d --- /dev/null +++ b/zsh/completions/_url_oshi @@ -0,0 +1,2 @@ +#compdef url_oshi +_arguments '1:filename:_files' "2:no of days:({1..90})" diff --git a/zsh/completions/_yt-music b/zsh/completions/_yt-music new file mode 100644 index 0000000..e96f604 --- /dev/null +++ b/zsh/completions/_yt-music @@ -0,0 +1,41 @@ +#compdef yt-music + +local -a subcmds +subcmds=( + 'search_play:searches first, then plays the music in mpv' + 'play:plays the music in mpv' + 'play_next:plays the next music in /tmp/yt-music/next file' + 'loop:plays the next music after the current is finished (run it as a background process)' +) + +local -a play_next_args +play_next_args=( + 'menu:menu:Show music list to choose from' +) + +local -a loop_args +loop_args=( + 'print:print:show what is going on' +) + +local subcmd + +if (( $#words > 3 )); then + return 1 +fi + +subcmd=${words[2]} + +case $subcmd in + (play_next) + # For 'play_next', add 'menu' as an option + _describe -t play_next_args 'subcommand arguments' play_next_args && return ;; + (loop) + # For 'loop', add 'print' as an option + _describe -t loop_args 'subcommand arguments' loop_args && return ;; + (play|search_play) + return ;; +esac + +# Describe the available subcommands +_describe 'command' subcmds diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100644 index 0000000..dac5804 --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,154 @@ +#user-defined functions + +hex_to_string() { + for hex in $(printf '%s' "$1" | sed 's/../&\n/g'); do + [ "$hex" = "00" ] && continue + printf "\x$hex" + done + unset hex +} + +gtp() { + [ -z "$*" ] && commit=$(curl -s "https://raw.githubusercontent.com/ngerakines/commitment/master/commit_messages.txt" | shuf -n1) || commit=$* + git add -p + git commit -m "$commit" + git push + unset commit +} + +megamind() { + len=$(printf '%s' "$*" | wc -c) + + printf "———————————%s——————————— +⠀⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝ +⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇ +⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀ +⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀ +⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀ +⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +——————————————————————" "$*" + for i in $(seq $len); do + printf '—' + done + printf '\n' + unset len +} +gtb() { + [ -z "$*" ] && br=$(git branch -a | fzf --border=rounded --layout=reverse --height=10 | tr -d ' ') || br=$* + [ -z "$br" ] || git checkout $br + unset br +} + +b64() { + # base64 wrapper , also converts url base64 + printf "%s" "$1" | tr "._-" '=/+' | base64 -w 0 $2 +} + +url_oshi() { + days=${2:-1} + out=$(curl -k https://oshi.at -F shorturl=0 -F "f=@$1" -F "expire=$((days * 1440))") #1440 means 1 day duration + [ -z "$out" ] && return 1 + printf "%s" "$out" | sed -nE 's|DL: (.*)|\1|p' | wl-copy && notify-send "Link copied to clipboard" + wl-paste + curr=$(date '+%s') + #storing only long duration links + [ -z "$2" ] && printf "%s\n%s" "$out" "$((curr + (86400 * days)))" | tr '\n' '>' | sed 's/>/ | /g' >>$HOME/.cache/oshi-urls + + #deleting file uploaded than nth day ago + for i in $(cut -d'|' -f3 $HOME/.cache/oshi-urls | tr -d ' '); do + [ "$curr" -ge "$i" ] && sed -i "/$i/d" $HOME/.cache/oshi-urls & + done + echo >>$HOME/.cache/oshi-urls +} + +url_nextcloud() { + [ ! -f "$HOME/.secrets" ] && notify-send "Credentials not found" -u critical && return 1 + source "$HOME"/.secrets + curl "$NC_HOST/remote.php/dav/files/${NC_USER}${NC_FOLDER_PATH}/$(basename "$1")" -H "Authorization: Basic $NC_AUTH" -T "$1" + + #To enable sharing, the output will be in json containing share link + curl -s -H "Authorization: Basic $NC_AUTH" "$NC_HOST/ocs/v2.php/apps/files_sharing/api/v1/shares" -H 'content-type: application/json' -H 'accept: application/json, text/plain, */*' -H 'OCS-APIRequest: true' --data-raw "{\"path\":\"${NC_FOLDER_PATH}/$(basename "$1")\",\"shareType\":3,\"attributes\":\"[]\"}" | sed -nE 's|.*"url":"([^"]*)".*|\1|p' | sed 's/\\//g' | wl-copy && notify-send "Link copied to clipboard" + unset NC_HOST NC_USER NC_FOLDER_PATH NC_AUTH +} + +gtd() { + preview="git diff $@ --color=always -- {-1}" + file=$(git diff $@ --name-only --relative | fzf --ansi --preview $preview --preview-window right:65%:wrap -0) + [ -n "$file" ] && nvim $file + unset preview file +} + +gtc() { + [ -z "$1" ] && [ -p "/dev/stdin" ] && read -r query &1 | bat --plain --language=help +} + +addpkg() { + [ -z "$*" ] && printf "\033[1;31mPlease write the name of package (just some words)..\033[0m" && return 1 + paru -Ss "$*" | sed -nE 's|^([a-z]*)/([^ ]*).*|[\1] \2|p' | fzf --layout=reverse --border --preview 'paru -Si $(echo {} | cut -d" " -f2) | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | cut -d' ' -f2- | paru -S - +} + +rmpkg() { + paru -Qq | fzf --preview 'paru -Si {} | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | paru -Rcns - +} + +# Lines configured by zsh-newuser-install +export MANPAGER="sh -c 'col -bx | bat -l man -p'" +alias cat="bat -pp --color=always" +alias open="xdg-open" +alias cp="cp -v" +alias lsblk="lsblk -o 'NAME,SIZE,FSAVAIL,FSUSED,FSUSE%,MOUNTPOINTS'" +alias art="php artisan" +alias rm="rm -v" +alias mv="mv -v" +alias pgrep="pgrep -a" +alias grep="grep --color=auto" +alias ncdu="ncdu --color dark" +alias ll="lsd --color=auto -alh" +alias ls="lsd --color=auto" +alias fetch='/bin/*fetch' +alias nchh="nvim ~/.config/hypr/hyprland.conf" +alias shfmt="shfmt -ci -d -w" + +HISTFILE=~/.histfile +HISTSIZE=500 +SAVEHIST=500 +clshist +PROMPT_EOL_MARK=' ⏎ ' +setopt autocd +bindkey -e +zstyle :compinstall filename "$0" +fpath=($HOME/.config/zsh/completions $fpath) +autoload -Uz compinit +compinit +zstyle ':completion:*' menu select +eval "$(starship init zsh)" +[ -f "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] && source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +source $HOME/.config/fzf-tab/fzf-tab.plugin.zsh