Derp, asset redirection in dev mode

This commit is contained in:
coolnsx
2024-02-29 15:17:10 +05:30
parent 09ab6e0765
commit 80de39466a
11 changed files with 81 additions and 41 deletions

View File

@@ -1,20 +1,47 @@
#!/bin/sh
i=10
dir="/sys/class/power_supply/BAT0/"
icon_dir="/usr/share/icons/Papirus/22x22/panel/"
remind() {
notify-send -i "$icon_dir/battery-010.svg" -h "string:x-canonical-private-synchronous:${0##*/}" "$1 % Battery $2, Please Plugin Charger!!" -u "$2"
}
[ -n "$1" ] && printf "Sleep for %s seconds\n" "$i"
print_sleep() {
[ -n "$4" ] && printf "Status: %s, Charge: %s,Next Check in %s seconds\n" "$3" "$2" "$1"
sleep "$1"
}
while sleep $i; do
capacity_level=$(cat "$dir"/capacity_level)
state=$(cat "$dir"/status)
case $capacity_level in
*ritical) i=10 ;;
*ow) i=60 ;;
*) i=300 ;;
esac
[ -n "$1" ] && printf "Sleep for %s seconds\n" "$i"
[ "$state" = "Discharging" ] || continue
[ "$capacity_level" != "Normal" ] && notify-send -i "$icon_dir/battery-010.svg" -h "string:x-canonical-private-synchronous:${0##*/}" "$(cat "$dir/capacity") Battery $capacity_level, Please Plugin Charger!!" -u "$capacity_level"
#declaration
battery="BAT0" #change accordingly
dir="/sys/class/power_supply/$battery/"
icon_dir="/usr/share/icons/Papirus/22x22/panel/" #change accordingly
i=0
status="normal"
#infinite loop
while charge=$(cat "$dir"/capacity); do
if [ "$(cat "$dir"/status)" = "Charging" ]; then
i=300 #default polling time, it's 5 minutes
else
case $charge in
[2-9][0-9] | 100)
i=300 # 5 minutes
status="normal"
;;
[1-2][0-9])
i=150 # 2.5 minutes
status="low"
;;
[5-9])
i=60 # every minute
status="critical"
;;
[0-4])
i=10 # every 10 seconds
status="critical"
;;
esac
# remind appropriately
[ "$status" != "normal" ] && remind "$charge" "$status"
fi
print_sleep "$i" "$charge" "$status" "$1" #pass 'log' as argument to print logs
done

View File

@@ -7,7 +7,7 @@ data="$(wl-paste -p | tr '\n' '\`' | sed 's/$/ /g')"
file="$HOME/.cache/bookmarks"
oshi_file="$HOME/.cache/oshi-urls"
menu(){
menu() {
bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 30 -p "$1" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT"
}
@@ -25,7 +25,7 @@ case $1 in
rm)
data="$(sed '/^$/d' "$file" | nl -n'ln')"
[ -z "$data" ] && notify-send "Bookmark is empty" && exit 0
del=$(printf "%s" "$data" | menu "delete-bookmark :" | cut -f1)
del=$(printf "%s" "$data" | menu "delete-bookmark :" | cut -f1)
[ -z "$del" ] || (sed -i "${del}d" "$file" && notify-send -i "bookmark-missing" "Bookmark deleted" -u critical)
;;
copy)

View File

@@ -4,10 +4,10 @@ cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
cache=$cachedir/dmenu_run
historyfile=$cachedir/dmenu_history
ls /bin > "$cache"
ls /bin >"$cache"
cut -f2 "$historyfile" "$cache" | bemenu --fixed-height --fn 'JetBrainsMono Nerd Font 15' -i -c -W 0.5 -B 3 -p "RUN: " -l 15 -P ">>" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT" \
| awk -v histfile=$historyfile '
cut -f2 "$historyfile" "$cache" | bemenu --fixed-height --fn 'JetBrainsMono Nerd Font 15' -i -c -W 0.5 -B 3 -p "RUN: " -l 15 -P ">>" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT" |
awk -v histfile=$historyfile '
BEGIN {
FS=OFS="\t"
while ( (getline < histfile) > 0 ) {
@@ -29,5 +29,5 @@ cut -f2 "$historyfile" "$cache" | bemenu --fixed-height --fn 'JetBrainsMono Nerd
for (f in history)
print history[f],f | "sort -t '\t' -k1rn >" histfile
}
' \
| while read cmd; do ${SHELL:-"/bin/sh"} -c "$cmd" & done
' |
while read cmd; do ${SHELL:-"/bin/sh"} -c "$cmd" & done

View File

@@ -1,15 +1,12 @@
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,highrr,auto,1.6,bitdepth,10
#monitor=,2880x1800@60.000999,auto,1.6,bitdepth,10
#monitor=,2880x1800@120,auto,1.6,bitdepth,10
$hypr_dir="$HOME/.config/hypr"
$accent=5E88DD
$accent=D81860
#envs
#env = LIBVA_DRIVER_NAME,nvidia
env = XDG_SESSION_TYPE,wayland
#env = GBM_BACKEND,nvidia-drm
#env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = WLR_NO_HARDWARE_CURSORS,1
env = GLOBAL_ACCENT,$accent
@@ -142,6 +139,7 @@ bind = $mainMod, F4, exec, $HOME/repos_scripts/ani-new
bind = $mainMod, F5, exec, $hypr_dir/wifi
bind = $mainMod, return, exec, [workspace 2] foot
bind = $mainMod, Q, exec, $hypr_dir/dmenu_run_history
bind = $mainMod, G, exec, $hypr_dir/rungame
bind = $mainMod, A, exec, [workspace 1] google-chrome-stable
bind = $mainMod, C, exec, [workspace 3] code
bind = $mainMod, E, exec, [workspace 3] pcmanfm
@@ -181,14 +179,14 @@ windowrulev2=workspace 4,class:^(pavucontrol)$
windowrulev2=workspace 4,class:^(org.freedesktop.Xwayland)$
windowrulev2=fullscreen,class:^(org.freedesktop.Xwayland)$
windowrulev2=workspace 4,class:^(virt-manager)$
windowrulev2 = bordercolor rgba(D81860FF), xwayland: 1
windowrulev2 = bordercolor rgba(64f2a4FF), xwayland: 1
#startup applications
exec-once=dbus-update-activation-environment --systemd --all
exec-once=ssh-agent
exec-once=/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec-once=node $HOME/github/arrpc/src > /tmp/arrpc-log
exec-once=swaybg -i $HOME/.config/wall/18.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=$hypr_dir/battery

15
hypr/rungame Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
gamedir="$HOME/games"
game=$(find "$gamedir" -maxdepth 2 -type f -name '*.exe' -executable | sed "s|$gamedir/||g;/unin.*/d" | bemenu --fn 'JetBrainsMono Nerd Font 15' -i -c -W 0.5 -B 3 -p "PLAY GAME: " -l 15 -P ">>" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT")
[ -z "$game" ] && notify-send -h "string:x-canonical-private-synchronous:${0##*/}" -u critical "No game selected" && exit 1
cd "$(dirname "$gamedir"/"$game")" || (notify-send -h "string:x-canonical-private-synchronous:${0##*/}" -u critical "Directory Not found" && exit 1)
gamename=$(basename "$game")
notify-send -h "string:x-canonical-private-synchronous:${0##*/}" -i "wine" "Launching $gamename"
RADV_PERFTEST=gpl DXVK_ASYNC=1 gamemoderun mangohud wine "$gamename"

View File

@@ -3,5 +3,5 @@
icon="/usr/share/icons/Papirus/16x16/apps/applets-screenshooter.svg"
killall grim slurp
[ "$*" = "fullclip" ] && grim - | wl-copy -t image/png && notify-send -i "$icon" "Screenshot copied to clipboard"
[ "$*" = "fullsave" ] && grim && notify-send -i "$icon" "Screenshot saved"
[ "$*" = "fullsave" ] && grim "$HOME/Pictures/$(date -u "+%Y-%m-%d_%H-%M-%S").png" && notify-send -i "$icon" "Screenshot saved"
[ "$*" = "selclip" ] && grim -g "$(slurp)" - | wl-copy -t image/png && notify-send -i "$icon" "Screenshot copied to clipboard"