init
This commit is contained in:
commit
b4cdb80b5c
137 changed files with 6383 additions and 0 deletions
126
bin/.bin/base16-rose-pine-scheme.sh
Executable file
126
bin/.bin/base16-rose-pine-scheme.sh
Executable file
|
@ -0,0 +1,126 @@
|
|||
#!/bin/sh
|
||||
# base16-shell (https://github.com/chriskempson/base16-shell)
|
||||
# Base16 Shell template by Chris Kempson (http://chriskempson.com)
|
||||
# Rosé Pine Dawn scheme by Emilia Dunfelt <sayhi@dunfelt.se>
|
||||
|
||||
color00="19/17/24" # Base 00 - Black
|
||||
color01="eb/6f/92" # Base 08 - Red
|
||||
color02="31/74/8f" # Base 0B - Green
|
||||
color03="eb/bc/ba" # Base 0A - Yellow
|
||||
color04="c4/a7/e7" # Base 0D - Blue
|
||||
color05="f6/c1/77" # Base 0E - Magenta
|
||||
color06="9c/cf/d8" # Base 0C - Cyan
|
||||
color07="e0/de/f4" # Base 05 - White
|
||||
color08="90/8c/aa" # Base 03 - Bright Black
|
||||
color09=$color01 # Base 08 - Bright Red
|
||||
color10=$color02 # Base 0B - Bright Green
|
||||
color11=$color03 # Base 0A - Bright Yellow
|
||||
color12=$color04 # Base 0D - Bright Blue
|
||||
color13=$color05 # Base 0E - Bright Magenta
|
||||
color14=$color06 # Base 0C - Bright Cyan
|
||||
color15="52/4f/67" # Base 07 - Bright White
|
||||
color16="f6/c1/77" # Base 09
|
||||
color17="eb/6f/92" # Base 0F
|
||||
color18="1f/1d/2e" # Base 01
|
||||
color19="26/23/3a" # Base 02
|
||||
color20="6e/6a/86" # Base 03
|
||||
color21="52/4f/67" # Base 04
|
||||
color_foreground="e0/de/f4" # Base 05
|
||||
color_background="19/17/24" # Base 00
|
||||
|
||||
if [ -n "$TMUX" ]; then
|
||||
# Tell tmux to pass the escape sequences through
|
||||
# (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324)
|
||||
put_template() { printf '\033Ptmux;\033\033]4;%d;rgb:%s\033\033\\\033\\' $@; }
|
||||
put_template_var() { printf '\033Ptmux;\033\033]%d;rgb:%s\033\033\\\033\\' $@; }
|
||||
put_template_custom() { printf '\033Ptmux;\033\033]%s%s\033\033\\\033\\' $@; }
|
||||
elif [ "${TERM%%[-.]*}" = "screen" ]; then
|
||||
# GNU screen (screen, screen-256color, screen-256color-bce)
|
||||
put_template() { printf '\033P\033]4;%d;rgb:%s\007\033\\' $@; }
|
||||
put_template_var() { printf '\033P\033]%d;rgb:%s\007\033\\' $@; }
|
||||
put_template_custom() { printf '\033P\033]%s%s\007\033\\' $@; }
|
||||
elif [ "${TERM%%-*}" = "linux" ]; then
|
||||
put_template() { [ $1 -lt 16 ] && printf "\e]P%x%s" $1 $(echo $2 | sed 's/\///g'); }
|
||||
put_template_var() { true; }
|
||||
put_template_custom() { true; }
|
||||
else
|
||||
put_template() { printf '\033]4;%d;rgb:%s\033\\' $@; }
|
||||
put_template_var() { printf '\033]%d;rgb:%s\033\\' $@; }
|
||||
put_template_custom() { printf '\033]%s%s\033\\' $@; }
|
||||
fi
|
||||
|
||||
# 16 color space
|
||||
put_template 0 $color00
|
||||
put_template 1 $color01
|
||||
put_template 2 $color02
|
||||
put_template 3 $color03
|
||||
put_template 4 $color04
|
||||
put_template 5 $color05
|
||||
put_template 6 $color06
|
||||
put_template 7 $color07
|
||||
put_template 8 $color08
|
||||
put_template 9 $color09
|
||||
put_template 10 $color10
|
||||
put_template 11 $color11
|
||||
put_template 12 $color12
|
||||
put_template 13 $color13
|
||||
put_template 14 $color14
|
||||
put_template 15 $color15
|
||||
|
||||
# 256 color space
|
||||
put_template 16 $color16
|
||||
put_template 17 $color17
|
||||
put_template 18 $color18
|
||||
put_template 19 $color19
|
||||
put_template 20 $color20
|
||||
put_template 21 $color21
|
||||
|
||||
# foreground / background / cursor color
|
||||
if [ -n "$ITERM_SESSION_ID" ]; then
|
||||
# iTerm2 proprietary escape codes
|
||||
put_template_custom Pg 575279 # foreground
|
||||
put_template_custom Ph faf4ed # background
|
||||
put_template_custom Pi 575279 # bold color
|
||||
put_template_custom Pj f2e9de # selection color
|
||||
put_template_custom Pk 575279 # selected text color
|
||||
put_template_custom Pl 575279 # cursor
|
||||
put_template_custom Pm faf4ed # cursor text
|
||||
else
|
||||
put_template_var 10 $color_foreground
|
||||
if [ "$BASE16_SHELL_SET_BACKGROUND" != false ]; then
|
||||
put_template_var 11 $color_background
|
||||
if [ "${TERM%%-*}" = "rxvt" ]; then
|
||||
put_template_var 708 $color_background # internal border (rxvt)
|
||||
fi
|
||||
fi
|
||||
put_template_custom 12 ";7" # cursor (reverse video)
|
||||
fi
|
||||
|
||||
# clean up
|
||||
unset -f put_template
|
||||
unset -f put_template_var
|
||||
unset -f put_template_custom
|
||||
unset color00
|
||||
unset color01
|
||||
unset color02
|
||||
unset color03
|
||||
unset color04
|
||||
unset color05
|
||||
unset color06
|
||||
unset color07
|
||||
unset color08
|
||||
unset color09
|
||||
unset color10
|
||||
unset color11
|
||||
unset color12
|
||||
unset color13
|
||||
unset color14
|
||||
unset color15
|
||||
unset color16
|
||||
unset color17
|
||||
unset color18
|
||||
unset color19
|
||||
unset color20
|
||||
unset color21
|
||||
unset color_foreground
|
||||
unset color_background
|
15
bin/.bin/code.sh
Executable file
15
bin/.bin/code.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
MODULE_URL="mzunino.com.uy/go/code"
|
||||
BINARY_NAME="code"
|
||||
|
||||
TARGET_DIR="$HOME/.bin"
|
||||
CODE_PATH="$TARGET_DIR/$BINARY_NAME"
|
||||
if [ ! -x "$CODE_PATH" ]; then
|
||||
notify-send "Installing $BINARY_NAME" "Installing from $MODULE_URL..."
|
||||
GO111MODULE=on GOBIN="$TARGET_DIR" go install "$MODULE_URL@latest" || {
|
||||
notify-send -u critical "Installation Failed" "Failed to install $BINARY_NAME from $MODULE_URL"
|
||||
exit 1
|
||||
}
|
||||
notify-send "Installation Complete" "$BINARY_NAME has been installed successfully"
|
||||
fi
|
||||
exec "$CODE_PATH" "$@"
|
32
bin/.bin/fix-git.sh
Executable file
32
bin/.bin/fix-git.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
OLD_URL=$(git remote get-url origin)
|
||||
if [[ $OLD_URL == "https://github.com"* ]]; then
|
||||
# Modified sed pattern to better handle GitHub URLs
|
||||
USER_REPO=$(echo $OLD_URL | sed -n 's|https://github.com/\([^/]*/[^/]*\)|\1|p')
|
||||
if [ -z "$USER_REPO" ]; then
|
||||
echo "Error: Could not extract user/repo from URL: $OLD_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove any trailing .git if present and add it back consistently
|
||||
USER_REPO=$(echo $USER_REPO | sed 's/\.git$//')
|
||||
NEW_URL="git@github.com:${USER_REPO}.git"
|
||||
|
||||
echo "Old URL: $OLD_URL"
|
||||
echo "New URL: $NEW_URL"
|
||||
|
||||
# Update the remote URL to use SSH
|
||||
git remote set-url origin "$NEW_URL"
|
||||
|
||||
# Verify the change
|
||||
CURRENT_URL=$(git remote get-url origin)
|
||||
if [ "$CURRENT_URL" = "$NEW_URL" ]; then
|
||||
echo "Successfully updated remote URL to use SSH."
|
||||
else
|
||||
echo "Error: Failed to update remote URL."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Remote URL is already using SSH or a different protocol: $OLD_URL"
|
||||
fi
|
53
bin/.bin/fuzzel.lua
Normal file
53
bin/.bin/fuzzel.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
return {
|
||||
selector_cmd = function()
|
||||
return {
|
||||
command = "rofi",
|
||||
args = { "-dmenu", "-p", "Project: " },
|
||||
}
|
||||
end,
|
||||
editor_cmd = function(path, class)
|
||||
local dirName = path:match("([^/]+)$")
|
||||
-- Sanitize dirName for tmux session name (remove special chars)
|
||||
local tmuxSession = dirName:gsub("[^a-zA-Z0-9_]", "_")
|
||||
|
||||
local tmuxCmd = string.format(
|
||||
[[ tmux has-session -t %s 2>/dev/null && tmux attach -t %s || tmux new -c %s -s %s 'nvim %s' \; split-window -h -c %s ]],
|
||||
tmuxSession,
|
||||
tmuxSession,
|
||||
path,
|
||||
tmuxSession,
|
||||
path,
|
||||
path
|
||||
)
|
||||
return {
|
||||
command = "kitty",
|
||||
args = {
|
||||
"-d",
|
||||
path,
|
||||
"-T",
|
||||
class,
|
||||
"--class",
|
||||
class,
|
||||
"sh",
|
||||
"-c",
|
||||
tmuxCmd,
|
||||
},
|
||||
}
|
||||
end,
|
||||
format_project_title = function(path)
|
||||
-- Extract project name for better display
|
||||
-- local projectName = path:match("([^/]+)$") or path
|
||||
return "📘 " .. path
|
||||
end,
|
||||
|
||||
extract_path_from_title = function(title)
|
||||
-- Return back the path: 📘 work/project_1 -> work/project_1
|
||||
return title:gsub("^📘%s*", ""):gsub("\n$", "")
|
||||
end,
|
||||
|
||||
-- Add error handling function
|
||||
handle_error = function(err)
|
||||
io.stderr:write("Error: " .. tostring(err) .. "\n")
|
||||
return false
|
||||
end,
|
||||
}
|
15
bin/.bin/goq.sh
Executable file
15
bin/.bin/goq.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
MODULE_URL="github.com/marianozunino/goq"
|
||||
BINARY_NAME="goq"
|
||||
|
||||
TARGET_DIR="$HOME/.bin"
|
||||
CODE_PATH="$TARGET_DIR/$BINARY_NAME"
|
||||
if [ ! -x "$CODE_PATH" ]; then
|
||||
notify-send "Installing $BINARY_NAME" "Installing from $MODULE_URL..."
|
||||
GO111MODULE=on GOBIN="$TARGET_DIR" go install "$MODULE_URL@latest" || {
|
||||
notify-send -u critical "Installation Failed" "Failed to install $BINARY_NAME from $MODULE_URL"
|
||||
exit 1
|
||||
}
|
||||
notify-send "Installation Complete" "$BINARY_NAME has been installed successfully"
|
||||
fi
|
||||
exec "$CODE_PATH" "$@"
|
20
bin/.bin/leapp.sh
Executable file
20
bin/.bin/leapp.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
bin=~/.bin/leapp
|
||||
latest_version_url="https://api.github.com/repos/noovolari/leapp/releases/latest"
|
||||
|
||||
# Function to compare version numbers
|
||||
function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
|
||||
|
||||
# If leapp binary is not found or if there is a newer version, download it
|
||||
if [ ! -f $bin ] || version_gt "$(curl -s $latest_version_url | grep -oP '"tag_name": "\K(.*)(?=")')" "$(basename $bin | grep -oP '\d+\.\d+\.\d+')"; then
|
||||
notify-send -u normal "⏬ Leapp" "Checking for updates..."
|
||||
url="https://asset.noovolari.com/latest/Leapp-appImage.zip"
|
||||
wget -q -O /tmp/leapp.AppImage "$url"
|
||||
unzip /tmp/leapp.AppImage -d /tmp
|
||||
mv /tmp/release/Leapp* $bin
|
||||
chmod +x $bin
|
||||
fi
|
||||
|
||||
# Execute leapp
|
||||
$bin -f -i $1 -o $2
|
25
bin/.bin/lock.sh
Executable file
25
bin/.bin/lock.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
swaylock -f \
|
||||
--screenshots \
|
||||
--clock \
|
||||
--indicator \
|
||||
--indicator-radius 150 \
|
||||
--indicator-thickness 7 \
|
||||
--font-size 24 \
|
||||
--effect-blur 7x5 \
|
||||
--effect-vignette 0.5:0.5 \
|
||||
--ring-color 9ccfd8 \
|
||||
--ring-ver-color f6c177 \
|
||||
--ring-wrong-color eb6f92 \
|
||||
--key-hl-color eb6f92 \
|
||||
--line-color 00000000 \
|
||||
--inside-color 191724aa \
|
||||
--inside-ver-color 191724aa \
|
||||
--inside-wrong-color 191724aa \
|
||||
--separator-color 00000000 \
|
||||
--text-color e0def4 \
|
||||
--text-ver-color e0def4 \
|
||||
--text-wrong-color e0def4 \
|
||||
--text-caps-lock-color f6c177 \
|
||||
--grace 2 \
|
||||
--fade-in 0.2
|
14
bin/.bin/nosql.sh
Executable file
14
bin/.bin/nosql.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
bin=$HOME/.bin/nosql
|
||||
|
||||
# if nosql binary is not found, download it
|
||||
if [ ! -f $bin ]; then
|
||||
echo "Downloading NoSql binary..."
|
||||
url="https://s3.nosqlbooster.com/download/releasesv7/nosqlbooster4mongo-7.1.17.AppImage"
|
||||
wget -q -O $bin $url
|
||||
chmod +x $bin
|
||||
fi
|
||||
|
||||
# execute leapp
|
||||
$bin
|
6
bin/.bin/obsidian-launcher
Executable file
6
bin/.bin/obsidian-launcher
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
swaymsg '[class="obsidian"]' focus && exit
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
obsidian && swaymsg '[class="obsidian"]' focus >/dev/null 2>&1
|
||||
fi
|
16
bin/.bin/openlens.sh
Executable file
16
bin/.bin/openlens.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
bin=~/.bin/openlens
|
||||
|
||||
repo=MuhammedKalkan/OpenLens
|
||||
# if redis binary is not found, download it
|
||||
if [ ! -f $bin ]; then
|
||||
echo "Downloading openlens binary..."
|
||||
filename=$(curl -s https://api.github.com/repos/$repo/releases/latest | jq -r '.assets[].name' | grep "x86_64.AppImage$")
|
||||
fileurl=$(curl -s https://api.github.com/repos/$repo/releases/latest | jq -r --arg filename $filename '.assets[] | select(.name == $filename) | .browser_download_url')
|
||||
wget -q -O $bin $fileurl
|
||||
chmod +x $bin
|
||||
fi
|
||||
|
||||
# execute leapp
|
||||
$bin -f -i $1 -o $2
|
35
bin/.bin/randwall
Executable file
35
bin/.bin/randwall
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Kill any existing swaybg or feh instances
|
||||
pkill swaybg
|
||||
pkill feh
|
||||
|
||||
# Function to set wallpaper using swaybg on Sway
|
||||
set_wallpaper_sway() {
|
||||
swaymsg -t get_outputs -r | jq -r ".[].name" | parallel 'swaybg -o {} -i $(find ~/Pictures/* -type f | shuf -n 1) &'
|
||||
}
|
||||
|
||||
# Function to set wallpaper using swaybg on Hyprland
|
||||
set_wallpaper_hyprland() {
|
||||
hyprctl monitors -j | jq -r ".[].name" | parallel 'swaybg -o {} -i $(find ~/Pictures/* -type f | shuf -n 1) &'
|
||||
}
|
||||
|
||||
# Function to set wallpaper using feh on i3
|
||||
set_wallpaper_i3() {
|
||||
# Count number of connected monitors
|
||||
monitor_count=$(xrandr --query | grep " connected" | wc -l)
|
||||
|
||||
# Get random wallpapers equal to monitor count
|
||||
readarray -t wallpapers < <(find ~/Pictures/* -type f | shuf -n "$monitor_count")
|
||||
|
||||
# Construct the feh command with multiple --bg-fill arguments
|
||||
cmd="feh"
|
||||
for wallpaper in "${wallpapers[@]}"; do
|
||||
cmd+=" --bg-fill '$wallpaper'"
|
||||
done
|
||||
|
||||
# Execute the command
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
set_wallpaper_sway
|
50
bin/.bin/redis.sh
Executable file
50
bin/.bin/redis.sh
Executable file
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Define paths
|
||||
bin_dir=~/.bin
|
||||
bin_file="${bin_dir}/redis"
|
||||
|
||||
# Create directory if it doesn't exist
|
||||
mkdir -p "${bin_dir}"
|
||||
|
||||
# Set current working directory
|
||||
cd "${bin_dir}"
|
||||
|
||||
if [ ! -f "${bin_file}" ]; then
|
||||
notify-send -u normal "⏬ Redis Desktop Manager" "Downloading..."
|
||||
|
||||
# Get latest release info and parse with proper JSON handling
|
||||
release_info=$(curl -s https://api.github.com/repos/qishibo/AnotherRedisDesktopManager/releases/latest)
|
||||
|
||||
# Determine system architecture
|
||||
arch=$(uname -m)
|
||||
if [ "${arch}" = "x86_64" ]; then
|
||||
arch_pattern="x86_64"
|
||||
elif [ "${arch}" = "aarch64" ]; then
|
||||
arch_pattern="arm64"
|
||||
else
|
||||
echo "Unsupported architecture: ${arch}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Find appropriate AppImage for this architecture
|
||||
filename=$(echo "${release_info}" | jq -r ".assets[].name" | grep "AppImage" | grep "${arch_pattern}")
|
||||
echo "Selected filename: ${filename}"
|
||||
|
||||
# Get download URL
|
||||
fileurl=$(echo "${release_info}" | jq -r --arg filename "${filename}" '.assets[] | select(.name == $filename) | .browser_download_url')
|
||||
echo "Download URL: ${fileurl}"
|
||||
|
||||
# Download and make executable
|
||||
if [ -n "${fileurl}" ] && [ "${fileurl}" != "null" ]; then
|
||||
wget -q --show-progress -O "${bin_file}" "${fileurl}"
|
||||
chmod +x "${bin_file}"
|
||||
echo "Successfully downloaded Redis Desktop Manager"
|
||||
else
|
||||
echo "Failed to find download URL for architecture: ${arch}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Execute with parameters if provided
|
||||
"${bin_file}" -f ${1:+"-i"} ${1:+"$1"} ${2:+"-o"} ${2:+"$2"}
|
15
bin/.bin/rop.sh
Executable file
15
bin/.bin/rop.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
GO_PACKAGE="github.com/marianozunino/rop"
|
||||
BINARY_NAME="rop"
|
||||
|
||||
TARGET_DIR="$HOME/.bin"
|
||||
CODE_PATH="$TARGET_DIR/$BINARY_NAME"
|
||||
if [ ! -x "$CODE_PATH" ]; then
|
||||
notify-send "Installing $BINARY_NAME" "Installing from $MODULE_URL..."
|
||||
GO111MODULE=on GOBIN="$TARGET_DIR" go install "$MODULE_URL@latest" || {
|
||||
notify-send -u critical "Installation Failed" "Failed to install $BINARY_NAME from $MODULE_URL"
|
||||
exit 1
|
||||
}
|
||||
notify-send "Installation Complete" "$BINARY_NAME has been installed successfully"
|
||||
fi
|
||||
exec "$CODE_PATH" "$@"
|
7
bin/.bin/screenshot-upload
Executable file
7
bin/.bin/screenshot-upload
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
file=/tmp/$(date "+%Y%m%d-%H%M%S")_screenshot.png
|
||||
|
||||
grim -g "$(slurp)" "$file" &&
|
||||
satty --filename "$file" --fullscreen &&
|
||||
yad --title="Upload?" --text="Upload image?" --image="dialog-question" --default-cancel &&
|
||||
curl -F "file=@$file" https://drop.mz.uy | xargs xdg-open
|
15
bin/.bin/sdm-ui.sh
Executable file
15
bin/.bin/sdm-ui.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
MODULE_URL="github.com/marianozunino/sdm-ui"
|
||||
BINARY_NAME="sdm-ui"
|
||||
|
||||
TARGET_DIR="$HOME/.bin"
|
||||
CODE_PATH="$TARGET_DIR/$BINARY_NAME"
|
||||
if [ ! -x "$CODE_PATH" ]; then
|
||||
notify-send "Installing $BINARY_NAME" "Installing from $MODULE_URL..."
|
||||
GO111MODULE=on GOBIN="$TARGET_DIR" go install "$MODULE_URL@latest" || {
|
||||
notify-send -u critical "Installation Failed" "Failed to install $BINARY_NAME from $MODULE_URL"
|
||||
exit 1
|
||||
}
|
||||
notify-send "Installation Complete" "$BINARY_NAME has been installed successfully"
|
||||
fi
|
||||
exec "$CODE_PATH" "$@"
|
23
bin/.bin/sm.sh
Executable file
23
bin/.bin/sm.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
URL=$(curl https://www.sublimemerge.com/download_thanks?target=x64-tar#direct-downloads | grep -oP 'https://download.sublimetext.com/sublime_merge_build_\d+_x64.tar.xz' | head -n 1)
|
||||
VERSION=$(echo $URL | grep -oP '\d+' | head -n 1)
|
||||
FILENAME=sublime_merge_build_"$VERSION"_x64.tar.xz
|
||||
bin=~/.bin/sm
|
||||
|
||||
# set current working directory to ~/.bin
|
||||
cd ~/.bin
|
||||
|
||||
# if FILENAME exists, then exit
|
||||
if [ ! -f $FILENAME ]; then
|
||||
notify-send -u normal "⏬ Sublime Merge" "Updating to version $VERSION"
|
||||
# wget only if file does not exist
|
||||
wget -nc $URL
|
||||
tar -xvf $FILENAME
|
||||
fi
|
||||
|
||||
if [ ! -f $bin ]; then
|
||||
ln -fs $PWD/sublime_merge/sublime_merge $bin
|
||||
fi
|
||||
|
||||
# run sm
|
||||
$bin
|
62
bin/.bin/vmrss
Executable file
62
bin/.bin/vmrss
Executable file
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/env bash
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <pid>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function print_vmrss() {
|
||||
declare -a arr
|
||||
arr=("$1" 0)
|
||||
total=0
|
||||
|
||||
while [ ${#arr[@]} -gt 0 ]; do
|
||||
|
||||
# remove last element
|
||||
space=${arr[${#arr[@]}-1]}
|
||||
unset arr[${#arr[@]}-1]
|
||||
pid=${arr[${#arr[@]}-1]}
|
||||
unset arr[${#arr[@]}-1]
|
||||
|
||||
[ -d "/proc/$pid" ] || continue
|
||||
|
||||
GREP_OPTS=${GREP_OPTS:-"
|
||||
--color=auto
|
||||
--exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}
|
||||
"}
|
||||
mem=$(grep $GREP_OPTS VmRSS /proc/$pid/status \
|
||||
| grep $GREP_OPTS -o '[0-9]\+' \
|
||||
| awk '{print $1/1024}')
|
||||
#Add decimals to total
|
||||
total=$(echo $mem+$total | bc)
|
||||
|
||||
# name of process
|
||||
name=$(ps -p $pid -o comm=)
|
||||
|
||||
printf "%${space}s%s($pid): $mem MB\n" '' "$name"
|
||||
|
||||
# get children
|
||||
children=$(pgrep -P $pid)
|
||||
|
||||
# add children to array
|
||||
for child in $children; do
|
||||
arr+=("$child" $((space+2)))
|
||||
done
|
||||
done
|
||||
printf "Total: $total MB\n"
|
||||
}
|
||||
|
||||
# check VMRSS_MONITOR = 1
|
||||
if [ ! -z "$VMRSS_MONITOR" ]; then
|
||||
while true; do
|
||||
if ps -p $1 > /dev/null
|
||||
then
|
||||
print_vmrss $1
|
||||
sleep 0.5
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
print_vmrss $1
|
||||
else
|
||||
print_vmrss $1
|
||||
fi
|
11
bin/.bin/waybar.sh
Executable file
11
bin/.bin/waybar.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
CONFIG_FILES="$HOME/.config/waybar/config.jsonc $HOME/.config/waybar/style.css"
|
||||
|
||||
trap "killall waybar" EXIT
|
||||
|
||||
while true; do
|
||||
waybar &
|
||||
inotifywait -e create,modify $CONFIG_FILES
|
||||
killall waybar
|
||||
done
|
BIN
bin/.bin/wlrecord.sh
Executable file
BIN
bin/.bin/wlrecord.sh
Executable file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue