1
0
Fork 0
forked from ahurac/dotfiles

Supperssion : scripts shel inutiles

This commit is contained in:
Ahurac 2024-04-17 12:03:25 +02:00
parent 8db9d845a6
commit b30de47c0d
3 changed files with 0 additions and 66 deletions

View file

@ -1,11 +0,0 @@
#!/usr/bin/env sh
set -e
battery_capacity=$(cat "/sys/class/power_supply/${1}/capacity")
if [ "$battery_capacity" -lt 25 ]; then echo critical
elif [ "$battery_capacity" -lt 50 ]; then echo low
elif [ "$battery_capacity" -lt 75 ]; then echo medium
elif [ "$battery_capacity" -lt 100 ]; then echo high
else echo full
fi

View file

@ -1,2 +0,0 @@
#!/bin/sh
exec hyprctl clients -j | jq '.[] | select(.xwayland == true) | .class'

View file

@ -1,53 +0,0 @@
#!/bin/bash
# Arguments
hostname="$1"; shift
# Variables
declare mac
declare -a wol_com options
name="$(basename "$0")"
wolf_d="${HOME}/.wolf"
wolf_host="${wolf_d}/${hostname}"
# Functions
# Throw an error
function error {
>&2 echo -e "${name}: \033[1;31mERROR:\033[0m ${1:-No further details}"; shift
exit "${1:-1}"
}
# Parse variable in options file
function getvar {
grep '^'"$1"' ' "$wolf_host" | cut -d ' ' -f 2
}
# Parsing
[[ -f $wolf_host ]] || error "\"${hostname}\": No such host"
# Assign the options
mac="$(getvar Mac)"
ip="$(getvar IP)"
port="$(getvar Port)"
# Add options if necessary
[[ -n $ip ]] && options+=(-i "$ip" )
[[ -n $port ]] && options+=(-p "$port")
# Commands building
# wol
wol_com=(
wol
"$@"
"${options[@]}"
"$mac"
)
# Debug
#echo "${wol_com[@]}"
#exit 0
# Execution
set -xe
"${wol_com[@]}"