Move old config to old-dots branch

This commit is contained in:
2023-12-25 13:21:57 +03:00
commit 3dab77f779
119 changed files with 9623 additions and 0 deletions

43
.config/eww/bar/scripts/battery Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh
bat=/sys/class/power_supply/BAT0/
per="$(cat "$bat/capacity")"
icon() {
[ $(cat "$bat/status") = Charging ] && echo "" && exit
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
echo "$icon"
}
percent() {
echo $per
}
[ "$1" = "icon" ] && icon && exit
[ "$1" = "percent" ] && percent && exit
exit

View File

@ -0,0 +1,14 @@
#!/bin/bash
query=$(xset q | grep -Po "(?:Caps|Num|Scroll)\s+Lock:\s*(\w*)" | grep -Po "(off|on)")
result=""
for i in $query
do
[ $i = "off" ] && result+="ﰊ "|| result+="ﰉ "
done
# somehow results are shown reversed. So i am reversing them here to fix it
echo $result | rev | xargs

9
.config/eww/bar/scripts/layout Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
xprop -spy -root _XKB_RULES_NAMES | while read -r line; do
variant=$(echo $line | cut -d',' -f4 | tr -d '"')
if [[ "$variant" == " cdhpt" ]]; then
echo ""
else
echo ""
fi
done

View File

@ -0,0 +1,98 @@
#!/bin/bash
# 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

89
.config/eww/bar/scripts/pop Executable file
View File

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

12
.config/eww/bar/scripts/qtile Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
case "$1" in
switch) qtile cmd-obj -o group $2 -f toscreen
;;
restart) qtile cmd-obj -o cmd -f restart
;;
shutdown) qtile cmd-obj -o cmd -f shutdown
;;
esac

26
.config/eww/bar/scripts/wifi Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
status=$(nmcli g | grep -oE "disconnected")
essid=$(nmcli c | grep wlan0 | 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

View File

@ -0,0 +1,6 @@
#!/bin/bash
dir=`dirname $0`
python3 $dir/workspaces.py
tail -F -n1 ~/.cache/workspaces | while read -r; do
python3 $dir/workspaces.py
done

View File

@ -0,0 +1,53 @@
from libqtile.command.client import CommandClient
c = CommandClient()
groups = {}
for name, group in c.call('groups').items():
if name == "scratchpad":
continue
occupied = len(group["windows"]) > 0
focused = group['screen'] is not None
groups[name] = {"occupied": occupied, "focused": focused}
output = '(box :class "works" :orientation "h" :spacing 5 :space-evenly "false" '
for name, prop in groups.items():
command = f"scripts/qtile switch {name}"
class_ = "0"
focused, occupied = prop['focused'], prop['occupied']
if focused:
class_ += name * 2
elif occupied:
class_ += name
if occupied:
if name == "3":
class_ += " thunderbird"
elif name == "6":
class_ += " twitter"
elif name == "7":
class_ += " firefox"
elif name == "8":
class_ += " twitch"
elif name == "9":
class_ += " discord"
elif name == "0":
class_ += " telegram"
icons = {
"1": "1",
"2": "",
"3": "",
"4": "",
"5": "",
"6": "",
"7": "",
"8": "",
"9": "",
"0": "",
}
icon = icons[name]
output += f'(button :onclick "{command}" :class "{class_}" "{icon}") '
output += ')'
print(output)