feat: eww hypr alacritty and more

This commit is contained in:
Fabio Lenherr 2022-08-31 00:28:44 +02:00
parent 7fb4f9ee73
commit 99f7c60db7
No known key found for this signature in database
GPG key ID: 868FFD689D878939
431 changed files with 9853 additions and 23 deletions

77
eww/scripts/battery Executable file
View file

@ -0,0 +1,77 @@
#!/bin/sh
bat=/sys/class/power_supply/BAT0/
per="$(cat "$bat/capacity")"
char="$(cat "$bat/status")"
icon() {
#[ $(cat "$bat/status") = Charging ] && echo "" && exit
if [ "$char" == "Charging" ]; then
if [ "$per" -gt "90" ]; then
icon=""
elif [ "$per" -gt "80" ]; then
icon=""
elif [ "$per" -gt "70" ]; then
icon=""
elif [ "$per" -gt "60" ]; then
icon=""
elif [ "$per" -gt "50" ]; then
icon=""
elif [ "$per" -gt "40" ]; then
icon=""
elif [ "$per" -gt "30" ]; then
icon=""
elif [ "$per" -gt "20" ]; then
icon=""
elif [ "$per" -gt "10" ]; then
icon=""
elif [ "$per" -gt "0" ]; then
icon=""
else
echo  && exit
fi
else
if [ "$per" -gt "90" ]; then
icon=""
elif [ "$per" -gt "80" ]; then
icon=""
elif [ "$per" -gt "70" ]; then
icon=""
elif [ "$per" -gt "60" ]; then
icon=""
elif [ "$per" -gt "50" ]; then
icon=""
elif [ "$per" -gt "40" ]; then
icon=""
elif [ "$per" -gt "30" ]; then
icon=""
elif [ "$per" -gt "20" ]; then
icon=""
elif [ "$per" -gt "10" ]; then
icon=""
notify-send -u critical "Battery Low" "Connect Charger"
elif [ "$per" -gt "0" ]; then
icon=""
notify-send -u critical "Battery Low" "Connect Charger"
else
echo  && exit
fi
fi
echo "$icon"
}
percent() {
echo $per
}
stat() {
echo $char
}
[ "$1" = "icon" ] && icon && exit
[ "$1" = "percent" ] && percent && exit
[ "$1" = 'stat' ] && stat && exit
exit

9
eww/scripts/current_name Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
currentName() {
win=$(hyprctl activewindow | grep class | awk -F ':' '{print $2}' | tr -d ' ')
echo "(box :class \"module\" :space-evenly \"false\" :orientation \"h\" :spacing \"3\" (label :text \"$win\" :class \"clock_minute_class\"))"
}
currentName
tail -f /tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/hyprland.log | grep -E --line-buffered "focus to surface" | while read -r; do
currentName
done

15
eww/scripts/mem-ad Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
total="$(free -m | grep Mem: | awk '{ print $2 }')"
used="$(free -m | grep Mem: | awk '{ print $3 }')"
free=$(expr $total - $used)
if [ "$1" = "total" ]; then
echo $total
elif [ "$1" = "used" ]; then
echo $used
elif [ "$1" = "free" ]; then
echo $free
fi

3
eww/scripts/memory Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}')

98
eww/scripts/music_info Executable file
View file

@ -0,0 +1,98 @@
#!/bin/sh
# scripts by adi1090x
## Get data
STATUS="$(mpc status)"
COVER="/tmp/.music_cover.png"
MUSIC_DIR="$HOME/Music"
## Get status
get_status() {
if [[ $STATUS == *"[playing]"* ]]; then
echo ""
else
echo "奈"
fi
}
## Get song
get_song() {
song=`mpc -f %title% current`
if [[ -z "$song" ]]; then
echo "Offline"
else
echo "$song"
fi
}
## Get artist
get_artist() {
artist=`mpc -f %artist% current`
if [[ -z "$artist" ]]; then
echo ""
else
echo "$artist"
fi
}
## Get time
get_time() {
time=`mpc status | grep "%)" | awk '{print $4}' | tr -d '(%)'`
if [[ -z "$time" ]]; then
echo "0"
else
echo "$time"
fi
}
get_ctime() {
ctime=`mpc status | grep "#" | awk '{print $3}' | sed 's|/.*||g'`
if [[ -z "$ctime" ]]; then
echo "0:00"
else
echo "$ctime"
fi
}
get_ttime() {
ttime=`mpc -f %time% current`
if [[ -z "$ttime" ]]; then
echo "0:00"
else
echo "$ttime"
fi
}
## Get cover
get_cover() {
ffmpeg -i "${MUSIC_DIR}/$(mpc current -f %file%)" "${COVER}" -y &> /dev/null
STATUS=$?
# Check if the file has a embbeded album art
if [ "$STATUS" -eq 0 ];then
echo "$COVER"
else
echo "images/music.png"
fi
}
## Execute accordingly
if [[ "$1" == "--song" ]]; then
get_song
elif [[ "$1" == "--artist" ]]; then
get_artist
elif [[ "$1" == "--status" ]]; then
get_status
elif [[ "$1" == "--time" ]]; then
get_time
elif [[ "$1" == "--ctime" ]]; then
get_ctime
elif [[ "$1" == "--ttime" ]]; then
get_ttime
elif [[ "$1" == "--cover" ]]; then
get_cover
elif [[ "$1" == "--toggle" ]]; then
mpc -q toggle
elif [[ "$1" == "--next" ]]; then
{ mpc -q next; get_cover; }
elif [[ "$1" == "--prev" ]]; then
{ mpc -q prev; get_cover; }
fi

92
eww/scripts/pop Executable file
View file

@ -0,0 +1,92 @@
#!/bin/sh
calendar() {
LOCK_FILE="$HOME/.cache/eww-calendar.lock"
EWW_BIN="$HOME/.local/bin/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww open calendar
}
# Open widgets
if [[ ! -f "$LOCK_FILE" ]]; then
${EWW_BIN} -c $HOME/.config/eww close system music_win audio_ctl
touch "$LOCK_FILE"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww close calendar
rm "$LOCK_FILE" && echo "closed"
fi
}
system() {
LOCK_FILE_MEM="$HOME/.cache/eww-system.lock"
EWW_BIN="$HOME/.local/bin/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww open system
}
# Open widgets
if [[ ! -f "$LOCK_FILE_MEM" ]]; then
${EWW_BIN} -c $HOME/.config/eww close calendar music_win audio_ctl
touch "$LOCK_FILE_MEM"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww close system
rm "$LOCK_FILE_MEM" && echo "closed"
fi
}
music() {
LOCK_FILE_SONG="$HOME/.cache/eww-song.lock"
EWW_BIN="$HOME/.local/bin/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww open music_win
}
# Open widgets
if [[ ! -f "$LOCK_FILE_SONG" ]]; then
${EWW_BIN} -c $HOME/.config/eww close system calendar
touch "$LOCK_FILE_SONG"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww close music_win
rm "$LOCK_FILE_SONG" && echo "closed"
fi
}
audio() {
LOCK_FILE_AUDIO="$HOME/.cache/eww-audio.lock"
EWW_BIN="$HOME/.local/bin/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww open audio_ctl
}
# Open widgets
if [[ ! -f "$LOCK_FILE_AUDIO" ]]; then
${EWW_BIN} -c $HOME/.config/eww close system calendar music
touch "$LOCK_FILE_AUDIO"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww close audio_ctl
rm "$LOCK_FILE_AUDIO" && echo "closed"
fi
}
if [ "$1" = "calendar" ]; then
calendar
elif [ "$1" = "system" ]; then
system
#elif [ "$1" = "music" ]; then
#music
elif [ "$1" = "audio" ]; then
audio
fi

26
eww/scripts/wifi Executable file
View file

@ -0,0 +1,26 @@
#!/bin/sh
status=$(nmcli g | grep -oE "disconnected")
essid=$(nmcli c | grep wlp2s0 | awk '{print ($1)}')
if [ $status ] ; then
icon=""
text=""
col="#575268"
else
icon=""
text="${essid}"
col="#a1bdce"
fi
if [[ "$1" == "--COL" ]]; then
echo $col
elif [[ "$1" == "--ESSID" ]]; then
echo $text
elif [[ "$1" == "--ICON" ]]; then
echo $icon
fi

99
eww/scripts/workspace Executable file
View file

@ -0,0 +1,99 @@
#!/bin/sh
workspaces() {
ws1="ID 1"
ws2="ID 2"
ws3="ID 3"
ws4="ID 4"
ws5="ID 5"
ws6="ID 6"
ws7="ID 7"
ws8="ID 8"
# check if Occupied
o1=$(hyprctl workspaces | grep "$ws1" )
o2=$(hyprctl workspaces | grep "$ws2" )
o3=$(hyprctl workspaces | grep "$ws3" )
o4=$(hyprctl workspaces | grep "$ws4" )
o5=$(hyprctl workspaces | grep "$ws5" )
o6=$(hyprctl workspaces | grep "$ws6" )
o7=$(hyprctl workspaces | grep "$ws7" )
o8=$(hyprctl workspaces | grep "$ws8" )
# check if Focused
f1=$(hyprctl monitors | grep "workspace: 1" )
f2=$(hyprctl monitors | grep "workspace: 2" )
f3=$(hyprctl monitors | grep "workspace: 3" )
f4=$(hyprctl monitors | grep "workspace: 4" )
f5=$(hyprctl monitors | grep "workspace: 5" )
f6=$(hyprctl monitors | grep "workspace: 6" )
f7=$(hyprctl monitors | grep "workspace: 7" )
f8=$(hyprctl monitors | grep "workspace: 8" )
if [ "$o1" != "" ]; then
ic_1="①"
else
ic_1=""
fi
if [ "$o2" != "" ]; then
ic_2="②"
else
ic_2=""
fi
if [ "$o3" != "" ]; then
ic_3="③"
else
ic_3=""
fi
if [ "$o4" != "" ]; then
ic_4="④"
else
ic_4=""
fi
if [ "$o5" != "" ]; then
ic_5="⑤"
else
ic_5=""
fi
if [ "$o6" != "" ]; then
ic_6="⑥"
else
ic_6=""
fi
if [ "$o7" != "" ]; then
ic_7="⑦"
else
ic_7=""
fi
if [ "$o8" != "" ]; then
ic_8="⑧"
else
ic_8=""
fi
if [ "$f1" != "" ]; then
ic_1="➊"
elif [ "$f2" != "" ]; then
ic_2="➋"
elif [ "$f3" != "" ]; then
ic_3="➌"
elif [ "$f4" != "" ]; then
ic_4="➍"
elif [ "$f5" != "" ]; then
ic_5="➎"
elif [ "$f6" != "" ]; then
ic_6="➏"
elif [ "$f7" != "" ]; then
ic_7="➐"
elif [ "$f8" != "" ]; then
ic_8="➑"
fi
#ic_1=$(hyprctl workspaces)
#ic_2="t"
echo "(box :class \"works\" :orientation \"h\" :spacing 5 :space-evenly \"false\" (button :onclick \"hyprctl dispatch workspace 1\" :class \"$un$o1$f1\" \"$ic_1\") (button :onclick \"hyprctl dispatch workspace 2\" :class \"$un$o2$f2\" \"$ic_2\") (button :onclick \"hyprctl dispatch workspace 3\" :class \"$un$o3$f3\" \"$ic_3\") (button :onclick \"hyprctl dispatch workspace 4\" :class \"$un$o4$f4\" \"$ic_4\") (button :onclick \"hyprctl dispatch workspace 5\" :class \"$un$o5$f5\" \"$ic_5\") (button :onclick \"hyprctl dispatch workspace 6\" :class \"$un$o6$f6\" \"$ic_6\") (button :onclick \"hyprctl dispatch workspace 7\" :class \"$un$o7$f7\" \"$ic_7\") (button :onclick \"hyprctl dispatch workspace 8\" :class \"$un$o8$f8\" \"$ic_8\"))"
}
workspaces
tail -f /tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/hyprland.log | grep -E --line-buffered "Changed to workspace|focus to surface" | while read -r; do
workspaces
done